Merge "healthd: support reading charge status from BatteryMonitor."
am: d633106d3e
* commit 'd633106d3e43a77bb509ce1cf259b14f78f246ae':
healthd: support reading charge status from BatteryMonitor.
This commit is contained in:
commit
0007c4efbe
2 changed files with 12 additions and 0 deletions
|
|
@ -341,6 +341,17 @@ bool BatteryMonitor::update(void) {
|
||||||
props.chargerWirelessOnline;
|
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 BatteryMonitor::getProperty(int id, struct BatteryProperty *val) {
|
||||||
status_t ret = BAD_VALUE;
|
status_t ret = BAD_VALUE;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,7 @@ class BatteryMonitor {
|
||||||
BatteryMonitor();
|
BatteryMonitor();
|
||||||
void init(struct healthd_config *hc);
|
void init(struct healthd_config *hc);
|
||||||
bool update(void);
|
bool update(void);
|
||||||
|
int getChargeStatus();
|
||||||
status_t getProperty(int id, struct BatteryProperty *val);
|
status_t getProperty(int id, struct BatteryProperty *val);
|
||||||
void dumpState(int fd);
|
void dumpState(int fd);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue