diff options
| -rw-r--r-- | core/java/android/view/View.java | 37 | ||||
| -rw-r--r-- | core/java/android/view/accessibility/flags/accessibility_flags.aconfig | 7 |
2 files changed, 34 insertions, 10 deletions
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 82a7e162dc2d..a23e3839c348 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -30,6 +30,7 @@ import static android.view.Surface.FRAME_RATE_COMPATIBILITY_FIXED_SOURCE; import static android.view.Surface.FRAME_RATE_COMPATIBILITY_GTE; import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD; import static android.view.accessibility.AccessibilityEvent.CONTENT_CHANGE_TYPE_UNDEFINED; +import static android.view.accessibility.Flags.removeChildHoverCheckForTouchExploration; import static android.view.displayhash.DisplayHashResultCallback.DISPLAY_HASH_ERROR_INVALID_BOUNDS; import static android.view.displayhash.DisplayHashResultCallback.DISPLAY_HASH_ERROR_MISSING_WINDOW; import static android.view.displayhash.DisplayHashResultCallback.DISPLAY_HASH_ERROR_NOT_VISIBLE_ON_SCREEN; @@ -17486,9 +17487,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * Dispatching hover events to {@link TouchDelegate} to improve accessibility. * <p> * This method is dispatching hover events to the delegate target to support explore by touch. - * Similar to {@link ViewGroup#dispatchTouchEvent}, this method send proper hover events to + * Similar to {@link ViewGroup#dispatchTouchEvent}, this method sends proper hover events to * the delegate target according to the pointer and the touch area of the delegate while touch - * exploration enabled. + * exploration is enabled. * </p> * * @param event The motion event dispatch to the delegate target. @@ -17520,17 +17521,33 @@ public class View implements Drawable.Callback, KeyEvent.Callback, // hover events but receive accessibility focus, it should also not delegate to these // views when hovered. if (!oldHoveringTouchDelegate) { - if ((action == MotionEvent.ACTION_HOVER_ENTER - || action == MotionEvent.ACTION_HOVER_MOVE) - && !pointInHoveredChild(event) - && pointInDelegateRegion) { - mHoveringTouchDelegate = true; + if (removeChildHoverCheckForTouchExploration()) { + if ((action == MotionEvent.ACTION_HOVER_ENTER + || action == MotionEvent.ACTION_HOVER_MOVE) && pointInDelegateRegion) { + mHoveringTouchDelegate = true; + } + } else { + if ((action == MotionEvent.ACTION_HOVER_ENTER + || action == MotionEvent.ACTION_HOVER_MOVE) + && !pointInHoveredChild(event) + && pointInDelegateRegion) { + mHoveringTouchDelegate = true; + } } } else { - if (action == MotionEvent.ACTION_HOVER_EXIT - || (action == MotionEvent.ACTION_HOVER_MOVE + if (removeChildHoverCheckForTouchExploration()) { + if (action == MotionEvent.ACTION_HOVER_EXIT + || (action == MotionEvent.ACTION_HOVER_MOVE)) { + if (!pointInDelegateRegion) { + mHoveringTouchDelegate = false; + } + } + } else { + if (action == MotionEvent.ACTION_HOVER_EXIT + || (action == MotionEvent.ACTION_HOVER_MOVE && (pointInHoveredChild(event) || !pointInDelegateRegion))) { - mHoveringTouchDelegate = false; + mHoveringTouchDelegate = false; + } } } switch (action) { diff --git a/core/java/android/view/accessibility/flags/accessibility_flags.aconfig b/core/java/android/view/accessibility/flags/accessibility_flags.aconfig index d0bc57b9afbe..44c1acc34273 100644 --- a/core/java/android/view/accessibility/flags/accessibility_flags.aconfig +++ b/core/java/android/view/accessibility/flags/accessibility_flags.aconfig @@ -128,6 +128,13 @@ flag { } flag { + namespace: "accessibility" + name: "remove_child_hover_check_for_touch_exploration" + description: "Remove a check for a hovered child that prevents touch events from being delegated to non-direct descendants" + bug: "304770837" +} + +flag { name: "skip_accessibility_warning_dialog_for_trusted_services" namespace: "accessibility" description: "Skips showing the accessibility warning dialog for trusted services." |