Merge "PIP: Disable hover show/hide menu if accessibility service is on." into rvc-dev am: 6f6216d303

Change-Id: Ie1a778db6e89412b3a358263121662d0ac851e83
This commit is contained in:
Ben Lin
2020-04-09 18:10:50 +00:00
committed by Automerger Merge Worker

View File

@@ -592,8 +592,14 @@ public class PipTouchHandler {
break; break;
} }
case MotionEvent.ACTION_HOVER_ENTER: case MotionEvent.ACTION_HOVER_ENTER:
mMenuController.showMenu(MENU_STATE_FULL, mMotionHelper.getBounds(), // If Touch Exploration is enabled, some a11y services (e.g. Talkback) is probably
mMovementBounds, false /* allowMenuTimeout */, false /* willResizeMenu */); // 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: { case MotionEvent.ACTION_HOVER_MOVE: {
if (!shouldDeliverToMenu && !mSendingHoverAccessibilityEvents) { if (!shouldDeliverToMenu && !mSendingHoverAccessibilityEvents) {
sendAccessibilityHoverEvent(AccessibilityEvent.TYPE_VIEW_HOVER_ENTER); sendAccessibilityHoverEvent(AccessibilityEvent.TYPE_VIEW_HOVER_ENTER);
@@ -602,7 +608,12 @@ public class PipTouchHandler {
break; break;
} }
case MotionEvent.ACTION_HOVER_EXIT: { 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) { if (!shouldDeliverToMenu && mSendingHoverAccessibilityEvents) {
sendAccessibilityHoverEvent(AccessibilityEvent.TYPE_VIEW_HOVER_EXIT); sendAccessibilityHoverEvent(AccessibilityEvent.TYPE_VIEW_HOVER_EXIT);
mSendingHoverAccessibilityEvents = false; mSendingHoverAccessibilityEvents = false;