summaryrefslogtreecommitdiffstats
path: root/healthd
diff options
context:
space:
mode:
authorJin Qian <jinqian@google.com>2017-02-02 17:31:13 -0800
committerJin Qian <jinqian@google.com>2017-02-07 21:41:05 +0000
commit72adf11daf55f98179fafab98ccb6bcfd309de19 (patch)
tree5676fffa6af184ec204caf6e84b4ad233454ceae /healthd
parent8bff15d4f303c0b439969bd9f432cf74c33098df (diff)
downloadcore-72adf11daf55f98179fafab98ccb6bcfd309de19.tar.gz
core-72adf11daf55f98179fafab98ccb6bcfd309de19.tar.bz2
core-72adf11daf55f98179fafab98ccb6bcfd309de19.zip
healthd: return battery status property
Bug: 34198239 Change-Id: Ib0f312c15eb75ba7482f4f0b3f30ba2feae2c209
Diffstat (limited to 'healthd')
-rw-r--r--healthd/BatteryMonitor.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/healthd/BatteryMonitor.cpp b/healthd/BatteryMonitor.cpp
index 369a022c9..4007203b2 100644
--- a/healthd/BatteryMonitor.cpp
+++ b/healthd/BatteryMonitor.cpp
@@ -348,6 +348,7 @@ int BatteryMonitor::getChargeStatus() {
status_t BatteryMonitor::getProperty(int id, struct BatteryProperty *val) {
status_t ret = BAD_VALUE;
+ std::string buf;
val->valueInt64 = LONG_MIN;
@@ -400,6 +401,15 @@ status_t BatteryMonitor::getProperty(int id, struct BatteryProperty *val) {
}
break;
+ case BATTERY_PROP_BATTERY_STATUS:
+ if (mAlwaysPluggedDevice) {
+ val->valueInt64 = BATTERY_STATUS_CHARGING;
+ } else {
+ val->valueInt64 = getChargeStatus();
+ }
+ ret = NO_ERROR;
+ break;
+
default:
break;
}