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

Commit 3e49def5 authored by YiKai Peng's avatar YiKai Peng Committed by Android (Google) Code Review
Browse files

Merge "healthd: add annotations for dumpsys diagnostics" into main

parents 937d02a1 ae455dbc
Loading
Loading
Loading
Loading
+21 −16
Original line number Diff line number Diff line
@@ -715,6 +715,8 @@ void BatteryMonitor::dumpState(int fd) {
    char vs[128];
    const HealthInfo& props = *mHealthInfo;

    snprintf(vs, sizeof(vs), "Cached HealthInfo:\n");
    write(fd, vs, strlen(vs));
    snprintf(vs, sizeof(vs),
             "  ac: %d usb: %d wireless: %d dock: %d current_max: %d voltage_max: %d\n",
             props.chargerAcOnline, props.chargerUsbOnline, props.chargerWirelessOnline,
@@ -729,35 +731,38 @@ void BatteryMonitor::dumpState(int fd) {
    write(fd, vs, strlen(vs));

    if (!mHealthdConfig->batteryCurrentNowPath.empty()) {
        v = getIntField(mHealthdConfig->batteryCurrentNowPath);
        snprintf(vs, sizeof(vs), "current now: %d\n", v);
        snprintf(vs, sizeof(vs), "  current now: %d\n", props.batteryCurrentMicroamps);
        write(fd, vs, strlen(vs));
    }

    if (!mHealthdConfig->batteryCurrentAvgPath.empty()) {
        v = getIntField(mHealthdConfig->batteryCurrentAvgPath);
        snprintf(vs, sizeof(vs), "current avg: %d\n", v);
    if (!mHealthdConfig->batteryCycleCountPath.empty()) {
        snprintf(vs, sizeof(vs), "  cycle count: %d\n", props.batteryCycleCount);
        write(fd, vs, strlen(vs));
    }

    if (!mHealthdConfig->batteryChargeCounterPath.empty()) {
        v = getIntField(mHealthdConfig->batteryChargeCounterPath);
        snprintf(vs, sizeof(vs), "charge counter: %d\n", v);
    if (!mHealthdConfig->batteryFullChargePath.empty()) {
        snprintf(vs, sizeof(vs), "  Full charge: %d\n", props.batteryFullChargeUah);
        write(fd, vs, strlen(vs));
    }

    snprintf(vs, sizeof(vs), "Real-time Values:\n");
    write(fd, vs, strlen(vs));

    if (!mHealthdConfig->batteryCurrentNowPath.empty()) {
        snprintf(vs, sizeof(vs), "current now: %d\n", props.batteryCurrentMicroamps);
        v = getIntField(mHealthdConfig->batteryCurrentNowPath);
        snprintf(vs, sizeof(vs), "  current now: %d\n", v);
        write(fd, vs, strlen(vs));
    }

    if (!mHealthdConfig->batteryCycleCountPath.empty()) {
        snprintf(vs, sizeof(vs), "cycle count: %d\n", props.batteryCycleCount);
    if (!mHealthdConfig->batteryCurrentAvgPath.empty()) {
        v = getIntField(mHealthdConfig->batteryCurrentAvgPath);
        snprintf(vs, sizeof(vs), "  current avg: %d\n", v);
        write(fd, vs, strlen(vs));
    }

    if (!mHealthdConfig->batteryFullChargePath.empty()) {
        snprintf(vs, sizeof(vs), "Full charge: %d\n", props.batteryFullChargeUah);
    if (!mHealthdConfig->batteryChargeCounterPath.empty()) {
        v = getIntField(mHealthdConfig->batteryChargeCounterPath);
        snprintf(vs, sizeof(vs), "  charge counter: %d\n", v);
        write(fd, vs, strlen(vs));
    }
}