[RESTRICT AUTOMERGE] Ignore small source rect hint am: a54d763886

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

Change-Id: I1e3f37ca0afec74271252f9c7fed24169b58bb49
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:52:03 +00:00
committed by Automerger Merge Worker

View File

@@ -442,7 +442,8 @@ public class PipTaskOrganizer extends TaskOrganizer implements
final Rect currentBounds = mTaskInfo.configuration.windowConfiguration.getBounds(); final Rect currentBounds = mTaskInfo.configuration.windowConfiguration.getBounds();
if (mOneShotAnimationType == ANIM_TYPE_BOUNDS) { if (mOneShotAnimationType == ANIM_TYPE_BOUNDS) {
final Rect sourceHintRect = getValidSourceHintRect(info, currentBounds); final Rect sourceHintRect = getValidSourceHintRect(info, currentBounds,
destinationBounds);
scheduleAnimateResizePip(currentBounds, destinationBounds, sourceHintRect, scheduleAnimateResizePip(currentBounds, destinationBounds, sourceHintRect,
TRANSITION_DIRECTION_TO_PIP, mEnterExitAnimationDuration, TRANSITION_DIRECTION_TO_PIP, mEnterExitAnimationDuration,
null /* updateBoundsCallback */); null /* updateBoundsCallback */);
@@ -457,14 +458,17 @@ public class PipTaskOrganizer extends TaskOrganizer implements
/** /**
* Returns the source hint rect if it is valid (if provided and is contained by the current * Returns the source hint rect if it is valid (if provided and is contained by the current
* task bounds). * task bounds and not too small).
*/ */
private Rect getValidSourceHintRect(ActivityManager.RunningTaskInfo info, Rect sourceBounds) { private Rect getValidSourceHintRect(ActivityManager.RunningTaskInfo info, Rect sourceBounds,
Rect destinationBounds) {
final Rect sourceHintRect = info.pictureInPictureParams != null final Rect sourceHintRect = info.pictureInPictureParams != null
&& info.pictureInPictureParams.hasSourceBoundsHint() && info.pictureInPictureParams.hasSourceBoundsHint()
? info.pictureInPictureParams.getSourceRectHint() ? info.pictureInPictureParams.getSourceRectHint()
: null; : null;
if (sourceHintRect != null && sourceBounds.contains(sourceHintRect)) { if (sourceHintRect != null && sourceBounds.contains(sourceHintRect)
&& sourceHintRect.width() > destinationBounds.width()
&& sourceHintRect.height() > destinationBounds.height()) {
return sourceHintRect; return sourceHintRect;
} }
return null; return null;