health: Modify IHealthInfo Callback interface to return V2.0 HealthInfo

Bug: 71860528
Test: vts-tradefed run vts -m VtsHalHealthV2_0
Change-Id: I7de39ffa4c21772d8878c9a3f054bc6dbbde2fb9
This commit is contained in:
Hridya Valsaraju 2018-01-17 23:02:56 -08:00
parent 4bd6183721
commit 79d38ebcaf
3 changed files with 6 additions and 6 deletions

View File

@ -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 = {

View File

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

View File

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