Loading services/accessibility/java/com/android/server/accessibility/gestures/GestureManifold.java +2 −2 Original line number Diff line number Diff line Loading @@ -104,9 +104,9 @@ class GestureManifold implements GestureMatcher.StateChangeListener { // Shared state information. private TouchState mState; GestureManifold(Context context, Listener listener, TouchState state) { GestureManifold(Context context, Listener listener, TouchState state, Handler handler) { mContext = context; mHandler = new Handler(context.getMainLooper()); mHandler = handler; mListener = listener; mState = state; mMultiFingerGesturesEnabled = false; Loading services/accessibility/java/com/android/server/accessibility/gestures/TouchExplorer.java +11 −3 Original line number Diff line number Diff line Loading @@ -175,7 +175,7 @@ public class TouchExplorer extends BaseEventStreamTransformation AccessibilityEvent.TYPE_TOUCH_INTERACTION_END, mDetermineUserIntentTimeout); if (detector == null) { mGestureDetector = new GestureManifold(context, this, mState); mGestureDetector = new GestureManifold(context, this, mState, mHandler); } else { mGestureDetector = detector; } Loading Loading @@ -353,7 +353,6 @@ public class TouchExplorer extends BaseEventStreamTransformation public boolean onGestureStarted() { // We have to perform gesture detection, so // clear the current state and try to detect. mState.startGestureDetecting(); mSendHoverEnterAndMoveDelayed.cancel(); mSendHoverExitDelayed.cancel(); mExitGestureDetectionModeDelayed.post(); Loading Loading @@ -1107,7 +1106,7 @@ public class TouchExplorer extends BaseEventStreamTransformation } private boolean shouldPerformGestureDetection(MotionEvent event) { if (mState.isDelegating()) { if (mState.isDelegating() || mState.isDragging()) { return false; } if (event.getActionMasked() == MotionEvent.ACTION_DOWN) { Loading Loading @@ -1200,6 +1199,15 @@ public class TouchExplorer extends BaseEventStreamTransformation } public void run() { if (mReceivedPointerTracker.getReceivedPointerDownCount() > 1) { // Multi-finger touch exploration doesn't make sense. Slog.e( LOG_TAG, "Attempted touch exploration with " + mReceivedPointerTracker.getReceivedPointerDownCount() + " pointers down."); return; } // Send an accessibility event to announce the touch exploration start. mDispatcher.sendAccessibilityEvent( AccessibilityEvent.TYPE_TOUCH_EXPLORATION_GESTURE_START); Loading services/accessibility/java/com/android/server/accessibility/gestures/TouchState.java +3 −1 Original line number Diff line number Diff line Loading @@ -208,7 +208,9 @@ public class TouchState { startGestureDetecting(); break; case AccessibilityEvent.TYPE_GESTURE_DETECTION_END: startTouchInteracting(); // Clear to make sure that we don't accidentally execute passthrough, and that we // are ready for the next interaction. clear(); break; default: break; Loading services/tests/servicestests/src/com/android/server/accessibility/gestures/GestureManifoldTest.java +3 −1 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import android.accessibilityservice.AccessibilityService; import android.content.Context; import android.graphics.Point; import android.graphics.PointF; import android.os.Handler; import android.view.MotionEvent; import androidx.test.InstrumentationRegistry; Loading Loading @@ -56,7 +57,8 @@ public class GestureManifoldTest { // Construct a testable GestureManifold. mResultListener = mock(GestureManifold.Listener.class); mState = new TouchState(); mManifold = new GestureManifold(context, mResultListener, mState); Handler handler = new Handler(context.getMainLooper()); mManifold = new GestureManifold(context, mResultListener, mState, handler); // Play the role of touch explorer in updating the shared state. when(mResultListener.onGestureStarted()).thenReturn(onGestureStarted()); Loading Loading
services/accessibility/java/com/android/server/accessibility/gestures/GestureManifold.java +2 −2 Original line number Diff line number Diff line Loading @@ -104,9 +104,9 @@ class GestureManifold implements GestureMatcher.StateChangeListener { // Shared state information. private TouchState mState; GestureManifold(Context context, Listener listener, TouchState state) { GestureManifold(Context context, Listener listener, TouchState state, Handler handler) { mContext = context; mHandler = new Handler(context.getMainLooper()); mHandler = handler; mListener = listener; mState = state; mMultiFingerGesturesEnabled = false; Loading
services/accessibility/java/com/android/server/accessibility/gestures/TouchExplorer.java +11 −3 Original line number Diff line number Diff line Loading @@ -175,7 +175,7 @@ public class TouchExplorer extends BaseEventStreamTransformation AccessibilityEvent.TYPE_TOUCH_INTERACTION_END, mDetermineUserIntentTimeout); if (detector == null) { mGestureDetector = new GestureManifold(context, this, mState); mGestureDetector = new GestureManifold(context, this, mState, mHandler); } else { mGestureDetector = detector; } Loading Loading @@ -353,7 +353,6 @@ public class TouchExplorer extends BaseEventStreamTransformation public boolean onGestureStarted() { // We have to perform gesture detection, so // clear the current state and try to detect. mState.startGestureDetecting(); mSendHoverEnterAndMoveDelayed.cancel(); mSendHoverExitDelayed.cancel(); mExitGestureDetectionModeDelayed.post(); Loading Loading @@ -1107,7 +1106,7 @@ public class TouchExplorer extends BaseEventStreamTransformation } private boolean shouldPerformGestureDetection(MotionEvent event) { if (mState.isDelegating()) { if (mState.isDelegating() || mState.isDragging()) { return false; } if (event.getActionMasked() == MotionEvent.ACTION_DOWN) { Loading Loading @@ -1200,6 +1199,15 @@ public class TouchExplorer extends BaseEventStreamTransformation } public void run() { if (mReceivedPointerTracker.getReceivedPointerDownCount() > 1) { // Multi-finger touch exploration doesn't make sense. Slog.e( LOG_TAG, "Attempted touch exploration with " + mReceivedPointerTracker.getReceivedPointerDownCount() + " pointers down."); return; } // Send an accessibility event to announce the touch exploration start. mDispatcher.sendAccessibilityEvent( AccessibilityEvent.TYPE_TOUCH_EXPLORATION_GESTURE_START); Loading
services/accessibility/java/com/android/server/accessibility/gestures/TouchState.java +3 −1 Original line number Diff line number Diff line Loading @@ -208,7 +208,9 @@ public class TouchState { startGestureDetecting(); break; case AccessibilityEvent.TYPE_GESTURE_DETECTION_END: startTouchInteracting(); // Clear to make sure that we don't accidentally execute passthrough, and that we // are ready for the next interaction. clear(); break; default: break; Loading
services/tests/servicestests/src/com/android/server/accessibility/gestures/GestureManifoldTest.java +3 −1 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import android.accessibilityservice.AccessibilityService; import android.content.Context; import android.graphics.Point; import android.graphics.PointF; import android.os.Handler; import android.view.MotionEvent; import androidx.test.InstrumentationRegistry; Loading Loading @@ -56,7 +57,8 @@ public class GestureManifoldTest { // Construct a testable GestureManifold. mResultListener = mock(GestureManifold.Listener.class); mState = new TouchState(); mManifold = new GestureManifold(context, mResultListener, mState); Handler handler = new Handler(context.getMainLooper()); mManifold = new GestureManifold(context, mResultListener, mState, handler); // Play the role of touch explorer in updating the shared state. when(mResultListener.onGestureStarted()).thenReturn(onGestureStarted()); Loading