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

Commit 1703c54a authored by Dianne Hackborn's avatar Dianne Hackborn Committed by Android Git Automerger
Browse files

am 021a138b: am 8144585c: Merge "Fix issue #10422349: Limit/change the battery...

am 021a138b: am 8144585c: Merge "Fix issue #10422349: Limit/change the battery history data in batterystats" into klp-dev

* commit '021a138b':
  Fix issue #10422349: Limit/change the battery history data in batterystats
parents 125b2f8d 021a138b
Loading
Loading
Loading
Loading
+14 −11
Original line number Diff line number Diff line
@@ -2380,11 +2380,13 @@ public abstract class BatteryStats implements Parcelable {
    
    @SuppressWarnings("unused")
    public void dumpCheckinLocked(
            PrintWriter pw, List<ApplicationInfo> apps, boolean isUnpluggedOnly) {
            PrintWriter pw, List<ApplicationInfo> apps, boolean isUnpluggedOnly,
            boolean includeHistory) {
        prepareForDumpLocked();
        
        long now = getHistoryBaseTime() + SystemClock.elapsedRealtime();

        if (includeHistory) {
            final HistoryItem rec = new HistoryItem();
            if (startIteratingHistoryLocked()) {
                HistoryPrinter hprinter = new HistoryPrinter();
@@ -2397,6 +2399,7 @@ public abstract class BatteryStats implements Parcelable {
                }
                finishIteratingHistoryLocked();
            }
        }

        if (apps != null) {
            SparseArray<ArrayList<String>> uids = new SparseArray<ArrayList<String>>();
+6 −2
Original line number Diff line number Diff line
@@ -481,7 +481,7 @@ public final class BatteryStatsService extends IBatteryStats.Stub {
    
    private void dumpHelp(PrintWriter pw) {
        pw.println("Battery stats (batterystats) dump options:");
        pw.println("  [--checkin] [--unplugged] [--reset] [--write] [-h] [<package.name>]");
        pw.println("  [--checkin] [-c] [--unplugged] [--reset] [--write] [-h] [<package.name>]");
        pw.println("  --checkin: format output for a checkin report.");
        pw.println("  --unplugged: only output data since last unplugged.");
        pw.println("  --reset: reset the stats, clearing all current data.");
@@ -501,6 +501,7 @@ public final class BatteryStatsService extends IBatteryStats.Stub {
        }

        boolean isCheckin = false;
        boolean includeHistory = false;
        boolean isUnpluggedOnly = false;
        boolean noOutput = false;
        int reqUid = -1;
@@ -508,6 +509,9 @@ public final class BatteryStatsService extends IBatteryStats.Stub {
            for (String arg : args) {
                if ("--checkin".equals(arg)) {
                    isCheckin = true;
                } else if ("-c".equals(arg)) {
                    isCheckin = true;
                    includeHistory = true;
                } else if ("--unplugged".equals(arg)) {
                    isUnpluggedOnly = true;
                } else if ("--reset".equals(arg)) {
@@ -550,7 +554,7 @@ public final class BatteryStatsService extends IBatteryStats.Stub {
        if (isCheckin) {
            List<ApplicationInfo> apps = mContext.getPackageManager().getInstalledApplications(0);
            synchronized (mStats) {
                mStats.dumpCheckinLocked(pw, apps, isUnpluggedOnly);
                mStats.dumpCheckinLocked(pw, apps, isUnpluggedOnly, includeHistory);
            }
        } else {
            synchronized (mStats) {