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
This commit is contained in:
Chris Li
2022-05-11 15:43:14 +08:00
parent c9ab8713b8
commit d6fa728705

View File

@@ -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;