MenuController ignore touch if owner wants gesture
Gesture recognizer handles touches in two phases: event pre-dispatch and post-dispatch. Closing MenuHost during dispatching skips the post-dispatch phase because target (MenuHost) is destroyed. As a result, the touch is never acked and gesture recognizer stops generating any further gestures. The above problem could be resolved either by asynchronously closing the menu, or manually ack the touch event. The next problem is that MenuController could not mark the touch event as handled. Otherwise, gesture recognizer cancels the current sequence without GESTURE_END event and breaks the owner's expectation. If MenuController does not mark the touch as handled, gesture recognizer would then translate the 2nd touch pressed into a two-finger tap and causing the menu to flash because it is shown again. Given all that, a reasonable fix would be make MenuController to skip touch events handling when the owner wants the current gesture sequence. The problems would not happen if MenuHost is not closed in middle of touch events dispatching. Side effect is that menu is no longer closed on the 2nd figure down and could only be closed after all figures are lifted, which is probably okay. Bug: 874215 Test: MenuControllerTest.NoTouchCloseWhenSendingGesturesToOwner Change-Id: I1818b6c35c80006c999f96ddbea38fd1f79948c3 Reviewed-on: https://chromium-review.googlesource.com/1179250Reviewed-by:Michael Wasserman <msw@chromium.org> Commit-Queue: Xiyuan Xia <xiyuan@chromium.org> Cr-Commit-Position: refs/heads/master@{#584519}
Showing
Please register or sign in to comment