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

Commit bff255d7 authored by Blake Kragten's avatar Blake Kragten
Browse files

Battery Stats Dumpsys Readability Fixes

1> Moved the following fields to right after Cellular kernel
active time
Cellular Sleep time
Cellular Idle time
Cellular Rx time
Cellular Tx time
Cellular Battery drain

2> Moved the following fields to right after Wifi kernel active time
WiFi Scan time
WiFi Sleep time
WiFi Idle time
WiFi Rx time
WiFi Tx time
WiFi Battery drain

3> GPS Battery Drain (mAh): Limit to 2 decimal places and renamed to be
aligned with how cellular and wifi list out their battery drain.
Example:
"GPS Battery Drain: 0.20mAh"

Test: verified output using adb shell dumpsys batterystats
Bug: 111268544

Change-Id: Iafe4680b55cfb0be9545cc96227c450a8c13d177

Example Dumpsys for Cellular/Wifi:
  CONNECTIVITY POWER SUMMARY START
  Logging duration for connectivity statistics: 12m 17s 181ms
  Cellular Statistics:
     Cellular kernel active time: 0ms (0.0%)
     Cellular Sleep time:  8m 38s 185ms (70.3%)
     Cellular Idle time:   3m 12s 970ms (26.2%)
     Cellular Rx time:     27s 220ms (3.7%)
     Cellular Tx time:
       less than 0dBm:  355ms (0.0%)
       0dBm to 8dBm:  46ms (0.0%)
       8dBm to 15dBm:  123ms (0.0%)
       15dBm to 20dBm:  19ms (0.0%)
       above 20dBm:  2ms (0.0%)
     Cellular Battery drain: 6.48mAh
     Cellular data received: 4.61KB
     Cellular data sent: 16.63KB
     Cellular packets received: 60
     Cellular packets sent: 323
     Cellular Radio Access Technology:
       lte 12m 17s 181ms (100.0%)
     Cellular Rx signal strength (RSRP):
       very poor (less than -128dBm):  3s 836ms (0.5%)
       poor (-128dBm to -118dBm):  7s 554ms (1.0%)
       moderate (-118dBm to -108dBm):  1m 22s 381ms (11.2%)
       good (-108dBm to -98dBm):  10m 43s 410ms (87.3%)
  Wifi Statistics:
     Wifi kernel active time: 11m 30s 882ms (93.7%)
     WiFi Scan time:  15s 579ms (2.1%)
     WiFi Sleep time:  9m 31s 151ms (77.5%)
     WiFi Idle time:   2m 30s 927ms (20.5%)
     WiFi Rx time:     10s 793ms (1.5%)
     WiFi Tx time:     4s 318ms (0.6%)
     WiFi Battery drain: 4.11mAh
     Wifi data received: 143.66MB
     Wifi data sent: 94.23MB
     Wifi packets received: 77632
     Wifi packets sent: 31785
     Wifi states:
       sta 12m 17s 181ms (100.0%)
     Wifi supplicant states:
       completed 12m 17s 181ms (100.0%)
     Wifi Rx signal strength (RSSI):
         good (-66.25dBm to -55dBm): 12m 17s 181ms (100.0%)
parent 095adc27
Loading
Loading
Loading
Loading
+10 −8
Original line number Diff line number Diff line
@@ -4761,6 +4761,9 @@ public abstract class BatteryStats implements Parcelable {
        sb.append(")");
        pw.println(sb.toString());

        printControllerActivity(pw, sb, prefix, CELLULAR_CONTROLLER_NAME,
                getModemControllerActivity(), which);

        pw.print("     Cellular data received: "); pw.println(formatBytesLocked(mobileRxTotalBytes));
        pw.print("     Cellular data sent: "); pw.println(formatBytesLocked(mobileTxTotalBytes));
        pw.print("     Cellular packets received: "); pw.println(mobileRxTotalPackets);
@@ -4818,9 +4821,6 @@ public abstract class BatteryStats implements Parcelable {
        if (!didOne) sb.append(" (no activity)");
        pw.println(sb.toString());

        printControllerActivity(pw, sb, prefix, CELLULAR_CONTROLLER_NAME,
            getModemControllerActivity(), which);

        pw.print(prefix);
        sb.setLength(0);
        sb.append(prefix);
@@ -4837,6 +4837,9 @@ public abstract class BatteryStats implements Parcelable {
        sb.append(")");
        pw.println(sb.toString());

        printControllerActivity(pw, sb, prefix, WIFI_CONTROLLER_NAME,
                getWifiControllerActivity(), which);

        pw.print("     Wifi data received: "); pw.println(formatBytesLocked(wifiRxTotalBytes));
        pw.print("     Wifi data sent: "); pw.println(formatBytesLocked(wifiTxTotalBytes));
        pw.print("     Wifi packets received: "); pw.println(wifiRxTotalPackets);
@@ -4914,9 +4917,6 @@ public abstract class BatteryStats implements Parcelable {
        if (!didOne) sb.append(" (no activity)");
        pw.println(sb.toString());

        printControllerActivity(pw, sb, prefix, WIFI_CONTROLLER_NAME,
            getWifiControllerActivity(), which);

        pw.print(prefix);
        sb.setLength(0);
        sb.append(prefix);
@@ -4949,8 +4949,10 @@ public abstract class BatteryStats implements Parcelable {
            pw.print(prefix);
            sb.setLength(0);
            sb.append(prefix);
            sb.append("     Battery Drain (mAh): ");
            sb.append(Double.toString(((double) gpsBatteryDrainMaMs)/(3600 * 1000)));
            sb.append("     GPS Battery Drain: ");
            sb.append(new DecimalFormat("#.##").format(
                    ((double) gpsBatteryDrainMaMs) / (3600 * 1000)));
            sb.append("mAh");
            pw.println(sb.toString());
        }