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

Commit c2a94de8 authored by Hongwei Wang's avatar Hongwei Wang
Browse files

Ignore cutouts in handleSwipePiptoHomeTransition

For auto-enter PiP animation,
PipTransition#handleSwipePipToHomeTransition populates the final surface
control transactions from the animator by setting fraction to end.

With ag/28133983, display cutout insets would be taken into account
mistakenly and causes the content shifted at the end.

Fixing this by empty the cutout information before populating the final
transactions.

Flag: EXEMPT bugfix
Bug: 354206307
Test: Enter PiP from Netflix on different foldables and phones
Change-Id: If57b774ba7c9343f9c45f32069b637302fafcf9f
parent a97e0590
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED;
import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
import static android.util.RotationUtils.deltaRotation;
import static android.util.RotationUtils.rotateBounds;
import static android.view.Surface.ROTATION_0;
import static android.view.Surface.ROTATION_270;
import static android.view.Surface.ROTATION_90;
import static android.view.WindowManager.TRANSIT_CHANGE;
@@ -1183,10 +1184,15 @@ public class PipTransition extends PipTransitionController {
                ? pipTaskInfo.configuration.windowConfiguration.getBounds()
                : mPipOrganizer.mAppBounds;

        // Populate the final surface control transactions from PipTransitionAnimator,
        // display cutout insets is handled in the swipe pip to home animator, empty it out here
        // to avoid flicker.
        final Rect savedDisplayCutoutInsets = new Rect(pipTaskInfo.displayCutoutInsets);
        pipTaskInfo.displayCutoutInsets.setEmpty();
        final PipAnimationController.PipTransitionAnimator animator =
                mPipAnimationController.getAnimator(pipTaskInfo, leash, sourceBounds, sourceBounds,
                        destinationBounds, sourceHintRect, TRANSITION_DIRECTION_TO_PIP,
                        0 /* startingAngle */, 0 /* rotationDelta */)
                        0 /* startingAngle */, ROTATION_0 /* rotationDelta */)
                        .setPipTransactionHandler(mTransactionConsumer)
                        .setTransitionDirection(TRANSITION_DIRECTION_TO_PIP);
        // The start state is the end state for swipe-auto-pip.
@@ -1194,6 +1200,7 @@ public class PipTransition extends PipTransitionController {
        animator.applySurfaceControlTransaction(leash, startTransaction,
                PipAnimationController.FRACTION_END);
        startTransaction.apply();
        pipTaskInfo.displayCutoutInsets.set(savedDisplayCutoutInsets);

        mPipBoundsState.setBounds(destinationBounds);
        final SurfaceControl.Transaction tx = new SurfaceControl.Transaction();