Program: 56442
Project: 56442
Buggy source:
@Override public boolean onTouchEvent(MotionEvent ev){
  velocityTracker.addMovement(ev);
  final int action=ev.getAction() & MotionEvent.ACTION_MASK;
switch (action) {
case MotionEvent.ACTION_DOWN:
{
      velocityTracker.clear();
      scroller.abortAnimation();
      lastTouchY=ev.getY();
      lastTouchX=ev.getX();
      final int x=(int)ev.getX();
      activePointerId=ev.getPointerId(0);
      touchRemainderY=0;
      motionPosition=getPositionAt(x,(int)lastTouchY);
      if (hasStableIds) {
        motionId=((LayoutParams)getChildAt(motionPosition).getLayoutParams()).id;
      }
      if (motionPosition != INVALID_POSITION && adapter != null && adapter.isEnabled(motionPosition)) {
        pendingTapCheck=new TapCheck();
        postDelayed(pendingTapCheck,ViewConfiguration.getTapTimeout());
      }
      break;
    }
case MotionEvent.ACTION_MOVE:
{
    final int index=ev.findPointerIndex(activePointerId);
    if (index < 0) {
      Log.e(TAG,"String_Node_Str" + activePointerId + "String_Node_Str"+ "String_Node_Str");
      return false;
    }
    final float y=ev.getY(index);
    final float x=ev.getX(index);
    final float dy=y - lastTouchY + touchRemainderY;
    final int deltaY=(int)dy;
    touchRemainderY=dy - deltaY;
    if (Math.abs(dy) > touchSlop) {
      touchMode=TOUCH_MODE_DRAGGING;
    }
    if (touchMode == TOUCH_MODE_DRAGGING) {
      if (pendingTapCheck != null) {
        removeCallbacks(pendingTapCheck);
      }
      if (!selectorRect.isEmpty()) {
        selectorRect.setEmpty();
      }
      if (motionPosition != INVALID_POSITION) {
        final View child=getChildAt(motionPosition - firstPosition);
        if (child != null) {
          child.setPressed(false);
        }
        setPressed(false);
        selector.setState(StateSet.NOTHING);
        motionPosition=INVALID_POSITION;
        motionId=-1L;
      }
      lastTouchY=y;
      lastTouchX=x;
      if (!trackMotionScroll(deltaY,true)) {
        velocityTracker.clear();
      }
    }
  }
break;
case MotionEvent.ACTION_CANCEL:
touchMode=TOUCH_MODE_IDLE;
if (motionPosition != INVALID_POSITION) {
View child=getChildAt(motionPosition);
child.setPressed(false);
setPressed(false);
}
motionPosition=INVALID_POSITION;
motionId=-1L;
if (pendingTapCheck != null) {
removeCallbacks(pendingTapCheck);
pendingTapCheck=null;
}
break;
case MotionEvent.ACTION_UP:
{
velocityTracker.computeCurrentVelocity(1000,maximumVelocity);
final float velocity=velocityTracker.getYVelocity(activePointerId);
if (pendingTapCheck != null) {
removeCallbacks(pendingTapCheck);
pendingTapCheck=null;
}
if (Math.abs(velocity) > flingVelocity) {
touchMode=TOUCH_MODE_FLINGING;
scroller.fling(0,0,0,(int)velocity,0,0,Integer.MIN_VALUE,Integer.MAX_VALUE);
lastTouchY=0;
postInvalidateOnAnimation();
}
 else {
if (touchMode != TOUCH_MODE_DRAGGING && motionPosition != INVALID_POSITION) {
if (adapter != null && adapter.isEnabled(motionPosition)) {
new TapCheck().run();
tapReset=new TapReset();
postDelayed(tapReset,ViewConfiguration.getPressedStateDuration());
}
 else {
motionPosition=INVALID_POSITION;
motionId=-1L;
}
}
touchMode=TOUCH_MODE_IDLE;
}
}
break;
}
return true;
}

