diff options
| author | 2021-06-29 12:18:41 -0700 | |
|---|---|---|
| committer | 2021-06-30 22:03:26 +0000 | |
| commit | 67760d21fd55b51ad2ff492fd1a48ff92c072ed1 (patch) | |
| tree | 647d9824a40fb2b23a60712a1f089ceb94d478fd | |
| parent | cfe4767b40382e293c69d5c6eb05696b9e638ba8 (diff) | |
PiP: Move tap-outside-hide block one level higher.
This used to be only check for drag resize case, but now that it is
disabled, this is no longer called. Move it at a higher call block so
that it is also checked for pinch resizing case.
Bug: 191529856
Test: Tap outside PIP when menu is showing, it hides
Change-Id: I810a0825a96224b395dde7d51df077fed996c3ff
Merged-In: I810a0825a96224b395dde7d51df077fed996c3ff
(cherry picked from commit 3892e8e09f79d451107c1f955025e08d3c6c2824)
| -rw-r--r-- | libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipResizeGestureHandler.java | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipResizeGestureHandler.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipResizeGestureHandler.java index f0bd8a2846ed..c816f18c2fc2 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipResizeGestureHandler.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipResizeGestureHandler.java @@ -246,10 +246,20 @@ public class PipResizeGestureHandler { } if (ev instanceof MotionEvent) { + MotionEvent mv = (MotionEvent) ev; + int action = mv.getActionMasked(); + final Rect pipBounds = mPipBoundsState.getBounds(); + if (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_CANCEL) { + if (!pipBounds.contains((int) mv.getRawX(), (int) mv.getRawY()) + && mPhonePipMenuController.isMenuVisible()) { + mPhonePipMenuController.hideMenu(); + } + } + if (mEnablePinchResize && mOngoingPinchToResize) { - onPinchResize((MotionEvent) ev); + onPinchResize(mv); } else if (mEnableDragCornerResize) { - onDragCornerResize((MotionEvent) ev); + onDragCornerResize(mv); } } } @@ -450,7 +460,6 @@ public class PipResizeGestureHandler { float x = ev.getX(); float y = ev.getY() - mOhmOffset; if (action == MotionEvent.ACTION_DOWN) { - final Rect currentPipBounds = mPipBoundsState.getBounds(); mLastResizeBounds.setEmpty(); mAllowGesture = isInValidSysUiState() && isWithinDragResizeRegion((int) x, (int) y); if (mAllowGesture) { @@ -458,11 +467,6 @@ public class PipResizeGestureHandler { mDownPoint.set(x, y); mDownBounds.set(mPipBoundsState.getBounds()); } - if (!currentPipBounds.contains((int) x, (int) y) - && mPhonePipMenuController.isMenuVisible()) { - mPhonePipMenuController.hideMenu(); - } - } else if (mAllowGesture) { switch (action) { case MotionEvent.ACTION_POINTER_DOWN: |