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

Commit be75ad67 authored by Jack Wu's avatar Jack Wu Committed by Automerger Merge Worker
Browse files

Merge "BatteryMonitor: batteryStateOfHealth should be a property" am:...

Merge "BatteryMonitor: batteryStateOfHealth should be a property" am: bae352bd am: e8d76aae am: 26ad09e3 am: df3061ba

Original change: https://android-review.googlesource.com/c/platform/system/core/+/2441728



Change-Id: I9b00b6c2f1c0321eea720eb8ead0da6cf67dd406
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 2299ffeb df3061ba
Loading
Loading
Loading
Loading
+13 −3
Original line number Diff line number Diff line
@@ -392,12 +392,13 @@ void BatteryMonitor::updateValues(void) {
        mHealthInfo->batteryFullChargeDesignCapacityUah =
                getIntField(mHealthdConfig->batteryFullChargeDesignCapacityUahPath);

    if (!mHealthdConfig->batteryStateOfHealthPath.isEmpty())
        mHealthInfo->batteryStateOfHealth = getIntField(mHealthdConfig->batteryStateOfHealthPath);

    if (!mHealthdConfig->batteryHealthStatusPath.isEmpty())
        mBatteryHealthStatus = getIntField(mHealthdConfig->batteryHealthStatusPath);

    if (!mHealthdConfig->batteryStateOfHealthPath.isEmpty())
        mHealthInfo->batteryHealthData->batteryStateOfHealth =
                getIntField(mHealthdConfig->batteryStateOfHealthPath);

    if (!mHealthdConfig->batteryManufacturingDatePath.isEmpty())
        mHealthInfo->batteryHealthData->batteryManufacturingDateSeconds =
                getIntField(mHealthdConfig->batteryManufacturingDatePath);
@@ -591,6 +592,10 @@ int BatteryMonitor::getBatteryHealthData(int id) {
        if (!mHealthdConfig->batteryFirstUsageDatePath.isEmpty())
            return getIntField(mHealthdConfig->batteryFirstUsageDatePath);
    }
    if (id == BATTERY_PROP_STATE_OF_HEALTH) {
        if (!mHealthdConfig->batteryStateOfHealthPath.isEmpty())
            return getIntField(mHealthdConfig->batteryStateOfHealthPath);
    }
    return 0;
}

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

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

    default:
        break;
    }