diff options
| author | 2024-07-23 11:10:48 -0700 | |
|---|---|---|
| committer | 2024-07-23 11:16:26 -0700 | |
| commit | c2a94de85d96c0dbbef43cdcf428600cccfe2b7c (patch) | |
| tree | c875735e89dace40ae27bffb1e843fa5b93e0cfd | |
| parent | a97e0590eb9a0dba95e565c951a885d14d2b4a3e (diff) | |
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
| -rw-r--r-- | libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTransition.java | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTransition.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTransition.java index a52141c5f9d6..ba97c8322c92 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTransition.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTransition.java @@ -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(); |