Program: 179978
Project: 179978
Buggy source:
@Override public boolean onTouchEvent(MotionEvent ev){
  if (!isVisible()) {
    return true;
  }
  if (mLocks != 0) {
    return true;
  }
  super.onTouchEvent(ev);
  int x=(int)ev.getX();
  int y=(int)ev.getY();
  int action=ev.getAction();
switch (action) {
case MotionEvent.ACTION_DOWN:
    if (x < 60 && y > 700) {
    }
  if (y > mRollo.mTouchYBorders[mRollo.mTouchYBorders.length - 1]) {
    mTouchTracking=TRACKING_HOME;
  }
 else {
    mTouchTracking=TRACKING_FLING;
    mMotionDownRawX=(int)ev.getRawX();
    mMotionDownRawY=(int)ev.getRawY();
    mLastMotionX=x;
    mLastMotionY=y;
    if (mRotateMove) {
      mRollo.mState.newPositionX=ev.getRawY() / mDefines.SCREEN_WIDTH_PX;
    }
 else {
      mRollo.mState.newPositionX=ev.getRawX() / mDefines.SCREEN_WIDTH_PX;
    }
    mRollo.mState.newTouchDown=1;
    if (!mRollo.checkClickOK()) {
      mRollo.clearSelectedIcon();
    }
 else {
      mRollo.selectIcon(x,y,mRollo.mMessageProc.mPosX);
    }
    mRollo.mState.save();
    mRollo.move();
    mVelocity=VelocityTracker.obtain();
    mVelocity.addMovement(ev);
    mStartedScrolling=false;
  }
break;
case MotionEvent.ACTION_MOVE:
case MotionEvent.ACTION_OUTSIDE:
if (mTouchTracking == TRACKING_HOME) {
}
 else {
int slopX;
if (mRotateMove) {
  slopX=Math.abs(y - mLastMotionY);
}
 else {
  slopX=Math.abs(x - mLastMotionX);
}
if (!mStartedScrolling && slopX < mSlopX) {
}
 else {
  if (mRotateMove) {
    mRollo.mState.newPositionX=ev.getRawY() / mDefines.SCREEN_WIDTH_PX;
  }
 else {
    mRollo.mState.newPositionX=ev.getRawX() / mDefines.SCREEN_WIDTH_PX;
  }
  mRollo.mState.newTouchDown=1;
  mRollo.move();
  mStartedScrolling=true;
  mRollo.clearSelectedIcon();
  mVelocity.addMovement(ev);
  mRollo.mState.save();
  mLastMotionX=x;
  mLastMotionY=y;
}
}
break;
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL:
if (mTouchTracking == TRACKING_HOME) {
if (action == MotionEvent.ACTION_UP) {
if (y > mRollo.mTouchYBorders[mRollo.mTouchYBorders.length - 1]) {
mLauncher.closeAllApps(true);
}
}
}
 else {
mRollo.mState.newTouchDown=0;
if (mRotateMove) {
mRollo.mState.newPositionX=ev.getRawY() / mDefines.SCREEN_WIDTH_PX;
}
 else {
mRollo.mState.newPositionX=ev.getRawX() / mDefines.SCREEN_WIDTH_PX;
}
mVelocity.computeCurrentVelocity(1000,mMaxFlingVelocity);
if (mRotateMove) {
mRollo.mState.flingVelocityX=mVelocity.getYVelocity() / mDefines.SCREEN_WIDTH_PX;
}
 else {
mRollo.mState.flingVelocityX=mVelocity.getXVelocity() / mDefines.SCREEN_WIDTH_PX;
}
mRollo.clearSelectedIcon();
mRollo.mState.save();
mRollo.fling();
mLastMotionX=-10000;
if (mVelocity != null) {
mVelocity.recycle();
mVelocity=null;
}
break;
}
}
return true;
}

