Hack to get devices booting again.
If we try scheduling a pass before the system is ready, record a pending event and dispatch once we're actually ready. Bug: 26863668 Change-Id: I028285383c8bbe8b653aeaa7544eefe3d41277bc
This commit is contained in:
@@ -145,6 +145,8 @@ public class UsageStatsService extends SystemService implements
|
||||
private boolean mScreenOn;
|
||||
private long mLastAppIdleParoledTime;
|
||||
|
||||
private volatile boolean mPendingOneTimeCheckIdleStates;
|
||||
|
||||
long mScreenOnTime;
|
||||
long mLastScreenOnEventRealtime;
|
||||
|
||||
@@ -221,6 +223,10 @@ public class UsageStatsService extends SystemService implements
|
||||
synchronized (mLock) {
|
||||
updateDisplayLocked();
|
||||
}
|
||||
|
||||
if (mPendingOneTimeCheckIdleStates) {
|
||||
postOneTimeCheckIdleStates();
|
||||
}
|
||||
} else if (phase == PHASE_BOOT_COMPLETED) {
|
||||
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.
|
||||
*/
|
||||
void postOneTimeCheckIdleStates() {
|
||||
mHandler.sendEmptyMessage(MSG_ONE_TIME_CHECK_IDLE_STATES);
|
||||
if (mDeviceIdleController == null) {
|
||||
// Not booted yet; wait for it!
|
||||
mPendingOneTimeCheckIdleStates = true;
|
||||
} else {
|
||||
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. */
|
||||
|
||||
Reference in New Issue
Block a user