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

Commit 6d57c696 authored by Adrian Roos's avatar Adrian Roos Committed by Android Git Automerger
Browse files

am 92874394: Merge "Show charging speed on Keyguard" into mnc-dr-dev

* commit '92874394':
  Show charging speed on Keyguard
parents 559349e7 92874394
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -181,6 +181,7 @@ bool BatteryMonitor::update(void) {
    props.chargerWirelessOnline = false;
    props.batteryStatus = BATTERY_STATUS_UNKNOWN;
    props.batteryHealth = BATTERY_HEALTH_UNKNOWN;
    props.maxChargingCurrent = 0;

    if (!mHealthdConfig->batteryPresentPath.isEmpty())
        props.batteryPresent = getBooleanField(mHealthdConfig->batteryPresentPath);
@@ -235,6 +236,15 @@ bool BatteryMonitor::update(void) {
                    KLOG_WARNING(LOG_TAG, "%s: Unknown power supply type\n",
                                 mChargerNames[i].string());
                }
                path.clear();
                path.appendFormat("%s/%s/current_max", POWER_SUPPLY_SYSFS_PATH,
                                  mChargerNames[i].string());
                if (access(path.string(), R_OK) == 0) {
                    int maxChargingCurrent = getIntField(path);
                    if (props.maxChargingCurrent < maxChargingCurrent) {
                        props.maxChargingCurrent = maxChargingCurrent;
                    }
                }
            }
        }
    }
@@ -341,9 +351,9 @@ void BatteryMonitor::dumpState(int fd) {
    int v;
    char vs[128];

    snprintf(vs, sizeof(vs), "ac: %d usb: %d wireless: %d\n",
    snprintf(vs, sizeof(vs), "ac: %d usb: %d wireless: %d current_max: %d\n",
             props.chargerAcOnline, props.chargerUsbOnline,
             props.chargerWirelessOnline);
             props.chargerWirelessOnline, props.maxChargingCurrent);
    write(fd, vs, strlen(vs));
    snprintf(vs, sizeof(vs), "status: %d health: %d present: %d\n",
             props.batteryStatus, props.batteryHealth, props.batteryPresent);