Health HAL: add hinge info
Add a hingeinfo field to the Health HAL that returns information related to a
foldable's hinge health + rated life expectancy.
Ignore-AOSP-First: deprecated_ota_test compilation
Bug: 371322457
Test: th
Change-Id: I23688be268afcc542fa4bc90af37933e9c1c36e7
diff --git a/health/aidl/default/Android.bp b/health/aidl/default/Android.bp
index 2071f08..cc5d0a0 100644
--- a/health/aidl/default/Android.bp
+++ b/health/aidl/default/Android.bp
@@ -29,7 +29,7 @@
"libcutils",
"liblog",
"libutils",
- "android.hardware.health-V3-ndk",
+ "android.hardware.health-V4-ndk",
// TODO(b/177269435): remove when BatteryMonitor works with AIDL HealthInfo.
"libhidlbase",
@@ -48,7 +48,7 @@
name: "libhealth_aidl_charger_defaults",
shared_libs: [
// common
- "android.hardware.health-V3-ndk",
+ "android.hardware.health-V4-ndk",
"libbase",
"libcutils",
"liblog",
@@ -195,7 +195,7 @@
"service_fuzzer_defaults",
],
static_libs: [
- "android.hardware.health-V3-ndk",
+ "android.hardware.health-V4-ndk",
"libbase",
"liblog",
"fuzz_libhealth_aidl_impl",
diff --git a/health/aidl/default/Health.cpp b/health/aidl/default/Health.cpp
index 37662ea..d0e2dac 100644
--- a/health/aidl/default/Health.cpp
+++ b/health/aidl/default/Health.cpp
@@ -192,6 +192,12 @@
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
}
+ndk::ScopedAStatus Health::getHingeInfo(std::vector<HingeInfo>*) {
+ // This implementation does not support HingeInfo. An implementation may extend this
+ // class and override this function to support storage info.
+ return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
+}
+
ndk::ScopedAStatus Health::getHealthInfo(HealthInfo* out) {
battery_monitor_.updateValues();
diff --git a/health/aidl/default/android.hardware.health-service.example.xml b/health/aidl/default/android.hardware.health-service.example.xml
index 2acaaba..8ddfbda 100644
--- a/health/aidl/default/android.hardware.health-service.example.xml
+++ b/health/aidl/default/android.hardware.health-service.example.xml
@@ -1,7 +1,7 @@
<manifest version="1.0" type="device">
<hal format="aidl">
<name>android.hardware.health</name>
- <version>3</version>
+ <version>4</version>
<fqname>IHealth/default</fqname>
</hal>
</manifest>
diff --git a/health/aidl/default/include/health-impl/Health.h b/health/aidl/default/include/health-impl/Health.h
index 429ae2a..96df517 100644
--- a/health/aidl/default/include/health-impl/Health.h
+++ b/health/aidl/default/include/health-impl/Health.h
@@ -72,6 +72,7 @@
// The default implementations return nothing in |out|.
ndk::ScopedAStatus getDiskStats(std::vector<DiskStats>* out) override;
ndk::ScopedAStatus getStorageInfo(std::vector<StorageInfo>* out) override;
+ ndk::ScopedAStatus getHingeInfo(std::vector<HingeInfo>* out) override;
ndk::ScopedAStatus setChargingPolicy(BatteryChargingPolicy in_value) override;
ndk::ScopedAStatus getChargingPolicy(BatteryChargingPolicy* out) override;