Skip to content

Commit d5d11af

Browse files
committed
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
1 parent 86e1b96 commit d5d11af

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

services/java/com/android/server/wm/WindowManagerService.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2773,7 +2773,7 @@ public int relayoutWindow(Session session, IWindow client, int seq,
27732773
// TODO: Remove once b/7094175 is fixed
27742774
|| ((String)win.mAttrs.getTitle()).contains("Keyguard")
27752775
) Slog.v(TAG, "Relayout " + win + ": viewVisibility=" + viewVisibility
2776-
+ " " + requestedWidth + "x" + requestedHeight + " " + win.mAttrs);
2776+
+ " req=" + requestedWidth + "x" + requestedHeight + " " + win.mAttrs);
27772777

27782778
win.mEnforceSizeCompat = (win.mAttrs.flags & FLAG_COMPATIBLE_WINDOW) != 0;
27792779

@@ -3003,6 +3003,10 @@ public int relayoutWindow(Session session, IWindow client, int seq,
30033003
}
30043004

30053005
mInputMonitor.updateInputWindowsLw(true /*force*/);
3006+
3007+
if (DEBUG_LAYOUT) {
3008+
Slog.v(TAG, "Relayout complete " + win + ": outFrame=" + outFrame.toShortString());
3009+
}
30063010
}
30073011

30083012
if (configChanged) {
@@ -8379,7 +8383,8 @@ private final void performLayoutLockedInner(final DisplayContent displayContent,
83798383
// windows, since that means "perform layout as normal,
83808384
// just don't display").
83818385
if (!gone || !win.mHaveFrame || win.mLayoutNeeded
8382-
|| (win.mAttrs.type == TYPE_KEYGUARD && win.isConfigChanged())
8386+
|| ((win.mAttrs.type == TYPE_KEYGUARD || win.mAttrs.type == TYPE_WALLPAPER) &&
8387+
win.isConfigChanged())
83838388
|| win.mAttrs.type == TYPE_UNIVERSE_BACKGROUND) {
83848389
if (!win.mLayoutAttached) {
83858390
if (initial) {
@@ -9301,6 +9306,8 @@ private final void performLayoutAndPlaceSurfacesLockedInner(boolean recoveringMe
93019306
Log.wtf(TAG, "Unhandled exception in Window Manager", e);
93029307
} finally {
93039308
Surface.closeTransaction();
9309+
if (SHOW_LIGHT_TRANSACTIONS) Slog.i(TAG,
9310+
"<<< CLOSE TRANSACTION performLayoutAndPlaceSurfaces");
93049311
}
93059312

93069313
final WindowList defaultWindows = defaultDisplay.getWindowList();

0 commit comments

Comments
 (0)