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

Commit 36f3373f authored by Ikram Gabiyev's avatar Ikram Gabiyev Committed by Android (Google) Code Review
Browse files

Merge "Preserve the leash reference in PipTaskOrganizer" into udc-dev

parents b3ea5063 a45bcc33
Loading
Loading
Loading
Loading
+9 −16
Original line number Diff line number Diff line
@@ -1018,25 +1018,18 @@ public class PipTransition extends PipTransitionController {
    private void resetPrevPip(@NonNull TransitionInfo.Change prevPipTaskChange,
            @NonNull SurfaceControl.Transaction startTransaction) {
        final SurfaceControl leash = prevPipTaskChange.getLeash();
        final Rect bounds = prevPipTaskChange.getEndAbsBounds();
        final Point offset = prevPipTaskChange.getEndRelOffset();
        bounds.offset(-offset.x, -offset.y);
        startTransaction.remove(leash);

        startTransaction.setWindowCrop(leash, null);
        startTransaction.setMatrix(leash, 1, 0, 0, 1);
        startTransaction.setCornerRadius(leash, 0);
        startTransaction.setPosition(leash, bounds.left, bounds.top);

        if (mHasFadeOut && prevPipTaskChange.getTaskInfo().isVisible()) {
            if (mPipAnimationController.getCurrentAnimator() != null) {
                mPipAnimationController.getCurrentAnimator().cancel();
            }
            startTransaction.setAlpha(leash, 1);
        }
        mHasFadeOut = false;
        mCurrentPipTaskToken = null;

        // clean-up the state in PipTaskOrganizer if the PipTaskOrganizer#onTaskAppeared() hasn't
        // been called yet with its leash reference now pointing to a new SurfaceControl not
        // matching the leash of the pip we are removing.
        if (mPipOrganizer.getSurfaceControl() == leash) {
            mPipOrganizer.onExitPipFinished(prevPipTaskChange.getTaskInfo());
        }
    }

    @Override
    public boolean syncPipSurfaceState(@NonNull TransitionInfo info,