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

Commit 8ad2af7e authored by Dianne Hackborn's avatar Dianne Hackborn
Browse files

First stab at device idle mode.

Introduce a new device idle controller service that
monitor's the device state and determines when to go
in to idle mode.  When in idle mode, all we do right
now is turn off network access the same as we do for
power save mode.  Many more things should come in the
future -- stopping the alarm manager from scheduling
(most) alarms, telling GmsCore for it to stop doing
stuff, etc.

Battery stats now has state tracking for devie idle
mode, as well as events for the reasons we can come
out of idle mode (significant motion or the device
becoming active).  Also added new events noting when
packages are installed.

Renamed the "low power" event in battery stats to
"power save" because the former was just way too
confusing.

Finally, fix buffer size reading kernel wake locks.
(Stupidly, just increasing the buffer size.  Ideally
we should try to be smarter and grow our buffer to
fit the data available, but I'll leave that for
another time.)

Change-Id: I0be2062466c83ee9d890c6cf5a228d9cc4090eca
parent 27eac1d5
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -472,7 +472,8 @@ public final class DisplayManager {
    /**
     * Creates a virtual display.
     *
     * @see #createVirtualDisplay(String, int, int, int, Surface, int, VirtualDisplay.Callback)
     * @see #createVirtualDisplay(String, int, int, int, Surface, int,
     * VirtualDisplay.Callback, Handler)
     */
    public VirtualDisplay createVirtualDisplay(@NonNull String name,
            int width, int height, int densityDpi, @Nullable Surface surface, int flags) {
+2 −1
Original line number Diff line number Diff line
@@ -54,7 +54,8 @@ interface INetworkPolicyManager {
    void setRestrictBackground(boolean restrictBackground);
    boolean getRestrictBackground();

    void setDeviceIdleMode(boolean enabled);

    NetworkQuotaInfo getNetworkQuotaInfo(in NetworkState state);
    boolean isNetworkMetered(in NetworkState state);

}
+61 −21
Original line number Diff line number Diff line
@@ -30,7 +30,6 @@ import android.content.pm.ApplicationInfo;
import android.telephony.SignalStrength;
import android.text.format.DateFormat;
import android.util.Printer;
import android.util.Slog;
import android.util.SparseArray;
import android.util.SparseIntArray;
import android.util.TimeUtils;
@@ -1044,14 +1043,15 @@ public abstract class BatteryStats implements Parcelable {
        public static final int STATE2_WIFI_SIGNAL_STRENGTH_MASK =
                0x7 << STATE2_WIFI_SIGNAL_STRENGTH_SHIFT;

        public static final int STATE2_LOW_POWER_FLAG = 1<<31;
        public static final int STATE2_POWER_SAVE_FLAG = 1<<31;
        public static final int STATE2_VIDEO_ON_FLAG = 1<<30;
        public static final int STATE2_WIFI_RUNNING_FLAG = 1<<29;
        public static final int STATE2_WIFI_ON_FLAG = 1<<28;
        public static final int STATE2_FLASHLIGHT_FLAG = 1<<27;
        public static final int STATE2_DEVICE_IDLE_FLAG = 1<<26;

        public static final int MOST_INTERESTING_STATES2 =
            STATE2_LOW_POWER_FLAG | STATE2_WIFI_ON_FLAG;
            STATE2_POWER_SAVE_FLAG | STATE2_WIFI_ON_FLAG | STATE2_DEVICE_IDLE_FLAG;

        public int states2;

@@ -1086,10 +1086,18 @@ public abstract class BatteryStats implements Parcelable {
        public static final int EVENT_USER_RUNNING = 0x0007;
        // Events for foreground user.
        public static final int EVENT_USER_FOREGROUND = 0x0008;
        // Events for connectivity changed.
        // Event for connectivity changed.
        public static final int EVENT_CONNECTIVITY_CHANGED = 0x0009;
        // Event for significant motion taking us out of idle mode.
        public static final int EVENT_SIGNIFICANT_MOTION = 0x000a;
        // Event for becoming active taking us out of idle mode.
        public static final int EVENT_ACTIVE = 0x000b;
        // Event for a package being installed.
        public static final int EVENT_PACKAGE_INSTALLED = 0x000c;
        // Event for a package being uninstalled.
        public static final int EVENT_PACKAGE_UNINSTALLED = 0x000d;
        // Number of event types.
        public static final int EVENT_COUNT = 0x000a;
        public static final int EVENT_COUNT = 0x000e;
        // Mask to extract out only the type part of the event.
        public static final int EVENT_TYPE_MASK = ~(EVENT_FLAG_START|EVENT_FLAG_FINISH);

@@ -1486,19 +1494,34 @@ public abstract class BatteryStats implements Parcelable {
            long elapsedRealtimeUs, int which);

    /**
     * Returns the time in microseconds that low power mode has been enabled while the device was
     * Returns the time in microseconds that power save mode has been enabled while the device was
     * running on battery.
     *
     * {@hide}
     */
    public abstract long getLowPowerModeEnabledTime(long elapsedRealtimeUs, int which);
    public abstract long getPowerSaveModeEnabledTime(long elapsedRealtimeUs, int which);

    /**
     * Returns the number of times that low power mode was enabled.
     * Returns the number of times that power save mode was enabled.
     *
     * {@hide}
     */
    public abstract int getLowPowerModeEnabledCount(int which);
    public abstract int getPowerSaveModeEnabledCount(int which);

    /**
     * Returns the time in microseconds that device has been in idle mode while
     * running on battery.
     *
     * {@hide}
     */
    public abstract long getDeviceIdleModeEnabledTime(long elapsedRealtimeUs, int which);

    /**
     * Returns the number of times that the devie has gone in to idle mode.
     *
     * {@hide}
     */
    public abstract int getDeviceIdleModeEnabledCount(int which);

    /**
     * Returns the number of times that connectivity state changed.
@@ -1692,11 +1715,12 @@ public abstract class BatteryStats implements Parcelable {

    public static final BitDescription[] HISTORY_STATE2_DESCRIPTIONS
            = new BitDescription[] {
        new BitDescription(HistoryItem.STATE2_LOW_POWER_FLAG, "low_power", "lp"),
        new BitDescription(HistoryItem.STATE2_POWER_SAVE_FLAG, "power_save", "ps"),
        new BitDescription(HistoryItem.STATE2_VIDEO_ON_FLAG, "video", "v"),
        new BitDescription(HistoryItem.STATE2_WIFI_RUNNING_FLAG, "wifi_running", "Wr"),
        new BitDescription(HistoryItem.STATE2_WIFI_ON_FLAG, "wifi", "W"),
        new BitDescription(HistoryItem.STATE2_FLASHLIGHT_FLAG, "flashlight", "fl"),
        new BitDescription(HistoryItem.STATE2_DEVICE_IDLE_FLAG, "device_idle", "di"),
        new BitDescription(HistoryItem.STATE2_WIFI_SIGNAL_STRENGTH_MASK,
                HistoryItem.STATE2_WIFI_SIGNAL_STRENGTH_SHIFT, "wifi_signal_strength", "Wss",
                new String[] { "0", "1", "2", "3", "4" },
@@ -1707,11 +1731,13 @@ public abstract class BatteryStats implements Parcelable {
    };

    public static final String[] HISTORY_EVENT_NAMES = new String[] {
            "null", "proc", "fg", "top", "sync", "wake_lock_in", "job", "user", "userfg", "conn"
            "null", "proc", "fg", "top", "sync", "wake_lock_in", "job", "user", "userfg", "conn",
            "motion", "active", "pkginst", "pkgunin"
    };

    public static final String[] HISTORY_EVENT_CHECKIN_NAMES = new String[] {
            "Enl", "Epr", "Efg", "Etp", "Esy", "Ewl", "Ejb", "Eur", "Euf", "Ecn"
            "Enl", "Epr", "Efg", "Etp", "Esy", "Ewl", "Ejb", "Eur", "Euf", "Ecn",
            "Esm", "Eac", "Epi", "Epu"
    };

    /**
@@ -2310,7 +2336,8 @@ public abstract class BatteryStats implements Parcelable {
        final long totalUptime = computeUptime(rawUptime, which);
        final long screenOnTime = getScreenOnTime(rawRealtime, which);
        final long interactiveTime = getInteractiveTime(rawRealtime, which);
        final long lowPowerModeEnabledTime = getLowPowerModeEnabledTime(rawRealtime, which);
        final long powerSaveModeEnabledTime = getPowerSaveModeEnabledTime(rawRealtime, which);
        final long deviceIdleModeEnabledTime = getDeviceIdleModeEnabledTime(rawRealtime, which);
        final int connChanges = getNumConnectivityChange(which);
        final long phoneOnTime = getPhoneOnTime(rawRealtime, which);
        final long wifiOnTime = getWifiOnTime(rawRealtime, which);
@@ -2382,7 +2409,8 @@ public abstract class BatteryStats implements Parcelable {
                fullWakeLockTimeTotal / 1000, partialWakeLockTimeTotal / 1000,
                0 /*legacy input event count*/, getMobileRadioActiveTime(rawRealtime, which) / 1000,
                getMobileRadioActiveAdjustedTime(which) / 1000, interactiveTime / 1000,
                lowPowerModeEnabledTime / 1000, connChanges);
                powerSaveModeEnabledTime / 1000, connChanges, deviceIdleModeEnabledTime / 1000,
                getDeviceIdleModeEnabledCount(which));
        
        // Dump screen brightness stats
        Object[] args = new Object[NUM_SCREEN_BRIGHTNESS_BINS];
@@ -2849,7 +2877,8 @@ public abstract class BatteryStats implements Parcelable {

        final long screenOnTime = getScreenOnTime(rawRealtime, which);
        final long interactiveTime = getInteractiveTime(rawRealtime, which);
        final long lowPowerModeEnabledTime = getLowPowerModeEnabledTime(rawRealtime, which);
        final long powerSaveModeEnabledTime = getPowerSaveModeEnabledTime(rawRealtime, which);
        final long deviceIdleModeEnabledTime = getDeviceIdleModeEnabledTime(rawRealtime, which);
        final long phoneOnTime = getPhoneOnTime(rawRealtime, which);
        final long wifiRunningTime = getGlobalWifiRunningTime(rawRealtime, which);
        final long wifiOnTime = getWifiOnTime(rawRealtime, which);
@@ -2884,22 +2913,33 @@ public abstract class BatteryStats implements Parcelable {
        }
        if (!didOne) sb.append(" (no activity)");
        pw.println(sb.toString());
        if (lowPowerModeEnabledTime != 0) {
        if (powerSaveModeEnabledTime != 0) {
            sb.setLength(0);
            sb.append(prefix);
                    sb.append("  Low power mode enabled: ");
                    formatTimeMs(sb, lowPowerModeEnabledTime / 1000);
                    sb.append("  Power save mode enabled: ");
                    formatTimeMs(sb, powerSaveModeEnabledTime / 1000);
                    sb.append("(");
                    sb.append(formatRatioLocked(lowPowerModeEnabledTime, whichBatteryRealtime));
                    sb.append(formatRatioLocked(powerSaveModeEnabledTime, whichBatteryRealtime));
                    sb.append(")");
            pw.println(sb.toString());
        }
        if (deviceIdleModeEnabledTime != 0) {
            sb.setLength(0);
            sb.append(prefix);
                    sb.append("  Device idling: ");
                    formatTimeMs(sb, deviceIdleModeEnabledTime / 1000);
                    sb.append("(");
                    sb.append(formatRatioLocked(deviceIdleModeEnabledTime, whichBatteryRealtime));
                    sb.append(") "); sb.append(getDeviceIdleModeEnabledCount(which));
                    sb.append("x");
            pw.println(sb.toString());
        }
        if (phoneOnTime != 0) {
            sb.setLength(0);
            sb.append(prefix);
                    sb.append("  Active phone call: "); formatTimeMs(sb, phoneOnTime / 1000);
                    sb.append("("); sb.append(formatRatioLocked(phoneOnTime, whichBatteryRealtime));
                    sb.append(") "); sb.append(getPhoneOnCount(which));
                    sb.append(") "); sb.append(getPhoneOnCount(which)); sb.append("x");
        }
        int connChanges = getNumConnectivityChange(which);
        if (connChanges != 0) {
@@ -4721,7 +4761,7 @@ public abstract class BatteryStats implements Parcelable {
        prepareForDumpLocked();

        dumpLine(pw, 0 /* uid */, "i" /* category */, VERSION_DATA,
                "12", getParcelVersion(), getStartPlatformVersion(), getEndPlatformVersion());
                "13", getParcelVersion(), getStartPlatformVersion(), getEndPlatformVersion());

        long now = getHistoryBaseTime() + SystemClock.elapsedRealtime();

+1 −0
Original line number Diff line number Diff line
@@ -111,6 +111,7 @@ interface IBatteryStats {
    void noteWifiMulticastDisabledFromSource(in WorkSource ws);
    void noteNetworkInterfaceType(String iface, int type);
    void noteNetworkStatsEnabled();
    void noteDeviceIdleMode(boolean enabled, boolean fromActive, boolean fromMotion);
    void setBatteryState(int status, int health, int plugType, int level, int temp, int volt);
    long getAwakeTimeBattery();
    long getAwakeTimePlugged();
+98 −31
Original line number Diff line number Diff line
@@ -109,7 +109,7 @@ public final class BatteryStatsImpl extends BatteryStats {
    private static final int MAGIC = 0xBA757475; // 'BATSTATS'

    // Current on-disk Parcel version
    private static final int VERSION = 119 + (USE_OLD_HISTORY ? 1000 : 0);
    private static final int VERSION = 120 + (USE_OLD_HISTORY ? 1000 : 0);

    // Maximum number of items we will record in the history.
    private static final int MAX_HISTORY_ITEMS = 2000;
@@ -307,8 +307,11 @@ public final class BatteryStatsImpl extends BatteryStats {
    boolean mInteractive;
    StopwatchTimer mInteractiveTimer;

    boolean mLowPowerModeEnabled;
    StopwatchTimer mLowPowerModeEnabledTimer;
    boolean mPowerSaveModeEnabled;
    StopwatchTimer mPowerSaveModeEnabledTimer;

    boolean mDeviceIdleModeEnabled;
    StopwatchTimer mDeviceIdleModeEnabledTimer;

    boolean mPhoneOn;
    StopwatchTimer mPhoneOnTimer;
@@ -1775,17 +1778,18 @@ public final class BatteryStatsImpl extends BatteryStats {
    private final Map<String, KernelWakelockStats> readKernelWakelockStats() {

        FileInputStream is;
        byte[] buffer = new byte[8192];
        byte[] buffer = new byte[32*1024];
        int len;
        boolean wakeup_sources = false;
        boolean wakeup_sources;

        try {
            try {
                is = new FileInputStream("/proc/wakelocks");
            } catch (java.io.FileNotFoundException e) {
            try {
                is = new FileInputStream("/d/wakeup_sources");
                wakeup_sources = true;
            } catch (java.io.FileNotFoundException e) {
                try {
                    is = new FileInputStream("/proc/wakelocks");
                    wakeup_sources = false;
                } catch (java.io.FileNotFoundException e2) {
                    return null;
                }
@@ -1798,6 +1802,9 @@ public final class BatteryStatsImpl extends BatteryStats {
        }

        if (len > 0) {
            if (len >= buffer.length) {
                Slog.wtf(TAG, "Kernel wake locks exceeded buffer size " + buffer.length);
            }
            int i;
            for (i=0; i<len; i++) {
                if (buffer[i] == '\0') {
@@ -3386,29 +3393,73 @@ public final class BatteryStatsImpl extends BatteryStats {
        }
    }

    public void noteLowPowerMode(boolean enabled) {
        if (mLowPowerModeEnabled != enabled) {
    public void notePowerSaveMode(boolean enabled) {
        if (mPowerSaveModeEnabled != enabled) {
            int stepState = enabled ? STEP_LEVEL_MODE_POWER_SAVE : 0;
            mModStepMode |= (mCurStepMode&STEP_LEVEL_MODE_POWER_SAVE) ^ stepState;
            mCurStepMode = (mCurStepMode&~STEP_LEVEL_MODE_POWER_SAVE) | stepState;
            final long elapsedRealtime = SystemClock.elapsedRealtime();
            final long uptime = SystemClock.uptimeMillis();
            mLowPowerModeEnabled = enabled;
            mPowerSaveModeEnabled = enabled;
            if (enabled) {
                mHistoryCur.states2 |= HistoryItem.STATE2_LOW_POWER_FLAG;
                if (DEBUG_HISTORY) Slog.v(TAG, "Low power mode enabled to: "
                mHistoryCur.states2 |= HistoryItem.STATE2_POWER_SAVE_FLAG;
                if (DEBUG_HISTORY) Slog.v(TAG, "Power save mode enabled to: "
                        + Integer.toHexString(mHistoryCur.states2));
                mLowPowerModeEnabledTimer.startRunningLocked(elapsedRealtime);
                mPowerSaveModeEnabledTimer.startRunningLocked(elapsedRealtime);
            } else {
                mHistoryCur.states2 &= ~HistoryItem.STATE2_LOW_POWER_FLAG;
                if (DEBUG_HISTORY) Slog.v(TAG, "Low power mode disabled to: "
                mHistoryCur.states2 &= ~HistoryItem.STATE2_POWER_SAVE_FLAG;
                if (DEBUG_HISTORY) Slog.v(TAG, "Power save mode disabled to: "
                        + Integer.toHexString(mHistoryCur.states2));
                mLowPowerModeEnabledTimer.stopRunningLocked(elapsedRealtime);
                mPowerSaveModeEnabledTimer.stopRunningLocked(elapsedRealtime);
            }
            addHistoryRecordLocked(elapsedRealtime, uptime);
        }
    }

    public void noteDeviceIdleModeLocked(boolean enabled, boolean fromActive, boolean fromMotion) {
        if (mDeviceIdleModeEnabled != enabled) {
            final long elapsedRealtime = SystemClock.elapsedRealtime();
            final long uptime = SystemClock.uptimeMillis();
            mDeviceIdleModeEnabled = enabled;
            if (fromMotion) {
                addHistoryEventLocked(elapsedRealtime, uptime, HistoryItem.EVENT_SIGNIFICANT_MOTION,
                        "", 0);
            }
            if (fromActive) {
                addHistoryEventLocked(elapsedRealtime, uptime, HistoryItem.EVENT_ACTIVE,
                        "", 0);
            }
            if (enabled) {
                mHistoryCur.states2 |= HistoryItem.STATE2_DEVICE_IDLE_FLAG;
                if (DEBUG_HISTORY) Slog.v(TAG, "Device idle mode enabled to: "
                        + Integer.toHexString(mHistoryCur.states2));
                mDeviceIdleModeEnabledTimer.startRunningLocked(elapsedRealtime);
            } else {
                mHistoryCur.states2 &= ~HistoryItem.STATE2_DEVICE_IDLE_FLAG;
                if (DEBUG_HISTORY) Slog.v(TAG, "Device idle mode disabled to: "
                        + Integer.toHexString(mHistoryCur.states2));
                mDeviceIdleModeEnabledTimer.stopRunningLocked(elapsedRealtime);
            }
            addHistoryRecordLocked(elapsedRealtime, uptime);
        }
    }

    public void notePackageInstalledLocked(String pkgName, int versionCode) {
        final long elapsedRealtime = SystemClock.elapsedRealtime();
        final long uptime = SystemClock.uptimeMillis();
        addHistoryEventLocked(elapsedRealtime, uptime, HistoryItem.EVENT_PACKAGE_INSTALLED,
                pkgName, versionCode);
        mNumConnectivityChange++;
    }

    public void notePackageUninstalledLocked(String pkgName) {
        final long elapsedRealtime = SystemClock.elapsedRealtime();
        final long uptime = SystemClock.uptimeMillis();
        addHistoryEventLocked(elapsedRealtime, uptime, HistoryItem.EVENT_PACKAGE_UNINSTALLED,
                pkgName, 0);
        mNumConnectivityChange++;
    }

    public void notePhoneOnLocked() {
        if (!mPhoneOn) {
            final long elapsedRealtime = SystemClock.elapsedRealtime();
@@ -4195,12 +4246,20 @@ public final class BatteryStatsImpl extends BatteryStats {
        return mInteractiveTimer.getTotalTimeLocked(elapsedRealtimeUs, which);
    }

    @Override public long getLowPowerModeEnabledTime(long elapsedRealtimeUs, int which) {
        return mLowPowerModeEnabledTimer.getTotalTimeLocked(elapsedRealtimeUs, which);
    @Override public long getPowerSaveModeEnabledTime(long elapsedRealtimeUs, int which) {
        return mPowerSaveModeEnabledTimer.getTotalTimeLocked(elapsedRealtimeUs, which);
    }

    @Override public int getPowerSaveModeEnabledCount(int which) {
        return mPowerSaveModeEnabledTimer.getCountLocked(which);
    }

    @Override public long getDeviceIdleModeEnabledTime(long elapsedRealtimeUs, int which) {
        return mDeviceIdleModeEnabledTimer.getTotalTimeLocked(elapsedRealtimeUs, which);
    }

    @Override public int getLowPowerModeEnabledCount(int which) {
        return mLowPowerModeEnabledTimer.getCountLocked(which);
    @Override public int getDeviceIdleModeEnabledCount(int which) {
        return mDeviceIdleModeEnabledTimer.getCountLocked(which);
    }

    @Override public int getNumConnectivityChange(int which) {
@@ -6662,8 +6721,9 @@ public final class BatteryStatsImpl extends BatteryStats {
        for (int i=0; i<NUM_SCREEN_BRIGHTNESS_BINS; i++) {
            mScreenBrightnessTimer[i] = new StopwatchTimer(null, -100-i, null, mOnBatteryTimeBase);
        }
        mInteractiveTimer = new StopwatchTimer(null, -9, null, mOnBatteryTimeBase);
        mLowPowerModeEnabledTimer = new StopwatchTimer(null, -2, null, mOnBatteryTimeBase);
        mInteractiveTimer = new StopwatchTimer(null, -10, null, mOnBatteryTimeBase);
        mPowerSaveModeEnabledTimer = new StopwatchTimer(null, -2, null, mOnBatteryTimeBase);
        mDeviceIdleModeEnabledTimer = new StopwatchTimer(null, -11, null, mOnBatteryTimeBase);
        mPhoneOnTimer = new StopwatchTimer(null, -3, null, mOnBatteryTimeBase);
        for (int i=0; i<SignalStrength.NUM_SIGNAL_STRENGTH_BINS; i++) {
            mPhoneSignalStrengthsTimer[i] = new StopwatchTimer(null, -200-i, null,
@@ -7233,7 +7293,8 @@ public final class BatteryStatsImpl extends BatteryStats {
            mScreenBrightnessTimer[i].reset(false);
        }
        mInteractiveTimer.reset(false);
        mLowPowerModeEnabledTimer.reset(false);
        mPowerSaveModeEnabledTimer.reset(false);
        mDeviceIdleModeEnabledTimer.reset(false);
        mPhoneOnTimer.reset(false);
        mAudioOnTimer.reset(false);
        mVideoOnTimer.reset(false);
@@ -8534,7 +8595,8 @@ public final class BatteryStatsImpl extends BatteryStats {
        mInteractive = false;
        mInteractiveTimer.readSummaryFromParcelLocked(in);
        mPhoneOn = false;
        mLowPowerModeEnabledTimer.readSummaryFromParcelLocked(in);
        mPowerSaveModeEnabledTimer.readSummaryFromParcelLocked(in);
        mDeviceIdleModeEnabledTimer.readSummaryFromParcelLocked(in);
        mPhoneOnTimer.readSummaryFromParcelLocked(in);
        for (int i=0; i<SignalStrength.NUM_SIGNAL_STRENGTH_BINS; i++) {
            mPhoneSignalStrengthsTimer[i].readSummaryFromParcelLocked(in);
@@ -8835,7 +8897,8 @@ public final class BatteryStatsImpl extends BatteryStats {
            mScreenBrightnessTimer[i].writeSummaryFromParcelLocked(out, NOWREAL_SYS);
        }
        mInteractiveTimer.writeSummaryFromParcelLocked(out, NOWREAL_SYS);
        mLowPowerModeEnabledTimer.writeSummaryFromParcelLocked(out, NOWREAL_SYS);
        mPowerSaveModeEnabledTimer.writeSummaryFromParcelLocked(out, NOWREAL_SYS);
        mDeviceIdleModeEnabledTimer.writeSummaryFromParcelLocked(out, NOWREAL_SYS);
        mPhoneOnTimer.writeSummaryFromParcelLocked(out, NOWREAL_SYS);
        for (int i=0; i<SignalStrength.NUM_SIGNAL_STRENGTH_BINS; i++) {
            mPhoneSignalStrengthsTimer[i].writeSummaryFromParcelLocked(out, NOWREAL_SYS);
@@ -9132,9 +9195,10 @@ public final class BatteryStatsImpl extends BatteryStats {
                    in);
        }
        mInteractive = false;
        mInteractiveTimer = new StopwatchTimer(null, -9, null, mOnBatteryTimeBase, in);
        mInteractiveTimer = new StopwatchTimer(null, -10, null, mOnBatteryTimeBase, in);
        mPhoneOn = false;
        mLowPowerModeEnabledTimer = new StopwatchTimer(null, -2, null, mOnBatteryTimeBase, in);
        mPowerSaveModeEnabledTimer = new StopwatchTimer(null, -2, null, mOnBatteryTimeBase, in);
        mDeviceIdleModeEnabledTimer = new StopwatchTimer(null, -11, null, mOnBatteryTimeBase, in);
        mPhoneOnTimer = new StopwatchTimer(null, -3, null, mOnBatteryTimeBase, in);
        for (int i=0; i<SignalStrength.NUM_SIGNAL_STRENGTH_BINS; i++) {
            mPhoneSignalStrengthsTimer[i] = new StopwatchTimer(null, -200-i,
@@ -9299,7 +9363,8 @@ public final class BatteryStatsImpl extends BatteryStats {
            mScreenBrightnessTimer[i].writeToParcel(out, uSecRealtime);
        }
        mInteractiveTimer.writeToParcel(out, uSecRealtime);
        mLowPowerModeEnabledTimer.writeToParcel(out, uSecRealtime);
        mPowerSaveModeEnabledTimer.writeToParcel(out, uSecRealtime);
        mDeviceIdleModeEnabledTimer.writeToParcel(out, uSecRealtime);
        mPhoneOnTimer.writeToParcel(out, uSecRealtime);
        for (int i=0; i<SignalStrength.NUM_SIGNAL_STRENGTH_BINS; i++) {
            mPhoneSignalStrengthsTimer[i].writeToParcel(out, uSecRealtime);
@@ -9436,8 +9501,10 @@ public final class BatteryStatsImpl extends BatteryStats {
            }
            pr.println("*** Interactive timer:");
            mInteractiveTimer.logState(pr, "  ");
            pr.println("*** Low power mode timer:");
            mLowPowerModeEnabledTimer.logState(pr, "  ");
            pr.println("*** Power save mode timer:");
            mPowerSaveModeEnabledTimer.logState(pr, "  ");
            pr.println("*** Device idle mode timer:");
            mDeviceIdleModeEnabledTimer.logState(pr, "  ");
            pr.println("*** Phone timer:");
            mPhoneOnTimer.logState(pr, "  ");
            for (int i=0; i<SignalStrength.NUM_SIGNAL_STRENGTH_BINS; i++) {
Loading