Program: 199097
Project: 199097
Buggy source:
private boolean onScrollTouch(MotionEvent ev){
  if (!isScrollingEnabled()) {
    return false;
  }
  initVelocityTrackerIfNotExists();
  mVelocityTracker.addMovement(ev);
  final int action=ev.getAction();
switch (action & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_DOWN:
{
      if (getChildCount() == 0 || !isInContentBounds(ev)) {
        return false;
      }
      boolean isBeingDragged=!mScroller.isFinished();
      setIsBeingDragged(isBeingDragged);
      if (!mScroller.isFinished()) {
        mScroller.forceFinished(true);
      }
      mLastMotionY=(int)ev.getY();
      mDownX=(int)ev.getX();
      mActivePointerId=ev.getPointerId(0);
      break;
    }
case MotionEvent.ACTION_MOVE:
  final int activePointerIndex=ev.findPointerIndex(mActivePointerId);
if (activePointerIndex == -1) {
  Log.e(TAG,"String_Node_Str" + mActivePointerId + "String_Node_Str");
  break;
}
final int y=(int)ev.getY(activePointerIndex);
final int x=(int)ev.getX(activePointerIndex);
int deltaY=mLastMotionY - y;
final int xDiff=Math.abs(x - mDownX);
final int yDiff=Math.abs(deltaY);
if (!mIsBeingDragged && yDiff > mTouchSlop && yDiff > xDiff) {
setIsBeingDragged(true);
if (deltaY > 0) {
deltaY-=mTouchSlop;
}
 else {
deltaY+=mTouchSlop;
}
}
if (mIsBeingDragged) {
mLastMotionY=y;
int range=getScrollRange();
if (mExpandedInThisMotion) {
range=Math.min(range,mMaxScrollAfterExpand);
}
float scrollAmount;
if (deltaY < 0) {
scrollAmount=overScrollDown(deltaY);
}
 else {
scrollAmount=overScrollUp(deltaY,range);
}
if (scrollAmount != 0.0f) {
overScrollBy(0,(int)scrollAmount,0,mOwnScrollY,0,range,0,getHeight() / 2,true);
}
}
break;
case MotionEvent.ACTION_UP:
if (mIsBeingDragged) {
final VelocityTracker velocityTracker=mVelocityTracker;
velocityTracker.computeCurrentVelocity(1000,mMaximumVelocity);
int initialVelocity=(int)velocityTracker.getYVelocity(mActivePointerId);
if (shouldOverScrollFling(initialVelocity)) {
onOverScrollFling(true,initialVelocity);
}
 else {
if (getChildCount() > 0) {
if ((Math.abs(initialVelocity) > mMinimumVelocity)) {
float currentOverScrollTop=getCurrentOverScrollAmount(true);
if (currentOverScrollTop == 0.0f || initialVelocity > 0) {
fling(-initialVelocity);
}
 else {
onOverScrollFling(false,initialVelocity);
}
}
 else {
if (mScroller.springBack(mScrollX,mOwnScrollY,0,0,0,getScrollRange())) {
postInvalidateOnAnimation();
}
}
}
mActivePointerId=INVALID_POINTER;
endDrag();
}
}
break;
case MotionEvent.ACTION_CANCEL:
if (mIsBeingDragged && getChildCount() > 0) {
if (mScroller.springBack(mScrollX,mOwnScrollY,0,0,0,getScrollRange())) {
postInvalidateOnAnimation();
}
mActivePointerId=INVALID_POINTER;
endDrag();
}
break;
case MotionEvent.ACTION_POINTER_DOWN:
{
final int index=ev.getActionIndex();
mLastMotionY=(int)ev.getY(index);
mDownX=(int)ev.getX(index);
mActivePointerId=ev.getPointerId(index);
break;
}
case MotionEvent.ACTION_POINTER_UP:
onSecondaryPointerUp(ev);
mLastMotionY=(int)ev.getY(ev.findPointerIndex(mActivePointerId));
mDownX=(int)ev.getX(ev.findPointerIndex(mActivePointerId));
break;
}
return true;
}

