[RESTRICT AUTOMERGE] Ignore small source rect hint am: 4fda9095ba

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/24272818

Change-Id: I62bd52cda8bbb53ad390c3278f4afc0c72eb2ff0
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Hongwei Wang
2023-08-08 03:46:22 +00:00
committed by Automerger Merge Worker
3 changed files with 19 additions and 4 deletions

View File

@@ -182,6 +182,21 @@ public class PipBoundsAlgorithm {
return null;
}
/**
* Returns the source hint rect if it is valid (if provided and is contained by the current
* task bounds and not too small).
*/
public static Rect getValidSourceHintRect(PictureInPictureParams params, Rect sourceBounds,
@NonNull Rect destinationBounds) {
final Rect sourceHintRect = getValidSourceHintRect(params, sourceBounds);
if (sourceHintRect != null
&& sourceHintRect.width() > destinationBounds.width()
&& sourceHintRect.height() > destinationBounds.height()) {
return sourceHintRect;
}
return null;
}
public float getDefaultAspectRatio() {
return mDefaultAspectRatio;
}

View File

@@ -564,7 +564,7 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener,
if (mOneShotAnimationType == ANIM_TYPE_BOUNDS) {
mPipMenuController.attach(mLeash);
final Rect sourceHintRect = PipBoundsAlgorithm.getValidSourceHintRect(
info.pictureInPictureParams, currentBounds);
info.pictureInPictureParams, currentBounds, destinationBounds);
scheduleAnimateResizePip(currentBounds, destinationBounds, 0 /* startingAngle */,
sourceHintRect, TRANSITION_DIRECTION_TO_PIP, mEnterAnimationDuration,
null /* updateBoundsCallback */);
@@ -590,9 +590,9 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener,
return;
}
final Rect currentBounds = mTaskInfo.configuration.windowConfiguration.getBounds();
final Rect sourceHintRect = PipBoundsAlgorithm.getValidSourceHintRect(
mPictureInPictureParams, currentBounds);
final Rect destinationBounds = mPipBoundsAlgorithm.getEntryDestinationBounds();
final Rect sourceHintRect = PipBoundsAlgorithm.getValidSourceHintRect(
mPictureInPictureParams, currentBounds, destinationBounds);
animateResizePip(currentBounds, destinationBounds, sourceHintRect,
TRANSITION_DIRECTION_TO_PIP, mEnterAnimationDuration, 0 /* startingAngle */);
mState = State.ENTERING_PIP;

View File

@@ -110,7 +110,7 @@ public class PipTransition extends PipTransitionController {
if (mOneShotAnimationType == ANIM_TYPE_BOUNDS) {
final Rect sourceHintRect =
PipBoundsAlgorithm.getValidSourceHintRect(
taskInfo.pictureInPictureParams, currentBounds);
taskInfo.pictureInPictureParams, currentBounds, destinationBounds);
animator = mPipAnimationController.getAnimator(taskInfo, leash, currentBounds,
currentBounds, destinationBounds, sourceHintRect, TRANSITION_DIRECTION_TO_PIP,
0 /* startingAngle */, Surface.ROTATION_0);