Merge "healthd: support reading charge status from BatteryMonitor." into nyc-dev

This commit is contained in:
Yabin Cui 2016-02-23 22:42:58 +00:00 committed by Android (Google) Code Review
commit 959dea3585
2 changed files with 12 additions and 0 deletions

View file

@ -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;

View file

@ -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);