Draw PipContentOverlay when enter PIP with Shell transition
Fix: 210970518 Test: manual test with enabling Shell transition Change-Id: Ic0c45ac63600393fdf60723052468b5904014dbe
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user