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

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

Merge "Show pip until drawn with entering bounds if rotation changes" into main

parents a3b84225 427778b0
Loading
Loading
Loading
Loading
+20 −2
Original line number Original line Diff line number Diff line
@@ -489,6 +489,14 @@ public class PipTransition extends PipTransitionController {
                    // activity windowing mode, and set the task bounds to the final bounds
                    // activity windowing mode, and set the task bounds to the final bounds
                    wct.setActivityWindowingMode(taskInfo.token, WINDOWING_MODE_UNDEFINED);
                    wct.setActivityWindowingMode(taskInfo.token, WINDOWING_MODE_UNDEFINED);
                    wct.setBounds(taskInfo.token, destinationBounds);
                    wct.setBounds(taskInfo.token, destinationBounds);
                    // If the animation is only used to apply destination bounds immediately and
                    // invisibly, then reshow it until the pip is drawn with the bounds.
                    final PipAnimationController.PipTransitionAnimator<?> animator =
                            mPipAnimationController.getCurrentAnimator();
                    if (animator != null && animator.getEndValue().equals(0f)) {
                        tx.addTransactionCommittedListener(mTransitions.getMainExecutor(),
                                () -> fadeExistingPip(true /* show */));
                    }
                } else {
                } else {
                    wct.setBounds(taskInfo.token, null /* bounds */);
                    wct.setBounds(taskInfo.token, null /* bounds */);
                }
                }
@@ -1026,6 +1034,7 @@ public class PipTransition extends PipTransitionController {
        }
        }
        startTransaction.apply();
        startTransaction.apply();


        int animationDuration = mEnterExitAnimationDuration;
        PipAnimationController.PipTransitionAnimator animator;
        PipAnimationController.PipTransitionAnimator animator;
        if (enterAnimationType == ANIM_TYPE_BOUNDS) {
        if (enterAnimationType == ANIM_TYPE_BOUNDS) {
            animator = mPipAnimationController.getAnimator(taskInfo, leash, currentBounds,
            animator = mPipAnimationController.getAnimator(taskInfo, leash, currentBounds,
@@ -1057,8 +1066,17 @@ public class PipTransition extends PipTransitionController {
                }
                }
            }
            }
        } else if (enterAnimationType == ANIM_TYPE_ALPHA) {
        } else if (enterAnimationType == ANIM_TYPE_ALPHA) {
            // In case augmentRequest() is unable to apply the entering bounds (e.g. the request
            // info only contains display change), keep the animation invisible (alpha 0) and
            // duration 0 to apply the destination bounds. The actual fade-in animation will be
            // done in onFinishResize() after the bounds are applied.
            final boolean fadeInAfterOnFinishResize = rotationDelta != Surface.ROTATION_0
                    && mFixedRotationState == FIXED_ROTATION_CALLBACK;
            animator = mPipAnimationController.getAnimator(taskInfo, leash, destinationBounds,
            animator = mPipAnimationController.getAnimator(taskInfo, leash, destinationBounds,
                    0f, 1f);
                    0f, fadeInAfterOnFinishResize ? 0f : 1f);
            if (fadeInAfterOnFinishResize) {
                animationDuration = 0;
            }
            mSurfaceTransactionHelper
            mSurfaceTransactionHelper
                    .crop(finishTransaction, leash, destinationBounds)
                    .crop(finishTransaction, leash, destinationBounds)
                    .round(finishTransaction, leash, true /* applyCornerRadius */);
                    .round(finishTransaction, leash, true /* applyCornerRadius */);
@@ -1068,7 +1086,7 @@ public class PipTransition extends PipTransitionController {
        mPipOrganizer.setContentOverlay(animator.getContentOverlayLeash(), currentBounds);
        mPipOrganizer.setContentOverlay(animator.getContentOverlayLeash(), currentBounds);
        animator.setTransitionDirection(TRANSITION_DIRECTION_TO_PIP)
        animator.setTransitionDirection(TRANSITION_DIRECTION_TO_PIP)
                .setPipAnimationCallback(mPipAnimationCallback)
                .setPipAnimationCallback(mPipAnimationCallback)
                .setDuration(mEnterExitAnimationDuration);
                .setDuration(animationDuration);
        if (rotationDelta != Surface.ROTATION_0
        if (rotationDelta != Surface.ROTATION_0
                && mFixedRotationState == FIXED_ROTATION_TRANSITION) {
                && mFixedRotationState == FIXED_ROTATION_TRANSITION) {
            // For fixed rotation, the animation destination bounds is in old rotation coordinates.
            // For fixed rotation, the animation destination bounds is in old rotation coordinates.