diff options
author | Todd Poynor <toddpoynor@google.com> | 2014-05-08 17:15:45 -0700 |
---|---|---|
committer | Todd Poynor <toddpoynor@google.com> | 2014-05-16 03:05:47 +0000 |
commit | 8f132af495d208272ea55d0ca24068926fa80e51 (patch) | |
tree | 01c13f8ae3b5513b1ebf205a4fcb0fc29ad36cf2 /healthd/BatteryMonitor.cpp | |
parent | e1d5247e0090b57f1f5c63df7eba6754c502a449 (diff) | |
download | system_core-8f132af495d208272ea55d0ca24068926fa80e51.tar.gz system_core-8f132af495d208272ea55d0ca24068926fa80e51.tar.bz2 system_core-8f132af495d208272ea55d0ca24068926fa80e51.zip |
healthd: Add ENERGY_COUNTER property placeholder, and 64-bit properties
Will add healthd HAL support for ENERGY_COUNTER, and support in some HALs,
in following CLs.
Change-Id: Ife2eaa30473be3a59183c6ce61fdaa61f32dd01b
Diffstat (limited to 'healthd/BatteryMonitor.cpp')
-rw-r--r-- | healthd/BatteryMonitor.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/healthd/BatteryMonitor.cpp b/healthd/BatteryMonitor.cpp index 731099459..ac649ce78 100644 --- a/healthd/BatteryMonitor.cpp +++ b/healthd/BatteryMonitor.cpp @@ -271,10 +271,12 @@ bool BatteryMonitor::update(void) { status_t BatteryMonitor::getProperty(int id, struct BatteryProperty *val) { status_t ret = BAD_VALUE; + val->valueInt64 = LONG_MIN; + switch(id) { case BATTERY_PROP_CHARGE_COUNTER: if (!mHealthdConfig->batteryChargeCounterPath.isEmpty()) { - val->valueInt = + val->valueInt64 = getIntField(mHealthdConfig->batteryChargeCounterPath); ret = NO_ERROR; } else { @@ -284,7 +286,7 @@ status_t BatteryMonitor::getProperty(int id, struct BatteryProperty *val) { case BATTERY_PROP_CURRENT_NOW: if (!mHealthdConfig->batteryCurrentNowPath.isEmpty()) { - val->valueInt = + val->valueInt64 = getIntField(mHealthdConfig->batteryCurrentNowPath); ret = NO_ERROR; } else { @@ -294,7 +296,7 @@ status_t BatteryMonitor::getProperty(int id, struct BatteryProperty *val) { case BATTERY_PROP_CURRENT_AVG: if (!mHealthdConfig->batteryCurrentAvgPath.isEmpty()) { - val->valueInt = + val->valueInt64 = getIntField(mHealthdConfig->batteryCurrentAvgPath); ret = NO_ERROR; } else { @@ -304,7 +306,7 @@ status_t BatteryMonitor::getProperty(int id, struct BatteryProperty *val) { case BATTERY_PROP_CAPACITY: if (!mHealthdConfig->batteryCapacityPath.isEmpty()) { - val->valueInt = + val->valueInt64 = getIntField(mHealthdConfig->batteryCapacityPath); ret = NO_ERROR; } else { @@ -312,13 +314,14 @@ status_t BatteryMonitor::getProperty(int id, struct BatteryProperty *val) { } break; + case BATTERY_PROP_ENERGY_COUNTER: + ret = NAME_NOT_FOUND; + break; + default: break; } - if (ret != NO_ERROR) - val->valueInt = INT_MIN; - return ret; } |