summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author TreeHugger Robot <treehugger-gerrit@google.com> 2020-10-13 22:47:49 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2020-10-13 22:47:49 +0000
commit7c4bea4b7012eb1f1aee359a8b8226efcbada986 (patch)
treefabfb15ad7b5f612d0b473b0df2f1429a00b23eb
parentff4dd01b46cb905a75be8fab79065f37f549d199 (diff)
parent5f6523cdf4b534835de727aa83ca4cccb2ea19a0 (diff)
Merge "Revert "Use out pipBounds to save reentry size""
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipController.java14
1 files changed, 13 insertions, 1 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipController.java
index fd5bf422188f..d191c980375c 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipController.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipController.java
@@ -63,6 +63,7 @@ public class PipController implements Pip, PipTaskOrganizer.PipTransitionCallbac
private final DisplayInfo mTmpDisplayInfo = new DisplayInfo();
private final Rect mTmpInsetBounds = new Rect();
private final Rect mTmpNormalBounds = new Rect();
+ protected final Rect mReentryBounds = new Rect();
private DisplayController mDisplayController;
private PipAppOpsListener mAppOpsListener;
@@ -401,7 +402,8 @@ public class PipController implements Pip, PipTaskOrganizer.PipTransitionCallbac
public void onPipTransitionStarted(ComponentName activity, int direction, Rect pipBounds) {
if (isOutPipDirection(direction)) {
// Exiting PIP, save the reentry bounds to restore to when re-entering.
- mPipBoundsHandler.onSaveReentryBounds(activity, pipBounds);
+ updateReentryBounds(pipBounds);
+ mPipBoundsHandler.onSaveReentryBounds(activity, mReentryBounds);
}
// Disable touches while the animation is running
mTouchHandler.setTouchEnabled(false);
@@ -410,6 +412,16 @@ public class PipController implements Pip, PipTaskOrganizer.PipTransitionCallbac
}
}
+ /**
+ * Update the bounds used to save the re-entry size and snap fraction when exiting PIP.
+ */
+ public void updateReentryBounds(Rect bounds) {
+ final Rect reentryBounds = mTouchHandler.getUserResizeBounds();
+ float snapFraction = mPipBoundsHandler.getSnapFraction(bounds);
+ mPipBoundsHandler.applySnapFraction(reentryBounds, snapFraction);
+ mReentryBounds.set(reentryBounds);
+ }
+
@Override
public void onPipTransitionFinished(ComponentName activity, int direction) {
onPipTransitionFinishedOrCanceled(direction);