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

Commit 89844eb2 authored by Camden Bickel's avatar Camden Bickel Committed by Android (Google) Code Review
Browse files

Merge "Cleanup flag "always_allow_observing_touch_events"" into main

parents 5d0f719c 9f112286
Loading
Loading
Loading
Loading
+3 −26
Original line number Diff line number Diff line
@@ -1180,7 +1180,6 @@ class AccessibilityInputFilter extends InputFilter implements EventStreamTransfo
    }

    private boolean anyServiceWantsGenericMotionEvent(MotionEvent event) {
        if (Flags.alwaysAllowObservingTouchEvents()) {
        final boolean isTouchEvent = event.isFromSource(InputDevice.SOURCE_TOUCHSCREEN);
        if (isTouchEvent && !canShareGenericTouchEvent()) {
            return false;
@@ -1188,33 +1187,11 @@ class AccessibilityInputFilter extends InputFilter implements EventStreamTransfo
        final int eventSourceWithoutClass = event.getSource() & ~InputDevice.SOURCE_CLASS_MASK;
        return (mCombinedGenericMotionEventSources & eventSourceWithoutClass) != 0;
    }
        // Disable SOURCE_TOUCHSCREEN generic event interception if any service is performing
        // touch exploration.
        if (event.isFromSource(InputDevice.SOURCE_TOUCHSCREEN)
                && (mEnabledFeatures & FLAG_FEATURE_TOUCH_EXPLORATION) != 0) {
            return false;
        }
        final int eventSourceWithoutClass = event.getSource() & ~InputDevice.SOURCE_CLASS_MASK;
        return (mCombinedGenericMotionEventSources & eventSourceWithoutClass) != 0;
    }

    private boolean anyServiceWantsToObserveMotionEvent(MotionEvent event) {
        if (Flags.alwaysAllowObservingTouchEvents()) {
        final int eventSourceWithoutClass = event.getSource() & ~InputDevice.SOURCE_CLASS_MASK;
        return (mCombinedMotionEventObservedSources & eventSourceWithoutClass) != 0;
    }
        // Disable SOURCE_TOUCHSCREEN generic event interception if any service is performing
        // touch exploration.
        if (event.isFromSource(InputDevice.SOURCE_TOUCHSCREEN)
                && (mEnabledFeatures & FLAG_FEATURE_TOUCH_EXPLORATION) != 0) {
            return false;
        }
        final int eventSourceWithoutClass = event.getSource() & ~InputDevice.SOURCE_CLASS_MASK;
        return (mCombinedGenericMotionEventSources
                & mCombinedMotionEventObservedSources
                & eventSourceWithoutClass)
                != 0;
    }

    private boolean canShareGenericTouchEvent() {
        if ((mCombinedMotionEventObservedSources & InputDevice.SOURCE_TOUCHSCREEN) != 0) {