Fixed version (ground truth):
@Override public boolean onTouchEvent(MotionEvent ev){
  if (!isVisible()) {
    return true;
  }
  if (mLocks != 0) {
    return true;
  }
  super.onTouchEvent(ev);
  int x=(int)ev.getX();
  int y=(int)ev.getY();
  int action=ev.getAction();
switch (action) {
case MotionEvent.ACTION_DOWN:
    if (x < 60 && y > 700) {
    }
  if (y > mRollo.mTouchYBorders[mRollo.mTouchYBorders.length - 1]) {
    mTouchTracking=TRACKING_HOME;
  }
 else {
    mTouchTracking=TRACKING_FLING;
    mMotionDownRawX=(int)ev.getRawX();
    mMotionDownRawY=(int)ev.getRawY();
    if (mRotateMove) {
      mRollo.mState.newPositionX=ev.getRawY() / mDefines.SCREEN_WIDTH_PX;
    }
 else {
      mRollo.mState.newPositionX=ev.getRawX() / mDefines.SCREEN_WIDTH_PX;
    }
    mRollo.mState.newTouchDown=1;
    if (!mRollo.checkClickOK()) {
      mRollo.clearSelectedIcon();
    }
 else {
      mDownIconIndex=mCurrentIconIndex=mRollo.selectIcon(x,y,mRollo.mMessageProc.mPosX);
      if (mDownIconIndex < 0) {
        cancelLongPress();
      }
    }
    mRollo.mState.save();
    mRollo.move();
    mVelocity=VelocityTracker.obtain();
    mVelocity.addMovement(ev);
    mStartedScrolling=false;
  }
break;
case MotionEvent.ACTION_MOVE:
case MotionEvent.ACTION_OUTSIDE:
if (mTouchTracking == TRACKING_HOME) {
}
 else {
int rawX=(int)ev.getRawX();
int rawY=(int)ev.getRawY();
int slop;
if (mRotateMove) {
  slop=Math.abs(rawY - mMotionDownRawY);
}
 else {
  slop=Math.abs(rawX - mMotionDownRawX);
}
if (!mStartedScrolling && slop < mSlop) {
  mCurrentIconIndex=mRollo.chooseTappedIcon(x,y,mRollo.mMessageProc.mPosX);
  if (mDownIconIndex != mCurrentIconIndex) {
    cancelLongPress();
    mCurrentIconIndex=-1;
  }
}
 else {
  if (!mStartedScrolling) {
    cancelLongPress();
    mCurrentIconIndex=-1;
  }
  if (mRotateMove) {
    mRollo.mState.newPositionX=ev.getRawY() / mDefines.SCREEN_WIDTH_PX;
  }
 else {
    mRollo.mState.newPositionX=ev.getRawX() / mDefines.SCREEN_WIDTH_PX;
  }
  mRollo.mState.newTouchDown=1;
  mRollo.move();
  mStartedScrolling=true;
  mRollo.clearSelectedIcon();
  mVelocity.addMovement(ev);
  mRollo.mState.save();
}
}
break;
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL:
if (mTouchTracking == TRACKING_HOME) {
if (action == MotionEvent.ACTION_UP) {
if (y > mRollo.mTouchYBorders[mRollo.mTouchYBorders.length - 1]) {
mLauncher.closeAllApps(true);
}
}
}
 else {
mRollo.mState.newTouchDown=0;
if (mRotateMove) {
mRollo.mState.newPositionX=ev.getRawY() / mDefines.SCREEN_WIDTH_PX;
}
 else {
mRollo.mState.newPositionX=ev.getRawX() / mDefines.SCREEN_WIDTH_PX;
}
mVelocity.computeCurrentVelocity(1000,mMaxFlingVelocity);
if (mRotateMove) {
mRollo.mState.flingVelocityX=mVelocity.getYVelocity() / mDefines.SCREEN_WIDTH_PX;
}
 else {
mRollo.mState.flingVelocityX=mVelocity.getXVelocity() / mDefines.SCREEN_WIDTH_PX;
}
mRollo.clearSelectedIcon();
mRollo.mState.save();
mRollo.fling();
if (mVelocity != null) {
mVelocity.recycle();
mVelocity=null;
}
break;
}
}
return true;
}