From bab68777109d4ca9b553d73ed1b16b048bbcc77e Mon Sep 17 00:00:00 2001 From: Stephane Lee Date: Wed, 12 Aug 2020 22:38:20 -0700 Subject: [PATCH] Assume UNSUPPORTED if the battery capacity level sysfs node does not exist. Bug: 163382088 Test: Ensure that, if the ./capacity_level does not exist, that the device will shut down at 0 % SOC in an Health 2.1 implementation Change-Id: I00822b4bfba5d823c1a30163ea6824e59d3aae32 --- healthd/BatteryMonitor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/healthd/BatteryMonitor.cpp b/healthd/BatteryMonitor.cpp index 599f5005f..fd810cbf7 100644 --- a/healthd/BatteryMonitor.cpp +++ b/healthd/BatteryMonitor.cpp @@ -79,7 +79,7 @@ static void initHealthInfo(HealthInfo_2_1* health_info_2_1) { // HIDL enum values are zero initialized, so they need to be initialized // properly. - health_info_2_1->batteryCapacityLevel = BatteryCapacityLevel::UNKNOWN; + health_info_2_1->batteryCapacityLevel = BatteryCapacityLevel::UNSUPPORTED; health_info_2_1->batteryChargeTimeToFullNowSeconds = (int64_t)Constants::BATTERY_CHARGE_TIME_TO_FULL_NOW_SECONDS_UNSUPPORTED; auto* props = &health_info_2_1->legacy.legacy;