diff options
| author | 2023-04-19 18:48:12 +0000 | |
|---|---|---|
| committer | 2023-04-19 18:48:12 +0000 | |
| commit | 84c2fd772ea494cd4c0514289fd1cf3676c5484c (patch) | |
| tree | ab146587f5e481db4abe52900a33f648a9a7d0ed | |
| parent | a55382eb884184f7c7c9d2fb919d4c3df7d26457 (diff) | |
| parent | f924ff4f3792c014f2218135cbbb0c19a9539628 (diff) | |
Merge "Fix incorrect logic in touch explorer state transitions." into udc-dev
| -rw-r--r-- | services/accessibility/java/com/android/server/accessibility/gestures/TouchExplorer.java | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/services/accessibility/java/com/android/server/accessibility/gestures/TouchExplorer.java b/services/accessibility/java/com/android/server/accessibility/gestures/TouchExplorer.java index 9a257e54cf41..777c7c8e0da9 100644 --- a/services/accessibility/java/com/android/server/accessibility/gestures/TouchExplorer.java +++ b/services/accessibility/java/com/android/server/accessibility/gestures/TouchExplorer.java @@ -1417,20 +1417,29 @@ public class TouchExplorer extends BaseEventStreamTransformation mSendTouchExplorationEndDelayed.forceSendAndRemove(); } } - if (!mState.isTouchInteracting()) { + if (!mState.isTouchInteracting() && !mState.isDragging()) { // It makes no sense to delegate. - Slog.e(LOG_TAG, "Error: Trying to delegate from " - + mState.getStateSymbolicName(mState.getState())); + Slog.e( + LOG_TAG, + "Error: Trying to delegate from " + + mState.getStateSymbolicName(mState.getState())); return; } - mState.startDelegating(); - MotionEvent prototype = mState.getLastReceivedEvent(); - if (prototype == null) { + MotionEvent event = mState.getLastReceivedEvent(); + MotionEvent rawEvent = mState.getLastReceivedRawEvent(); + if (event == null || rawEvent == null) { Slog.d(LOG_TAG, "Unable to start delegating: unable to get last received event."); return; } int policyFlags = mState.getLastReceivedPolicyFlags(); - mDispatcher.sendDownForAllNotInjectedPointers(prototype, policyFlags); + if (mState.isDragging()) { + // Send an event to the end of the drag gesture. + mDispatcher.sendMotionEvent( + event, ACTION_UP, rawEvent, ALL_POINTER_ID_BITS, policyFlags); + } + mState.startDelegating(); + // Deliver all pointers to the view hierarchy. + mDispatcher.sendDownForAllNotInjectedPointers(event, policyFlags); } } |