From aedf6038dcc23137f2ae3268f95f760a9440cf0c Mon Sep 17 00:00:00 2001 From: Yabin Cui Date: Fri, 19 Feb 2016 18:03:23 -0800 Subject: healthd: support reading charge status from BatteryMonitor. recovery needs to know whether the battery is charged. Bug: 26879394 Change-Id: Ie2a1d06e81878efa3ff432c2015d409a625e473e --- healthd/BatteryMonitor.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'healthd/BatteryMonitor.cpp') diff --git a/healthd/BatteryMonitor.cpp b/healthd/BatteryMonitor.cpp index 2022ae7ef..477148bd9 100644 --- a/healthd/BatteryMonitor.cpp +++ b/healthd/BatteryMonitor.cpp @@ -341,6 +341,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; -- cgit v1.2.3