diff options
author | Jeff Brown <jeffbrown@google.com> | 2015-06-10 23:45:11 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-06-10 23:45:13 +0000 |
commit | 1631f3744f5a1f5e2dd7a35f32a9773e9f5cdf4c (patch) | |
tree | 10ae854317df780d95b58785729459cfc7f14da0 /services | |
parent | 548a42653cfa981d00941e9942390a3a00ff095b (diff) | |
parent | 48d1b14b7b54ae1491e7d9d5fdd9be8906c19a3c (diff) | |
download | frameworks_base-1631f3744f5a1f5e2dd7a35f32a9773e9f5cdf4c.zip frameworks_base-1631f3744f5a1f5e2dd7a35f32a9773e9f5cdf4c.tar.gz frameworks_base-1631f3744f5a1f5e2dd7a35f32a9773e9f5cdf4c.tar.bz2 |
Merge "Pause activities when the screen is off." into mnc-dev
Diffstat (limited to 'services')
-rw-r--r-- | services/core/java/com/android/server/policy/PhoneWindowManager.java | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java index 6e52358..25ca167 100644 --- a/services/core/java/com/android/server/policy/PhoneWindowManager.java +++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java @@ -514,6 +514,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { boolean mDreamingLockscreen; boolean mDreamingSleepTokenNeeded; SleepToken mDreamingSleepToken; + SleepToken mScreenOffSleepToken; boolean mKeyguardSecure; boolean mKeyguardSecureIncludingHidden; volatile boolean mKeyguardOccluded; @@ -5385,6 +5386,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { public void screenTurnedOff() { if (DEBUG_WAKEUP) Slog.i(TAG, "Screen turned off..."); + updateScreenOffSleepToken(true); synchronized (mLock) { mScreenOnEarly = false; mScreenOnFully = false; @@ -5399,6 +5401,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { public void screenTurningOn(final ScreenOnListener screenOnListener) { if (DEBUG_WAKEUP) Slog.i(TAG, "Screen turning on..."); + updateScreenOffSleepToken(false); synchronized (mLock) { mScreenOnEarly = true; mScreenOnFully = false; @@ -6021,6 +6024,20 @@ public class PhoneWindowManager implements WindowManagerPolicy { } else { if (mDreamingSleepToken != null) { mDreamingSleepToken.release(); + mDreamingSleepToken = null; + } + } + } + + private void updateScreenOffSleepToken(boolean acquire) { + if (acquire) { + if (mScreenOffSleepToken == null) { + mScreenOffSleepToken = mActivityManagerInternal.acquireSleepToken("ScreenOff"); + } + } else { + if (mScreenOffSleepToken != null) { + mScreenOffSleepToken.release(); + mScreenOffSleepToken = null; } } } |