From 9825ec61b4a40ed92a5bb28019289e5bab9cfb56 Mon Sep 17 00:00:00 2001 From: Romain Guy Date: Thu, 1 Oct 2009 00:58:09 -0700 Subject: [PATCH] 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 --- services/java/com/android/server/WindowManagerService.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/services/java/com/android/server/WindowManagerService.java b/services/java/com/android/server/WindowManagerService.java index e5b6720b079f5..ed6476697c284 100644 --- a/services/java/com/android/server/WindowManagerService.java +++ b/services/java/com/android/server/WindowManagerService.java @@ -7072,6 +7072,11 @@ public class WindowManagerService extends IWindowManager.Stub 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,