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
This commit is contained in:
Adam Lesinski 2017-02-15 18:49:00 -08:00
parent a4bc98941a
commit 3dec1aa66d
2 changed files with 5 additions and 0 deletions

View File

@ -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();

View File

@ -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;