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

Commit a9144842 authored by Ikram Gabiyev's avatar Ikram Gabiyev
Browse files

Enable supportsEnterPipOnTaskSwitch early on

We need to enable supportsEnterPipOnTaskSwitch
before we check for the PiP state to be valid in PiP2.

This should fix the CTS test case where we launch the
TestActivity over a pip-able PipActivity with auto-enter flag on.

Bug: 359675378
Flag: com.android.wm.shell.enable_pip2_implementation
Test: atest PinnedStackTests#testAutoPipOnLaunchingRegularActivity
Change-Id: I75e68e0bbbbb7a1bfd965684fb666f21f8d27d8d
parent 79a8e2be
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -1776,11 +1776,6 @@ class TaskFragment extends WindowContainer<WindowContainer> {
        if (resuming != null) {
            // We do not want to trigger auto-PiP upon launch of a translucent activity.
            final boolean resumingOccludesParent = resuming.occludesParent();
            // Resuming the new resume activity only if the previous activity can't go into Pip
            // since we want to give Pip activities a chance to enter Pip before resuming the
            // next activity.
            final boolean lastResumedCanPip = prev.checkEnterPictureInPictureState(
                    "shouldAutoPipWhilePausing", userLeaving);

            if (ActivityTaskManagerService.isPip2ExperimentEnabled()) {
                // If a new task is being launched, then mark the existing top activity as
@@ -1790,6 +1785,12 @@ class TaskFragment extends WindowContainer<WindowContainer> {
                Task.enableEnterPipOnTaskSwitch(prev, resuming.getTask(),
                        resuming, resuming.getOptions());
            }

            // Resuming the new resume activity only if the previous activity can't go into Pip
            // since we want to give Pip activities a chance to enter Pip before resuming the
            // next activity.
            final boolean lastResumedCanPip = prev.checkEnterPictureInPictureState(
                    "shouldAutoPipWhilePausing", userLeaving);
            if (prev.supportsEnterPipOnTaskSwitch && userLeaving
                    && resumingOccludesParent && lastResumedCanPip
                    && prev.pictureInPictureArgs.isAutoEnterEnabled()) {