Prevents the WindowManager from requesting empty or negative surfaces.

Windows with a negative Y position can end up in createSurfaceLocked()
with mFrame containing a negative height, causing SurfaceFlinger to go
crazy when asked to create the surface. This change simply guards
against such a situation by instead asking for a 1x1 surface and relying
or later layout operations to resize the window to the appropriate size.

Change-Id: I66f2058f4cd1cf069b12d3d23e6fd340dc76b74e
diff --git a/services/java/com/android/server/WindowManagerService.java b/services/java/com/android/server/WindowManagerService.java
index e5b6720..ed64766 100644
--- a/services/java/com/android/server/WindowManagerService.java
+++ b/services/java/com/android/server/WindowManagerService.java
@@ -7072,6 +7072,11 @@
                     h = mRequestedHeight;
                 }
 
+                // Something is wrong and SurfaceFlinger will not like this,
+                // try to revert to sane values
+                if (w <= 0) w = 1;
+                if (h <= 0) h = 1;
+
                 try {
                     mSurface = new Surface(
                             mSession.mSurfaceSession, mSession.mPid,