From f5a0732d83df058af0b6ec3f9c4d178bd9184cc9 Mon Sep 17 00:00:00 2001 From: Jack Wu Date: Sun, 19 Feb 2023 01:35:53 +0800 Subject: [PATCH] Revert "health: batteryStateOfHealth should be a property" This reverts commit a60e7a43a90ef990f9d5426df04411025ccbc82e. Reason for revert: merge to aosp first Bug: 251427118 Test: m android.hardware.health-update-api Change-Id: If56fe4b141b3ad31b7f859118e432f08915c98f3 Signed-off-by: Jack Wu --- .../hardware/health/BatteryCapacityLevel.aidl | 14 +++++++------- .../android/hardware/health/BatteryHealthData.aidl | 1 - .../android/hardware/health/HealthInfo.aidl | 3 ++- .../android/hardware/health/BatteryHealthData.aidl | 7 ------- .../aidl/android/hardware/health/HealthInfo.aidl | 7 +++++++ .../aidl/vts/functional/VtsHalHealthTargetTest.cpp | 4 ---- 6 files changed, 16 insertions(+), 20 deletions(-) diff --git a/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/BatteryCapacityLevel.aidl b/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/BatteryCapacityLevel.aidl index 4d705887e5..e5438865c1 100644 --- a/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/BatteryCapacityLevel.aidl +++ b/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/BatteryCapacityLevel.aidl @@ -34,11 +34,11 @@ package android.hardware.health; @Backing(type="int") @VintfStability enum BatteryCapacityLevel { - UNSUPPORTED = (-1) /* -1 */, - UNKNOWN, - CRITICAL, - LOW, - NORMAL, - HIGH, - FULL, + UNSUPPORTED = -1, + UNKNOWN = 0, + CRITICAL = 1, + LOW = 2, + NORMAL = 3, + HIGH = 4, + FULL = 5, } diff --git a/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/BatteryHealthData.aidl b/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/BatteryHealthData.aidl index 2dd01b146f..d523fadf13 100644 --- a/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/BatteryHealthData.aidl +++ b/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/BatteryHealthData.aidl @@ -36,5 +36,4 @@ package android.hardware.health; parcelable BatteryHealthData { long batteryManufacturingDateSeconds; long batteryFirstUsageSeconds; - long batteryStateOfHealth; } diff --git a/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/HealthInfo.aidl b/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/HealthInfo.aidl index bfa14758f3..664cc70e55 100644 --- a/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/HealthInfo.aidl +++ b/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/HealthInfo.aidl @@ -57,8 +57,9 @@ parcelable HealthInfo { android.hardware.health.BatteryCapacityLevel batteryCapacityLevel; long batteryChargeTimeToFullNowSeconds; int batteryFullChargeDesignCapacityUah; + int batteryStateOfHealth; android.hardware.health.BatteryChargingState chargingState; android.hardware.health.BatteryChargingPolicy chargingPolicy; @nullable android.hardware.health.BatteryHealthData batteryHealthData; - const int BATTERY_CHARGE_TIME_TO_FULL_NOW_SECONDS_UNSUPPORTED = (-1) /* -1 */; + const int BATTERY_CHARGE_TIME_TO_FULL_NOW_SECONDS_UNSUPPORTED = -1; } diff --git a/health/aidl/android/hardware/health/BatteryHealthData.aidl b/health/aidl/android/hardware/health/BatteryHealthData.aidl index 594bcce576..fb17f63ab9 100644 --- a/health/aidl/android/hardware/health/BatteryHealthData.aidl +++ b/health/aidl/android/hardware/health/BatteryHealthData.aidl @@ -29,11 +29,4 @@ parcelable BatteryHealthData { * The date of first usage is reported in epoch. */ long batteryFirstUsageSeconds; - /** - * Measured battery state of health (remaining estimate full charge capacity - * relative to the rated capacity in %). - * Value must be 0 if batteryStatus is UNKNOWN. - * Otherwise, value must be in the range 0 to 100. - */ - long batteryStateOfHealth; } diff --git a/health/aidl/android/hardware/health/HealthInfo.aidl b/health/aidl/android/hardware/health/HealthInfo.aidl index af84089598..238f5242da 100644 --- a/health/aidl/android/hardware/health/HealthInfo.aidl +++ b/health/aidl/android/hardware/health/HealthInfo.aidl @@ -136,6 +136,13 @@ parcelable HealthInfo { * Value must be less than 100 000 000 µAh if known. */ int batteryFullChargeDesignCapacityUah; + /** + * Measured battery state of health (remaining estimate full charge capacity + * relative to the rated capacity in %). + * Value must be 0 if batteryStatus is UNKNOWN. + * Otherwise, value must be in the range 0 to 100. + */ + int batteryStateOfHealth; /** * Battery charging state */ diff --git a/health/aidl/vts/functional/VtsHalHealthTargetTest.cpp b/health/aidl/vts/functional/VtsHalHealthTargetTest.cpp index 69d4789727..6506ea2359 100644 --- a/health/aidl/vts/functional/VtsHalHealthTargetTest.cpp +++ b/health/aidl/vts/functional/VtsHalHealthTargetTest.cpp @@ -278,10 +278,6 @@ MATCHER(IsValidHealthData, "") { *result_listener << " for batteryFirstUsageSeconds."; return false; } - if (!ExplainMatchResult(Ge(-1), arg.batteryStateOfHealth, result_listener)) { - *result_listener << " for batteryStateOfHealth."; - return false; - } return true; }