Program: 157470
Project: 157470
Buggy source:
@Override public boolean onTouchEvent(MotionEvent nativeMotionEvent){
  if (mKeyboard == null)   return false;
  mMotionEvent.setNativeMotionEvent(nativeMotionEvent);
  WMotionEvent me=mMotionEvent;
  final int action=me.getActionMasked();
  final int pointerCount=me.getPointerCount();
  final int oldPointerCount=mOldPointerCount;
  mOldPointerCount=pointerCount;
  if (pointerCount > 1)   mLastTimeHadTwoFingers=SystemClock.elapsedRealtime();
  if (!mHasDistinctMultitouch && pointerCount > 1 && oldPointerCount > 1) {
    return true;
  }
  mSwipeTracker.addMovement(nativeMotionEvent);
  if (!mMiniKeyboardVisible && mGestureDetector != null && (mGestureDetector.onTouchEvent(nativeMotionEvent))) {
    Log.d(TAG,"String_Node_Str");
    mHandler.cancelKeyTimers();
    dismissKeyPreview();
    return true;
  }
  final long eventTime=me.getEventTime();
  final int index=me.getActionIndex();
  final int id=me.getPointerId(index);
  final int x=(int)me.getX(index);
  final int y=(int)me.getY(index);
  if (mMiniKeyboard != null && mMiniKeyboardVisible) {
    final int miniKeyboardPointerIndex=me.findPointerIndex(mMiniKeyboardTrackerId);
    if (miniKeyboardPointerIndex >= 0 && miniKeyboardPointerIndex < pointerCount) {
      final int miniKeyboardX=(int)me.getX(miniKeyboardPointerIndex);
      final int miniKeyboardY=(int)me.getY(miniKeyboardPointerIndex);
      MotionEvent translated=generateMiniKeyboardMotionEvent(action,miniKeyboardX,miniKeyboardY,eventTime);
      mMiniKeyboard.onTouchEvent(translated);
      translated.recycle();
    }
    return true;
  }
  if (mHandler.isInKeyRepeat()) {
    if (action == MotionEvent.ACTION_MOVE) {
      return true;
    }
    final PointerTracker tracker=getPointerTracker(id);
    if (pointerCount > 1 && !tracker.isModifier()) {
      mHandler.cancelKeyRepeatTimer();
    }
  }
  if (!mHasDistinctMultitouch) {
    PointerTracker tracker=getPointerTracker(0);
    if (pointerCount == 1 && oldPointerCount == 2) {
      tracker.onDownEvent(x,y,eventTime);
    }
 else     if (pointerCount == 2 && oldPointerCount == 1) {
      tracker.onUpEvent(tracker.getLastX(),tracker.getLastY(),eventTime);
    }
 else     if (pointerCount == 1 && oldPointerCount == 1) {
      tracker.onTouchEvent(action,x,y,eventTime);
    }
 else {
      Log.w(TAG,"String_Node_Str" + pointerCount + "String_Node_Str"+ oldPointerCount+ "String_Node_Str");
    }
    return true;
  }
  if (action == MotionEvent.ACTION_MOVE) {
    for (int i=0; i < pointerCount; i++) {
      PointerTracker tracker=getPointerTracker(me.getPointerId(i));
      tracker.onMoveEvent((int)me.getX(i),(int)me.getY(i),eventTime);
    }
  }
 else {
    PointerTracker tracker=getPointerTracker(id);
    sendOnXEvent(action,eventTime,x,y,tracker);
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean onTouchEvent(MotionEvent nativeMotionEvent){
  if (mKeyboard == null)   return false;
  mMotionEvent.setNativeMotionEvent(nativeMotionEvent);
  WMotionEvent me=mMotionEvent;
  final int action=me.getActionMasked();
  final int pointerCount=me.getPointerCount();
  final int oldPointerCount=mOldPointerCount;
  mOldPointerCount=pointerCount;
  if (pointerCount > 1)   mLastTimeHadTwoFingers=SystemClock.elapsedRealtime();
  if (mTouchesAreDisabledTillLastFingerIsUp) {
    if (mOldPointerCount == 1 && (action == MotionEvent.ACTION_CANCEL || action == MotionEvent.ACTION_UP)) {
      mTouchesAreDisabledTillLastFingerIsUp=false;
    }
    return true;
  }
  if (!mHasDistinctMultitouch && pointerCount > 1 && oldPointerCount > 1) {
    return true;
  }
  mSwipeTracker.addMovement(nativeMotionEvent);
  if (!mMiniKeyboardVisible && mGestureDetector != null && (mGestureDetector.onTouchEvent(nativeMotionEvent))) {
    Log.d(TAG,"String_Node_Str");
    mHandler.cancelKeyTimers();
    dismissKeyPreview();
    return true;
  }
  final long eventTime=me.getEventTime();
  final int index=me.getActionIndex();
  final int id=me.getPointerId(index);
  final int x=(int)me.getX(index);
  final int y=(int)me.getY(index);
  if (mMiniKeyboard != null && mMiniKeyboardVisible) {
    final int miniKeyboardPointerIndex=me.findPointerIndex(mMiniKeyboardTrackerId);
    if (miniKeyboardPointerIndex >= 0 && miniKeyboardPointerIndex < pointerCount) {
      final int miniKeyboardX=(int)me.getX(miniKeyboardPointerIndex);
      final int miniKeyboardY=(int)me.getY(miniKeyboardPointerIndex);
      MotionEvent translated=generateMiniKeyboardMotionEvent(action,miniKeyboardX,miniKeyboardY,eventTime);
      mMiniKeyboard.onTouchEvent(translated);
      translated.recycle();
    }
    return true;
  }
  if (mHandler.isInKeyRepeat()) {
    if (action == MotionEvent.ACTION_MOVE) {
      return true;
    }
    final PointerTracker tracker=getPointerTracker(id);
    if (pointerCount > 1 && !tracker.isModifier()) {
      mHandler.cancelKeyRepeatTimer();
    }
  }
  if (!mHasDistinctMultitouch) {
    PointerTracker tracker=getPointerTracker(0);
    if (pointerCount == 1 && oldPointerCount == 2) {
      tracker.onDownEvent(x,y,eventTime);
    }
 else     if (pointerCount == 2 && oldPointerCount == 1) {
      tracker.onUpEvent(tracker.getLastX(),tracker.getLastY(),eventTime);
    }
 else     if (pointerCount == 1 && oldPointerCount == 1) {
      tracker.onTouchEvent(action,x,y,eventTime);
    }
 else {
      Log.w(TAG,"String_Node_Str" + pointerCount + "String_Node_Str"+ oldPointerCount+ "String_Node_Str");
    }
    return true;
  }
  if (action == MotionEvent.ACTION_MOVE) {
    for (int i=0; i < pointerCount; i++) {
      PointerTracker tracker=getPointerTracker(me.getPointerId(i));
      tracker.onMoveEvent((int)me.getX(i),(int)me.getY(i),eventTime);
    }
  }
 else {
    PointerTracker tracker=getPointerTracker(id);
    sendOnXEvent(action,eventTime,x,y,tracker);
  }
  return true;
}