diff options
author | Jeff Sharkey <jsharkey@android.com> | 2015-09-14 15:35:38 -0700 |
---|---|---|
committer | Jeff Sharkey <jsharkey@android.com> | 2015-09-14 15:49:53 -0700 |
commit | 5ded7af622539ded176f81951843c3c52c89a6d1 (patch) | |
tree | a01626bed97f9a33acb0ccd63a3aa495d71c2d9d /services | |
parent | dc988061ac145c86d6871e249d65ca326aaff99f (diff) | |
download | frameworks_base-5ded7af622539ded176f81951843c3c52c89a6d1.zip frameworks_base-5ded7af622539ded176f81951843c3c52c89a6d1.tar.gz frameworks_base-5ded7af622539ded176f81951843c3c52c89a6d1.tar.bz2 |
Fix parole scheduling bugs.
There were a few subtle bugs in app idle parole scheduling that
would cause us to never end a parole period we had entered. The
updated logic in this change concentrates the registration for the
next event in one place in setAppIdleParoled().
Bug: 24050462
Change-Id: I1efe43cd6e00a547f70c4a4a37e1f3ef52a7e706
Diffstat (limited to 'services')
-rw-r--r-- | services/usage/java/com/android/server/usage/UsageStatsService.java | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/services/usage/java/com/android/server/usage/UsageStatsService.java b/services/usage/java/com/android/server/usage/UsageStatsService.java index 4146c1c..5ad796f 100644 --- a/services/usage/java/com/android/server/usage/UsageStatsService.java +++ b/services/usage/java/com/android/server/usage/UsageStatsService.java @@ -314,6 +314,8 @@ public class UsageStatsService extends SystemService implements mAppIdleParoled = paroled; if (DEBUG) Slog.d(TAG, "Changing paroled to " + mAppIdleParoled); if (paroled) { + postParoleEndTimeout(); + } else { mLastAppIdleParoledTime = checkAndGetTimeLocked(); postNextParoleTimeout(); } @@ -404,8 +406,6 @@ public class UsageStatsService extends SystemService implements if (timeSinceLastParole > mAppIdleParoleIntervalMillis) { if (DEBUG) Slog.d(TAG, "Crossed default parole interval"); setAppIdleParoled(true); - // Make sure it ends at some point - postParoleEndTimeout(); } else { if (DEBUG) Slog.d(TAG, "Not long enough to go to parole"); postNextParoleTimeout(); @@ -492,7 +492,6 @@ public class UsageStatsService extends SystemService implements if (!deviceIdle && timeSinceLastParole >= mAppIdleParoleIntervalMillis) { if (DEBUG) Slog.i(TAG, "Bringing idle apps out of inactive state due to deviceIdleMode=false"); - postNextParoleTimeout(); setAppIdleParoled(true); } else if (deviceIdle) { if (DEBUG) Slog.i(TAG, "Device idle, back to prison"); |