diff options
| author | 2024-03-22 23:54:43 +0800 | |
|---|---|---|
| committer | 2024-03-25 22:23:19 +0800 | |
| commit | c2ec6faaec4c8f2cc43aaa9d528e32f2ef41afc5 (patch) | |
| tree | 681ffa75fd9f4b6d71295564a0b0512d96a466fe | |
| parent | 642bdb48a81b682be3307e9066786bdfc63b0e84 (diff) | |
Skip collecting wallpaper to transition for non collected app
Currently wallpaper is not fully handled by shell transition.
Because the wallpaper target can be any window that requests to
show wallpaper. And the window can be not handled by transition.
So the visibility change of wallpaper may come from legacy path.
Such as when launching app from home, the visibility change will
happen after the open transition is finished, i.e. home received
to stop or invisible (IWindow#dispatchAppVisibility). There are
2 possible entries to hide wallpaper:
WMS#relayoutWindow -> adjustWallpaperWindows
WindowStateAnimator#prepareSurfaceLocked -> hideWallpapers
If there is another transition starts before that, the wallpaper
will be collected into the unrelated transition.
Bug: 330457044
Test: atest ActivityTransitionTests# \
testCustomTransitionCanOverrideBackgroundColor
Test: Launch an activity from home, and it delay tens~hundred
millisecond to start next activity in the same task.
The second transition info should not contain wallpaper.
Change-Id: I07c887be55f4e0a20c92965ad5504e9c542bc8d3
| -rw-r--r-- | services/core/java/com/android/server/wm/WallpaperWindowToken.java | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/wm/WallpaperWindowToken.java b/services/core/java/com/android/server/wm/WallpaperWindowToken.java index dc500a2748cf..55eeaf22cca8 100644 --- a/services/core/java/com/android/server/wm/WallpaperWindowToken.java +++ b/services/core/java/com/android/server/wm/WallpaperWindowToken.java @@ -192,7 +192,18 @@ class WallpaperWindowToken extends WindowToken { void setVisibility(boolean visible) { if (mVisibleRequested != visible) { // Before setting mVisibleRequested so we can track changes. - mTransitionController.collect(this); + final WindowState wpTarget = mDisplayContent.mWallpaperController.getWallpaperTarget(); + final boolean isTargetNotCollectedActivity = wpTarget != null + && wpTarget.mActivityRecord != null + && !mTransitionController.isCollecting(wpTarget.mActivityRecord); + // Skip collecting requesting-invisible wallpaper if the wallpaper target is an activity + // and it is not collected. Because the visibility change may be called after the + // transition of activity is finished, e.g. WallpaperController#hideWallpapers from + // hiding surface of the target. Then if there is a next transition, the wallpaper + // change may be collected into the unrelated transition and cause a weird animation. + if (!isTargetNotCollectedActivity || visible) { + mTransitionController.collect(this); + } setVisibleRequested(visible); } |