Fixed version (ground truth):
@Override public boolean onTouchEvent(MotionEvent ev){
  velocityTracker.addMovement(ev);
  final int action=ev.getAction() & MotionEvent.ACTION_MASK;
switch (action) {
case MotionEvent.ACTION_DOWN:
{
      velocityTracker.clear();
      scroller.abortAnimation();
      lastTouchY=ev.getY();
      lastTouchX=ev.getX();
      final int x=(int)ev.getX();
      activePointerId=ev.getPointerId(0);
      touchRemainderY=0;
      motionPosition=getPositionAt(x,(int)lastTouchY);
      if (motionPosition != INVALID_POSITION && adapter != null && adapter.isEnabled(motionPosition)) {
        pendingTapCheck=new TapCheck();
        postDelayed(pendingTapCheck,ViewConfiguration.getTapTimeout());
        if (hasStableIds) {
          motionId=((LayoutParams)getChildAt(motionPosition - firstPosition).getLayoutParams()).id;
        }
      }
      break;
    }
case MotionEvent.ACTION_MOVE:
{
    final int index=ev.findPointerIndex(activePointerId);
    if (index < 0) {
      Log.e(TAG,"String_Node_Str" + activePointerId + "String_Node_Str"+ "String_Node_Str");
      return false;
    }
    final float y=ev.getY(index);
    final float x=ev.getX(index);
    final float dy=y - lastTouchY + touchRemainderY;
    final int deltaY=(int)dy;
    touchRemainderY=dy - deltaY;
    if (Math.abs(dy) > touchSlop) {
      touchMode=TOUCH_MODE_DRAGGING;
    }
    if (touchMode == TOUCH_MODE_DRAGGING) {
      if (pendingTapCheck != null) {
        removeCallbacks(pendingTapCheck);
      }
      if (!selectorRect.isEmpty()) {
        selectorRect.setEmpty();
      }
      if (motionPosition != INVALID_POSITION) {
        final View child=getChildAt(motionPosition - firstPosition);
        if (child != null) {
          child.setPressed(false);
        }
        setPressed(false);
        selector.setState(StateSet.NOTHING);
        motionPosition=INVALID_POSITION;
        motionId=-1L;
      }
      lastTouchY=y;
      lastTouchX=x;
      if (!trackMotionScroll(deltaY,true)) {
        velocityTracker.clear();
      }
    }
  }
break;
case MotionEvent.ACTION_CANCEL:
touchMode=TOUCH_MODE_IDLE;
if (motionPosition != INVALID_POSITION) {
View child=getChildAt(motionPosition - firstPosition);
child.setPressed(false);
setPressed(false);
}
motionPosition=INVALID_POSITION;
motionId=-1L;
selectorRect.setEmpty();
if (pendingTapCheck != null) {
removeCallbacks(pendingTapCheck);
pendingTapCheck=null;
}
break;
case MotionEvent.ACTION_UP:
{
velocityTracker.computeCurrentVelocity(1000,maximumVelocity);
final float velocity=velocityTracker.getYVelocity(activePointerId);
if (pendingTapCheck != null) {
removeCallbacks(pendingTapCheck);
pendingTapCheck=null;
}
if (Math.abs(velocity) > flingVelocity) {
touchMode=TOUCH_MODE_FLINGING;
scroller.fling(0,0,0,(int)velocity,0,0,Integer.MIN_VALUE,Integer.MAX_VALUE);
lastTouchY=0;
postInvalidateOnAnimation();
if (motionPosition != INVALID_POSITION) {
View child=getChildAt(motionPosition - firstPosition);
if (child != null) {
child.setPressed(false);
}
setPressed(false);
motionPosition=INVALID_POSITION;
motionId=-1L;
selectorRect.setEmpty();
if (pendingTapCheck != null) {
removeCallbacks(pendingTapCheck);
pendingTapCheck=null;
}
}
}
 else {
if (touchMode != TOUCH_MODE_DRAGGING && motionPosition != INVALID_POSITION) {
if (adapter != null && adapter.isEnabled(motionPosition)) {
new TapCheck().run();
tapReset=new TapReset();
postDelayed(tapReset,ViewConfiguration.getPressedStateDuration());
}
 else {
motionPosition=INVALID_POSITION;
motionId=-1L;
}
}
touchMode=TOUCH_MODE_IDLE;
}
}
break;
}
return true;
}