summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Riddle Hsu <riddlehsu@google.com> 2023-06-19 19:08:09 +0000
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2023-06-19 19:08:09 +0000
commita0ac912bb8710480a1e4a4b26fbfebf96b73cab8 (patch)
tree1687b43b445b108a7b3e48fcc401cbf57c16961e
parent0581b98a754c99076ec6efad0800ee30fa37fa9f (diff)
parenta5de62db1e60d59e96313de21a7d1ed44236c8ce (diff)
Merge "Reduce flickering when exiting PiP to fullscreen" into udc-dev am: a5de62db1e
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23694223 Change-Id: If938c6a337637316429594f3e0ef3ba489f5c7ff Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java3
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTransition.java21
2 files changed, 11 insertions, 13 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java
index 4dbb50f34a35..cf389905c526 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java
@@ -534,8 +534,7 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener,
return;
}
- final Rect displayBounds = mPipBoundsState.getDisplayBounds();
- final Rect destinationBounds = new Rect(displayBounds);
+ final Rect destinationBounds = new Rect(getExitDestinationBounds());
final int direction = syncWithSplitScreenBounds(destinationBounds, requestEnterSplit)
? TRANSITION_DIRECTION_LEAVE_PIP_TO_SPLIT_SCREEN
: TRANSITION_DIRECTION_LEAVE_PIP;
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 86b0f33ad54c..e04e9f7caa91 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
@@ -351,7 +351,7 @@ public class PipTransition extends PipTransitionController {
if (taskInfo != null) {
startExpandAnimation(taskInfo, mPipOrganizer.getSurfaceControl(),
mPipBoundsState.getBounds(), mPipBoundsState.getBounds(),
- new Rect(mExitDestinationBounds), Surface.ROTATION_0);
+ new Rect(mExitDestinationBounds), Surface.ROTATION_0, null /* startT */);
}
mExitDestinationBounds.setEmpty();
mCurrentPipTaskToken = null;
@@ -604,14 +604,8 @@ public class PipTransition extends PipTransitionController {
}
}
- // Set the initial frame as scaling the end to the start.
final Rect destinationBounds = new Rect(pipChange.getEndAbsBounds());
destinationBounds.offset(-offset.x, -offset.y);
- startTransaction.setWindowCrop(pipLeash, destinationBounds.width(),
- destinationBounds.height());
- mSurfaceTransactionHelper.scale(startTransaction, pipLeash, destinationBounds,
- currentBounds);
- startTransaction.apply();
// Check if it is fixed rotation.
final int rotationDelta;
@@ -641,7 +635,7 @@ public class PipTransition extends PipTransitionController {
rotationDelta = Surface.ROTATION_0;
}
startExpandAnimation(taskInfo, pipLeash, currentBounds, currentBounds, destinationBounds,
- rotationDelta);
+ rotationDelta, startTransaction);
}
private void startExpandAndRotationAnimation(@NonNull TransitionInfo info,
@@ -697,7 +691,7 @@ public class PipTransition extends PipTransitionController {
private void startExpandAnimation(final TaskInfo taskInfo, final SurfaceControl leash,
final Rect baseBounds, final Rect startBounds, final Rect endBounds,
- final int rotationDelta) {
+ final int rotationDelta, @Nullable SurfaceControl.Transaction startTransaction) {
final Rect sourceHintRect = PipBoundsAlgorithm.getValidSourceHintRect(
taskInfo.pictureInPictureParams, endBounds);
final PipAnimationController.PipTransitionAnimator animator =
@@ -705,9 +699,14 @@ public class PipTransition extends PipTransitionController {
endBounds, sourceHintRect, TRANSITION_DIRECTION_LEAVE_PIP,
0 /* startingAngle */, rotationDelta);
animator.setTransitionDirection(TRANSITION_DIRECTION_LEAVE_PIP)
- .setPipAnimationCallback(mPipAnimationCallback)
+ .setDuration(mEnterExitAnimationDuration);
+ if (startTransaction != null) {
+ animator.setPipTransactionHandler(mTransactionConsumer).applySurfaceControlTransaction(
+ leash, startTransaction, PipAnimationController.FRACTION_START);
+ startTransaction.apply();
+ }
+ animator.setPipAnimationCallback(mPipAnimationCallback)
.setPipTransactionHandler(mPipOrganizer.getPipTransactionHandler())
- .setDuration(mEnterExitAnimationDuration)
.start();
}