Program: 113313
Project: 113313
Buggy source:
@Override public boolean onTouch(View v,MotionEvent event){
  final float eventX=event.getX();
  final float eventY=event.getY();
  int degrees;
  int value;
  final Boolean[] isInnerCircle=new Boolean[1];
  isInnerCircle[0]=false;
  long millis=SystemClock.uptimeMillis();
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
    if (!mInputEnabled) {
      return true;
    }
  mDownX=eventX;
mDownY=eventY;
mLastValueSelected=-1;
mDoingMove=false;
mDoingTouch=true;
if (!mHideAmPm) {
mIsTouchingAmOrPm=mAmPmCirclesView.getIsTouchingAmOrPm(eventX,eventY);
}
 else {
mIsTouchingAmOrPm=-1;
}
if (mIsTouchingAmOrPm == AM || mIsTouchingAmOrPm == PM) {
tryVibrate();
mDownDegrees=-1;
mHandler.postDelayed(new Runnable(){
@Override public void run(){
mAmPmCirclesView.setAmOrPmPressed(mIsTouchingAmOrPm);
mAmPmCirclesView.invalidate();
}
}
,TAP_TIMEOUT);
}
 else {
boolean forceLegal=mAccessibilityManager.isTouchExplorationEnabled();
mDownDegrees=getDegreesFromCoords(eventX,eventY,forceLegal,isInnerCircle);
if (mDownDegrees != -1) {
tryVibrate();
mHandler.postDelayed(new Runnable(){
@Override public void run(){
mDoingMove=true;
int value=reselectSelector(mDownDegrees,isInnerCircle[0],false,true);
mLastValueSelected=value;
mListener.onValueSelected(getCurrentItemShowing(),value,false);
}
}
,TAP_TIMEOUT);
}
}
return true;
case MotionEvent.ACTION_MOVE:
if (!mInputEnabled) {
Log.e(TAG,"String_Node_Str");
return true;
}
float dY=Math.abs(eventY - mDownY);
float dX=Math.abs(eventX - mDownX);
if (!mDoingMove && dX <= TOUCH_SLOP && dY <= TOUCH_SLOP) {
break;
}
if (mIsTouchingAmOrPm == AM || mIsTouchingAmOrPm == PM) {
mHandler.removeCallbacksAndMessages(null);
int isTouchingAmOrPm=mAmPmCirclesView.getIsTouchingAmOrPm(eventX,eventY);
if (isTouchingAmOrPm != mIsTouchingAmOrPm) {
mAmPmCirclesView.setAmOrPmPressed(-1);
mAmPmCirclesView.invalidate();
mIsTouchingAmOrPm=-1;
}
break;
}
if (mDownDegrees == -1) {
break;
}
mDoingMove=true;
mHandler.removeCallbacksAndMessages(null);
degrees=getDegreesFromCoords(eventX,eventY,true,isInnerCircle);
if (degrees != -1) {
value=reselectSelector(degrees,isInnerCircle[0],false,true);
if (value != mLastValueSelected) {
tryVibrate();
mLastValueSelected=value;
mListener.onValueSelected(getCurrentItemShowing(),value,false);
}
}
return true;
case MotionEvent.ACTION_UP:
if (!mInputEnabled) {
Log.d(TAG,"String_Node_Str");
mListener.onValueSelected(ENABLE_PICKER_INDEX,1,false);
return true;
}
mHandler.removeCallbacksAndMessages(null);
mDoingTouch=false;
if (mIsTouchingAmOrPm == AM || mIsTouchingAmOrPm == PM) {
int isTouchingAmOrPm=mAmPmCirclesView.getIsTouchingAmOrPm(eventX,eventY);
mAmPmCirclesView.setAmOrPmPressed(-1);
mAmPmCirclesView.invalidate();
if (isTouchingAmOrPm == mIsTouchingAmOrPm) {
mAmPmCirclesView.setAmOrPm(isTouchingAmOrPm);
if (getIsCurrentlyAmOrPm() != isTouchingAmOrPm) {
mListener.onValueSelected(AMPM_INDEX,mIsTouchingAmOrPm,false);
setValueForItem(AMPM_INDEX,isTouchingAmOrPm);
}
}
mIsTouchingAmOrPm=-1;
break;
}
if (mDownDegrees != -1) {
degrees=getDegreesFromCoords(eventX,eventY,mDoingMove,isInnerCircle);
if (degrees != -1) {
value=reselectSelector(degrees,isInnerCircle[0],!mDoingMove,false);
if (getCurrentItemShowing() == HOUR_INDEX && !mIs24HourMode) {
int amOrPm=getIsCurrentlyAmOrPm();
if (amOrPm == AM && value == 12) {
value=0;
}
 else if (amOrPm == PM && value != 12) {
value+=12;
}
}
setValueForItem(getCurrentItemShowing(),value);
mListener.onValueSelected(getCurrentItemShowing(),value,true);
}
}
mDoingMove=false;
return true;
default :
break;
}
return false;
}

