summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Hongwei Wang <hwwang@google.com> 2023-08-08 03:03:39 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2023-08-08 03:03:39 +0000
commita415e44d5bbdec3bf0a169ec8c40d4e1104e6c39 (patch)
tree3ba9df79104768c2437e8b87a7424be9cbe6a77a
parentc1aa2bb3604d9fb46ad5414109028198af378456 (diff)
parenta54d763886ffd69aa14360dc999c76cd2af263f2 (diff)
Merge "[RESTRICT AUTOMERGE] Ignore small source rect hint" into rvc-dev
-rw-r--r--packages/SystemUI/src/com/android/systemui/pip/PipTaskOrganizer.java12
1 files changed, 8 insertions, 4 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/pip/PipTaskOrganizer.java b/packages/SystemUI/src/com/android/systemui/pip/PipTaskOrganizer.java
index ae3269fbc19b..7b0a40af4ce0 100644
--- a/packages/SystemUI/src/com/android/systemui/pip/PipTaskOrganizer.java
+++ b/packages/SystemUI/src/com/android/systemui/pip/PipTaskOrganizer.java
@@ -387,7 +387,8 @@ public class PipTaskOrganizer extends TaskOrganizer implements
final Rect currentBounds = mTaskInfo.configuration.windowConfiguration.getBounds();
if (mOneShotAnimationType == ANIM_TYPE_BOUNDS) {
- final Rect sourceHintRect = getValidSourceHintRect(info, currentBounds);
+ final Rect sourceHintRect = getValidSourceHintRect(info, currentBounds,
+ destinationBounds);
scheduleAnimateResizePip(currentBounds, destinationBounds, sourceHintRect,
TRANSITION_DIRECTION_TO_PIP, mEnterExitAnimationDuration,
null /* updateBoundsCallback */);
@@ -401,14 +402,17 @@ public class PipTaskOrganizer extends TaskOrganizer implements
/**
* 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
&& info.pictureInPictureParams.hasSourceBoundsHint()
? info.pictureInPictureParams.getSourceRectHint()
: null;
- if (sourceHintRect != null && sourceBounds.contains(sourceHintRect)) {
+ if (sourceHintRect != null && sourceBounds.contains(sourceHintRect)
+ && sourceHintRect.width() > destinationBounds.width()
+ && sourceHintRect.height() > destinationBounds.height()) {
return sourceHintRect;
}
return null;