Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fa66973d authored by Sally Yuen's avatar Sally Yuen Committed by Android (Google) Code Review
Browse files

Merge "Remove a check for hovered child when dispatching events to TouchDelegates" into main

parents 6a5eb0f8 51ac901b
Loading
Loading
Loading
Loading
+27 −10
Original line number Diff line number Diff line
@@ -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,12 +17521,27 @@ 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 (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 (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
@@ -17533,6 +17549,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
                    mHoveringTouchDelegate = false;
                }
            }
        }
        switch (action) {
            case MotionEvent.ACTION_HOVER_MOVE:
                if (oldHoveringTouchDelegate && mHoveringTouchDelegate) {
+7 −0
Original line number Diff line number Diff line
@@ -127,6 +127,13 @@ flag {
    bug: "277305460"
}

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"