Add optional notifyThresholdChanged API
Bump thermal HAL to v3
Bug: 360486877
Flag: EXEMPT AIDL interface changes
Test: atest VtsHalThermalTargetTest
Change-Id: I3954301c11351153f2df1d111f7fe2439cc16aae
diff --git a/compatibility_matrices/compatibility_matrix.202504.xml b/compatibility_matrices/compatibility_matrix.202504.xml
index 616a701..80352c7 100644
--- a/compatibility_matrices/compatibility_matrix.202504.xml
+++ b/compatibility_matrices/compatibility_matrix.202504.xml
@@ -551,7 +551,7 @@
</hal>
<hal format="aidl">
<name>android.hardware.thermal</name>
- <version>2</version>
+ <version>3</version>
<interface>
<name>IThermal</name>
<instance>default</instance>
diff --git a/thermal/aidl/Android.bp b/thermal/aidl/Android.bp
index 597a166..db77783 100644
--- a/thermal/aidl/Android.bp
+++ b/thermal/aidl/Android.bp
@@ -48,8 +48,7 @@
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 5e1d753..779544b 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 @@
@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 105f085..1ff4b7a 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 @@
@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 9fe62ce..9d89903 100644
--- a/thermal/aidl/default/Android.bp
+++ b/thermal/aidl/default/Android.bp
@@ -27,7 +27,7 @@
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 08dc68c..148ddbf 100644
--- a/thermal/aidl/default/thermal-example.xml
+++ b/thermal/aidl/default/thermal-example.xml
@@ -1,7 +1,7 @@
<manifest version="1.0" type="device">
<hal format="aidl">
<name>android.hardware.thermal</name>
- <version>2</version>
+ <version>3</version>
<fqname>IThermal/default</fqname>
</hal>
</manifest>
diff --git a/thermal/aidl/vts/Android.bp b/thermal/aidl/vts/Android.bp
index 0812811..8235be2 100644
--- a/thermal/aidl/vts/Android.bp
+++ b/thermal/aidl/vts/Android.bp
@@ -32,7 +32,7 @@
"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 7f33e2d..066e773 100644
--- a/thermal/aidl/vts/VtsHalThermalTargetTest.cpp
+++ b/thermal/aidl/vts/VtsHalThermalTargetTest.cpp
@@ -93,6 +93,10 @@
return ndk::ScopedAStatus::ok();
}
+ ndk::ScopedAStatus notifyThresholdChanged(const TemperatureThreshold&) {
+ return ndk::ScopedAStatus::ok();
+ }
+
template <typename R, typename P>
[[nodiscard]] bool waitForCallback(std::chrono::duration<R, P> duration) {
std::unique_lock<std::mutex> lock(mMutex);