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

Commit 35b7f967 authored by Ameer Armaly's avatar Ameer Armaly
Browse files

TouchExplorer: reset hover event timer on ACTION_UP.

This insures that users have the correct interval between taps.
Fix: 326260351
Flag: reset_hover_event_timer_on_action_up
Test: atest TouchExplorerTest  -- --test-arg com.android.tradefed.testtype.AndroidJUnitTest:instrumentation-arg:randomize:=true --test-arg com.android.tradefed.testtype.AndroidJUnitTest:instrumentation-arg:randomSeed:=-9204845749734110277

Change-Id: I82a8dc36d956b8d184f30554f3721946f2eb61d0
parent 77c6fd2c
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -79,6 +79,16 @@ flag {
    bug: "286587811"
}

flag {
    name: "reset_hover_event_timer_on_action_up"
    namespace: "accessibility"
    description: "Reset the timer for sending hover events on receiving ACTION_UP to guarantee the correct amount of time is available between taps."
    bug: "326260351"
    metadata {
        purpose: PURPOSE_BUGFIX
    }
}

flag {
    name: "scan_packages_without_lock"
    namespace: "accessibility"
+13 −0
Original line number Diff line number Diff line
@@ -852,6 +852,11 @@ public class TouchExplorer extends BaseEventStreamTransformation
        final int pointerIdBits = (1 << pointerId);
        if (mSendHoverEnterAndMoveDelayed.isPending()) {
            // If we have not delivered the enter schedule an exit.
            if (Flags.resetHoverEventTimerOnActionUp()) {
                // We cancel first to reset the time window so that the user has the full amount of
                // time to do a multi tap.
                mSendHoverEnterAndMoveDelayed.repost();
            }
            mSendHoverExitDelayed.post(event, rawEvent, pointerIdBits, policyFlags);
        } else {
            // The user is touch exploring so we send events for end.
@@ -1554,6 +1559,14 @@ public class TouchExplorer extends BaseEventStreamTransformation
            }
        }

        public void repost() {
            // cancel without clearing
            if (isPending()) {
                mHandler.removeCallbacks(this);
                mHandler.postDelayed(this, mDetermineUserIntentTimeout);
            }
        }

        private boolean isPending() {
            return mHandler.hasCallbacks(this);
        }