Fixed version (ground truth):
private boolean onScrollTouch(MotionEvent ev){
  if (!isScrollingEnabled()) {
    return false;
  }
  initVelocityTrackerIfNotExists();
  mVelocityTracker.addMovement(ev);
  final int action=ev.getAction();
switch (action & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_DOWN:
{
      if (getChildCount() == 0 || !isInContentBounds(ev)) {
        return false;
      }
      boolean isBeingDragged=!mScroller.isFinished();
      setIsBeingDragged(isBeingDragged);
      if (!mScroller.isFinished()) {
        mScroller.forceFinished(true);
      }
      mLastMotionY=(int)ev.getY();
      mDownX=(int)ev.getX();
      mActivePointerId=ev.getPointerId(0);
      break;
    }
case MotionEvent.ACTION_MOVE:
  final int activePointerIndex=ev.findPointerIndex(mActivePointerId);
if (activePointerIndex == -1) {
  Log.e(TAG,"String_Node_Str" + mActivePointerId + "String_Node_Str");
  break;
}
final int y=(int)ev.getY(activePointerIndex);
final int x=(int)ev.getX(activePointerIndex);
int deltaY=mLastMotionY - y;
final int xDiff=Math.abs(x - mDownX);
final int yDiff=Math.abs(deltaY);
if (!mIsBeingDragged && yDiff > mTouchSlop && yDiff > xDiff) {
setIsBeingDragged(true);
if (deltaY > 0) {
deltaY-=mTouchSlop;
}
 else {
deltaY+=mTouchSlop;
}
}
if (mIsBeingDragged) {
mLastMotionY=y;
int range=getScrollRange();
if (mExpandedInThisMotion) {
range=Math.min(range,mMaxScrollAfterExpand);
}
float scrollAmount;
if (deltaY < 0) {
scrollAmount=overScrollDown(deltaY);
}
 else {
scrollAmount=overScrollUp(deltaY,range);
}
if (scrollAmount != 0.0f) {
overScrollBy(0,(int)scrollAmount,0,mOwnScrollY,0,range,0,getHeight() / 2,true);
}
}
break;
case MotionEvent.ACTION_UP:
if (mIsBeingDragged) {
final VelocityTracker velocityTracker=mVelocityTracker;
velocityTracker.computeCurrentVelocity(1000,mMaximumVelocity);
int initialVelocity=(int)velocityTracker.getYVelocity(mActivePointerId);
if (shouldOverScrollFling(initialVelocity)) {
onOverScrollFling(true,initialVelocity);
}
 else {
if (getChildCount() > 0) {
if ((Math.abs(initialVelocity) > mMinimumVelocity)) {
float currentOverScrollTop=getCurrentOverScrollAmount(true);
if (currentOverScrollTop == 0.0f || initialVelocity > 0) {
fling(-initialVelocity);
}
 else {
onOverScrollFling(false,initialVelocity);
}
}
 else {
if (mScroller.springBack(mScrollX,mOwnScrollY,0,0,0,getScrollRange())) {
postInvalidateOnAnimation();
}
}
}
}
mActivePointerId=INVALID_POINTER;
endDrag();
}
break;
case MotionEvent.ACTION_CANCEL:
if (mIsBeingDragged && getChildCount() > 0) {
if (mScroller.springBack(mScrollX,mOwnScrollY,0,0,0,getScrollRange())) {
postInvalidateOnAnimation();
}
mActivePointerId=INVALID_POINTER;
endDrag();
}
break;
case MotionEvent.ACTION_POINTER_DOWN:
{
final int index=ev.getActionIndex();
mLastMotionY=(int)ev.getY(index);
mDownX=(int)ev.getX(index);
mActivePointerId=ev.getPointerId(index);
break;
}
case MotionEvent.ACTION_POINTER_UP:
onSecondaryPointerUp(ev);
mLastMotionY=(int)ev.getY(ev.findPointerIndex(mActivePointerId));
mDownX=(int)ev.getX(ev.findPointerIndex(mActivePointerId));
break;
}
return true;
}