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

Commit fd9bbd5a authored by Ameer Armaly's avatar Ameer Armaly
Browse files

TouchExplorer: Send hover events based on the event stream.

Previously there were a few areas where we sent hover events based on the internal state of TouchExplorer.
The issue is that when doing gesture detection in talkback, the state is no longer necessarily accurate in relation to the event stream.
The event stream is the source of truth for crashes.

Flag: send_hover_events_based_on_event_stream
Fix: 314251047
Test: atest FrameworksServicesTests:TouchExplorerTest CtsAccessibilityServiceTestCases:TouchExplorer
Test

Change-Id: Id34aaaea94b4ea81be9d4341761f9163a06f5865
parent af27ba90
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -126,3 +126,12 @@ flag {
    description: "Sends accessibility events in TouchExplorer#onAccessibilityEvent based on internal state to keep it consistent. This reduces test flakiness."
    bug: "295575684"
}
flag {
    name: "send_hover_events_based_on_event_stream"
    namespace: "accessibility"
    description: "Send hover enter and exit based on the state of the hover event stream rather than the internal state of the touch explorer state machine. Because of the nondeterministic nature of gesture detection when done in talkback, relying on the internal state can cause crashes."
    bug: "314251047"
    metadata {
        purpose: PURPOSE_BUGFIX
    }
}
+5 −2
Original line number Diff line number Diff line
@@ -240,7 +240,7 @@ public class TouchExplorer extends BaseEventStreamTransformation
    }

    private void clear(MotionEvent event, int policyFlags) {
        if (mState.isTouchExploring()) {
        if (mState.isTouchExploring() || Flags.sendHoverEventsBasedOnEventStream()) {
            // If a touch exploration gesture is in progress send events for its end.
            sendHoverExitAndTouchExplorationGestureEndIfNeeded(policyFlags);
        }
@@ -563,7 +563,7 @@ public class TouchExplorer extends BaseEventStreamTransformation
        mSendHoverEnterAndMoveDelayed.clear();
        mSendHoverExitDelayed.cancel();
        // If a touch exploration gesture is in progress send events for its end.
        if (mState.isTouchExploring()) {
        if (mState.isTouchExploring() || Flags.sendHoverEventsBasedOnEventStream()) {
            sendHoverExitAndTouchExplorationGestureEndIfNeeded(policyFlags);
        }
        if (mState.isClear()) {
@@ -1604,6 +1604,9 @@ public class TouchExplorer extends BaseEventStreamTransformation
            if (Flags.resetHoverEventTimerOnActionUp() && mEvents.size() == 0) {
                return;
            }
            if (Flags.sendHoverEventsBasedOnEventStream()) {
                sendHoverExitAndTouchExplorationGestureEndIfNeeded(mPolicyFlags);
            }
            // Send an accessibility event to announce the touch exploration start.
            mDispatcher.sendAccessibilityEvent(TYPE_TOUCH_EXPLORATION_GESTURE_START);
            if (isSendMotionEventsEnabled()) {