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

Commit ffb30680 authored by Android Build Merger (Role)'s avatar Android Build Merger (Role) Committed by Android (Google) Code Review
Browse files

Merge "Merge "DO NOT MERGE: Update BatteryStatsImpl to handle change in no. of...

Merge "Merge "DO NOT MERGE: Update BatteryStatsImpl to handle change in no. of freqs." into oc-mr1-dev am: 3cb64c2c" into oc-mr1-dev-plus-aosp
parents 0778f438 76974ee4
Loading
Loading
Loading
Loading
+20 −16
Original line number Diff line number Diff line
@@ -3667,9 +3667,12 @@ public abstract class BatteryStats implements Parcelable {
                        0 /* old cpu power, keep for compatibility */);
            }

            // If the cpuFreqs is null, then don't bother checking for cpu freq times.
            if (cpuFreqs != null) {
                final long[] cpuFreqTimeMs = u.getCpuFreqTimes(which);
            // If total cpuFreqTimes is null, then we don't need to check for screenOffCpuFreqTimes.
            if (cpuFreqTimeMs != null) {
                // If total cpuFreqTimes is null, then we don't need to check for
                // screenOffCpuFreqTimes.
                if (cpuFreqTimeMs != null && cpuFreqTimeMs.length == cpuFreqs.length) {
                    sb.setLength(0);
                    for (int i = 0; i < cpuFreqTimeMs.length; ++i) {
                        sb.append((i == 0 ? "" : ",") + cpuFreqTimeMs[i]);
@@ -3687,6 +3690,7 @@ public abstract class BatteryStats implements Parcelable {
                    dumpLine(pw, uid, category, CPU_TIMES_AT_FREQ_DATA, UID_TIMES_TYPE_ALL,
                            cpuFreqTimeMs.length, sb.toString());
                }
            }

            final ArrayMap<String, ? extends BatteryStats.Uid.Proc> processStats
                    = u.getProcessStats();
+8 −2
Original line number Diff line number Diff line
@@ -1063,6 +1063,10 @@ public class BatteryStatsImpl extends BatteryStats {
            }
        }

        public int getSize() {
            return mCounts == null ? 0 : mCounts.length;
        }

        /**
         * Clear state of this counter.
         */
@@ -10526,11 +10530,13 @@ public class BatteryStatsImpl extends BatteryStats {
                            return;
                        }
                        final Uid u = getUidStatsLocked(uid);
                        if (u.mCpuFreqTimeMs == null) {
                        if (u.mCpuFreqTimeMs == null
                                || u.mCpuFreqTimeMs.getSize() != cpuFreqTimeMs.length) {
                            u.mCpuFreqTimeMs = new LongSamplingCounterArray(mOnBatteryTimeBase);
                        }
                        u.mCpuFreqTimeMs.addCountLocked(cpuFreqTimeMs);
                        if (u.mScreenOffCpuFreqTimeMs == null) {
                        if (u.mScreenOffCpuFreqTimeMs == null
                                || u.mScreenOffCpuFreqTimeMs.getSize() != cpuFreqTimeMs.length) {
                            u.mScreenOffCpuFreqTimeMs = new LongSamplingCounterArray(
                                    mOnBatteryScreenOffTimeBase);
                        }