From bd4ef078136cddd9cd54ede4d67b21a515b8f522 Mon Sep 17 00:00:00 2001 From: Xiang Wang Date: Fri, 20 Sep 2024 16:24:22 -0700 Subject: [PATCH] Add optional notifyThresholdChanged API Bump thermal HAL to v3 Bug: 360486877 Flag: EXEMPT AIDL interface changes Test: atest VtsHalThermalTargetTest Change-Id: I3954301c11351153f2df1d111f7fe2439cc16aae --- .../compatibility_matrix.202504.xml | 2 +- thermal/aidl/Android.bp | 3 +-- .../hardware/thermal/IThermalChangedCallback.aidl | 1 + .../hardware/thermal/IThermalChangedCallback.aidl | 11 ++++++++++- thermal/aidl/default/Android.bp | 2 +- thermal/aidl/default/thermal-example.xml | 2 +- thermal/aidl/vts/Android.bp | 2 +- thermal/aidl/vts/VtsHalThermalTargetTest.cpp | 4 ++++ 8 files changed, 20 insertions(+), 7 deletions(-) diff --git a/compatibility_matrices/compatibility_matrix.202504.xml b/compatibility_matrices/compatibility_matrix.202504.xml index 616a70103f..80352c72e9 100644 --- a/compatibility_matrices/compatibility_matrix.202504.xml +++ b/compatibility_matrices/compatibility_matrix.202504.xml @@ -551,7 +551,7 @@ android.hardware.thermal - 2 + 3 IThermal default diff --git a/thermal/aidl/Android.bp b/thermal/aidl/Android.bp index 597a166beb..db777834ac 100644 --- a/thermal/aidl/Android.bp +++ b/thermal/aidl/Android.bp @@ -48,8 +48,7 @@ aidl_interface { version: "2", imports: [], }, - ], - frozen: true, + frozen: false, } diff --git a/thermal/aidl/aidl_api/android.hardware.thermal/current/android/hardware/thermal/IThermalChangedCallback.aidl b/thermal/aidl/aidl_api/android.hardware.thermal/current/android/hardware/thermal/IThermalChangedCallback.aidl index 5e1d753d18..779544b8cd 100644 --- a/thermal/aidl/aidl_api/android.hardware.thermal/current/android/hardware/thermal/IThermalChangedCallback.aidl +++ b/thermal/aidl/aidl_api/android.hardware.thermal/current/android/hardware/thermal/IThermalChangedCallback.aidl @@ -36,4 +36,5 @@ package android.hardware.thermal; @VintfStability interface IThermalChangedCallback { oneway void notifyThrottling(in android.hardware.thermal.Temperature temperature); + oneway void notifyThresholdChanged(in android.hardware.thermal.TemperatureThreshold threshold); } diff --git a/thermal/aidl/android/hardware/thermal/IThermalChangedCallback.aidl b/thermal/aidl/android/hardware/thermal/IThermalChangedCallback.aidl index 105f085864..1ff4b7af27 100644 --- a/thermal/aidl/android/hardware/thermal/IThermalChangedCallback.aidl +++ b/thermal/aidl/android/hardware/thermal/IThermalChangedCallback.aidl @@ -17,6 +17,7 @@ package android.hardware.thermal; import android.hardware.thermal.Temperature; +import android.hardware.thermal.TemperatureThreshold; /** * IThermalChangedCallback send throttling notification to clients. @@ -25,11 +26,19 @@ import android.hardware.thermal.Temperature; @VintfStability interface IThermalChangedCallback { /** - * Send a thermal throttling event to all ThermalHAL + * Send a thermal throttling event to all Thermal HAL * thermal event listeners. * * @param temperature The temperature associated with the * throttling event. */ oneway void notifyThrottling(in Temperature temperature); + + /** + * Send a thermal threshold change event to all Thermal HAL + * thermal event listeners. + * + * @param threshold The temperature threshold that changed. + */ + oneway void notifyThresholdChanged(in TemperatureThreshold threshold); } diff --git a/thermal/aidl/default/Android.bp b/thermal/aidl/default/Android.bp index 9fe62cebdb..9d89903078 100644 --- a/thermal/aidl/default/Android.bp +++ b/thermal/aidl/default/Android.bp @@ -27,7 +27,7 @@ cc_binary { vendor: true, stl: "c++_static", static_libs: [ - "android.hardware.thermal-V2-ndk", + "android.hardware.thermal-V3-ndk", "libbase", ], shared_libs: [ diff --git a/thermal/aidl/default/thermal-example.xml b/thermal/aidl/default/thermal-example.xml index 08dc68ca04..148ddbfcb1 100644 --- a/thermal/aidl/default/thermal-example.xml +++ b/thermal/aidl/default/thermal-example.xml @@ -1,7 +1,7 @@ android.hardware.thermal - 2 + 3 IThermal/default diff --git a/thermal/aidl/vts/Android.bp b/thermal/aidl/vts/Android.bp index 0812811738..8235be269c 100644 --- a/thermal/aidl/vts/Android.bp +++ b/thermal/aidl/vts/Android.bp @@ -32,7 +32,7 @@ cc_test { "libbinder_ndk", ], static_libs: [ - "android.hardware.thermal-V2-ndk", + "android.hardware.thermal-V3-ndk", ], test_suites: [ "vts", diff --git a/thermal/aidl/vts/VtsHalThermalTargetTest.cpp b/thermal/aidl/vts/VtsHalThermalTargetTest.cpp index 7f33e2df66..066e773da4 100644 --- a/thermal/aidl/vts/VtsHalThermalTargetTest.cpp +++ b/thermal/aidl/vts/VtsHalThermalTargetTest.cpp @@ -93,6 +93,10 @@ class ThermalCallback : public BnThermalChangedCallback { return ndk::ScopedAStatus::ok(); } + ndk::ScopedAStatus notifyThresholdChanged(const TemperatureThreshold&) { + return ndk::ScopedAStatus::ok(); + } + template [[nodiscard]] bool waitForCallback(std::chrono::duration duration) { std::unique_lock lock(mMutex);