healthd: support reading charge status from BatteryMonitor.
recovery needs to know whether the battery is charged.
Bug: 26879394
Change-Id: Ie2a1d06e81878efa3ff432c2015d409a625e473e
(cherry picked from commit aedf6038dc
)
This commit is contained in:
parent
126f4d65ca
commit
b0580d710f
|
@ -340,6 +340,17 @@ bool BatteryMonitor::update(void) {
|
|||
props.chargerWirelessOnline;
|
||||
}
|
||||
|
||||
int BatteryMonitor::getChargeStatus() {
|
||||
int result = BATTERY_STATUS_UNKNOWN;
|
||||
if (!mHealthdConfig->batteryStatusPath.isEmpty()) {
|
||||
char buf[128];
|
||||
if (readFromFile(mHealthdConfig->batteryStatusPath, buf, sizeof(buf)) > 0) {
|
||||
result = getBatteryStatus(buf);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
status_t BatteryMonitor::getProperty(int id, struct BatteryProperty *val) {
|
||||
status_t ret = BAD_VALUE;
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@ class BatteryMonitor {
|
|||
BatteryMonitor();
|
||||
void init(struct healthd_config *hc);
|
||||
bool update(void);
|
||||
int getChargeStatus();
|
||||
status_t getProperty(int id, struct BatteryProperty *val);
|
||||
void dumpState(int fd);
|
||||
|
||||
|
|
Loading…
Reference in New Issue