Program: 157278
Project: 157278
Buggy source:
@Override public boolean onTouchEvent(@NonNull MotionEvent nativeMotionEvent){
  if (mKeyboard == null)   return false;
  final int action=MotionEventCompat.getActionMasked(nativeMotionEvent);
  final int pointerCount=MotionEventCompat.getPointerCount(nativeMotionEvent);
  if (pointerCount > 1)   mLastTimeHadTwoFingers=SystemClock.elapsedRealtime();
  if (mTouchesAreDisabledTillLastFingerIsUp) {
    if (pointerCount == 1 && (action == MotionEvent.ACTION_CANCEL || action == MotionEvent.ACTION_DOWN || action == MotionEvent.ACTION_UP)) {
      mTouchesAreDisabledTillLastFingerIsUp=false;
      if (action != MotionEvent.ACTION_DOWN) {
        return true;
      }
    }
 else {
      return true;
    }
  }
  final long eventTime=nativeMotionEvent.getEventTime();
  final int index=MotionEventCompat.getActionIndex(nativeMotionEvent);
  final int id=nativeMotionEvent.getPointerId(index);
  final int x=(int)nativeMotionEvent.getX(index);
  final int y=(int)nativeMotionEvent.getY(index);
  if (mKeyPressTimingHandler.isInKeyRepeat()) {
    if (action == MotionEvent.ACTION_MOVE) {
      return true;
    }
    final PointerTracker tracker=getPointerTracker(id);
    if (pointerCount > 1 && !tracker.isModifier()) {
      mKeyPressTimingHandler.cancelKeyRepeatTimer();
    }
  }
  if (action == MotionEvent.ACTION_MOVE) {
    for (int i=0; i < pointerCount; i++) {
      PointerTracker tracker=getPointerTracker(nativeMotionEvent.getPointerId(i));
      tracker.onMoveEvent((int)nativeMotionEvent.getX(i),(int)nativeMotionEvent.getY(i));
    }
  }
 else {
    PointerTracker tracker=getPointerTracker(id);
    sendOnXEvent(action,eventTime,x,y,tracker);
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean onTouchEvent(@NonNull MotionEvent nativeMotionEvent){
  if (mKeyboard == null)   return false;
  final int action=MotionEventCompat.getActionMasked(nativeMotionEvent);
  final int pointerCount=MotionEventCompat.getPointerCount(nativeMotionEvent);
  if (pointerCount > 1)   mLastTimeHadTwoFingers=SystemClock.elapsedRealtime();
  if (mTouchesAreDisabledTillLastFingerIsUp) {
    if (!areTouchesDisabled(nativeMotionEvent)) {
      mTouchesAreDisabledTillLastFingerIsUp=false;
      if (action != MotionEvent.ACTION_DOWN) {
        return true;
      }
    }
 else {
      return true;
    }
  }
  final long eventTime=nativeMotionEvent.getEventTime();
  final int index=MotionEventCompat.getActionIndex(nativeMotionEvent);
  final int id=nativeMotionEvent.getPointerId(index);
  final int x=(int)nativeMotionEvent.getX(index);
  final int y=(int)nativeMotionEvent.getY(index);
  if (mKeyPressTimingHandler.isInKeyRepeat()) {
    if (action == MotionEvent.ACTION_MOVE) {
      return true;
    }
    final PointerTracker tracker=getPointerTracker(id);
    if (pointerCount > 1 && !tracker.isModifier()) {
      mKeyPressTimingHandler.cancelKeyRepeatTimer();
    }
  }
  if (action == MotionEvent.ACTION_MOVE) {
    for (int i=0; i < pointerCount; i++) {
      PointerTracker tracker=getPointerTracker(nativeMotionEvent.getPointerId(i));
      tracker.onMoveEvent((int)nativeMotionEvent.getX(i),(int)nativeMotionEvent.getY(i));
    }
  }
 else {
    PointerTracker tracker=getPointerTracker(id);
    sendOnXEvent(action,eventTime,x,y,tracker);
  }
  return true;
}