summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
author jorgegil@google.com <jorgegil@google.com> 2021-05-20 13:26:55 -0700
committer jorgegil@google.com <jorgegil@google.com> 2021-05-20 13:26:55 -0700
commit553bfd91619b41f3099f21cefa8d3eedcf669a09 (patch)
treef6e872f2e1460b13f273e111b9f1e9384bc85b48 /libs
parenta025621bcd3233a4ffab1269d8b640fa40dab165 (diff)
Expand PIP to the normal size when menu actions don't fit
Instead of resizing to bounds larger than the default size when the menu is shown, resize to the normal/default bounds instead. Also, remove the unused animateToMinimizedState() method. Bug: 184789365 Test: enter PIP, pinch resize to min size, tap to poke menu - verify that PIP expands to the default size Change-Id: Ib0d7780fce2ec9157fb0f533d67b175ce699f40b
Diffstat (limited to 'libs')
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipTouchHandler.java21
1 files changed, 7 insertions, 14 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipTouchHandler.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipTouchHandler.java
index f2e250aeb509..9aee95cf9a9f 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipTouchHandler.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipTouchHandler.java
@@ -666,7 +666,9 @@ public class PipTouchHandler {
// we store back to this snap fraction. Otherwise, we'll reset the snap
// fraction and snap to the closest edge.
if (resize) {
- animateToExpandedState(callback);
+ // PIP is too small to show the menu actions and thus needs to be resized to a
+ // size that can fit them all. Resize to the default size.
+ animateToNormalSize(callback);
}
} else if (menuState == MENU_STATE_NONE && mMenuState == MENU_STATE_FULL) {
// Try and restore the PiP to the closest edge, using the saved snap fraction
@@ -720,22 +722,13 @@ public class PipTouchHandler {
callback);
}
- private void animateToMinimizedState() {
- animateToUnexpandedState(new Rect(0, 0, mPipBoundsState.getMinSize().x,
- mPipBoundsState.getMinSize().y));
- }
-
- private void animateToExpandedState(Runnable callback) {
+ private void animateToNormalSize(Runnable callback) {
mPipResizeGestureHandler.setUserResizeBounds(mPipBoundsState.getBounds());
- final Rect currentBounds = mPipBoundsState.getBounds();
- final Rect expandedBounds = mPipBoundsState.getExpandedBounds();
- Rect finalExpandedBounds = new Rect(expandedBounds.width() > expandedBounds.width()
- && expandedBounds.height() > expandedBounds.height()
- ? currentBounds : expandedBounds);
+ final Rect normalBounds = new Rect(mPipBoundsState.getNormalBounds());
Rect restoredMovementBounds = new Rect();
- mPipBoundsAlgorithm.getMovementBounds(finalExpandedBounds,
+ mPipBoundsAlgorithm.getMovementBounds(normalBounds,
mInsetBounds, restoredMovementBounds, mIsImeShowing ? mImeHeight : 0);
- mSavedSnapFraction = mMotionHelper.animateToExpandedState(finalExpandedBounds,
+ mSavedSnapFraction = mMotionHelper.animateToExpandedState(normalBounds,
mPipBoundsState.getMovementBounds(), restoredMovementBounds, callback);
}