am 7eda9de1: am 2fe57183: am 30eec832: Merge "Transparent activity orientation problem when previous landsacpe fullscreen activity not yet destroyed."

* commit '7eda9de1a638e4ed1ce5dc65fecd673400b9f3c0':
  Transparent activity orientation problem when previous landsacpe fullscreen activity not yet destroyed.
diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java
old mode 100644
new mode 100755
index 7aee8d2..b4a458f
--- a/services/java/com/android/server/wm/WindowManagerService.java
+++ b/services/java/com/android/server/wm/WindowManagerService.java
@@ -3557,17 +3557,7 @@
                 continue;
             }
 
-            if (!haveGroup) {
-                // We ignore any hidden applications on the top.
-                if (wtoken.hiddenRequested || wtoken.willBeHidden) {
-                    if (DEBUG_ORIENTATION) Slog.v(TAG, "Skipping " + wtoken
-                            + " -- hidden on top");
-                    continue;
-                }
-                haveGroup = true;
-                curGroup = wtoken.groupId;
-                lastOrientation = wtoken.requestedOrientation;
-            } else if (curGroup != wtoken.groupId) {
+            if (haveGroup == true && curGroup != wtoken.groupId) {
                 // If we have hit a new application group, and the bottom
                 // of the previous group didn't explicitly say to use
                 // the orientation behind it, and the last app was
@@ -3580,6 +3570,20 @@
                     return lastOrientation;
                 }
             }
+
+            // We ignore any hidden applications on the top.
+            if (wtoken.hiddenRequested || wtoken.willBeHidden) {
+                if (DEBUG_ORIENTATION) Slog.v(TAG, "Skipping " + wtoken
+                        + " -- hidden on top");
+                continue;
+            }
+
+            if (!haveGroup) {
+                haveGroup = true;
+                curGroup = wtoken.groupId;
+                lastOrientation = wtoken.requestedOrientation;
+            } 
+
             int or = wtoken.requestedOrientation;
             // If this application is fullscreen, and didn't explicitly say
             // to use the orientation behind it, then just take whatever