summaryrefslogtreecommitdiffstats
path: root/healthd/BatteryMonitor.cpp
diff options
context:
space:
mode:
authorTodd Poynor <toddpoynor@google.com>2013-09-30 15:36:44 -0700
committerTodd Poynor <toddpoynor@google.com>2013-09-30 15:36:44 -0700
commit2e227fbc5ad735856ce016714440e377e85fb839 (patch)
treec02fd97da407f67cedc8f349d090eda107ef0294 /healthd/BatteryMonitor.cpp
parent6298d6601eff1c782458956e4e39445e06b4eccb (diff)
downloadsystem_core-2e227fbc5ad735856ce016714440e377e85fb839.tar.gz
system_core-2e227fbc5ad735856ce016714440e377e85fb839.tar.bz2
system_core-2e227fbc5ad735856ce016714440e377e85fb839.zip
healthd: start switchover to BatteryExtraProperties
Change-Id: I47a24d4284f502858ee929b2cda8881165ef4ef3
Diffstat (limited to 'healthd/BatteryMonitor.cpp')
-rw-r--r--healthd/BatteryMonitor.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/healthd/BatteryMonitor.cpp b/healthd/BatteryMonitor.cpp
index f641077f3..682706275 100644
--- a/healthd/BatteryMonitor.cpp
+++ b/healthd/BatteryMonitor.cpp
@@ -171,6 +171,7 @@ int BatteryMonitor::getIntField(const String8& path) {
bool BatteryMonitor::update(void) {
struct BatteryProperties props;
+ struct BatteryExtraProperties extraProps;
bool logthis;
props.chargerAcOnline = false;
@@ -178,8 +179,8 @@ bool BatteryMonitor::update(void) {
props.chargerWirelessOnline = false;
props.batteryStatus = BATTERY_STATUS_UNKNOWN;
props.batteryHealth = BATTERY_HEALTH_UNKNOWN;
- props.batteryCurrentNow = INT_MIN;
- props.batteryChargeCounter = INT_MIN;
+ extraProps.batteryCurrentNow = INT_MIN;
+ extraProps.batteryChargeCounter = INT_MIN;
if (!mHealthdConfig->batteryPresentPath.isEmpty())
props.batteryPresent = getBooleanField(mHealthdConfig->batteryPresentPath);
@@ -190,10 +191,11 @@ bool BatteryMonitor::update(void) {
props.batteryVoltage = getIntField(mHealthdConfig->batteryVoltagePath) / 1000;
if (!mHealthdConfig->batteryCurrentNowPath.isEmpty())
- props.batteryCurrentNow = getIntField(mHealthdConfig->batteryCurrentNowPath);
+ extraProps.batteryCurrentNow = getIntField(mHealthdConfig->batteryCurrentNowPath);
+ /* temporary while dumpsys being reworked */
if (!mHealthdConfig->batteryChargeCounterPath.isEmpty())
- props.batteryChargeCounter = getIntField(mHealthdConfig->batteryChargeCounterPath);
+ extraProps.batteryChargeCounter = getIntField(mHealthdConfig->batteryChargeCounterPath);
props.batteryTemperature = getIntField(mHealthdConfig->batteryTemperaturePath);
@@ -240,6 +242,10 @@ bool BatteryMonitor::update(void) {
}
}
+ /* temporary while these are moved and dumpsys reworked */
+ props.batteryCurrentNow = extraProps.batteryCurrentNow;
+ props.batteryChargeCounter = extraProps.batteryChargeCounter;
+
logthis = !healthd_board_battery_update(&props);
if (logthis) {
@@ -255,7 +261,7 @@ bool BatteryMonitor::update(void) {
if (!mHealthdConfig->batteryCurrentNowPath.isEmpty()) {
char b[20];
- snprintf(b, sizeof(b), " c=%d", props.batteryCurrentNow / 1000);
+ snprintf(b, sizeof(b), " c=%d", extraProps.batteryCurrentNow / 1000);
strlcat(dmesgline, b, sizeof(dmesgline));
}