Completely remove pinned task when starting a new PiP

When a new ActivityRecord tries to replace the existing PiP by
explicitly call enterPictureInPictureMode (normally a cause of in-app
enter PiP button), it's more desirable that the old PiP disappears
instead of turning into full-screen at the same time, as the
Task#dismissPip is trying to do.

Video: http://recall/-/aaaaaabFQoRHlzixHdtY/ebskmHfvlcwKa3OSBFONWY
Bug: 231294285
Test: following the reproduce steps, see video
Test: atest PinnedStackTests
Change-Id: Ib4fb9be03d1a26a7046c303124224b0ecccabecb
This commit is contained in:
Hongwei Wang
2022-05-04 15:16:45 -07:00
parent 6e08678675
commit 0e2a67bb70

View File

@@ -1999,7 +1999,10 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
final Task rootPinnedTask = taskDisplayArea.getRootPinnedTask();
if (rootPinnedTask != null) {
transitionController.collect(rootPinnedTask);
rootPinnedTask.dismissPip();
// The new ActivityRecord should replace the existing PiP, so it's more desirable
// that the old PiP disappears instead of turning to full-screen at the same time,
// as the Task#dismissPip is trying to do.
removeRootTasksInWindowingModes(WINDOWING_MODE_PINNED);
}
// Set a transition to ensure that we don't immediately try and update the visibility