Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f0430706 authored by Wei Sheng Shih's avatar Wei Sheng Shih Committed by wilsonshih
Browse files

Revert^2 Do not enter pip during transient launch

When Pair-to-pair switch, the closing task is accidentally enter pip
during startActivityFromRecents => moveTaskToFront, which cause two
problems:
1. Pip transition should happen after transient launch finich.
2. StageCoordinator cannot handle the pip change, so that pip
   task will enter a strange situation.
By checking whether the current top root task is transient hide, if it
does, don't allow it to enter pip while pausing. And if that task
really need to enter pip, it shall happen after transient launch was
committed.

Bug: 290857445
Test: Do pair-to-pair quick switch with an auto-pip app exist, verify
no auto pip happen like switch on fullscreen app.
Test: atest SwipeUpAppToPipTestsMeet
Test: Verify swipe up to enter auto-pip still work.

Change-Id: I190381a290352f8c71c43355adadcf071546f21f
parent 0e61b8a1
Loading
Loading
Loading
Loading
+12 −8
Original line number Diff line number Diff line
@@ -5251,17 +5251,21 @@ class Task extends TaskFragment {
            // Ensure that we do not trigger entering PiP an activity on the root pinned task.
            return;
        }
        final boolean isTransient = opts != null && opts.getTransientLaunch();
        final Task targetRootTask = toFrontTask != null
                ? toFrontTask.getRootTask() : toFrontActivity.getRootTask();
        if (targetRootTask != null && (targetRootTask.isActivityTypeAssistant() || isTransient)) {
            // Ensure the task/activity being brought forward is not the assistant and is not
            // transient. In the case of transient-launch, we want to wait until the end of the
            // transition and only allow switch if the transient launch was committed.
        final Task targetRootTask = toFrontTask != null ? toFrontTask.getRootTask()
                : toFrontActivity != null ? toFrontActivity.getRootTask() : null;
        if (targetRootTask == null) {
            Slog.e(TAG, "No root task for enter pip, both to front task and activity are null?");
            return;
        }
        pipCandidate.supportsEnterPipOnTaskSwitch = true;
        final boolean isTransient = opts != null && opts.getTransientLaunch()
                || (targetRootTask.mTransitionController.isTransientHide(targetRootTask));

        // Ensure the task/activity being brought forward is not the assistant and is not transient
        // nor transient hide target. In the case of transient-launch, we want to wait until the end
        // of the transition and only allow to enter pip on task switch after the transient launch
        // was committed.
        pipCandidate.supportsEnterPipOnTaskSwitch = !targetRootTask.isActivityTypeAssistant()
                && !isTransient;
    }

    /**