From 633661ca8b1824f9a6f3e558cbd64a840ded1341 Mon Sep 17 00:00:00 2001 From: Yifan Hong Date: Mon, 8 Feb 2021 15:16:58 -0800 Subject: [PATCH] health 2.1 impl: log values properly. getHealthInfo_2_1 calls UpdateHealthInfo, where a subclass may update health_info without updating the data in BatteryMonitor. Hence, calling battery_monitor_.logValues() isn't accurate. Log values properly by logging the updated health_info struct. Test: healthd kernel logs have correct data Fixes: 179326883 Change-Id: Ifab863746793abf3e3f1d5a458f05f4d9889bdfc --- health/utils/libhealth2impl/Health.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/health/utils/libhealth2impl/Health.cpp b/health/utils/libhealth2impl/Health.cpp index f4684ae6f6..035b36f747 100644 --- a/health/utils/libhealth2impl/Health.cpp +++ b/health/utils/libhealth2impl/Health.cpp @@ -80,14 +80,14 @@ Return Health::unregisterCallback(const sp&) Return Health::update() { Result result = Result::UNKNOWN; - getHealthInfo_2_1([&](auto res, const auto& /* health_info */) { + getHealthInfo_2_1([&](auto res, const auto& health_info) { result = res; if (res != Result::SUCCESS) { LOG(ERROR) << "Cannot call getHealthInfo_2_1: " << toString(res); return; } - battery_monitor_.logValues(); + BatteryMonitor::logValues(health_info, *healthd_config_); }); return result; }