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

Commit d6e4da1f authored by Treehugger Robot's avatar Treehugger Robot
Browse files

Merge "Consume design capacity in health HAL 2.1" am: c7b92ea1

Change-Id: Iedba862c1ca0a001b2262bf07ddc58beef2a5d37
parents 97b4d62e c7b92ea1
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -265,7 +265,9 @@ void BatteryMonitor::updateValues(void) {
        mHealthInfo->batteryChargeTimeToFullNowSeconds =
                getIntField(mHealthdConfig->batteryChargeTimeToFullNowPath);

    mHealthInfo->batteryFullCapacityUah = props.batteryFullCharge;
    if (!mHealthdConfig->batteryFullChargeDesignCapacityUahPath.isEmpty())
        mHealthInfo->batteryFullChargeDesignCapacityUah =
                getIntField(mHealthdConfig->batteryFullChargeDesignCapacityUahPath);

    props.batteryTemperature = mBatteryFixedTemperature ?
        mBatteryFixedTemperature :
@@ -622,6 +624,13 @@ void BatteryMonitor::init(struct healthd_config *hc) {
                        mHealthdConfig->batteryChargeTimeToFullNowPath = path;
                }

                if (mHealthdConfig->batteryFullChargeDesignCapacityUahPath.isEmpty()) {
                    path.clear();
                    path.appendFormat("%s/%s/charge_full_design", POWER_SUPPLY_SYSFS_PATH, name);
                    if (access(path, R_OK) == 0)
                        mHealthdConfig->batteryFullChargeDesignCapacityUahPath = path;
                }

                if (mHealthdConfig->batteryCurrentAvgPath.isEmpty()) {
                    path.clear();
                    path.appendFormat("%s/%s/current_avg",
@@ -694,6 +703,8 @@ void BatteryMonitor::init(struct healthd_config *hc) {
            KLOG_WARNING(LOG_TAG, "batteryCapacityLevelPath not found\n");
        if (mHealthdConfig->batteryChargeTimeToFullNowPath.isEmpty())
            KLOG_WARNING(LOG_TAG, "batteryChargeTimeToFullNowPath. not found\n");
        if (mHealthdConfig->batteryFullChargeDesignCapacityUahPath.isEmpty())
            KLOG_WARNING(LOG_TAG, "batteryFullChargeDesignCapacityUahPath. not found\n");
    }

    if (property_get("ro.boot.fake_battery", pval, NULL) > 0
+1 −0
Original line number Diff line number Diff line
@@ -71,6 +71,7 @@ struct healthd_config {
    android::String8 batteryCycleCountPath;
    android::String8 batteryCapacityLevelPath;
    android::String8 batteryChargeTimeToFullNowPath;
    android::String8 batteryFullChargeDesignCapacityUahPath;

    int (*energyCounter)(int64_t *);
    int boot_min_cap;