Merge "health: batterymonitor uses AIDL HealthInfo." am: e9cb1bedfd

Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2004612

Change-Id: Ic95ccd4d9740774ad9d76491329b61b609874c4a
This commit is contained in:
Yifan Hong
2022-03-02 19:41:59 +00:00
committed by Automerger Merge Worker

View File

@@ -130,12 +130,7 @@ ndk::ScopedAStatus Health::getStorageInfo(std::vector<StorageInfo>*) {
ndk::ScopedAStatus Health::getHealthInfo(HealthInfo* out) { ndk::ScopedAStatus Health::getHealthInfo(HealthInfo* out) {
battery_monitor_.updateValues(); battery_monitor_.updateValues();
// TODO(b/177269435): BatteryMonitor should store AIDL HealthInfo instead. *out = battery_monitor_.getHealthInfo();
auto health_info_2_1 = battery_monitor_.getHealthInfo_2_1();
if (!::android::h2a::translate(health_info_2_1, out)) {
return ndk::ScopedAStatus::fromServiceSpecificErrorWithMessage(
IHealth::STATUS_UNKNOWN, "Cannot translate HIDL HealthInfo to AIDL");
}
// Fill in storage infos; these aren't retrieved by BatteryMonitor. // Fill in storage infos; these aren't retrieved by BatteryMonitor.
if (auto res = getStorageInfo(&out->storageInfos); !res.isOk()) { if (auto res = getStorageInfo(&out->storageInfos); !res.isOk()) {