summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Maryam Dehaini <mdehaini@google.com> 2024-05-29 15:29:31 -0700
committer Maryam Dehaini <mdehaini@google.com> 2024-05-29 15:42:38 -0700
commitcd50b9a0d3c0752d4a8c373b0d1e3915c867bb05 (patch)
tree56f3fc61c78a8416808e6fdc32b8ea3cab66755b
parent592fca977abf84a465bbe324f56577ca551ec550 (diff)
Post maximize menu close runnable when any maximize menu view is exited
Currently, when we exit the maximize menu quickly when hovering, we sometimes do not receive the ACTION_HOVER_EXIT call when the following occurs: 1. User hovers over the maximize menu and we receive an ACTION_HOVER_ENTER. 2. User quickly exits the menu by hovering downwards and hovers over one of the maximize menu's buttons. We recieve a ACTION_HOVER_ENTER and then a ACTION_HOVER_EXIT from the view. 3. Given the small margin below the button and the speed at which the hover occurs, the maximize menu view does not register the hover so we never receive the ACTION_HOVER_EXIT. Therefore, the close menu runnable is never posted. To fix this issue, this change has the listener post the close menu runnable whenever any menu view is exited and removes the callback if there is an ACTION_HOVER_MOVE over any view to assure that we do not prematurely close the menu when we exit a button in the menu without fully exiting the menu. Bug: 327677202 Test: Open the menu by hovering over the maximize button and quickly exit. Change-Id: I43c541c168bb67b2613b96ecf4bb85d245cab061
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModel.java9
1 files changed, 6 insertions, 3 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModel.java b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModel.java
index 10ab13a74042..f579606cb178 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModel.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModel.java
@@ -588,17 +588,20 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel {
} else if (ev.getAction() == ACTION_HOVER_MOVE
&& MaximizeMenu.Companion.isMaximizeMenuView(id)) {
decoration.onMaximizeMenuHoverMove(id, ev);
+ mMainHandler.removeCallbacks(mCloseMaximizeWindowRunnable);
} else if (ev.getAction() == ACTION_HOVER_EXIT) {
if (!decoration.isMaximizeMenuActive() && id == R.id.maximize_window) {
decoration.onMaximizeWindowHoverExit();
- } else if (id == R.id.maximize_window || id == R.id.maximize_menu) {
+ } else if (id == R.id.maximize_window
+ || MaximizeMenu.Companion.isMaximizeMenuView(id)) {
// Close menu if not hovering over maximize menu or maximize button after a
// delay to give user a chance to re-enter view or to move from one maximize
// menu view to another.
mMainHandler.postDelayed(mCloseMaximizeWindowRunnable,
CLOSE_MAXIMIZE_MENU_DELAY_MS);
- } else if (MaximizeMenu.Companion.isMaximizeMenuView(id)) {
- decoration.onMaximizeMenuHoverExit(id, ev);
+ if (id != R.id.maximize_window) {
+ decoration.onMaximizeMenuHoverExit(id, ev);
+ }
}
return true;
}