From c8a3d88def08d399995efa3be8cf5cfcd83cf487 Mon Sep 17 00:00:00 2001 From: Chris Li Date: Sun, 9 Jan 2022 19:35:16 +0800 Subject: [PATCH] Fix WallpaperWindowToken visible update with Shell transition With Shell transition, when mVisibleRequested is changed, it will wait until the transition finish to update the isVisible(). As a result, if there is a visible change before the previous transition is finished, it will be skipped. For example, when we first open a fullscreen app and then immediately enter pip: 1. TRANSIT_OPEN will call to hide wallpaper and set mVisibleRequest to false, but not commit visible until transition animation is finished. 2. TRANSIT_PIP will call to show wallpaper, but if it is started before the OPEN transition is finsihed, it will not update the wallpaper mVisibleRequested, which will leave the wallpaper hidden. Fix: 210965575 Bug: 210965692 Test: atest WMShellFlickerTests:ExpandPipOnDoubleClickTest Change-Id: I2578aafd024a3c9a6ec96079d4dc6cb740c890d2 --- .../wm/shell/flicker/pip/ExpandPipOnDoubleClickTest.kt | 9 --------- .../java/com/android/server/wm/WallpaperWindowToken.java | 2 +- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/ExpandPipOnDoubleClickTest.kt b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/ExpandPipOnDoubleClickTest.kt index 52177c2c7684e..ef9ff4fc63c2d 100644 --- a/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/ExpandPipOnDoubleClickTest.kt +++ b/libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/pip/ExpandPipOnDoubleClickTest.kt @@ -26,9 +26,6 @@ import com.android.server.wm.flicker.FlickerTestParameterFactory import com.android.server.wm.flicker.LAUNCHER_COMPONENT import com.android.server.wm.flicker.annotation.Group3 import com.android.server.wm.flicker.dsl.FlickerBuilder -import com.android.server.wm.flicker.helpers.isShellTransitionsEnabled -import org.junit.Assume.assumeFalse -import org.junit.Before import org.junit.FixMethodOrder import org.junit.Test import org.junit.runner.RunWith @@ -65,12 +62,6 @@ class ExpandPipOnDoubleClickTest(testSpec: FlickerTestParameter) : PipTransition } } - @Before - fun onBefore() { - // This CUJ don't work in shell transitions because of b/204570898 b/204562589 - assumeFalse(isShellTransitionsEnabled) - } - /** * Checks that the pip app window remains inside the display bounds throughout the whole * animation diff --git a/services/core/java/com/android/server/wm/WallpaperWindowToken.java b/services/core/java/com/android/server/wm/WallpaperWindowToken.java index fe405e5b3af8f..fc154a8b3179c 100644 --- a/services/core/java/com/android/server/wm/WallpaperWindowToken.java +++ b/services/core/java/com/android/server/wm/WallpaperWindowToken.java @@ -107,7 +107,7 @@ class WallpaperWindowToken extends WindowToken { /** Returns {@code true} if visibility is changed. */ boolean updateWallpaperWindows(boolean visible) { boolean changed = false; - if (isVisible() != visible) { + if (mVisibleRequested != visible) { ProtoLog.d(WM_DEBUG_WALLPAPER, "Wallpaper token %s visible=%b", token, visible); setVisibility(visible);