diff options
author | Yabin Cui <yabinc@google.com> | 2016-02-22 19:25:58 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2016-02-22 19:25:58 +0000 |
commit | f8eaff2dd916b1bdb4c38984c2500491cf1d7893 (patch) | |
tree | 216ee9d58f17f773ce8a658fbd2de1ca151f30fe /healthd/BatteryMonitor.cpp | |
parent | b219fe37c67fe735cd4e231cc03d8f56899d59df (diff) | |
parent | 0007c4efbe412148ebaf77a964226575a02e3af0 (diff) | |
download | core-f8eaff2dd916b1bdb4c38984c2500491cf1d7893.tar.gz core-f8eaff2dd916b1bdb4c38984c2500491cf1d7893.tar.bz2 core-f8eaff2dd916b1bdb4c38984c2500491cf1d7893.zip |
Merge "healthd: support reading charge status from BatteryMonitor." am: d633106d3e
am: 0007c4efbe
* commit '0007c4efbe412148ebaf77a964226575a02e3af0':
healthd: support reading charge status from BatteryMonitor.
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 fd4f4b858..efb273a7a 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; |