From a997c886e32f1ada236b1671d188c1b72e51f25e Mon Sep 17 00:00:00 2001 From: "jorgegil@google.com" <jorgegil@google.com> Date: Fri, 12 Feb 2021 14:22:56 -0800 Subject: [PATCH] Hide the Pip menu on drag resize, expand and dismiss - In drag resize, removes the call to #hideMenuWithoutResize since that only triggered a menu state change but didn't actually hide the menu view. The following call to hideMenu would also no-op because of it. Instead, just call hideMenu with resize=false. This will actually hide the menu view and then update the state. - During expand pip, also use hideMenu(animate, resize) to really hide the menu view - do not animate in this scenario - During dismiss pip, also use hideMenu(animate, resize) to really hide the menu view - do animate the menu fade here Bug: 178391622 Test: Expand, dismiss, drag resize - make sure the menu hides correctly Change-Id: Ia84b998e275506f22dd40c977fcd2d87ba63c45a --- .../wm/shell/pip/phone/PhonePipMenuController.java | 9 --------- .../com/android/wm/shell/pip/phone/PipMotionHelper.java | 4 ++-- .../wm/shell/pip/phone/PipResizeGestureHandler.java | 4 ++-- 3 files changed, 4 insertions(+), 13 deletions(-) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PhonePipMenuController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PhonePipMenuController.java index a1eeca1f93e3..725f87d93e4e 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PhonePipMenuController.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PhonePipMenuController.java @@ -415,15 +415,6 @@ public class PhonePipMenuController implements PipMenuController { } } - /** - * Preemptively mark the menu as invisible, used when we are directly manipulating the pinned - * stack and don't want to trigger a resize which can animate the stack in a conflicting way - * (ie. when manually expanding or dismissing). - */ - public void hideMenuWithoutResize() { - onMenuStateChanged(MENU_STATE_NONE, false /* resize */, null /* callback */); - } - /** * Sets the menu actions to the actions provided by the current PiP menu. */ diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipMotionHelper.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipMotionHelper.java index b19dcae2def8..4bcd76fdf4e6 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipMotionHelper.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipMotionHelper.java @@ -325,7 +325,7 @@ public class PipMotionHelper implements PipAppOpsListener.Callback, + " callers=\n" + Debug.getCallers(5, " ")); } cancelPhysicsAnimation(); - mMenuController.hideMenuWithoutResize(); + mMenuController.hideMenu(false /* animate */, false /* resize */); mPipTaskOrganizer.exitPip(skipAnimation ? 0 : LEAVE_PIP_DURATION); } @@ -338,7 +338,7 @@ public class PipMotionHelper implements PipAppOpsListener.Callback, Log.d(TAG, "removePip: callers=\n" + Debug.getCallers(5, " ")); } cancelPhysicsAnimation(); - mMenuController.hideMenuWithoutResize(); + mMenuController.hideMenu(true /* animate*/, false /* resize */); mPipTaskOrganizer.removePip(); } 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 1ef9ffa494f4..6740ce3a3bdf 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 @@ -516,8 +516,8 @@ public class PipResizeGestureHandler { } if (mThresholdCrossed) { if (mPhonePipMenuController.isMenuVisible()) { - mPhonePipMenuController.hideMenuWithoutResize(); - mPhonePipMenuController.hideMenu(); + mPhonePipMenuController.hideMenu(false /* animate */, + false /* resize */); } final Rect currentPipBounds = mPipBoundsState.getBounds(); mLastResizeBounds.set(TaskResizingAlgorithm.resizeDrag(x, y, -- GitLab