Merge "BatteryMonitor: batteryStateOfHealth should be a property" am: bae352bddb
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2441728 Change-Id: I7f3a15566a9da89d29b14f998b18c4ef911fb627 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
commit
e8d76aae3f
1 changed files with 13 additions and 3 deletions
|
|
@ -392,12 +392,13 @@ void BatteryMonitor::updateValues(void) {
|
|||
mHealthInfo->batteryFullChargeDesignCapacityUah =
|
||||
getIntField(mHealthdConfig->batteryFullChargeDesignCapacityUahPath);
|
||||
|
||||
if (!mHealthdConfig->batteryStateOfHealthPath.isEmpty())
|
||||
mHealthInfo->batteryStateOfHealth = getIntField(mHealthdConfig->batteryStateOfHealthPath);
|
||||
|
||||
if (!mHealthdConfig->batteryHealthStatusPath.isEmpty())
|
||||
mBatteryHealthStatus = getIntField(mHealthdConfig->batteryHealthStatusPath);
|
||||
|
||||
if (!mHealthdConfig->batteryStateOfHealthPath.isEmpty())
|
||||
mHealthInfo->batteryHealthData->batteryStateOfHealth =
|
||||
getIntField(mHealthdConfig->batteryStateOfHealthPath);
|
||||
|
||||
if (!mHealthdConfig->batteryManufacturingDatePath.isEmpty())
|
||||
mHealthInfo->batteryHealthData->batteryManufacturingDateSeconds =
|
||||
getIntField(mHealthdConfig->batteryManufacturingDatePath);
|
||||
|
|
@ -591,6 +592,10 @@ int BatteryMonitor::getBatteryHealthData(int id) {
|
|||
if (!mHealthdConfig->batteryFirstUsageDatePath.isEmpty())
|
||||
return getIntField(mHealthdConfig->batteryFirstUsageDatePath);
|
||||
}
|
||||
if (id == BATTERY_PROP_STATE_OF_HEALTH) {
|
||||
if (!mHealthdConfig->batteryStateOfHealthPath.isEmpty())
|
||||
return getIntField(mHealthdConfig->batteryStateOfHealthPath);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -669,6 +674,11 @@ status_t BatteryMonitor::getProperty(int id, struct BatteryProperty *val) {
|
|||
ret = OK;
|
||||
break;
|
||||
|
||||
case BATTERY_PROP_STATE_OF_HEALTH:
|
||||
val->valueInt64 = getBatteryHealthData(BATTERY_PROP_STATE_OF_HEALTH);
|
||||
ret = OK;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue