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

Commit 29a71157 authored by Ameer Armaly's avatar Ameer Armaly Committed by Automerger Merge Worker
Browse files

[RESTRICT AUTOMERGE] Fix the consistency of the event stream during...

[RESTRICT AUTOMERGE] Fix the consistency of the event stream during interrupted and continued touch exploration. am: 7e765885

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2684569



Change-Id: I072db922df1e960e095b00a093af7799185c1836
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 4b13bda7 7e765885
Loading
Loading
Loading
Loading
+15 −4
Original line number Diff line number Diff line
@@ -634,7 +634,7 @@ public class TouchExplorer extends BaseEventStreamTransformation
            MotionEvent event, MotionEvent rawEvent, int policyFlags) {
        switch (event.getActionMasked()) {
            case ACTION_DOWN:
                // We should have already received ACTION_DOWN. Ignore.
                handleActionDownStateTouchExploring(event, rawEvent, policyFlags);
                break;
            case ACTION_POINTER_DOWN:
                handleActionPointerDown(event, rawEvent, policyFlags);
@@ -840,6 +840,15 @@ public class TouchExplorer extends BaseEventStreamTransformation
        }
    }

    private void handleActionDownStateTouchExploring(
            MotionEvent event, MotionEvent rawEvent, int policyFlags) {
        // This is an interrupted and continued touch exploration. Maintain the consistency of the
        // event stream.
        mSendTouchExplorationEndDelayed.cancel();
        mSendTouchInteractionEndDelayed.cancel();
        sendTouchExplorationGestureStartAndHoverEnterIfNeeded(policyFlags);
    }

    /**
     * Handles move events while touch exploring. this is also where we drag or delegate based on
     * the number of fingers moving on the screen.
@@ -1097,12 +1106,15 @@ public class TouchExplorer extends BaseEventStreamTransformation
    }

    /**
     * Sends the enter events if needed. Such events are hover enter and touch explore
     * gesture start.
     * Sends the enter events if needed. Such events are hover enter and touch explore gesture
     * start.
     *
     * @param policyFlags The policy flags associated with the event.
     */
    private void sendTouchExplorationGestureStartAndHoverEnterIfNeeded(int policyFlags) {
        if (!mState.isTouchExploring()) {
            mDispatcher.sendAccessibilityEvent(TYPE_TOUCH_EXPLORATION_GESTURE_START);
        }
        MotionEvent event = mState.getLastInjectedHoverEvent();
        if (event != null && event.getActionMasked() == ACTION_HOVER_EXIT) {
            final int pointerIdBits = event.getPointerIdBits();
@@ -1115,7 +1127,6 @@ public class TouchExplorer extends BaseEventStreamTransformation
        }
    }


    /**
     * Determines whether a two pointer gesture is a dragging one.
     *