Merge "Ensure MotionEvent.split() won\'t be given an invalid value." into nyc-dev

am: a5e6601ad1

* commit 'a5e6601ad1db77563038946ed1316134f7e55ee6':
  Ensure MotionEvent.split() won't be given an invalid value.

Change-Id: Ide2f549e62750f39cecee18a71e0f35d4724d1f3
This commit is contained in:
Zachary Kuznia
2016-05-25 21:06:19 +00:00
committed by android-build-merger

View File

@@ -648,7 +648,16 @@ class TouchExplorer implements EventStreamTransformation, AccessibilityGestureDe
* @param policyFlags The policy flags associated with the event.
*/
private void handleMotionEventStateDragging(MotionEvent event, int policyFlags) {
final int pointerIdBits = (1 << mDraggingPointerId);
int pointerIdBits = 0;
// Clear the dragging pointer id if it's no longer valid.
if (event.findPointerIndex(mDraggingPointerId) == -1) {
Slog.e(LOG_TAG, "mDraggingPointerId doesn't match any pointers on current event. " +
"mDraggingPointerId: " + Integer.toString(mDraggingPointerId) +
", Event: " + event);
mDraggingPointerId = INVALID_POINTER_ID;
} else {
pointerIdBits = (1 << mDraggingPointerId);
}
switch (event.getActionMasked()) {
case MotionEvent.ACTION_DOWN: {
throw new IllegalStateException("Dragging state can be reached only if two "
@@ -664,6 +673,9 @@ class TouchExplorer implements EventStreamTransformation, AccessibilityGestureDe
sendDownForAllNotInjectedPointers(event, policyFlags);
} break;
case MotionEvent.ACTION_MOVE: {
if (mDraggingPointerId == INVALID_POINTER_ID) {
break;
}
switch (event.getPointerCount()) {
case 1: {
// do nothing