From 8a35943e5f1526539feed260f4dfbf7b67f8d35f Mon Sep 17 00:00:00 2001 From: "jorgegil@google.com" Date: Wed, 25 May 2022 14:46:19 -0700 Subject: Remove lingering content overlays in onTaskVanished onTaskVanished already attempted to do some last resort overlay cleanup, but because onExitPipFinished was called right above it, and it internally set the state=UNDEFINED, the overlay removal in onTaskVanished was always a no-op. This change changes the order of onExitPipFinished and the animator cancelling/overlay removal so that there is always an attempt to do the removal in on vanish. There should be no risk with this change that the removal is done twice since even if the overlay is removed by an animator in onAnimationEnd, the removal in onTaskVanished first checks that an animator exists and that a content overlay exists, and one or both of those should cause it to no-op if someone else removed the content overlay earlier. Bug: 230561935 Test: enter MS teams call, swipe edge to go back, verify there's no fullscreen overlay lingering. Test: atest --iteration 5 \ ActivityThreadTest#testHandlePictureInPictureRequested_overriddenToEnter \ ScreenshotTests#testScreenshotSecureLayers \ TaskStackChangedListenerTest#testTaskChangeCallBacks Change-Id: If8639ce78148c5ba1b247bb8afeee76e20863dc5 --- .../Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'libs') diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java index 07f2e95dfcb1..a69d373de24c 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java @@ -795,11 +795,7 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener, "%s: Unrecognized token: %s", TAG, token); return; } - onExitPipFinished(info); - if (Transitions.ENABLE_SHELL_TRANSITIONS) { - mPipTransitionController.forceFinishTransition(); - } final PipAnimationController.PipTransitionAnimator animator = mPipAnimationController.getCurrentAnimator(); if (animator != null) { @@ -810,6 +806,12 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener, animator.removeAllListeners(); animator.cancel(); } + + onExitPipFinished(info); + + if (Transitions.ENABLE_SHELL_TRANSITIONS) { + mPipTransitionController.forceFinishTransition(); + } } @Override -- cgit v1.2.3-59-g8ed1b