From 79d38ebcaf25dd90b58dac018bc3532db908e9b0 Mon Sep 17 00:00:00 2001 From: Hridya Valsaraju Date: Wed, 17 Jan 2018 23:02:56 -0800 Subject: [PATCH] health: Modify IHealthInfo Callback interface to return V2.0 HealthInfo Bug: 71860528 Test: vts-tradefed run vts -m VtsHalHealthV2_0 Change-Id: I7de39ffa4c21772d8878c9a3f054bc6dbbde2fb9 --- healthd/HealthServiceCommon.cpp | 6 +++--- storaged/include/storaged.h | 2 +- storaged/storaged.cpp | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/healthd/HealthServiceCommon.cpp b/healthd/HealthServiceCommon.cpp index e8fbcb004..a2ca44b05 100644 --- a/healthd/HealthServiceCommon.cpp +++ b/healthd/HealthServiceCommon.cpp @@ -30,7 +30,7 @@ using android::hardware::IPCThreadState; using android::hardware::configureRpcThreadpool; using android::hardware::handleTransportPoll; using android::hardware::setupTransportPolling; -using android::hardware::health::V1_0::HealthInfo; +using android::hardware::health::V2_0::HealthInfo; using android::hardware::health::V1_0::hal_conversion::convertToHealthInfo; using android::hardware::health::V2_0::IHealth; using android::hardware::health::V2_0::implementation::Health; @@ -71,8 +71,8 @@ void healthd_mode_service_2_0_heartbeat(void) { void healthd_mode_service_2_0_battery_update(struct android::BatteryProperties* prop) { HealthInfo info; - convertToHealthInfo(prop, info); - Health::getImplementation()->notifyListeners(info); + convertToHealthInfo(prop, info.legacy); + Health::getImplementation()->notifyListeners(&info); } static struct healthd_mode_ops healthd_mode_service_2_0_ops = { diff --git a/storaged/include/storaged.h b/storaged/include/storaged.h index 7b27988b4..400e734ca 100644 --- a/storaged/include/storaged.h +++ b/storaged/include/storaged.h @@ -136,7 +136,7 @@ class storaged_t : public android::hardware::health::V2_0::IHealthInfoCallback, void remove_user_ce(userid_t user_id); virtual ::android::hardware::Return healthInfoChanged( - const ::android::hardware::health::V1_0::HealthInfo& info); + const ::android::hardware::health::V2_0::HealthInfo& info); void serviceDied(uint64_t cookie, const wp<::android::hidl::base::V1_0::IBase>& who); void report_storage_info(); diff --git a/storaged/storaged.cpp b/storaged/storaged.cpp index 6807cd920..bf8b448ab 100644 --- a/storaged/storaged.cpp +++ b/storaged/storaged.cpp @@ -66,9 +66,9 @@ const uint32_t storaged_t::current_version = 4; using android::hardware::interfacesEqual; using android::hardware::Return; using android::hardware::health::V1_0::BatteryStatus; -using android::hardware::health::V1_0::HealthInfo; using android::hardware::health::V1_0::toString; using android::hardware::health::V2_0::get_health_service; +using android::hardware::health::V2_0::HealthInfo; using android::hardware::health::V2_0::IHealth; using android::hardware::health::V2_0::Result; using android::hidl::manager::V1_0::IServiceManager; @@ -80,7 +80,7 @@ inline charger_stat_t is_charger_on(BatteryStatus prop) { } Return storaged_t::healthInfoChanged(const HealthInfo& props) { - mUidm.set_charger_state(is_charger_on(props.batteryStatus)); + mUidm.set_charger_state(is_charger_on(props.legacy.batteryStatus)); return android::hardware::Void(); }