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

Commit 29700949 authored by Bart Sears's avatar Bart Sears Committed by Android (Google) Code Review
Browse files

Merge "Hack to get devices booting again." into mnc-dr1.5-dev

parents b2628caa f67823b8
Loading
Loading
Loading
Loading
+13 −1
Original line number Original line Diff line number Diff line
@@ -145,6 +145,8 @@ public class UsageStatsService extends SystemService implements
    private boolean mScreenOn;
    private boolean mScreenOn;
    private long mLastAppIdleParoledTime;
    private long mLastAppIdleParoledTime;


    private volatile boolean mPendingOneTimeCheckIdleStates;

    long mScreenOnTime;
    long mScreenOnTime;
    long mLastScreenOnEventRealtime;
    long mLastScreenOnEventRealtime;


@@ -221,6 +223,10 @@ public class UsageStatsService extends SystemService implements
            synchronized (this) {
            synchronized (this) {
                updateDisplayLocked();
                updateDisplayLocked();
            }
            }

            if (mPendingOneTimeCheckIdleStates) {
                postOneTimeCheckIdleStates();
            }
        } else if (phase == PHASE_BOOT_COMPLETED) {
        } else if (phase == PHASE_BOOT_COMPLETED) {
            setAppIdleParoled(getContext().getSystemService(BatteryManager.class).isCharging());
            setAppIdleParoled(getContext().getSystemService(BatteryManager.class).isCharging());
        }
        }
@@ -368,7 +374,13 @@ public class UsageStatsService extends SystemService implements
     * scheduling a series of repeating checkIdleStates each time we fired off one.
     * scheduling a series of repeating checkIdleStates each time we fired off one.
     */
     */
    void postOneTimeCheckIdleStates() {
    void postOneTimeCheckIdleStates() {
        if (mDeviceIdleController == null) {
            // Not booted yet; wait for it!
            mPendingOneTimeCheckIdleStates = true;
        } else {
            mHandler.sendEmptyMessage(MSG_ONE_TIME_CHECK_IDLE_STATES);
            mHandler.sendEmptyMessage(MSG_ONE_TIME_CHECK_IDLE_STATES);
            mPendingOneTimeCheckIdleStates = false;
        }
    }
    }


    /** Check all running users' or specified user's apps to see if they enter an idle state. */
    /** Check all running users' or specified user's apps to see if they enter an idle state. */