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

Commit e80b0c34 authored by David Anderson's avatar David Anderson Committed by Automerger Merge Worker
Browse files

Merge "healthd: Add support for the new Health HAL v3 properties." into main am: bc9acc9f

parents 83fe701d bc9acc9f
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -59,6 +59,7 @@ using aidl::android::hardware::health::BatteryChargingPolicy;
using aidl::android::hardware::health::BatteryChargingState;
using aidl::android::hardware::health::BatteryHealth;
using aidl::android::hardware::health::BatteryHealthData;
using aidl::android::hardware::health::BatteryPartStatus;
using aidl::android::hardware::health::BatteryStatus;
using aidl::android::hardware::health::HealthInfo;

@@ -596,6 +597,9 @@ int BatteryMonitor::getBatteryHealthData(int id) {
        if (!mHealthdConfig->batteryStateOfHealthPath.empty())
            return getIntField(mHealthdConfig->batteryStateOfHealthPath);
    }
    if (id == BATTERY_PROP_PART_STATUS) {
        return static_cast<int>(BatteryPartStatus::UNSUPPORTED);
    }
    return 0;
}

@@ -679,6 +683,11 @@ status_t BatteryMonitor::getProperty(int id, struct BatteryProperty *val) {
        ret = OK;
        break;

    case BATTERY_PROP_PART_STATUS:
        val->valueInt64 = getBatteryHealthData(BATTERY_PROP_PART_STATUS);
        ret = OK;
        break;

    default:
        break;
    }
@@ -686,6 +695,11 @@ status_t BatteryMonitor::getProperty(int id, struct BatteryProperty *val) {
    return ret;
}

status_t BatteryMonitor::getSerialNumber(std::optional<std::string>* out) {
    *out = std::nullopt;
    return OK;
}

void BatteryMonitor::dumpState(int fd) {
    int v;
    char vs[128];
+3 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@
#define HEALTHD_BATTERYMONITOR_H

#include <memory>
#include <optional>

#include <batteryservice/BatteryService.h>
#include <utils/String8.h>
@@ -86,6 +87,8 @@ class BatteryMonitor {
    int getChargingPolicy();
    int getBatteryHealthData(int id);

    status_t getSerialNumber(std::optional<std::string>* out);

    static void logValues(const android::hardware::health::V2_1::HealthInfo& health_info,
                          const struct healthd_config& healthd_config);