From d5d11af3d3cefff6267d4e3a19e61a9b03cfbab5 Mon Sep 17 00:00:00 2001 From: Chet Haase Date: Wed, 31 Oct 2012 08:57:17 -0700 Subject: [PATCH] Fix for regression in WindowManager orientation changes A fix yesterday for #7428221 caused a regression where new orientations would sometimes cause a flash through black on the way to seeing the real static wallpaper. There is a fundamental problem in WindowManagerService where we show a window before it has all of the layout/sizing information it needs, which is the cause of the black flash. The regression yesterday was that we are now less aggressive about layout out hidden windows, so we won't layout the window until after the window is shown with the incorrect sizing info. The fix/workaround is to back off the layout logic specifically for the wallpaper, ensuring that we will lay it out on orientation changes, even when hidden. This means that when we finally do show it, it will already have been drawn in the correct orientation/size. Issue #7444971 Home jank regression Change-Id: Ib20fdabc43ece9720b261bf04b272c5511e2d902 --- .../com/android/server/wm/WindowManagerService.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java index 3532c0c9d992e..7958f9aca4eb1 100755 --- a/services/java/com/android/server/wm/WindowManagerService.java +++ b/services/java/com/android/server/wm/WindowManagerService.java @@ -2773,7 +2773,7 @@ public class WindowManagerService extends IWindowManager.Stub // TODO: Remove once b/7094175 is fixed || ((String)win.mAttrs.getTitle()).contains("Keyguard") ) Slog.v(TAG, "Relayout " + win + ": viewVisibility=" + viewVisibility - + " " + requestedWidth + "x" + requestedHeight + " " + win.mAttrs); + + " req=" + requestedWidth + "x" + requestedHeight + " " + win.mAttrs); win.mEnforceSizeCompat = (win.mAttrs.flags & FLAG_COMPATIBLE_WINDOW) != 0; @@ -3003,6 +3003,10 @@ public class WindowManagerService extends IWindowManager.Stub } mInputMonitor.updateInputWindowsLw(true /*force*/); + + if (DEBUG_LAYOUT) { + Slog.v(TAG, "Relayout complete " + win + ": outFrame=" + outFrame.toShortString()); + } } if (configChanged) { @@ -8379,7 +8383,8 @@ public class WindowManagerService extends IWindowManager.Stub // windows, since that means "perform layout as normal, // just don't display"). if (!gone || !win.mHaveFrame || win.mLayoutNeeded - || (win.mAttrs.type == TYPE_KEYGUARD && win.isConfigChanged()) + || ((win.mAttrs.type == TYPE_KEYGUARD || win.mAttrs.type == TYPE_WALLPAPER) && + win.isConfigChanged()) || win.mAttrs.type == TYPE_UNIVERSE_BACKGROUND) { if (!win.mLayoutAttached) { if (initial) { @@ -9301,6 +9306,8 @@ public class WindowManagerService extends IWindowManager.Stub Log.wtf(TAG, "Unhandled exception in Window Manager", e); } finally { Surface.closeTransaction(); + if (SHOW_LIGHT_TRANSACTIONS) Slog.i(TAG, + "<<< CLOSE TRANSACTION performLayoutAndPlaceSurfaces"); } final WindowList defaultWindows = defaultDisplay.getWindowList();