From d6fa728705aa63d441165242604d7642d109e0e1 Mon Sep 17 00:00:00 2001 From: Chris Li Date: Wed, 11 May 2022 15:43:14 +0800 Subject: [PATCH] Fix visibility change during entering PIP app transition In the cl[1], we exclude entering PIP window from app transition. However, there is a corner case where the visible is actually changed. In gesture navigation, swiping to home will cause the activity to be invisible before entering PIP (from recent animation). For this case, we don't want to exclude it from app transition, otherwise it will commit the visibility immediately and cause flicker. [1]: I2bb781fb362518f5f11c4c8ad65eb5d2f33a5dfd Bug: 225371112 Fix: 232136259 Test: verify locally with swipe to home with PIP app Change-Id: I2acf91d9d4f2f121dc1c26956d8291e37bb4e4be --- .../java/com/android/server/wm/ActivityRecord.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java index 791d193f36ab9..730e709cf4858 100644 --- a/services/core/java/com/android/server/wm/ActivityRecord.java +++ b/services/core/java/com/android/server/wm/ActivityRecord.java @@ -5094,13 +5094,15 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A // still check DC#okToAnimate again if the transition animation is fine to apply. // TODO(new-app-transition): Rewrite this logic using WM Shell. final boolean recentsAnimating = isAnimating(PARENTS, ANIMATION_TYPE_RECENTS); + final boolean isEnteringPipWithoutVisibleChange = mWaitForEnteringPinnedMode + && mVisible == visible; if (okToAnimate(true /* ignoreFrozen */, canTurnScreenOn()) && (appTransition.isTransitionSet() || (recentsAnimating && !isActivityTypeHome())) - // If the visibility change during enter PIP, we don't want to include it in app - // transition to affect the animation theme, because the Pip organizer will animate - // the entering PIP instead. - && !mWaitForEnteringPinnedMode) { + // If the visibility is not changed during enter PIP, we don't want to include it in + // app transition to affect the animation theme, because the Pip organizer will + // animate the entering PIP instead. + && !isEnteringPipWithoutVisibleChange) { if (visible) { displayContent.mOpeningApps.add(this); mEnteringAnimation = true;