From 1ced4b7b70836206f4ed81208348618d0f366325 Mon Sep 17 00:00:00 2001 From: Bryce Lee Date: Fri, 29 Sep 2017 08:35:42 -0700 Subject: [PATCH] Update configuration whenever the visible window is laid out. The configuration update during layout is currently restricted to whether the client is hidden. This does not cover all the conditions where the window can be laid out, such as if it is the starting window. This changelist makes sure the same condition is used in both cases. Change-Id: I64a2f70718b949f3803e8cafcdabd2be5b5885e6 Fixes: 67027059 Test: Repeatedly open Gmail and ensure no jump-cut occurs. --- .../com/android/server/wm/WindowManagerService.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java index f9d10ada0e31a..c8cbcd811de87 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -2027,10 +2027,14 @@ public class WindowManagerService extends IWindowManager.Stub Slog.i(TAG_WM, "Relayout " + win + ": oldVis=" + oldVisibility + " newVis=" + viewVisibility, stack); } - if (viewVisibility == View.VISIBLE && - (win.mAppToken == null || win.mAttrs.type == TYPE_APPLICATION_STARTING - || !win.mAppToken.isClientHidden())) { + // We should only relayout if the view is visible, it is a starting window, or the + // associated appToken is not hidden. + final boolean shouldRelayout = viewVisibility == View.VISIBLE && + (win.mAppToken == null || win.mAttrs.type == TYPE_APPLICATION_STARTING + || !win.mAppToken.isClientHidden()); + + if (shouldRelayout) { Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "relayoutWindow: viewVisibility_1"); // We are about to create a surface, but we didn't run a layout yet. So better run @@ -2191,7 +2195,7 @@ public class WindowManagerService extends IWindowManager.Stub // to the client erroneously accepting a configuration that would have otherwise caused // an activity restart. We instead hand back the last reported // {@link MergedConfiguration}. - if (win.mAppToken == null || !win.mAppToken.isClientHidden()) { + if (shouldRelayout) { win.getMergedConfiguration(mergedConfiguration); } else { win.getLastReportedMergedConfiguration(mergedConfiguration);