From c4f76dd5231a00253381d32144bae759a2b9c512 Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Fri, 9 Jul 2021 11:48:12 -0700 Subject: Account for recents animation when reporting client visibility - While the current app is still resumed and running in overview, the start of a new activity will trigger the current app to pause and be added to the stopping list while the new app is passed to the existing recents animation via onTaskAppeared() callback. We don't actually process the stopping activities until the recents animation is done, but pausing will trigger the report client visibility to the app if the animation is complete (which triggers the SurfaceView to destroy the surface). This check needs to also account for the recents animation that is driving the launching app as well. Fixes: 184211875 Test: Open an app with a SurfaceView in overview and then launch the next app (repeat until you see a blank area where the SV is) Change-Id: I35d1947795f529b701af22586b23441d5ac55313 Merged-In: I35d1947795f529b701af22586b23441d5ac55313 --- services/core/java/com/android/server/wm/ActivityRecord.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java index 64b5fc77dea7..db5d1f661618 100644 --- a/services/core/java/com/android/server/wm/ActivityRecord.java +++ b/services/core/java/com/android/server/wm/ActivityRecord.java @@ -4721,7 +4721,8 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A */ private void postApplyAnimation(boolean visible) { final boolean delayed = isAnimating(PARENTS | CHILDREN, - ANIMATION_TYPE_APP_TRANSITION | ANIMATION_TYPE_WINDOW_ANIMATION); + ANIMATION_TYPE_APP_TRANSITION | ANIMATION_TYPE_WINDOW_ANIMATION + | ANIMATION_TYPE_RECENTS); if (!delayed) { // We aren't delayed anything, but exiting windows rely on the animation finished // callback being called in case the ActivityRecord was pretending to be delayed, @@ -4741,7 +4742,8 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A // updated. // If we're becoming invisible, update the client visibility if we are not running an // animation. Otherwise, we'll update client visibility in onAnimationFinished. - if (visible || !isAnimating(PARENTS, ANIMATION_TYPE_APP_TRANSITION)) { + if (visible || !isAnimating(PARENTS, + ANIMATION_TYPE_APP_TRANSITION | ANIMATION_TYPE_RECENTS)) { setClientVisible(visible); } -- cgit v1.2.3-59-g8ed1b