Program: 179798
Project: 179798
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();
  final boolean isPortrait=getWidth() < getHeight();
  int action=ev.getAction();
switch (action) {
case MotionEvent.ACTION_DOWN:
    if ((isPortrait && y > mRollo.mTouchYBorders[mRollo.mTouchYBorders.length - 1]) || (!isPortrait && x > mRollo.mTouchXBorders[mRollo.mTouchXBorders.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,mPosX,SELECTED_PRESSED);
        if (mDownIconIndex < 0) {
          cancelLongPress();
        }
      }
      mRollo.mState.save();
      mRollo.move();
      mVelocityTracker=VelocityTracker.obtain();
      mVelocityTracker.addMovement(ev);
      mStartedScrolling=false;
    }
  break;
case MotionEvent.ACTION_MOVE:
case MotionEvent.ACTION_OUTSIDE:
if (mTouchTracking == TRACKING_HOME) {
  mRollo.setHomeSelected((isPortrait && y > mRollo.mTouchYBorders[mRollo.mTouchYBorders.length - 1]) || (!isPortrait && x > mRollo.mTouchXBorders[mRollo.mTouchXBorders.length - 1]) ? SELECTED_PRESSED : SELECTED_NONE);
  mRollo.mState.save();
}
 else if (mTouchTracking == TRACKING_FLING) {
  int rawY=(int)ev.getRawY();
  int slop;
  slop=Math.abs(rawY - mMotionDownRawY);
  if (!mStartedScrolling && slop < mSlop) {
    mCurrentIconIndex=mRollo.chooseTappedIcon(x,y,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();
    mVelocityTracker.addMovement(ev);
    mRollo.mState.save();
  }
}
break;
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL:
if (mTouchTracking == TRACKING_HOME) {
if (action == MotionEvent.ACTION_UP) {
if ((isPortrait && y > mRollo.mTouchYBorders[mRollo.mTouchYBorders.length - 1]) || (!isPortrait && x > mRollo.mTouchXBorders[mRollo.mTouchXBorders.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();
mVelocityTracker.computeCurrentVelocity(1000,mMaxFlingVelocity);
mRollo.mState.flingVelocity=mVelocityTracker.getYVelocity() / getHeight();
mRollo.clearSelectedIcon();
mRollo.mState.save();
mRollo.fling();
if (mVelocityTracker != null) {
mVelocityTracker.recycle();
mVelocityTracker=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();
  final boolean isPortrait=getWidth() < getHeight();
  int action=ev.getAction();
switch (action) {
case MotionEvent.ACTION_DOWN:
    if ((isPortrait && y > mRollo.mTouchYBorders[mRollo.mTouchYBorders.length - 1]) || (!isPortrait && x > mRollo.mTouchXBorders[mRollo.mTouchXBorders.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,SELECTED_PRESSED);
        if (mDownIconIndex < 0) {
          cancelLongPress();
        }
      }
      mRollo.mState.save();
      mRollo.move();
      mVelocityTracker=VelocityTracker.obtain();
      mVelocityTracker.addMovement(ev);
      mStartedScrolling=false;
    }
  break;
case MotionEvent.ACTION_MOVE:
case MotionEvent.ACTION_OUTSIDE:
if (mTouchTracking == TRACKING_HOME) {
  mRollo.setHomeSelected((isPortrait && y > mRollo.mTouchYBorders[mRollo.mTouchYBorders.length - 1]) || (!isPortrait && x > mRollo.mTouchXBorders[mRollo.mTouchXBorders.length - 1]) ? SELECTED_PRESSED : SELECTED_NONE);
  mRollo.mState.save();
}
 else if (mTouchTracking == TRACKING_FLING) {
  int rawY=(int)ev.getRawY();
  int slop;
  slop=Math.abs(rawY - mMotionDownRawY);
  if (!mStartedScrolling && slop < mSlop) {
    mCurrentIconIndex=mRollo.chooseTappedIcon(x,y);
    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();
    mVelocityTracker.addMovement(ev);
    mRollo.mState.save();
  }
}
break;
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL:
if (mTouchTracking == TRACKING_HOME) {
if (action == MotionEvent.ACTION_UP) {
if ((isPortrait && y > mRollo.mTouchYBorders[mRollo.mTouchYBorders.length - 1]) || (!isPortrait && x > mRollo.mTouchXBorders[mRollo.mTouchXBorders.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();
mVelocityTracker.computeCurrentVelocity(1000,mMaxFlingVelocity);
mRollo.mState.flingVelocity=mVelocityTracker.getYVelocity() / getHeight();
mRollo.clearSelectedIcon();
mRollo.mState.save();
mRollo.fling();
if (mVelocityTracker != null) {
mVelocityTracker.recycle();
mVelocityTracker=null;
}
}
mTouchTracking=TRACKING_NONE;
break;
}
return true;
}