From 049b6d89277f67ae210fdc4428df80a306556cfb Mon Sep 17 00:00:00 2001 From: Wale Ogunwale Date: Mon, 27 Jun 2016 08:46:09 -0700 Subject: [PATCH] Fixed bug with continuously changing orientation while dreaming If the keyguard is locked while the device is dreaming in landscape mode, the display will be frozen. When this happens we want to continue to use the orientation the keyguard forced since that will be the orientation used once the display is no longer frozen vs. switching to the orientation of the top activity. Bug: 29542506 Change-Id: I30a8370357735dcdff336a562ca248aa9206ae29 --- .../java/com/android/server/wm/WindowManagerService.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java index 54960a4ee46ca..536a0af4907c3 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -3519,6 +3519,13 @@ public class WindowManagerService extends IWindowManager.Stub // can re-appear and inflict its own orientation on us. Keep the // orientation stable until this all settles down. return mLastWindowForcedOrientation; + } else if (mPolicy.isKeyguardLocked() + && mLastKeyguardForcedOrientation != SCREEN_ORIENTATION_UNSPECIFIED) { + // Use the last orientation the keyguard forced while the display is frozen with the + // keyguard locked. + if (DEBUG_ORIENTATION) Slog.v(TAG_WM, "Display is frozen while keyguard locked, " + + "return " + mLastKeyguardForcedOrientation); + return mLastKeyguardForcedOrientation; } } else { // TODO(multidisplay): Change to the correct display.