// we are coming from in WM before we reparent because it became empty.
mWindowContainerController.reparent(toStack.getWindowContainerController(), position);
- // Reset the resumed activity on the previous stack
- if (wasResumed) {
- sourceStack.mResumedActivity = null;
- }
-
- // Reset the paused activity on the previous stack
- if (wasPaused) {
- sourceStack.mPausingActivity = null;
- sourceStack.removeTimeoutsForActivityLocked(r);
- }
-
// Move the task
sourceStack.removeTask(this, reason, REMOVE_TASK_MODE_MOVING);
- toStack.addTask(this, position, reason);
+ toStack.addTask(this, position, false /* schedulePictureInPictureModeChange */, reason);
- // TODO: Ensure that this is actually necessary here
- // Notify of picture-in-picture mode changes
- supervisor.scheduleReportPictureInPictureModeChangedIfNeeded(this, sourceStack);
+ if (schedulePictureInPictureModeChange) {
+ // Notify of picture-in-picture mode changes
+ supervisor.scheduleUpdatePictureInPictureModeIfNeeded(this, sourceStack);
+ }
// TODO: Ensure that this is actually necessary here
// Notify the voice session if required