From aeb8d0ed0d98d398a66a092c418f4f2bca8719e0 Mon Sep 17 00:00:00 2001 From: Svetoslav Ganov Date: Tue, 2 Oct 2012 14:16:08 -0700 Subject: [PATCH] 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 --- .../server/accessibility/TouchExplorer.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/services/java/com/android/server/accessibility/TouchExplorer.java b/services/java/com/android/server/accessibility/TouchExplorer.java index 616bc131b825d..c9f89b162ec87 100644 --- a/services/java/com/android/server/accessibility/TouchExplorer.java +++ b/services/java/com/android/server/accessibility/TouchExplorer.java @@ -198,7 +198,7 @@ class TouchExplorer implements EventStreamTransformation { private GestureLibrary mGestureLibrary; // The long pressing pointer id if coordinate remapping is needed. - private int mLongPressingPointerId; + private int mLongPressingPointerId = -1; // The long pressing pointer X if coordinate remapping is needed. private int mLongPressingPointerDeltaX; @@ -702,10 +702,24 @@ class TouchExplorer implements EventStreamTransformation { } } } break; + case MotionEvent.ACTION_POINTER_UP: { + final int pointerId = event.getPointerId(event.getActionIndex()); + if (pointerId == mDraggingPointerId) { + mDraggingPointerId = INVALID_POINTER_ID; + // Send an event to the end of the drag gesture. + sendMotionEvent(event, MotionEvent.ACTION_UP, pointerIdBits, policyFlags); + } + } break; case MotionEvent.ACTION_UP: { // Announce the end of a new touch interaction. sendAccessibilityEvent( AccessibilityEvent.TYPE_TOUCH_INTERACTION_END); + final int pointerId = event.getPointerId(event.getActionIndex()); + if (pointerId == mDraggingPointerId) { + mDraggingPointerId = INVALID_POINTER_ID; + // Send an event to the end of the drag gesture. + sendMotionEvent(event, MotionEvent.ACTION_UP, pointerIdBits, policyFlags); + } mCurrentState = STATE_TOUCH_EXPLORING; } break; case MotionEvent.ACTION_CANCEL: {