diff options
author | Yabin Cui <yabinc@google.com> | 2016-02-19 18:03:23 -0800 |
---|---|---|
committer | Yabin Cui <yabinc@google.com> | 2016-02-19 18:03:23 -0800 |
commit | aedf6038dcc23137f2ae3268f95f760a9440cf0c (patch) | |
tree | 31073a0de4d539927ca43bf255c1e94c20763557 /healthd/BatteryMonitor.cpp | |
parent | ee127f3d6b20c45e90f277d5571260b0250f0349 (diff) | |
download | core-aedf6038dcc23137f2ae3268f95f760a9440cf0c.tar.gz core-aedf6038dcc23137f2ae3268f95f760a9440cf0c.tar.bz2 core-aedf6038dcc23137f2ae3268f95f760a9440cf0c.zip |
healthd: support reading charge status from BatteryMonitor.
recovery needs to know whether the battery is charged.
Bug: 26879394
Change-Id: Ie2a1d06e81878efa3ff432c2015d409a625e473e
Diffstat (limited to 'healthd/BatteryMonitor.cpp')
-rw-r--r-- | healthd/BatteryMonitor.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
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; |