summaryrefslogtreecommitdiffstats
path: root/services/usage
diff options
context:
space:
mode:
authorJeff Sharkey <jsharkey@android.com>2016-01-29 10:45:45 -0700
committerThe Android Automerger <android-build@google.com>2016-02-24 13:21:14 -0800
commit3a8f0cf7612b5ebd0710a424a437f5540a72b279 (patch)
treeb00f8132e4be3ad8ecb690b57344d06fb30cd704 /services/usage
parenta94ceffd7bfeaae23cf2474e9a05a17a20e25607 (diff)
downloadframeworks_base-3a8f0cf7612b5ebd0710a424a437f5540a72b279.zip
frameworks_base-3a8f0cf7612b5ebd0710a424a437f5540a72b279.tar.gz
frameworks_base-3a8f0cf7612b5ebd0710a424a437f5540a72b279.tar.bz2
DO NOT MERGE ANYWHERE: 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 (cherry picked from commit 538c11cf2175d4e30337e8776401bfede85866be)
Diffstat (limited to 'services/usage')
-rw-r--r--services/usage/java/com/android/server/usage/UsageStatsService.java14
1 files changed, 13 insertions, 1 deletions
diff --git a/services/usage/java/com/android/server/usage/UsageStatsService.java b/services/usage/java/com/android/server/usage/UsageStatsService.java
index 85bde07..583bac2 100644
--- a/services/usage/java/com/android/server/usage/UsageStatsService.java
+++ b/services/usage/java/com/android/server/usage/UsageStatsService.java
@@ -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 (this) {
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. */