Fixed version (ground truth):
@Override public boolean onTouch(View v,MotionEvent event){
  final float eventX=event.getX();
  final float eventY=event.getY();
  int degrees;
  int value;
  final Boolean[] isInnerCircle=new Boolean[1];
  isInnerCircle[0]=false;
  long millis=SystemClock.uptimeMillis();
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
    if (!mInputEnabled) {
      return true;
    }
  mDownX=eventX;
mDownY=eventY;
mLastValueSelected=-1;
mDoingMove=false;
mDoingTouch=true;
if (!mHideAmPm) {
mIsTouchingAmOrPm=mAmPmCirclesView.getIsTouchingAmOrPm(eventX,eventY);
}
 else {
mIsTouchingAmOrPm=-1;
}
if (mIsTouchingAmOrPm == AM || mIsTouchingAmOrPm == PM) {
mController.tryVibrate();
mDownDegrees=-1;
mHandler.postDelayed(new Runnable(){
@Override public void run(){
mAmPmCirclesView.setAmOrPmPressed(mIsTouchingAmOrPm);
mAmPmCirclesView.invalidate();
}
}
,TAP_TIMEOUT);
}
 else {
boolean forceLegal=mAccessibilityManager.isTouchExplorationEnabled();
mDownDegrees=getDegreesFromCoords(eventX,eventY,forceLegal,isInnerCircle);
if (mDownDegrees != -1) {
mController.tryVibrate();
mHandler.postDelayed(new Runnable(){
@Override public void run(){
mDoingMove=true;
int value=reselectSelector(mDownDegrees,isInnerCircle[0],false,true);
mLastValueSelected=value;
mListener.onValueSelected(getCurrentItemShowing(),value,false);
}
}
,TAP_TIMEOUT);
}
}
return true;
case MotionEvent.ACTION_MOVE:
if (!mInputEnabled) {
Log.e(TAG,"String_Node_Str");
return true;
}
float dY=Math.abs(eventY - mDownY);
float dX=Math.abs(eventX - mDownX);
if (!mDoingMove && dX <= TOUCH_SLOP && dY <= TOUCH_SLOP) {
break;
}
if (mIsTouchingAmOrPm == AM || mIsTouchingAmOrPm == PM) {
mHandler.removeCallbacksAndMessages(null);
int isTouchingAmOrPm=mAmPmCirclesView.getIsTouchingAmOrPm(eventX,eventY);
if (isTouchingAmOrPm != mIsTouchingAmOrPm) {
mAmPmCirclesView.setAmOrPmPressed(-1);
mAmPmCirclesView.invalidate();
mIsTouchingAmOrPm=-1;
}
break;
}
if (mDownDegrees == -1) {
break;
}
mDoingMove=true;
mHandler.removeCallbacksAndMessages(null);
degrees=getDegreesFromCoords(eventX,eventY,true,isInnerCircle);
if (degrees != -1) {
value=reselectSelector(degrees,isInnerCircle[0],false,true);
if (value != mLastValueSelected) {
mController.tryVibrate();
mLastValueSelected=value;
mListener.onValueSelected(getCurrentItemShowing(),value,false);
}
}
return true;
case MotionEvent.ACTION_UP:
if (!mInputEnabled) {
Log.d(TAG,"String_Node_Str");
mListener.onValueSelected(ENABLE_PICKER_INDEX,1,false);
return true;
}
mHandler.removeCallbacksAndMessages(null);
mDoingTouch=false;
if (mIsTouchingAmOrPm == AM || mIsTouchingAmOrPm == PM) {
int isTouchingAmOrPm=mAmPmCirclesView.getIsTouchingAmOrPm(eventX,eventY);
mAmPmCirclesView.setAmOrPmPressed(-1);
mAmPmCirclesView.invalidate();
if (isTouchingAmOrPm == mIsTouchingAmOrPm) {
mAmPmCirclesView.setAmOrPm(isTouchingAmOrPm);
if (getIsCurrentlyAmOrPm() != isTouchingAmOrPm) {
mListener.onValueSelected(AMPM_INDEX,mIsTouchingAmOrPm,false);
setValueForItem(AMPM_INDEX,isTouchingAmOrPm);
}
}
mIsTouchingAmOrPm=-1;
break;
}
if (mDownDegrees != -1) {
degrees=getDegreesFromCoords(eventX,eventY,mDoingMove,isInnerCircle);
if (degrees != -1) {
value=reselectSelector(degrees,isInnerCircle[0],!mDoingMove,false);
if (getCurrentItemShowing() == HOUR_INDEX && !mIs24HourMode) {
int amOrPm=getIsCurrentlyAmOrPm();
if (amOrPm == AM && value == 12) {
value=0;
}
 else if (amOrPm == PM && value != 12) {
value+=12;
}
}
setValueForItem(getCurrentItemShowing(),value);
mListener.onValueSelected(getCurrentItemShowing(),value,true);
}
}
mDoingMove=false;
return true;
default :
break;
}
return false;
}