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

Commit d01eb4b4 authored by Merissa Mitchell's avatar Merissa Mitchell
Browse files

[PiP on Desktop] Disable swipe up PiP if task is freeform

Bug: 416766306
Test: atest WMShellUnitTests:com.android.wm.shell.pip2.phone
Test: Manual - swipe up after tiling YT with video playing in Desktop,
verify PiP is not entered and there is no crash
Flag: com.android.window.flags.enable_desktop_windowing_pip

Change-Id: I66d883059ee03a39868ba81b3c143baf2bf51b4e
parent a246d0fd
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_RECENTS;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD;
import static android.app.WindowConfiguration.ROTATION_UNDEFINED;
import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM;
import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED;
import static android.os.Trace.TRACE_TAG_WINDOW_MANAGER;
@@ -45,6 +46,7 @@ import static android.view.WindowManager.TRANSIT_TO_FRONT;
import static android.view.WindowManager.TransitionFlags;
import static android.view.WindowManager.TransitionType;
import static android.view.WindowManager.transitTypeToString;
import static android.window.DesktopExperienceFlags.ENABLE_DESKTOP_WINDOWING_PIP;
import static android.window.DesktopExperienceFlags.ENABLE_DISPLAY_DISCONNECT_INTERACTION;
import static android.window.DesktopExperienceFlags.ENABLE_DISPLAY_FOCUS_IN_SHELL_TRANSITIONS;
import static android.window.TaskFragmentAnimationParams.DEFAULT_ANIMATION_BACKGROUND_COLOR;
@@ -1304,6 +1306,12 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
            return false;
        }

        // If PiP on Desktop Windowing is enabled and the task is freeform, we disable entering PiP.
        if (ENABLE_DESKTOP_WINDOWING_PIP.isTrue()
                && ar.getTask().getWindowingMode() == WINDOWING_MODE_FREEFORM) {
            return false;
        }

        final ActivityRecord resuming = getVisibleTransientLaunch(ar.getTaskDisplayArea());
        if (ar.pictureInPictureArgs != null && ar.pictureInPictureArgs.isAutoEnterEnabled()) {
            if (!ar.getTask().isVisibleRequested() || didCommitTransientLaunch()) {