Program: 23318
Project: 23318
Buggy source:
/** 
 * Implement this method to handle touch screen motion events.
 * @param event The motion event.
 * @return True if the event was handled, false otherwise.
 */
public boolean onTouchEvent(MotionEvent event){
  final int viewFlags=mViewFlags;
  if ((viewFlags & ENABLED_MASK) == DISABLED) {
    return (((viewFlags & CLICKABLE) == CLICKABLE || (viewFlags & LONG_CLICKABLE) == LONG_CLICKABLE));
  }
  if (mTouchDelegate != null) {
    if (mTouchDelegate.onTouchEvent(event)) {
      return true;
    }
  }
  if (((viewFlags & CLICKABLE) == CLICKABLE || (viewFlags & LONG_CLICKABLE) == LONG_CLICKABLE)) {
switch (event.getAction()) {
case MotionEvent.ACTION_UP:
      if ((mPrivateFlags & PRESSED) != 0) {
        boolean focusTaken=false;
        if (isFocusable() && isFocusableInTouchMode() && !isFocused()) {
          focusTaken=requestFocus();
        }
        if (!mHasPerformedLongPress) {
          cancelLongPress();
          if (!focusTaken) {
            performClick();
          }
        }
        if (mUnsetPressedState == null) {
          mUnsetPressedState=new UnsetPressedState();
        }
        if (!post(mUnsetPressedState)) {
          mUnsetPressedState.run();
        }
      }
    break;
case MotionEvent.ACTION_DOWN:
  mPrivateFlags|=PRESSED;
refreshDrawableState();
if ((mViewFlags & LONG_CLICKABLE) == LONG_CLICKABLE) {
postCheckForLongClick();
}
break;
case MotionEvent.ACTION_CANCEL:
mPrivateFlags&=~PRESSED;
refreshDrawableState();
break;
case MotionEvent.ACTION_MOVE:
final int x=(int)event.getX();
final int y=(int)event.getY();
int slop=ViewConfiguration.get(mContext).getScaledTouchSlop();
if ((x < 0 - slop) || (x >= getWidth() + slop) || (y < 0 - slop)|| (y >= getHeight() + slop)) {
if ((mPrivateFlags & PRESSED) != 0) {
cancelLongPress();
mPrivateFlags&=~PRESSED;
refreshDrawableState();
}
}
 else {
if ((mPrivateFlags & PRESSED) == 0) {
mPrivateFlags|=PRESSED;
refreshDrawableState();
}
}
break;
}
return true;
}
return false;
}

Fixed version (ground truth):
/** 
 * Implement this method to handle touch screen motion events.
 * @param event The motion event.
 * @return True if the event was handled, false otherwise.
 */
public boolean onTouchEvent(MotionEvent event){
  final int viewFlags=mViewFlags;
  if ((viewFlags & ENABLED_MASK) == DISABLED) {
    return (((viewFlags & CLICKABLE) == CLICKABLE || (viewFlags & LONG_CLICKABLE) == LONG_CLICKABLE));
  }
  if (mTouchDelegate != null) {
    if (mTouchDelegate.onTouchEvent(event)) {
      return true;
    }
  }
  if (((viewFlags & CLICKABLE) == CLICKABLE || (viewFlags & LONG_CLICKABLE) == LONG_CLICKABLE)) {
switch (event.getAction()) {
case MotionEvent.ACTION_UP:
      if ((mPrivateFlags & PRESSED) != 0) {
        boolean focusTaken=false;
        if (isFocusable() && isFocusableInTouchMode() && !isFocused()) {
          focusTaken=requestFocus();
        }
        if (!mHasPerformedLongPress) {
          removeLongPressCallback();
          if (!focusTaken) {
            performClick();
          }
        }
        if (mUnsetPressedState == null) {
          mUnsetPressedState=new UnsetPressedState();
        }
        if (!post(mUnsetPressedState)) {
          mUnsetPressedState.run();
        }
      }
    break;
case MotionEvent.ACTION_DOWN:
  mPrivateFlags|=PRESSED;
refreshDrawableState();
if ((mViewFlags & LONG_CLICKABLE) == LONG_CLICKABLE) {
postCheckForLongClick();
}
break;
case MotionEvent.ACTION_CANCEL:
mPrivateFlags&=~PRESSED;
refreshDrawableState();
break;
case MotionEvent.ACTION_MOVE:
final int x=(int)event.getX();
final int y=(int)event.getY();
int slop=ViewConfiguration.get(mContext).getScaledTouchSlop();
if ((x < 0 - slop) || (x >= getWidth() + slop) || (y < 0 - slop)|| (y >= getHeight() + slop)) {
if ((mPrivateFlags & PRESSED) != 0) {
removeLongPressCallback();
mPrivateFlags&=~PRESSED;
refreshDrawableState();
}
}
 else {
if ((mPrivateFlags & PRESSED) == 0) {
mPrivateFlags|=PRESSED;
refreshDrawableState();
}
}
break;
}
return true;
}
return false;
}