Program: 179902
Project: 179902
Buggy source:
@Override public boolean onTouchEvent(MotionEvent ev){
  mArrowNavigation=false;
  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 (y > mRollo.mTouchYBorders[mRollo.mTouchYBorders.length - 1]) {
      mTouchTracking=TRACKING_HOME;
      mRollo.setHomeSelected(SELECTED_PRESSED);
      mRollo.mState.save();
      mCurrentIconIndex=-1;
    }
 else {
      mTouchTracking=TRACKING_FLING;
      mMotionDownRawX=(int)ev.getRawX();
      mMotionDownRawY=(int)ev.getRawY();
      mRollo.mState.newPositionX=ev.getRawY() / getHeight();
      mRollo.mState.newTouchDown=1;
      if (!mRollo.checkClickOK()) {
        mRollo.clearSelectedIcon();
      }
 else {
        mDownIconIndex=mCurrentIconIndex=mRollo.selectIcon(x,y,mRollo.mMessageProc.mPosX,SELECTED_PRESSED);
        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) {
  mRollo.setHomeSelected(y > mRollo.mTouchYBorders[mRollo.mTouchYBorders.length - 1] ? SELECTED_PRESSED : SELECTED_NONE);
  mRollo.mState.save();
}
 else if (mTouchTracking == TRACKING_FLING) {
  int rawX=(int)ev.getRawX();
  int rawY=(int)ev.getRawY();
  int slop;
  slop=Math.abs(rawY - mMotionDownRawY);
  if (!mStartedScrolling && slop < mSlop) {
    mCurrentIconIndex=mRollo.chooseTappedIcon(x,y,mRollo.mMessageProc.mPosX);
    if (mDownIconIndex != mCurrentIconIndex) {
      cancelLongPress();
      mCurrentIconIndex=-1;
    }
  }
 else {
    if (!mStartedScrolling) {
      cancelLongPress();
      mCurrentIconIndex=-1;
    }
    mRollo.mState.newPositionX=ev.getRawY() / getHeight();
    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]) {
  reallyPlaySoundEffect(SoundEffectConstants.CLICK);
  mLauncher.closeAllApps(true);
}
mRollo.setHomeSelected(SELECTED_NONE);
mRollo.mState.save();
}
mCurrentIconIndex=-1;
}
 else if (mTouchTracking == TRACKING_FLING) {
mRollo.mState.newTouchDown=0;
mRollo.mState.newPositionX=ev.getRawY() / getHeight();
mVelocity.computeCurrentVelocity(1000,mMaxFlingVelocity);
mRollo.mState.flingVelocity=mVelocity.getYVelocity() / getHeight();
mRollo.clearSelectedIcon();
mRollo.mState.save();
mRollo.fling();
if (mVelocity != null) {
mVelocity.recycle();
mVelocity=null;
}
}
mTouchTracking=TRACKING_NONE;
break;
}
return true;
}

Fixed version (ground truth):
@Override public boolean onTouchEvent(MotionEvent ev){
  mArrowNavigation=false;
  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 (y > mRollo.mTouchYBorders[mRollo.mTouchYBorders.length - 1]) {
      mTouchTracking=TRACKING_HOME;
      mRollo.setHomeSelected(SELECTED_PRESSED);
      mRollo.mState.save();
      mCurrentIconIndex=-1;
    }
 else {
      mTouchTracking=TRACKING_FLING;
      mMotionDownRawX=(int)ev.getRawX();
      mMotionDownRawY=(int)ev.getRawY();
      mRollo.mState.newPositionX=ev.getRawY() / getHeight();
      mRollo.mState.newTouchDown=1;
      if (!mRollo.checkClickOK()) {
        mRollo.clearSelectedIcon();
      }
 else {
        mDownIconIndex=mCurrentIconIndex=mRollo.selectIcon(x,y,mMessageProc.mPosX,SELECTED_PRESSED);
        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) {
  mRollo.setHomeSelected(y > mRollo.mTouchYBorders[mRollo.mTouchYBorders.length - 1] ? SELECTED_PRESSED : SELECTED_NONE);
  mRollo.mState.save();
}
 else if (mTouchTracking == TRACKING_FLING) {
  int rawX=(int)ev.getRawX();
  int rawY=(int)ev.getRawY();
  int slop;
  slop=Math.abs(rawY - mMotionDownRawY);
  if (!mStartedScrolling && slop < mSlop) {
    mCurrentIconIndex=mRollo.chooseTappedIcon(x,y,mMessageProc.mPosX);
    if (mDownIconIndex != mCurrentIconIndex) {
      cancelLongPress();
      mCurrentIconIndex=-1;
    }
  }
 else {
    if (!mStartedScrolling) {
      cancelLongPress();
      mCurrentIconIndex=-1;
    }
    mRollo.mState.newPositionX=ev.getRawY() / getHeight();
    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]) {
  reallyPlaySoundEffect(SoundEffectConstants.CLICK);
  mLauncher.closeAllApps(true);
}
mRollo.setHomeSelected(SELECTED_NONE);
mRollo.mState.save();
}
mCurrentIconIndex=-1;
}
 else if (mTouchTracking == TRACKING_FLING) {
mRollo.mState.newTouchDown=0;
mRollo.mState.newPositionX=ev.getRawY() / getHeight();
mVelocity.computeCurrentVelocity(1000,mMaxFlingVelocity);
mRollo.mState.flingVelocity=mVelocity.getYVelocity() / getHeight();
mRollo.clearSelectedIcon();
mRollo.mState.save();
mRollo.fling();
if (mVelocity != null) {
mVelocity.recycle();
mVelocity=null;
}
}
mTouchTracking=TRACKING_NONE;
break;
}
return true;
}