Merge "Add UNSUPPORTED to health HAL 2.1 values"
This commit is contained in:
commit
9d261c3fed
1 changed files with 6 additions and 3 deletions
|
@ -55,6 +55,7 @@ using HealthInfo_2_1 = android::hardware::health::V2_1::HealthInfo;
|
|||
using android::hardware::health::V1_0::BatteryHealth;
|
||||
using android::hardware::health::V1_0::BatteryStatus;
|
||||
using android::hardware::health::V2_1::BatteryCapacityLevel;
|
||||
using android::hardware::health::V2_1::Constants;
|
||||
|
||||
namespace android {
|
||||
|
||||
|
@ -79,6 +80,8 @@ 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->batteryChargeTimeToFullNowSeconds =
|
||||
(int64_t)Constants::BATTERY_CHARGE_TIME_TO_FULL_NOW_SECONDS_UNSUPPORTED;
|
||||
auto* props = &health_info_2_1->legacy.legacy;
|
||||
props->batteryStatus = BatteryStatus::UNKNOWN;
|
||||
props->batteryHealth = BatteryHealth::UNKNOWN;
|
||||
|
@ -134,13 +137,13 @@ BatteryCapacityLevel getBatteryCapacityLevel(const char* capacityLevel) {
|
|||
{"Normal", BatteryCapacityLevel::NORMAL},
|
||||
{"High", BatteryCapacityLevel::HIGH},
|
||||
{"Full", BatteryCapacityLevel::FULL},
|
||||
{NULL, BatteryCapacityLevel::UNKNOWN},
|
||||
{NULL, BatteryCapacityLevel::UNSUPPORTED},
|
||||
};
|
||||
|
||||
auto ret = mapSysfsString(capacityLevel, batteryCapacityLevelMap);
|
||||
if (!ret) {
|
||||
KLOG_WARNING(LOG_TAG, "Unknown battery capacity level '%s'\n", capacityLevel);
|
||||
*ret = BatteryCapacityLevel::UNKNOWN;
|
||||
KLOG_WARNING(LOG_TAG, "Unsupported battery capacity level '%s'\n", capacityLevel);
|
||||
*ret = BatteryCapacityLevel::UNSUPPORTED;
|
||||
}
|
||||
|
||||
return *ret;
|
||||
|
|
Loading…
Reference in a new issue