am 8416e5cf: am 6ad07db7: Merge "Fix fake display size when rotated." into honeycomb-mr2

* commit '8416e5cf0a8439a3f605629068d3639f2a35e08b':
  Fix fake display size when rotated.
diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java
index 26d89cd..607c60a 100644
--- a/services/java/com/android/server/wm/WindowManagerService.java
+++ b/services/java/com/android/server/wm/WindowManagerService.java
@@ -6498,8 +6498,22 @@
             }
             if (mBaseDisplayWidth < mInitialDisplayWidth
                     || mBaseDisplayHeight < mInitialDisplayHeight) {
-                Rect outer = new Rect(0, 0, mInitialDisplayWidth, mInitialDisplayHeight);
-                Rect inner = new Rect(0, 0, mBaseDisplayWidth, mBaseDisplayHeight);
+                int initW, initH, baseW, baseH;
+                final boolean rotated = (mRotation == Surface.ROTATION_90
+                        || mRotation == Surface.ROTATION_270);
+                if (rotated) {
+                    initW = mInitialDisplayHeight;
+                    initH = mInitialDisplayWidth;
+                    baseW = mBaseDisplayHeight;
+                    baseH = mBaseDisplayWidth;
+                } else {
+                    initW = mInitialDisplayWidth;
+                    initH = mInitialDisplayHeight;
+                    baseW = mBaseDisplayWidth;
+                    baseH = mBaseDisplayHeight;
+                }
+                Rect outer = new Rect(0, 0, initW, initH);
+                Rect inner = new Rect(0, 0, baseW, baseH);
                 try {
                     mBlackFrame = new BlackFrame(mFxSession, outer, inner, MASK_LAYER);
                 } catch (Surface.OutOfResourcesException e) {