Program: 199288
Project: 199288
Buggy source:
@Override public boolean onTouchEvent(MotionEvent ev){
  initVelocityTrackerIfNotExists();
  MotionEvent vtev=MotionEvent.obtain(ev);
  final int action=ev.getAction();
switch (action & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_DOWN:
{
      if (getChildCount() == 0) {
        return false;
      }
      if ((mIsBeingDragged=!mScroller.isFinished())) {
        final ViewParent parent=getParent();
        if (parent != null) {
          parent.requestDisallowInterceptTouchEvent(true);
        }
      }
      if (!mScroller.isFinished()) {
        mScroller.abortAnimation();
        if (mFlingStrictSpan != null) {
          mFlingStrictSpan.finish();
          mFlingStrictSpan=null;
        }
      }
      mLastMotionY=(int)ev.getY();
      mActivePointerId=ev.getPointerId(0);
      startNestedScroll(SCROLL_AXIS_VERTICAL);
      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);
int deltaY=mLastMotionY - y;
if (dispatchNestedPreScroll(0,deltaY,mScrollConsumed,mScrollOffset)) {
deltaY-=mScrollConsumed[1] + mScrollOffset[1];
vtev.offsetLocation(0,mScrollOffset[1]);
}
if (!mIsBeingDragged && Math.abs(deltaY) > mTouchSlop) {
final ViewParent parent=getParent();
if (parent != null) {
parent.requestDisallowInterceptTouchEvent(true);
}
mIsBeingDragged=true;
if (deltaY > 0) {
deltaY-=mTouchSlop;
}
 else {
deltaY+=mTouchSlop;
}
}
if (mIsBeingDragged) {
mLastMotionY=y;
final int oldY=mScrollY;
final int range=getScrollRange();
final int overscrollMode=getOverScrollMode();
boolean canOverscroll=overscrollMode == OVER_SCROLL_ALWAYS || (overscrollMode == OVER_SCROLL_IF_CONTENT_SCROLLS && range > 0);
if (overScrollBy(0,deltaY,0,mScrollY,0,range,0,mOverscrollDistance,true) && !hasNestedScrollingParent()) {
mVelocityTracker.clear();
}
final int scrolledDeltaY=mScrollY - oldY;
final int unconsumedY=deltaY - scrolledDeltaY;
if (dispatchNestedScroll(0,scrolledDeltaY,0,unconsumedY,mScrollOffset)) {
mLastMotionY-=mScrollOffset[1];
vtev.offsetLocation(0,mScrollOffset[1]);
}
 else if (canOverscroll) {
final int pulledToY=oldY + deltaY;
if (pulledToY < 0) {
mEdgeGlowTop.onPull((float)deltaY / getHeight());
if (!mEdgeGlowBottom.isFinished()) {
mEdgeGlowBottom.onRelease();
}
}
 else if (pulledToY > range) {
mEdgeGlowBottom.onPull((float)deltaY / getHeight());
if (!mEdgeGlowTop.isFinished()) {
mEdgeGlowTop.onRelease();
}
}
if (mEdgeGlowTop != null && (!mEdgeGlowTop.isFinished() || !mEdgeGlowBottom.isFinished())) {
postInvalidateOnAnimation();
}
}
}
break;
case MotionEvent.ACTION_UP:
if (mIsBeingDragged) {
final VelocityTracker velocityTracker=mVelocityTracker;
velocityTracker.computeCurrentVelocity(1000,mMaximumVelocity);
int initialVelocity=(int)velocityTracker.getYVelocity(mActivePointerId);
if ((Math.abs(initialVelocity) > mMinimumVelocity)) {
flingWithNestedDispatch(-initialVelocity);
}
 else if (mScroller.springBack(mScrollX,mScrollY,0,0,0,getScrollRange())) {
postInvalidateOnAnimation();
}
mActivePointerId=INVALID_POINTER;
endDrag();
}
break;
case MotionEvent.ACTION_CANCEL:
if (mIsBeingDragged && getChildCount() > 0) {
if (mScroller.springBack(mScrollX,mScrollY,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);
mActivePointerId=ev.getPointerId(index);
break;
}
case MotionEvent.ACTION_POINTER_UP:
onSecondaryPointerUp(ev);
mLastMotionY=(int)ev.getY(ev.findPointerIndex(mActivePointerId));
break;
}
if (mVelocityTracker != null) {
mVelocityTracker.addMovement(vtev);
}
vtev.recycle();
return true;
}

Fixed version (ground truth):
@Override public boolean onTouchEvent(MotionEvent ev){
  initVelocityTrackerIfNotExists();
  MotionEvent vtev=MotionEvent.obtain(ev);
  final int action=ev.getAction();
switch (action & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_DOWN:
{
      if (getChildCount() == 0) {
        return false;
      }
      if ((mIsBeingDragged=!mScroller.isFinished())) {
        final ViewParent parent=getParent();
        if (parent != null) {
          parent.requestDisallowInterceptTouchEvent(true);
        }
      }
      if (!mScroller.isFinished()) {
        mScroller.abortAnimation();
        if (mFlingStrictSpan != null) {
          mFlingStrictSpan.finish();
          mFlingStrictSpan=null;
        }
      }
      mLastMotionY=(int)ev.getY();
      mActivePointerId=ev.getPointerId(0);
      startNestedScroll(SCROLL_AXIS_VERTICAL);
      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);
int deltaY=mLastMotionY - y;
if (dispatchNestedPreScroll(0,deltaY,mScrollConsumed,mScrollOffset)) {
deltaY-=mScrollConsumed[1];
vtev.offsetLocation(0,mScrollOffset[1]);
}
if (!mIsBeingDragged && Math.abs(deltaY) > mTouchSlop) {
final ViewParent parent=getParent();
if (parent != null) {
parent.requestDisallowInterceptTouchEvent(true);
}
mIsBeingDragged=true;
if (deltaY > 0) {
deltaY-=mTouchSlop;
}
 else {
deltaY+=mTouchSlop;
}
}
if (mIsBeingDragged) {
mLastMotionY=y - mScrollOffset[1];
final int oldY=mScrollY;
final int range=getScrollRange();
final int overscrollMode=getOverScrollMode();
boolean canOverscroll=overscrollMode == OVER_SCROLL_ALWAYS || (overscrollMode == OVER_SCROLL_IF_CONTENT_SCROLLS && range > 0);
if (overScrollBy(0,deltaY,0,mScrollY,0,range,0,mOverscrollDistance,true) && !hasNestedScrollingParent()) {
mVelocityTracker.clear();
}
final int scrolledDeltaY=mScrollY - oldY;
final int unconsumedY=deltaY - scrolledDeltaY;
if (dispatchNestedScroll(0,scrolledDeltaY,0,unconsumedY,mScrollOffset)) {
mLastMotionY-=mScrollOffset[1];
vtev.offsetLocation(0,mScrollOffset[1]);
}
 else if (canOverscroll) {
final int pulledToY=oldY + deltaY;
if (pulledToY < 0) {
mEdgeGlowTop.onPull((float)deltaY / getHeight());
if (!mEdgeGlowBottom.isFinished()) {
mEdgeGlowBottom.onRelease();
}
}
 else if (pulledToY > range) {
mEdgeGlowBottom.onPull((float)deltaY / getHeight());
if (!mEdgeGlowTop.isFinished()) {
mEdgeGlowTop.onRelease();
}
}
if (mEdgeGlowTop != null && (!mEdgeGlowTop.isFinished() || !mEdgeGlowBottom.isFinished())) {
postInvalidateOnAnimation();
}
}
}
break;
case MotionEvent.ACTION_UP:
if (mIsBeingDragged) {
final VelocityTracker velocityTracker=mVelocityTracker;
velocityTracker.computeCurrentVelocity(1000,mMaximumVelocity);
int initialVelocity=(int)velocityTracker.getYVelocity(mActivePointerId);
if ((Math.abs(initialVelocity) > mMinimumVelocity)) {
flingWithNestedDispatch(-initialVelocity);
}
 else if (mScroller.springBack(mScrollX,mScrollY,0,0,0,getScrollRange())) {
postInvalidateOnAnimation();
}
mActivePointerId=INVALID_POINTER;
endDrag();
}
break;
case MotionEvent.ACTION_CANCEL:
if (mIsBeingDragged && getChildCount() > 0) {
if (mScroller.springBack(mScrollX,mScrollY,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);
mActivePointerId=ev.getPointerId(index);
break;
}
case MotionEvent.ACTION_POINTER_UP:
onSecondaryPointerUp(ev);
mLastMotionY=(int)ev.getY(ev.findPointerIndex(mActivePointerId));
break;
}
if (mVelocityTracker != null) {
mVelocityTracker.addMovement(vtev);
}
vtev.recycle();
return true;
}