Skip to content

Commit 9bfb8bc

Browse files
sganovAndroid (Google) Code Review
authored andcommitted
Merge "Up motion event not injected by the touch explorer at the end of a drag." into jb-mr1-dev
2 parents 046184f + aeb8d0e commit 9bfb8bc

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)