summaryrefslogtreecommitdiffstats
path: root/healthd
diff options
context:
space:
mode:
authorAdam Lesinski <adamlesinski@google.com>2017-02-15 18:49:00 -0800
committerAdam Lesinski <adamlesinski@google.com>2017-03-22 12:15:11 -0700
commit3dec1aa66d111a078c04b5b738daa928816de1af (patch)
tree20b89a0e488c95518dd62cbccf242c090a6d9ecc /healthd
parenta4bc98941af87ba95bb72b8be59e74ad5686e7d8 (diff)
downloadsystem_core-3dec1aa66d111a078c04b5b738daa928816de1af.tar.gz
system_core-3dec1aa66d111a078c04b5b738daa928816de1af.tar.bz2
system_core-3dec1aa66d111a078c04b5b738daa928816de1af.zip
healthd: Implement scheduleUpdate
scheduleUpdate forces a healthd battery update, which will notify all listeners. Test: Manual (strace -p $healthd_pid) Bug: 32645990 Change-Id: I8b19f79b633ca8988f0e3dd5be14757f6421ddcb
Diffstat (limited to 'healthd')
-rw-r--r--healthd/BatteryPropertiesRegistrar.cpp4
-rw-r--r--healthd/BatteryPropertiesRegistrar.h1
2 files changed, 5 insertions, 0 deletions
diff --git a/healthd/BatteryPropertiesRegistrar.cpp b/healthd/BatteryPropertiesRegistrar.cpp
index d28ba41ff..523e1f136 100644
--- a/healthd/BatteryPropertiesRegistrar.cpp
+++ b/healthd/BatteryPropertiesRegistrar.cpp
@@ -77,6 +77,10 @@ status_t BatteryPropertiesRegistrar::getProperty(int id, struct BatteryProperty
return healthd_get_property(id, val);
}
+void BatteryPropertiesRegistrar::scheduleUpdate() {
+ healthd_battery_update();
+}
+
status_t BatteryPropertiesRegistrar::dump(int fd, const Vector<String16>& /*args*/) {
IPCThreadState* self = IPCThreadState::self();
const int pid = self->getCallingPid();
diff --git a/healthd/BatteryPropertiesRegistrar.h b/healthd/BatteryPropertiesRegistrar.h
index 095f3d37c..14e914514 100644
--- a/healthd/BatteryPropertiesRegistrar.h
+++ b/healthd/BatteryPropertiesRegistrar.h
@@ -32,6 +32,7 @@ class BatteryPropertiesRegistrar : public BnBatteryPropertiesRegistrar,
public:
void publish(const sp<BatteryPropertiesRegistrar>& service);
void notifyListeners(const struct BatteryProperties& props);
+ void scheduleUpdate();
private:
Mutex mRegistrationLock;