From 9521b9d458942e4580e83d90aad968513a99f84a Mon Sep 17 00:00:00 2001 From: Yifan Hong Date: Mon, 7 Oct 2019 10:47:02 -0700 Subject: [PATCH] [REFACTOR] health 2.0: BatteryMonitor::update split into 3 funcs BatteryMonitor::update no longer calls healthd_board_battery_update and callback for us. Test: VTS health HAL 2.0 test Change-Id: I05fbf60b7e2c38f82e019d2fec2b5f535defaeae --- health/2.0/default/Health.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/health/2.0/default/Health.cpp b/health/2.0/default/Health.cpp index a2b81d1ba1..c0c5a404c9 100644 --- a/health/2.0/default/Health.cpp +++ b/health/2.0/default/Health.cpp @@ -148,7 +148,14 @@ Return Health::update() { // Retrieve all information and call healthd_mode_ops->battery_update, which calls // notifyListeners. - bool chargerOnline = battery_monitor_->update(); + battery_monitor_->updateValues(); + struct BatteryProperties props = getBatteryProperties(battery_monitor_.get()); + bool log = healthd_board_battery_update(&props); + if (log) { + battery_monitor_->logValues(); + } + healthd_mode_ops->battery_update(&props); + bool chargerOnline = battery_monitor_->isChargerOnline(); // adjust uevent / wakealarm periods healthd_battery_update_internal(chargerOnline);