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

Commit 655be140 authored by Charles Chen's avatar Charles Chen Committed by Android (Google) Code Review
Browse files

Merge "When Accessibility is on, intercept touch events during dispatch." into jb-mr1-dev

parents e30c4e0b dc2ee777
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -105,15 +105,15 @@ public class AccessibleKeyboardViewProxy extends AccessibilityDelegateCompat {
    }

    /**
     * Receives motion events when touch exploration is turned on in SDK
     * versions ICS and higher.
     * Intercepts touch events before dispatch when touch exploration is turned
     * on in ICS and higher.
     *
     * @param event The motion event.
     * @param event The motion event being dispatched.
     * @return {@code true} if the event is handled
     */
    public boolean onTouchEvent(MotionEvent event) {
    public boolean dispatchTouchEvent(MotionEvent event) {
        // To avoid accidental key presses during touch exploration, always drop
        // non-hover touch events.
        // touch events generated by the user.
        return false;
    }

+8 −3
Original line number Diff line number Diff line
@@ -660,14 +660,19 @@ public class MainKeyboardView extends KeyboardView implements PointerTracker.Key
        return mOldPointerCount;
    }

    @Override
    public boolean dispatchTouchEvent(MotionEvent event) {
        if (AccessibilityUtils.getInstance().isTouchExplorationEnabled()) {
            return AccessibleKeyboardViewProxy.getInstance().dispatchTouchEvent(event);
        }
        return super.dispatchTouchEvent(event);
    }

    @Override
    public boolean onTouchEvent(final MotionEvent me) {
        if (getKeyboard() == null) {
            return false;
        }
        if (AccessibilityUtils.getInstance().isTouchExplorationEnabled()) {
            return AccessibleKeyboardViewProxy.getInstance().onTouchEvent(me);
        }
        return mTouchScreenRegulator.onTouchEvent(me);
    }