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

Commit 073d6222 authored by Riddle Hsu's avatar Riddle Hsu Committed by Android (Google) Code Review
Browse files

Merge "Copy pip surface for the usages outside transition" into main

parents 304c9007 66563b44
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -1114,8 +1114,7 @@ public class PipTransition extends PipTransitionController {
                    destinationBounds, sourceHintRect);
        }
        if (!mPipOrganizer.shouldAttachMenuEarly()) {
            mTransitions.getMainExecutor().executeDelayed(
                    () -> mPipMenuController.attach(leash), 0);
            mPipMenuController.attach(leash);
        }

        if (taskInfo.pictureInPictureParams != null
+5 −2
Original line number Diff line number Diff line
@@ -166,7 +166,7 @@ public class PhonePipMenuController implements PipMenuController {
     */
    @Override
    public void attach(SurfaceControl leash) {
        mLeash = leash;
        mLeash = new SurfaceControl(leash, "PhonePipMenuController");
        attachPipMenuView();
    }

@@ -177,8 +177,11 @@ public class PhonePipMenuController implements PipMenuController {
    public void detach() {
        hideMenu();
        detachPipMenuView();
        if (mLeash != null) {
            mLeash.release();
            mLeash = null;
        }
    }

    void attachPipMenuView() {
        // In case detach was not called (e.g. PIP unexpectedly closed)
+5 −2
Original line number Diff line number Diff line
@@ -161,7 +161,7 @@ public class TvPipMenuController implements PipMenuController, TvPipMenuView.Lis
            throw new IllegalStateException("Delegate is not set.");
        }

        mLeash = leash;
        mLeash = new SurfaceControl(leash, "TvPipMenuController");
        attachPipMenu(/* showEduText */ true);
    }

@@ -294,8 +294,11 @@ public class TvPipMenuController implements PipMenuController, TvPipMenuView.Lis
    public void detach() {
        detachPipMenu();
        switchToMenuMode(MODE_NO_MENU);
        if (mLeash != null) {
            mLeash.release();
            mLeash = null;
        }
    }

    @Override
    public void setAppActions(List<RemoteAction> actions, RemoteAction closeAction) {
+1 −1
Original line number Diff line number Diff line
@@ -221,7 +221,7 @@ public class PhonePipMenuController implements PipMenuController,
                            @Override
                            public void surfaceCreated(SurfaceControl.Transaction t) {
                                final SurfaceControl sc = getSurfaceControl();
                                if (sc != null) {
                                if (sc != null && mLeash.isValid()) {
                                    t.reparent(sc, mLeash);
                                    // make menu on top of the surface
                                    t.setLayer(sc, Integer.MAX_VALUE);
+1 −6
Original line number Diff line number Diff line
@@ -19,7 +19,6 @@ import static com.android.wm.shell.pip2.phone.PipTransition.ANIMATING_BOUNDS_CHA
import static com.android.wm.shell.pip2.phone.PipTransition.PIP_DESTINATION_BOUNDS;

import android.annotation.Nullable;
import android.app.TaskInfo;
import android.content.Context;
import android.graphics.Rect;
import android.graphics.RectF;
@@ -143,8 +142,7 @@ public class PipDisplayTransferHandler implements
                ProtoLog.v(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
                        "%s Animating PiP display change to=%d", TAG, mTargetDisplayId);

                SurfaceControl pipLeash = mPipTransitionState.getPinnedTaskLeash();
                TaskInfo taskInfo = mPipTransitionState.getPipTaskInfo();
                final SurfaceControl pipLeash = mPipTransitionState.getPinnedTaskLeash();
                final int duration = extra.getInt(ANIMATING_BOUNDS_CHANGE_DURATION,
                        PipTransition.BOUNDS_CHANGE_JUMPCUT_DURATION);
                final Transaction startTx = extra.getParcelable(
@@ -169,9 +167,6 @@ public class PipDisplayTransferHandler implements
                mPipTransitionState.setState(PipTransitionState.EXITING_PIP);
                mPipTransitionState.setState(PipTransitionState.EXITED_PIP);

                mPipTransitionState.setPinnedTaskLeash(pipLeash);
                mPipTransitionState.setPipTaskInfo(taskInfo);

                final PipResizeAnimator animator = mPipResizeAnimatorSupplier.get(mContext,
                        mPipSurfaceTransactionHelper, pipLeash, startTx, finishTx,
                        mPipBoundsState.getBounds(), mPipBoundsState.getBounds(), pipBounds,
Loading