diff options
| -rw-r--r-- | services/core/java/com/android/server/policy/PhoneWindowManager.java | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java index a4dcf823ce06..b380d84c7c5c 100644 --- a/services/core/java/com/android/server/policy/PhoneWindowManager.java +++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java @@ -566,6 +566,9 @@ public class PhoneWindowManager implements WindowManagerPolicy { // What we do when the user double-taps on home private int mDoubleTapOnHomeBehavior; + // Whether to lock the device after the next app transition has finished. + private boolean mLockAfterAppTransitionFinished; + // Allowed theater mode wake actions private boolean mAllowTheaterModeWakeFromKey; private boolean mAllowTheaterModeWakeFromPowerKey; @@ -1055,11 +1058,10 @@ public class PhoneWindowManager implements WindowManagerPolicy { return; } - // Make sure the device locks. Unfortunately, this has the side-effect of briefly revealing - // the lock screen before the dream appears. Note that locking is a side-effect of the no - // dream action that is executed if we early return above. - // TODO(b/261662912): Find a better way to lock the device that doesn't result in jank. - lockNow(null); + synchronized (mLock) { + // Lock the device after the dream transition has finished. + mLockAfterAppTransitionFinished = true; + } dreamManagerInternal.requestDream(); } @@ -2138,6 +2140,22 @@ public class PhoneWindowManager implements WindowManagerPolicy { handleStartTransitionForKeyguardLw( keyguardGoingAway, false /* keyguardOccludingStarted */, 0 /* duration */); + + synchronized (mLock) { + mLockAfterAppTransitionFinished = false; + } + } + + @Override + public void onAppTransitionFinishedLocked(IBinder token) { + synchronized (mLock) { + if (!mLockAfterAppTransitionFinished) { + return; + } + mLockAfterAppTransitionFinished = false; + } + + lockNow(null); } }); |