Health@2.0: uses @1.0::HealthInfo
Revert "Update for expanding @2.0::HealthInfo."
BatteryService does not use these fields for posting
sticky intents.
This reverts commit be17a4f23529da0b769b745e3296e4e4e5ef06c5.
Test: boots
Bug: 63702641
Change-Id: I4df61645ab38a8e205ee21efc86bbef3e39674ab
diff --git a/healthd/Health.cpp b/healthd/Health.cpp
index ec05398..74f3eec 100644
--- a/healthd/Health.cpp
+++ b/healthd/Health.cpp
@@ -120,7 +120,7 @@
}
// Retrieve all information and call healthd_mode_ops->battery_update, which calls
- // updateAndNotify.
+ // notifyListeners.
bool chargerOnline = battery_monitor_->update();
// adjust uevent / wakealarm periods
@@ -129,19 +129,10 @@
return Result::SUCCESS;
}
-void Health::updateAndNotify(HealthInfo* info) {
- // update 2.0 specific fields
- struct BatteryProperty prop;
- if (battery_monitor_->getProperty(BATTERY_PROP_CURRENT_AVG, &prop) == OK)
- info->batteryCurrentAverage = static_cast<int32_t>(prop.valueInt64);
- if (battery_monitor_->getProperty(BATTERY_PROP_CAPACITY, &prop) == OK)
- info->batteryCapacity = static_cast<int32_t>(prop.valueInt64);
- if (battery_monitor_->getProperty(BATTERY_PROP_ENERGY_COUNTER, &prop) == OK)
- info->energyCounter = prop.valueInt64;
-
+void Health::notifyListeners(const HealthInfo& info) {
std::lock_guard<std::mutex> _lock(callbacks_lock_);
for (auto it = callbacks_.begin(); it != callbacks_.end();) {
- auto ret = (*it)->healthInfoChanged(*info);
+ auto ret = (*it)->healthInfoChanged(info);
if (!ret.isOk() && ret.isDeadObject()) {
it = callbacks_.erase(it);
} else {