From c0154a63ba1e5c73260146ff428ad4356c60c161 Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Fri, 9 Jul 2021 11:48:12 -0700 Subject: [PATCH] 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. Bug: 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 --- services/core/java/com/android/server/wm/ActivityRecord.java | 5 +++-- 1 file changed, 3 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 6167f3bf6fcd0..714680cd5c609 100644 --- a/services/core/java/com/android/server/wm/ActivityRecord.java +++ b/services/core/java/com/android/server/wm/ActivityRecord.java @@ -4838,7 +4838,8 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A final boolean usingShellTransitions = mAtmService.getTransitionController().getTransitionPlayer() != null; 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 && !usingShellTransitions) { // 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, @@ -4858,7 +4859,7 @@ 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) || usingShellTransitions) { setClientVisible(visible); }