Add SDK support for thermal headroom callback API
* Add cache for headroom forecast which resets on temperature or threshold update
* Remove the cache for thermal headroom thresholds in PowerManager
as it can change now
* Only trigger headroom callback on skin type throttling event or
threshold update event that causes significant difference in headrooms
Bug: 360486877
Flag: android.os.allow_thermal_thresholds_callback
Test: atest ThermalManagerServiceTest ThermalManagerServiceMockingTest PowerManagerTest
Change-Id: Id5e311634f3b94fe041e51732496d182b2a78139
diff --git a/native/android/tests/thermal/NativeThermalUnitTest.cpp b/native/android/tests/thermal/NativeThermalUnitTest.cpp
index 6d6861a..4e319fc 100644
--- a/native/android/tests/thermal/NativeThermalUnitTest.cpp
+++ b/native/android/tests/thermal/NativeThermalUnitTest.cpp
@@ -67,6 +67,14 @@
MOCK_METHOD(Status, getThermalHeadroomThresholds, (::std::vector<float> * _aidl_return),
(override));
MOCK_METHOD(IBinder*, onAsBinder, (), (override));
+ MOCK_METHOD(Status, registerThermalHeadroomListener,
+ (const ::android::sp<::android::os::IThermalHeadroomListener>& listener,
+ bool* _aidl_return),
+ (override));
+ MOCK_METHOD(Status, unregisterThermalHeadroomListener,
+ (const ::android::sp<::android::os::IThermalHeadroomListener>& listener,
+ bool* _aidl_return),
+ (override));
};
class NativeThermalUnitTest : public Test {