healthd: return battery status property
Bug: 34198239 Change-Id: Ib0f312c15eb75ba7482f4f0b3f30ba2feae2c209
This commit is contained in:
parent
8bff15d4f3
commit
72adf11daf
|
@ -348,6 +348,7 @@ int BatteryMonitor::getChargeStatus() {
|
|||
|
||||
status_t BatteryMonitor::getProperty(int id, struct BatteryProperty *val) {
|
||||
status_t ret = BAD_VALUE;
|
||||
std::string buf;
|
||||
|
||||
val->valueInt64 = LONG_MIN;
|
||||
|
||||
|
@ -400,6 +401,15 @@ status_t BatteryMonitor::getProperty(int id, struct BatteryProperty *val) {
|
|||
}
|
||||
break;
|
||||
|
||||
case BATTERY_PROP_BATTERY_STATUS:
|
||||
if (mAlwaysPluggedDevice) {
|
||||
val->valueInt64 = BATTERY_STATUS_CHARGING;
|
||||
} else {
|
||||
val->valueInt64 = getChargeStatus();
|
||||
}
|
||||
ret = NO_ERROR;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue