Fix pip activity remained in PAUSING state

The enter-pip activity was reparented to a newly created task
because the original host task contains more than one activity.
However, the pip activity remained in PAUSING state because
the task pausing activity was null and therefore the activity
didn't schedule to pause.

Bug: 213541422
Test: atest PinnedStackTests
Change-Id: I1aea45f70eb3983dc9859585321258813ee62af7
This commit is contained in:
Louis Chang
2022-07-15 07:52:52 +00:00
parent 8eee52bf1d
commit d64a037d41

View File

@@ -3521,10 +3521,9 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
mRootWindowContainer.moveActivityToPinnedRootTask(r,
null /* launchIntoPipHostActivity */, "enterPictureInPictureMode",
transition);
final Task task = r.getTask();
// Continue the pausing process after entering pip.
if (task.getPausingActivity() == r) {
task.schedulePauseActivity(r, false /* userLeaving */,
if (r.isState(PAUSING)) {
r.getTask().schedulePauseActivity(r, false /* userLeaving */,
false /* pauseImmediately */, "auto-pip");
}
}