TouchExplorer: remove dependency on AccessibilityGestureDetector#firstTapDetected.
Since we have proper states now this only serves as extra coupling to the gesture detector. Bug: 136131815 Test: atest CtsAccessibilityTestCases CtsAccessibilityServiceTestCases Test: atest FrameworksServicesTests:TouchExplorerTest Change-Id: I3be0f05e6492abad6a79f5167aaa61325dc5e9e6
This commit is contained in:
@@ -408,9 +408,6 @@ class AccessibilityGestureDetector extends GestureDetector.SimpleOnGestureListen
|
||||
cancelGesture();
|
||||
}
|
||||
|
||||
public boolean firstTapDetected() {
|
||||
return mFirstTapDetected;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLongPress(MotionEvent e) {
|
||||
|
||||
@@ -411,24 +411,12 @@ public class TouchExplorer extends BaseEventStreamTransformation
|
||||
// we resent the delayed callback and wait again.
|
||||
mSendHoverEnterAndMoveDelayed.cancel();
|
||||
mSendHoverExitDelayed.cancel();
|
||||
|
||||
// If a touch exploration gesture is in progress send events for its end.
|
||||
if (mState.isTouchExploring()) {
|
||||
sendHoverExitAndTouchExplorationGestureEndIfNeeded(policyFlags);
|
||||
}
|
||||
|
||||
// Avoid duplicated TYPE_TOUCH_INTERACTION_START event when 2nd tap of double
|
||||
// tap.
|
||||
if (!mGestureDetector.firstTapDetected() && mState.isClear()) {
|
||||
mSendTouchExplorationEndDelayed.forceSendAndRemove();
|
||||
mSendTouchInteractionEndDelayed.forceSendAndRemove();
|
||||
mDispatcher.sendAccessibilityEvent(AccessibilityEvent.TYPE_TOUCH_INTERACTION_START);
|
||||
} else {
|
||||
// Let gesture to handle to avoid duplicated TYPE_TOUCH_INTERACTION_END event.
|
||||
mSendTouchInteractionEndDelayed.cancel();
|
||||
}
|
||||
|
||||
if (!mGestureDetector.firstTapDetected() && !mState.isTouchExploring()) {
|
||||
if (mState.isClear()) {
|
||||
if (!mSendHoverEnterAndMoveDelayed.isPending()) {
|
||||
// Queue a delayed transition to STATE_TOUCH_EXPLORING.
|
||||
// If we do not detect that this is a gesture, delegation or drag the transition
|
||||
@@ -441,6 +429,12 @@ public class TouchExplorer extends BaseEventStreamTransformation
|
||||
// Cache the event until we discern exploration from gesturing.
|
||||
mSendHoverEnterAndMoveDelayed.addEvent(event, rawEvent);
|
||||
}
|
||||
mSendTouchExplorationEndDelayed.forceSendAndRemove();
|
||||
mSendTouchInteractionEndDelayed.forceSendAndRemove();
|
||||
mDispatcher.sendAccessibilityEvent(AccessibilityEvent.TYPE_TOUCH_INTERACTION_START);
|
||||
} else {
|
||||
// Avoid duplicated TYPE_TOUCH_INTERACTION_START event when 2nd tap of double tap.
|
||||
mSendTouchInteractionEndDelayed.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user