Fix issue #3037083: Problem report for Pinball

The app was toggling between hiding and showing the status bar, because
the dialog was large enough to fill the screen but didn't set to hide
the status bar.

It turns out that the code to determine the top fullscreen window is
intrinsically unstable, since it relies on comparing a window's frame
with the screen, yet the window frame can change as a result of changes
such as hiding the status bar.

Instead, we now simplify all of this to just say that the top fillxfill
window gets to control the status bar.

Change-Id: I22913adf7235fe0d52612f6738c7c94351274e38
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
index 384f527..538dae9 100755
--- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
@@ -1500,7 +1500,9 @@
             } 
             if (attrs.type >= FIRST_APPLICATION_WINDOW
                     && attrs.type <= LAST_APPLICATION_WINDOW
-                    && win.fillsScreenLw(mW, mH, false, false)) {
+                    && attrs.x == 0 && attrs.y == 0
+                    && attrs.width == WindowManager.LayoutParams.MATCH_PARENT
+                    && attrs.height == WindowManager.LayoutParams.MATCH_PARENT) {
                 if (DEBUG_LAYOUT) Log.v(TAG, "Fullscreen window: " + win);
                 mTopFullscreenOpaqueWindowState = win;
                 if ((attrs.flags & FLAG_SHOW_WHEN_LOCKED) != 0) {
diff --git a/services/java/com/android/server/WindowManagerService.java b/services/java/com/android/server/WindowManagerService.java
index d7a3596..713524a 100644
--- a/services/java/com/android/server/WindowManagerService.java
+++ b/services/java/com/android/server/WindowManagerService.java
@@ -6965,31 +6965,6 @@
                 && (mOrientationChanging || (!mDrawPending && !mCommitDrawPending));
         }
 
-        public boolean fillsScreenLw(int screenWidth, int screenHeight,
-                                   boolean shownFrame, boolean onlyOpaque) {
-            if (mSurface == null) {
-                return false;
-            }
-            if (mAppToken != null && !mAppToken.appFullscreen) {
-                return false;
-            }
-            if (onlyOpaque && mAttrs.format != PixelFormat.OPAQUE) {
-                return false;
-            }
-            final Rect frame = shownFrame ? mShownFrame : mFrame;
-
-            if ((mAttrs.flags & FLAG_COMPATIBLE_WINDOW) != 0) {
-                return frame.left <= mCompatibleScreenFrame.left &&
-                        frame.top <= mCompatibleScreenFrame.top &&
-                        frame.right >= mCompatibleScreenFrame.right &&
-                        frame.bottom >= mCompatibleScreenFrame.bottom;
-            } else {
-                return frame.left <= 0 && frame.top <= 0
-                        && frame.right >= screenWidth
-                        && frame.bottom >= screenHeight;
-            }
-        }
-
         /**
          * Return true if the window is opaque and fully drawn.  This indicates
          * it may obscure windows behind it.