Loading thermal/aidl/aidl_api/android.hardware.thermal/current/android/hardware/thermal/IThermal.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -46,4 +46,5 @@ interface IThermal { void unregisterThermalChangedCallback(in android.hardware.thermal.IThermalChangedCallback callback); void registerCoolingDeviceChangedCallbackWithType(in android.hardware.thermal.ICoolingDeviceChangedCallback callback, in android.hardware.thermal.CoolingType type); void unregisterCoolingDeviceChangedCallback(in android.hardware.thermal.ICoolingDeviceChangedCallback callback); float forecastSkinTemperature(in int forecastSeconds); } thermal/aidl/android/hardware/thermal/IThermal.aidl +16 −0 Original line number Diff line number Diff line Loading @@ -225,4 +225,20 @@ interface IThermal { * getMessage() must be populated with human-readable error message. */ void unregisterCoolingDeviceChangedCallback(in ICoolingDeviceChangedCallback callback); /** * Retrieves the forecasted skin temperature in Celsius. * * @param forecastSeconds the number of seconds to forecast the skin temperature, it should * at least support superset of [0, 60] seconds range. * * @return forecasted skin temperature in Celsius. * * @throws EX_ILLEGAL_STATE If the Thermal HAL is not initialized successfully * @throws EX_ILLEGAL_ARGUMENT If the provided forecastSeconds is negative * @throws EX_UNSUPPORTED_OPERATION if API is not supported or the forecastSeconds exceeds the * supported range. And the getMessage() must be populated with human-readable * error message. */ float forecastSkinTemperature(in int forecastSeconds); } thermal/aidl/default/Thermal.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -191,4 +191,9 @@ ScopedAStatus Thermal::unregisterCoolingDeviceChangedCallback( } return ScopedAStatus::ok(); } ndk::ScopedAStatus Thermal::forecastSkinTemperature(int32_t, float*) { return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION); } } // namespace aidl::android::hardware::thermal::impl::example thermal/aidl/default/Thermal.h +2 −0 Original line number Diff line number Diff line Loading @@ -60,6 +60,8 @@ class Thermal : public BnThermal { ndk::ScopedAStatus unregisterCoolingDeviceChangedCallback( const std::shared_ptr<ICoolingDeviceChangedCallback>& in_callback) override; ndk::ScopedAStatus forecastSkinTemperature(int32_t forecastSeconds, float* _aidl_return) override; private: std::mutex thermal_callback_mutex_; Loading thermal/aidl/vts/VtsHalThermalTargetTest.cpp +17 −0 Original line number Diff line number Diff line Loading @@ -426,6 +426,23 @@ TEST_P(ThermalAidlTest, CoolingDeviceTest) { } } // Test Thermal->forecastSkinTemperature. TEST_P(ThermalAidlTest, ForecastSkinTemperatureTest) { auto apiLevel = ::android::base::GetIntProperty<int32_t>("ro.vendor.api_level", 0); if (apiLevel < 202504) { GTEST_SKIP() << "Skipping test as the vendor level is below 202504: " << apiLevel; } float temperature = 0.0f; ::ndk::ScopedAStatus status = mThermal->forecastSkinTemperature(1, &temperature); if (status.getExceptionCode() == EX_UNSUPPORTED_OPERATION) { GTEST_SKIP() << "Skipping test as temperature forecast is not supported"; } for (int i = 0; i <= 60; i++) { status = mThermal->forecastSkinTemperature(i, &temperature); ASSERT_NE(NAN, temperature); } } GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(ThermalAidlTest); INSTANTIATE_TEST_SUITE_P( Thermal, ThermalAidlTest, Loading Loading
thermal/aidl/aidl_api/android.hardware.thermal/current/android/hardware/thermal/IThermal.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -46,4 +46,5 @@ interface IThermal { void unregisterThermalChangedCallback(in android.hardware.thermal.IThermalChangedCallback callback); void registerCoolingDeviceChangedCallbackWithType(in android.hardware.thermal.ICoolingDeviceChangedCallback callback, in android.hardware.thermal.CoolingType type); void unregisterCoolingDeviceChangedCallback(in android.hardware.thermal.ICoolingDeviceChangedCallback callback); float forecastSkinTemperature(in int forecastSeconds); }
thermal/aidl/android/hardware/thermal/IThermal.aidl +16 −0 Original line number Diff line number Diff line Loading @@ -225,4 +225,20 @@ interface IThermal { * getMessage() must be populated with human-readable error message. */ void unregisterCoolingDeviceChangedCallback(in ICoolingDeviceChangedCallback callback); /** * Retrieves the forecasted skin temperature in Celsius. * * @param forecastSeconds the number of seconds to forecast the skin temperature, it should * at least support superset of [0, 60] seconds range. * * @return forecasted skin temperature in Celsius. * * @throws EX_ILLEGAL_STATE If the Thermal HAL is not initialized successfully * @throws EX_ILLEGAL_ARGUMENT If the provided forecastSeconds is negative * @throws EX_UNSUPPORTED_OPERATION if API is not supported or the forecastSeconds exceeds the * supported range. And the getMessage() must be populated with human-readable * error message. */ float forecastSkinTemperature(in int forecastSeconds); }
thermal/aidl/default/Thermal.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -191,4 +191,9 @@ ScopedAStatus Thermal::unregisterCoolingDeviceChangedCallback( } return ScopedAStatus::ok(); } ndk::ScopedAStatus Thermal::forecastSkinTemperature(int32_t, float*) { return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION); } } // namespace aidl::android::hardware::thermal::impl::example
thermal/aidl/default/Thermal.h +2 −0 Original line number Diff line number Diff line Loading @@ -60,6 +60,8 @@ class Thermal : public BnThermal { ndk::ScopedAStatus unregisterCoolingDeviceChangedCallback( const std::shared_ptr<ICoolingDeviceChangedCallback>& in_callback) override; ndk::ScopedAStatus forecastSkinTemperature(int32_t forecastSeconds, float* _aidl_return) override; private: std::mutex thermal_callback_mutex_; Loading
thermal/aidl/vts/VtsHalThermalTargetTest.cpp +17 −0 Original line number Diff line number Diff line Loading @@ -426,6 +426,23 @@ TEST_P(ThermalAidlTest, CoolingDeviceTest) { } } // Test Thermal->forecastSkinTemperature. TEST_P(ThermalAidlTest, ForecastSkinTemperatureTest) { auto apiLevel = ::android::base::GetIntProperty<int32_t>("ro.vendor.api_level", 0); if (apiLevel < 202504) { GTEST_SKIP() << "Skipping test as the vendor level is below 202504: " << apiLevel; } float temperature = 0.0f; ::ndk::ScopedAStatus status = mThermal->forecastSkinTemperature(1, &temperature); if (status.getExceptionCode() == EX_UNSUPPORTED_OPERATION) { GTEST_SKIP() << "Skipping test as temperature forecast is not supported"; } for (int i = 0; i <= 60; i++) { status = mThermal->forecastSkinTemperature(i, &temperature); ASSERT_NE(NAN, temperature); } } GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(ThermalAidlTest); INSTANTIATE_TEST_SUITE_P( Thermal, ThermalAidlTest, Loading