summaryrefslogtreecommitdiff
path: root/core/java/android
diff options
context:
space:
mode:
authorTiger Huang <tigerhuang@google.com>2020-11-07 02:40:55 +0800
committerTiger Huang <tigerhuang@google.com>2020-11-08 02:08:57 +0800
commiteefe559c722c0c4e1ddc7404665ccf1ae0156250 (patch)
tree9e7a26017a6269353c5bf414e3d63dcc6769b7f9 /core/java/android
parentc6183933df243534cb0bb01b041e29f2d9d69a81 (diff)
Make insets source window stable while resizing
When the size and the position of the insets source window are changed at the same time, setPosition will be applied first, and the client will draw on the new-size surface later, which makes the screen flicker. This CL defers the setPosition transaction until the new frame is drawn, which can make the window stable if the content is drawn at the same location on the display. This CL also fixes WindowState#mGivenInsetsPending. If the given insets will be sent to window manager, the provided insets won't be changed during relayoutWindow until the given insets are sent. Bug: 171965103 Test: steps in the bug Change-Id: I4684c03e8def6fa33980e6c10e444f7377c306f8
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/view/ViewRootImpl.java18
1 files changed, 6 insertions, 12 deletions
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index 9d24dff13175..405f53229f62 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -2643,18 +2643,12 @@ public final class ViewRootImpl implements ViewParent,
|| mForceNextWindowRelayout) {
mForceNextWindowRelayout = false;
- if (isViewVisible) {
- // If this window is giving internal insets to the window
- // manager, and it is being added or changing its visibility,
- // then we want to first give the window manager "fake"
- // insets to cause it to effectively ignore the content of
- // the window during layout. This avoids it briefly causing
- // other windows to resize/move based on the raw frame of the
- // window, waiting until we can finish laying out this window
- // and get back to the window manager with the ultimately
- // computed insets.
- insetsPending = computesInternalInsets && (mFirst || viewVisibilityChanged);
- }
+ // If this window is giving internal insets to the window manager, then we want to first
+ // make the provided insets unchanged during layout. This avoids it briefly causing
+ // other windows to resize/move based on the raw frame of the window, waiting until we
+ // can finish laying out this window and get back to the window manager with the
+ // ultimately computed insets.
+ insetsPending = computesInternalInsets;
if (mSurfaceHolder != null) {
mSurfaceHolder.mSurfaceLock.lock();