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

Commit 1d35d293 authored by Chris Li's avatar Chris Li Committed by Android (Google) Code Review
Browse files

Merge "Draw PipContentOverlay when enter PIP with Shell transition"

parents 67ae4f5a 8b6165bb
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1435,7 +1435,7 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener,
    /**
     * Fades out and removes an overlay surface.
     */
    private void fadeOutAndRemoveOverlay(SurfaceControl surface, Runnable callback,
    void fadeOutAndRemoveOverlay(SurfaceControl surface, Runnable callback,
            boolean withStartDelay) {
        if (surface == null) {
            return;
+7 −0
Original line number Diff line number Diff line
@@ -65,6 +65,7 @@ public class PipTransition extends PipTransitionController {

    private static final String TAG = PipTransition.class.getSimpleName();

    private final Context mContext;
    private final PipTransitionState mPipTransitionState;
    private final int mEnterExitAnimationDuration;
    private final PipSurfaceTransactionHelper mSurfaceTransactionHelper;
@@ -86,6 +87,7 @@ public class PipTransition extends PipTransitionController {
            Optional<SplitScreenController> splitScreenOptional) {
        super(pipBoundsState, pipMenuController, pipBoundsAlgorithm,
                pipAnimationController, transitions, shellTaskOrganizer);
        mContext = context;
        mPipTransitionState = pipTransitionState;
        mEnterExitAnimationDuration = context.getResources()
                .getInteger(R.integer.config_pipResizeAnimationDuration);
@@ -359,6 +361,11 @@ public class PipTransition extends PipTransitionController {
            animator = mPipAnimationController.getAnimator(taskInfo, leash, currentBounds,
                    currentBounds, destinationBounds, sourceHintRect, TRANSITION_DIRECTION_TO_PIP,
                    0 /* startingAngle */, rotationDelta);
            if (sourceHintRect == null) {
                // We use content overlay when there is no source rect hint to enter PiP use bounds
                // animation.
                animator.setUseContentOverlay(mContext);
            }
        } else if (mOneShotAnimationType == ANIM_TYPE_ALPHA) {
            startTransaction.setAlpha(leash, 0f);
            // PiP menu is attached late in the process here to avoid any artifacts on the leash
+10 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.wm.shell.pip;
import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;

import static com.android.wm.shell.pip.PipAnimationController.TRANSITION_DIRECTION_REMOVE_STACK;
import static com.android.wm.shell.pip.PipAnimationController.isInPipDirection;

import android.annotation.Nullable;
import android.app.PictureInPictureParams;
@@ -69,6 +70,10 @@ public abstract class PipTransitionController implements Transitions.TransitionH
                    if (direction == TRANSITION_DIRECTION_REMOVE_STACK) {
                        return;
                    }
                    if (isInPipDirection(direction) && animator.getContentOverlay() != null) {
                        mPipOrganizer.fadeOutAndRemoveOverlay(animator.getContentOverlay(),
                                animator::clearContentOverlay, true /* withStartDelay*/);
                    }
                    onFinishResize(taskInfo, animator.getDestinationBounds(), direction, tx);
                    sendOnPipTransitionFinished(direction);
                }
@@ -76,6 +81,11 @@ public abstract class PipTransitionController implements Transitions.TransitionH
                @Override
                public void onPipAnimationCancel(TaskInfo taskInfo,
                        PipAnimationController.PipTransitionAnimator animator) {
                    final int direction = animator.getTransitionDirection();
                    if (isInPipDirection(direction) && animator.getContentOverlay() != null) {
                        mPipOrganizer.fadeOutAndRemoveOverlay(animator.getContentOverlay(),
                                animator::clearContentOverlay, true /* withStartDelay */);
                    }
                    sendOnPipTransitionCancelled(animator.getTransitionDirection());
                }
            };