From 45f6a2718adea9592a3ead1a9ef8055c7819b02e Mon Sep 17 00:00:00 2001 From: Robert Carr Date: Mon, 3 Oct 2016 16:42:04 -0700 Subject: [PATCH] Prevent triggering orientation changes until previous completes. Currently we defer rotation while the screen rotation animation is animating, but there is an additional interval after the animation completes where the display may not yet be unfrozen and attempting to rotate again will not work. Bug: 31749456 Change-Id: I5f6830d85fb326d5032b597cbed1b767f0b627f5 --- .../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 ce0ad25ebcc6d..bd266968613de 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -6807,6 +6807,13 @@ public class WindowManagerService extends IWindowManager.Stub if (DEBUG_ORIENTATION) Slog.v(TAG_WM, "Deferring rotation, animation in progress."); return false; } + if (mDisplayFrozen) { + // Even if the screen rotation animation has finished (e.g. isAnimating + // returns false), there is still some time where we haven't yet unfrozen + // the display. We also need to abort rotation here. + if (DEBUG_ORIENTATION) Slog.v(TAG_WM, "Deferring rotation, still finishing previous rotation"); + return false; + } if (!mDisplayEnabled) { // No point choosing a rotation if the display is not enabled.