From 70eba483b3a385afb214888dea463227dd764ff2 Mon Sep 17 00:00:00 2001 From: Riddle Hsu Date: Fri, 4 Dec 2020 23:47:22 +0800 Subject: Check isOnScreen for wallpaper target of recents animation If an unresponsive activity is launched by recents activity. WindowState#mDestroying of recents activity will be set until the exit animation is done. But because the next app is slow, before the transition is done, when starting the recents activity again, if it is set as wallpaper target, WallpaperController# updateWallpaperVisibility/isWallpaperVisible will make wallpaper window visible. But the later layout procedure calls WidowState# prepareSurfaceLocked that checks WindowState#isOnScreen to decide whether to hide the wallpaper. And since mDestroying is still true, isOnScreen will return false that leads to hide wallpaper. Then the visibility change of wallpaper becomes a loop that causes layout repeats. This change makes the condition of wallpaper target for recents animation consistent with normal case. That means the recents activity will be wallpaper target until its relayout with visible state that clears mDestroying. Bug: 174417869 Test: Assume home is the recents activity, launch an activity which sleep 10s in onCreate from home, and then swipe up by gesture navigation. There should not appear log message "Performed 6 layouts in a row. Skipping". Change-Id: I8982657bbe04a01406b50a6a2f32d34d33f560d4 --- .../core/java/com/android/server/wm/RecentsAnimationController.java | 2 +- .../src/com/android/server/wm/RecentsAnimationControllerTest.java | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/wm/RecentsAnimationController.java b/services/core/java/com/android/server/wm/RecentsAnimationController.java index 65db23c714a9..5ba4479e489b 100644 --- a/services/core/java/com/android/server/wm/RecentsAnimationController.java +++ b/services/core/java/com/android/server/wm/RecentsAnimationController.java @@ -799,7 +799,7 @@ public class RecentsAnimationController implements DeathRecipient { return w != null && w.mAttrs.type == TYPE_BASE_APPLICATION && ((w.mActivityRecord != null && mTargetActivityRecord == w.mActivityRecord) || isAnimatingTask(w.getTask())) - && isTargetOverWallpaper(); + && isTargetOverWallpaper() && w.isOnScreen(); } /** diff --git a/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationControllerTest.java b/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationControllerTest.java index 730e9beecf77..cfc50b5e95dc 100644 --- a/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationControllerTest.java +++ b/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationControllerTest.java @@ -437,6 +437,7 @@ public class RecentsAnimationControllerTest extends WindowTestsBase { final WindowState homeWindow = createWindow(null, TYPE_BASE_APPLICATION, homeActivity, "homeWindow"); + makeWindowVisible(homeWindow); homeActivity.addWindow(homeWindow); homeWindow.getAttrs().flags |= FLAG_SHOW_WALLPAPER; -- cgit v1.2.3-59-g8ed1b