Use the latest temperature read as base for headroom calculation
It was unexpectedly using the oldest temperature which can be 30s old
and not accurately reflect the current device's temperature (i.e.
getThermalheadroom(0) could return device status from 30s ago)
The unit test used to add new temperatures to the front of ring
buffer instead, which was inconsistent with the implementation which add
to the back and thus didn't catch the issue, it's now all fixed.
Bug: 343809405
Test: atest ThermalManagerServiceTest
Change-Id: I913572d04f9ca7d9106babe2017e686cf30f29ec
2 files changed