From 3413b8983a3af1c44ab7bafd186a56a5a116e5cc Mon Sep 17 00:00:00 2001 From: Owen Lin Date: Fri, 1 May 2009 17:12:32 -0700 Subject: [PATCH] Let screenOrientation="behind" works as expected --- .../com/android/server/WindowManagerService.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/services/java/com/android/server/WindowManagerService.java b/services/java/com/android/server/WindowManagerService.java index 321b17eddb828..3e75db1212ed6 100644 --- a/services/java/com/android/server/WindowManagerService.java +++ b/services/java/com/android/server/WindowManagerService.java @@ -2078,13 +2078,16 @@ public class WindowManagerService extends IWindowManager.Stub implements Watchdo int pos = mAppTokens.size() - 1; int curGroup = 0; int lastOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED; + boolean findingBehind = false; boolean haveGroup = false; boolean lastFullscreen = false; while (pos >= 0) { AppWindowToken wtoken = mAppTokens.get(pos); pos--; - // if we're about to tear down this window, don't use it for orientation - if (!wtoken.hidden && wtoken.hiddenRequested) { + // if we're about to tear down this window and not seek for + // the behind activity, don't use it for orientation + if (!findingBehind + && (!wtoken.hidden && wtoken.hiddenRequested)) { continue; } @@ -2108,10 +2111,12 @@ public class WindowManagerService extends IWindowManager.Stub implements Watchdo } } int or = wtoken.requestedOrientation; - // If this application is fullscreen, then just take whatever + // If this application is fullscreen, and didn't explicitly say + // to use the orientation behind it, then just take whatever // orientation it has and ignores whatever is under it. lastFullscreen = wtoken.appFullscreen; - if (lastFullscreen) { + if (lastFullscreen + && or != ActivityInfo.SCREEN_ORIENTATION_BEHIND) { return or; } // If this application has requested an explicit orientation, @@ -2123,6 +2128,7 @@ public class WindowManagerService extends IWindowManager.Stub implements Watchdo or == ActivityInfo.SCREEN_ORIENTATION_USER) { return or; } + findingBehind |= (or == ActivityInfo.SCREEN_ORIENTATION_BEHIND); } return ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED; }