diff options
author | Matthew Williams <mjwilliams@google.com> | 2015-08-10 22:51:32 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2015-08-10 22:51:32 +0000 |
commit | 83682890190c9a5b73e1742a58c1e017ac418ee2 (patch) | |
tree | cbe49c8c123f8be5055697c9bf9e1f11b3bbb927 | |
parent | 1e05bc6f77b9e609df598ef0aed20a0ef81848a1 (diff) | |
parent | 2c8c251e73a94ec934bbd5aefb49f2d1be866cdc (diff) | |
download | frameworks_base-83682890190c9a5b73e1742a58c1e017ac418ee2.zip frameworks_base-83682890190c9a5b73e1742a58c1e017ac418ee2.tar.gz frameworks_base-83682890190c9a5b73e1742a58c1e017ac418ee2.tar.bz2 |
am 2c8c251e: am 77d5b914: Merge "DO NOT MERGE: Idle Job Start During SCREEN_ON or DREAMING_STOPPED" into mnc-dev
* commit '2c8c251e73a94ec934bbd5aefb49f2d1be866cdc':
DO NOT MERGE: Idle Job Start During SCREEN_ON or DREAMING_STOPPED
-rw-r--r-- | services/core/java/com/android/server/job/controllers/IdleController.java | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/services/core/java/com/android/server/job/controllers/IdleController.java b/services/core/java/com/android/server/job/controllers/IdleController.java index 8e2ca18..92df851 100644 --- a/services/core/java/com/android/server/job/controllers/IdleController.java +++ b/services/core/java/com/android/server/job/controllers/IdleController.java @@ -108,6 +108,7 @@ public class IdleController extends StateController { private AlarmManager mAlarm; private PendingIntent mIdleTriggerIntent; boolean mIdle; + boolean mScreenOn; public IdlenessTracker() { mAlarm = (AlarmManager) mContext.getSystemService(Context.ALARM_SERVICE); @@ -120,6 +121,7 @@ public class IdleController extends StateController { // At boot we presume that the user has just "interacted" with the // device in some meaningful way. mIdle = false; + mScreenOn = true; } public boolean isIdle() { @@ -149,12 +151,14 @@ public class IdleController extends StateController { if (action.equals(Intent.ACTION_SCREEN_ON) || action.equals(Intent.ACTION_DREAMING_STOPPED)) { - // possible transition to not-idle + if (DEBUG) { + Slog.v(TAG,"exiting idle : " + action); + } + mScreenOn = true; + //cancel the alarm + mAlarm.cancel(mIdleTriggerIntent); if (mIdle) { - if (DEBUG) { - Slog.v(TAG, "exiting idle : " + action); - } - mAlarm.cancel(mIdleTriggerIntent); + // possible transition to not-idle mIdle = false; reportNewIdleState(mIdle); } @@ -169,11 +173,12 @@ public class IdleController extends StateController { Slog.v(TAG, "Scheduling idle : " + action + " now:" + nowElapsed + " when=" + when); } + mScreenOn = false; mAlarm.setWindow(AlarmManager.ELAPSED_REALTIME_WAKEUP, when, IDLE_WINDOW_SLOP, mIdleTriggerIntent); } else if (action.equals(ACTION_TRIGGER_IDLE)) { - // idle time starts now - if (!mIdle) { + // idle time starts now. Do not set mIdle if screen is on. + if (!mIdle && !mScreenOn) { if (DEBUG) { Slog.v(TAG, "Idle trigger fired @ " + SystemClock.elapsedRealtime()); } |