Merge "Add optional notifyThresholdChanged API" into main

This commit is contained in:
Xiang Wang
2024-10-23 00:59:03 +00:00
committed by Android (Google) Code Review
8 changed files with 20 additions and 7 deletions

View File

@@ -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>

View File

@@ -48,8 +48,7 @@ aidl_interface {
version: "2",
imports: [],
},
],
frozen: true,
frozen: false,
}

View File

@@ -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);
}

View File

@@ -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);
}

View File

@@ -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: [

View File

@@ -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>

View File

@@ -32,7 +32,7 @@ cc_test {
"libbinder_ndk",
],
static_libs: [
"android.hardware.thermal-V2-ndk",
"android.hardware.thermal-V3-ndk",
],
test_suites: [
"vts",

View File

@@ -93,6 +93,10 @@ class ThermalCallback : public BnThermalChangedCallback {
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);