From b198b74c145218e9f4f596f9ba847873cf60e060 Mon Sep 17 00:00:00 2001 From: Wale Ogunwale Date: Thu, 1 Dec 2016 08:44:09 -0800 Subject: [PATCH] Don't send SCREEN_ORIENTATION_UNSET to apps. SCREEN_ORIENTATION_UNSET is an internal implementation detail of how WM now handles WindowContainer requesting a specific orientation. The container will return SCREEN_ORIENTATION_UNSET for getOrientation method if it should affect the device orientation under specific conditions like when it isn't visible. However, we still want to return the requested app orientation if someone from outside WM asked for it regardless of if the app is visible or not. Bug: 33067025 Test: Adding a new document in the Drive app with the scan option doesn't crash. Change-Id: I53aee1afaa311994520f573139aea9a0d87bc8e6 --- services/core/java/com/android/server/wm/AppWindowToken.java | 5 +++++ .../java/com/android/server/wm/WindowManagerService.java | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/wm/AppWindowToken.java b/services/core/java/com/android/server/wm/AppWindowToken.java index 5d739d13c898e..5838a37bf9c9c 100644 --- a/services/core/java/com/android/server/wm/AppWindowToken.java +++ b/services/core/java/com/android/server/wm/AppWindowToken.java @@ -1103,6 +1103,11 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree return mOrientation; } + /** Returns the app's preferred orientation regardless of its currently visibility state. */ + int getOrientationIgnoreVisibility() { + return mOrientation; + } + @Override void checkAppWindowsReadyToShow() { if (allDrawn == mAppAnimator.allDrawn) { diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java index 77da22c09abdc..6ec3161af23a2 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -2716,7 +2716,7 @@ public class WindowManagerService extends IWindowManager.Stub return SCREEN_ORIENTATION_UNSPECIFIED; } - return wtoken.getOrientation(); + return wtoken.getOrientationIgnoreVisibility(); } }