summaryrefslogtreecommitdiffstats
path: root/healthd/BatteryPropertiesRegistrar.cpp
diff options
context:
space:
mode:
authorTodd Poynor <toddpoynor@google.com>2013-09-06 15:14:24 -0700
committerTodd Poynor <toddpoynor@google.com>2013-09-17 11:18:36 -0700
commit7b27f27d3de9e39d0de86c6e592d49bd4cc89158 (patch)
tree52c8fb62ebcd0c458a1ad86a8f5d410a7d6be1e4 /healthd/BatteryPropertiesRegistrar.cpp
parentc2c5a2410a2d7861d3c4f07f039eb8c471741cfa (diff)
downloadsystem_core-7b27f27d3de9e39d0de86c6e592d49bd4cc89158.tar.gz
system_core-7b27f27d3de9e39d0de86c6e592d49bd4cc89158.tar.bz2
system_core-7b27f27d3de9e39d0de86c6e592d49bd4cc89158.zip
healthd: break link between BatteryMonitor and BatteryPropertiesRegistrar
Make it easier to later separate out binder-related code. Add helper functions healthd_battery_update(), healthd_get_property() to allow these operations without needing references to the BatteryMonitor object. Change-Id: Ie584bf53e5178ce0a098d0d940d6c311fdff62d4
Diffstat (limited to 'healthd/BatteryPropertiesRegistrar.cpp')
-rw-r--r--healthd/BatteryPropertiesRegistrar.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/healthd/BatteryPropertiesRegistrar.cpp b/healthd/BatteryPropertiesRegistrar.cpp
index 3e06866be..f2edee434 100644
--- a/healthd/BatteryPropertiesRegistrar.cpp
+++ b/healthd/BatteryPropertiesRegistrar.cpp
@@ -23,11 +23,9 @@
#include <utils/Mutex.h>
#include <utils/String16.h>
-namespace android {
+#include "healthd.h"
-BatteryPropertiesRegistrar::BatteryPropertiesRegistrar(BatteryMonitor* monitor) {
- mBatteryMonitor = monitor;
-}
+namespace android {
void BatteryPropertiesRegistrar::publish() {
defaultServiceManager()->addService(String16("batterypropreg"), this);
@@ -53,7 +51,7 @@ void BatteryPropertiesRegistrar::registerListener(const sp<IBatteryPropertiesLis
mListeners.add(listener);
listener->asBinder()->linkToDeath(this);
}
- mBatteryMonitor->update();
+ healthd_battery_update();
}
void BatteryPropertiesRegistrar::unregisterListener(const sp<IBatteryPropertiesListener>& listener) {
@@ -68,7 +66,7 @@ void BatteryPropertiesRegistrar::unregisterListener(const sp<IBatteryPropertiesL
}
status_t BatteryPropertiesRegistrar::getProperty(int id, struct BatteryProperty *val) {
- return mBatteryMonitor->getProperty(id, val);
+ return healthd_get_property(id, val);
}
void BatteryPropertiesRegistrar::binderDied(const wp<IBinder>& who) {