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

Commit 0f9957ff authored by Hongwei Wang's avatar Hongwei Wang Committed by Android (Google) Code Review
Browse files

Merge "Dismiss split-screen for direct enter PiP" into main

parents a9263cdb 741c9277
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -91,8 +91,6 @@ public abstract class Pip2Module {
            @NonNull Transitions transitions,
            PipBoundsState pipBoundsState,
            PipBoundsAlgorithm pipBoundsAlgorithm,
            Optional<PipController> pipController,
            PipTouchHandler pipTouchHandler,
            PipTaskListener pipTaskListener,
            @NonNull PipScheduler pipScheduler,
            @NonNull PipTransitionState pipStackListenerController,
+0 −2
Original line number Diff line number Diff line
@@ -124,7 +124,6 @@ public class PipTransition extends PipTransitionController implements
    private final PipSurfaceTransactionHelper mPipSurfaceTransactionHelper;
    private final PipDesktopState mPipDesktopState;
    private final Optional<DesktopPipTransitionController> mDesktopPipTransitionController;
    private final PipInteractionHandler mPipInteractionHandler;

    //
    // Transition caches
@@ -185,7 +184,6 @@ public class PipTransition extends PipTransitionController implements
        mPipSurfaceTransactionHelper = pipSurfaceTransactionHelper;
        mPipDesktopState = pipDesktopState;
        mDesktopPipTransitionController = desktopPipTransitionController;
        mPipInteractionHandler = pipInteractionHandler;

        mExpandHandler = new PipExpandHandler(mContext, mPipSurfaceTransactionHelper,
                pipBoundsState, pipBoundsAlgorithm,
+26 −0
Original line number Diff line number Diff line
@@ -3197,6 +3197,32 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
        }
    }

    /**
     * This is used for mixed-transition scenarios (specifically when transitioning one split task
     * into PIP). For such scenarios, just make sure to include exiting split or entering split when
     * appropriate. This is an addition to
     * {@link #addEnterOrExitForPipIfNeeded(TransitionRequestInfo, WindowContainerTransaction)},
     * for PiP2 where PiP-able task can also come in through the pip change request field,
     * and this method is provided to explicitly prepare an exit in that case.
     *
     * This is only called if requestImpliesSplitToPip() returns `true`.
     */
    public void removePipFromSplitIfNeeded(@NonNull TransitionRequestInfo request,
            @NonNull WindowContainerTransaction outWCT) {
        if (request.getPipChange() == null || request.getPipChange().getTaskInfo() == null) {
            return;
        }
        final TaskInfo info = request.getPipChange().getTaskInfo();
        @StageType int topStage = STAGE_TYPE_UNDEFINED;
        @StageType int pipStage = getStageOfTask(info.taskId);
        if (pipStage == STAGE_TYPE_MAIN) {
            topStage = STAGE_TYPE_SIDE;
        } else if (pipStage == STAGE_TYPE_SIDE) {
            topStage = STAGE_TYPE_MAIN;
        }
        prepareExitSplitScreen(topStage, outWCT, EXIT_REASON_CHILD_TASK_ENTER_PIP);
    }

    /**
     * This is used for mixed-transition scenarios (specifically when transitioning one split task
     * into PIP). For such scenarios, just make sure to include exiting split or entering split when
+4 −0
Original line number Diff line number Diff line
@@ -54,6 +54,7 @@ import com.android.wm.shell.protolog.ShellProtoLogGroup;
import com.android.wm.shell.recents.RecentsTransitionHandler;
import com.android.wm.shell.shared.TransitionUtil;
import com.android.wm.shell.shared.bubbles.BubbleAnythingFlagHelper;
import com.android.wm.shell.shared.pip.PipFlags;
import com.android.wm.shell.splitscreen.SplitScreenController;
import com.android.wm.shell.splitscreen.StageCoordinator;
import com.android.wm.shell.sysui.ShellInit;
@@ -372,6 +373,9 @@ public class DefaultMixedHandler implements MixedTransitionHandler,

            WindowContainerTransaction out = new WindowContainerTransaction();
            mPipHandler.augmentRequest(transition, request, out);
            if (PipFlags.isPip2ExperimentEnabled() && mSplitHandler.isSplitScreenVisible()) {
                mSplitHandler.removePipFromSplitIfNeeded(request, out);
            }
            mSplitHandler.addEnterOrExitForPipIfNeeded(request, out);
            return out;
        } else if (request.getType() == TRANSIT_PIP