Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bc84a790 authored by Yifan Hong's avatar Yifan Hong
Browse files

health: batterymonitor uses AIDL HealthInfo.

As a side effect, chargerDockOnline is properly set.

Test: TH
Bug: 222120465
Change-Id: I660e8ac0d1897ce30e3ae5d4f402a0b9ccac3c5c
parent bf3f93bb
Loading
Loading
Loading
Loading
+1 −6
Original line number Diff line number Diff line
@@ -130,12 +130,7 @@ ndk::ScopedAStatus Health::getStorageInfo(std::vector<StorageInfo>*) {
ndk::ScopedAStatus Health::getHealthInfo(HealthInfo* out) {
    battery_monitor_.updateValues();

    // TODO(b/177269435): BatteryMonitor should store AIDL HealthInfo instead.
    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");
    }
    *out = battery_monitor_.getHealthInfo();

    // Fill in storage infos; these aren't retrieved by BatteryMonitor.
    if (auto res = getStorageInfo(&out->storageInfos); !res.isOk()) {