Skip to content

Commit aeb8d0e

Browse files
committed
Up motion event not injected by the touch explorer at the end of a drag.
1. The up event was not injected when the last pointer went up, i.e. at the end of the drag. This patch sends an up event if the dragging pointer goes up for both cases, when the dragging pointer goes up first and when it goes up second. bug:7272830 Change-Id: I708a2b93ee2d0a4c46dbeea002841666e919602d
1 parent 0944d62 commit aeb8d0e

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

services/java/com/android/server/accessibility/TouchExplorer.java

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ class TouchExplorer implements EventStreamTransformation {
198198
private GestureLibrary mGestureLibrary;
199199

200200
// The long pressing pointer id if coordinate remapping is needed.
201-
private int mLongPressingPointerId;
201+
private int mLongPressingPointerId = -1;
202202

203203
// The long pressing pointer X if coordinate remapping is needed.
204204
private int mLongPressingPointerDeltaX;
@@ -702,10 +702,24 @@ private void handleMotionEventStateDragging(MotionEvent event, int policyFlags)
702702
}
703703
}
704704
} break;
705+
case MotionEvent.ACTION_POINTER_UP: {
706+
final int pointerId = event.getPointerId(event.getActionIndex());
707+
if (pointerId == mDraggingPointerId) {
708+
mDraggingPointerId = INVALID_POINTER_ID;
709+
// Send an event to the end of the drag gesture.
710+
sendMotionEvent(event, MotionEvent.ACTION_UP, pointerIdBits, policyFlags);
711+
}
712+
} break;
705713
case MotionEvent.ACTION_UP: {
706714
// Announce the end of a new touch interaction.
707715
sendAccessibilityEvent(
708716
AccessibilityEvent.TYPE_TOUCH_INTERACTION_END);
717+
final int pointerId = event.getPointerId(event.getActionIndex());
718+
if (pointerId == mDraggingPointerId) {
719+
mDraggingPointerId = INVALID_POINTER_ID;
720+
// Send an event to the end of the drag gesture.
721+
sendMotionEvent(event, MotionEvent.ACTION_UP, pointerIdBits, policyFlags);
722+
}
709723
mCurrentState = STATE_TOUCH_EXPLORING;
710724
} break;
711725
case MotionEvent.ACTION_CANCEL: {

0 commit comments

Comments
 (0)