PIP: Disable hover show/hide menu if accessibility service is on.
With accessibility services on (e.g. Talkback), some MotionEvents get transformed into HoverEvents. Notably in the case of TalkBack, tapping on PIP will generate a pair of Hover enter/exit event, which then causes the menu to immediately show/hide, and the user is unable to do anything. We will disable the hover behavior for Accessibility services, and allow TalkBack users and such to open the menu via other menus (just tapping it twice so it shows menu similiar to a regular user flow). Bug: 152588263 Test: Enable talkback, enter PIP, tap once and then again - menu shows Change-Id: I28c8faa0032bc2c7b8fa1ef5a9efde94a590293e
This commit is contained in:
@@ -413,8 +413,14 @@ public class PipTouchHandler {
|
||||
break;
|
||||
}
|
||||
case MotionEvent.ACTION_HOVER_ENTER:
|
||||
mMenuController.showMenu(MENU_STATE_FULL, mMotionHelper.getBounds(),
|
||||
mMovementBounds, false /* allowMenuTimeout */, false /* willResizeMenu */);
|
||||
// If Touch Exploration is enabled, some a11y services (e.g. Talkback) is probably
|
||||
// on and changing MotionEvents into HoverEvents.
|
||||
// Let's not enable menu show/hide for a11y services.
|
||||
if (!mAccessibilityManager.isTouchExplorationEnabled()) {
|
||||
mMenuController.showMenu(MENU_STATE_FULL, mMotionHelper.getBounds(),
|
||||
mMovementBounds, false /* allowMenuTimeout */,
|
||||
false /* willResizeMenu */);
|
||||
}
|
||||
case MotionEvent.ACTION_HOVER_MOVE: {
|
||||
if (!shouldDeliverToMenu && !mSendingHoverAccessibilityEvents) {
|
||||
sendAccessibilityHoverEvent(AccessibilityEvent.TYPE_VIEW_HOVER_ENTER);
|
||||
@@ -423,7 +429,12 @@ public class PipTouchHandler {
|
||||
break;
|
||||
}
|
||||
case MotionEvent.ACTION_HOVER_EXIT: {
|
||||
mMenuController.hideMenu();
|
||||
// If Touch Exploration is enabled, some a11y services (e.g. Talkback) is probably
|
||||
// on and changing MotionEvents into HoverEvents.
|
||||
// Let's not enable menu show/hide for a11y services.
|
||||
if (!mAccessibilityManager.isTouchExplorationEnabled()) {
|
||||
mMenuController.hideMenu();
|
||||
}
|
||||
if (!shouldDeliverToMenu && mSendingHoverAccessibilityEvents) {
|
||||
sendAccessibilityHoverEvent(AccessibilityEvent.TYPE_VIEW_HOVER_EXIT);
|
||||
mSendingHoverAccessibilityEvents = false;
|
||||
|
||||
Reference in New Issue
Block a user