Skip to content

Commit 03e7b88

Browse files
committed
More than one finger at a time can trigger a system crash.
1. The crash was happening if: two active pointers are performing a drag; there are some inactive pointers down; the main dragging pointer (we are merging the dragging pointers into one) goes up; now an inactive pointer goes up and the explorer tries to inject up for the dragging pointer which is no longer in the event resulting in a crash. Basically two problems: inactive pointers were not ignored; 2) having only one active pointer should not only send the up event but also transition the explorer in touch exploring state. bug:6874128 Change-Id: I341fc360ebc074fe3919d5ba3b98ee5cb08dd71e
1 parent bc391d5 commit 03e7b88

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

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

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import android.gesture.GestureStroke;
2626
import android.gesture.Prediction;
2727
import android.graphics.Rect;
28-
import android.os.Build;
2928
import android.os.Handler;
3029
import android.os.SystemClock;
3130
import android.util.Slog;
@@ -687,15 +686,10 @@ private void handleMotionEventStateDragging(MotionEvent event, int policyFlags)
687686
}
688687
} break;
689688
case MotionEvent.ACTION_POINTER_UP: {
690-
final int activePointerCount = mReceivedPointerTracker.getActivePointerCount();
691-
switch (activePointerCount) {
692-
case 1: {
693-
// Send an event to the end of the drag gesture.
694-
sendMotionEvent(event, MotionEvent.ACTION_UP, pointerIdBits, policyFlags);
695-
} break;
696-
default: {
697-
mCurrentState = STATE_TOUCH_EXPLORING;
698-
}
689+
final int pointerId = event.getPointerId(event.getActionIndex());
690+
if (mReceivedPointerTracker.isActiveOrWasLastActiveUpPointer(pointerId)) {
691+
sendUpForInjectedDownPointers(event, policyFlags);
692+
mCurrentState = STATE_TOUCH_EXPLORING;
699693
}
700694
} break;
701695
case MotionEvent.ACTION_UP: {

0 commit comments

Comments
 (0)