Program: 25828
Project: 25828
Buggy source:
@Override public boolean onTouchEvent(MotionEvent event){
  if (null == stickData || stickData.size() == 0) {
    return false;
  }
  final float MIN_LENGTH=(super.getWidth() / 40) < 5 ? 5 : (super.getWidth() / 50);
switch (event.getAction() & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_DOWN:
    TOUCH_MODE=DOWN;
  if (event.getPointerCount() == 1) {
    startPoint=new PointF(event.getX(),event.getY());
  }
break;
case MotionEvent.ACTION_UP:
startPointA=null;
startPointB=null;
case MotionEvent.ACTION_POINTER_UP:
TOUCH_MODE=NONE;
startPointA=null;
startPointB=null;
return super.onTouchEvent(event);
case MotionEvent.ACTION_POINTER_DOWN:
olddistance=calcDistance(event);
if (olddistance > MIN_LENGTH) {
TOUCH_MODE=ZOOM;
startPointA=new PointF(event.getX(0),event.getY(0));
startPointB=new PointF(event.getX(1),event.getY(1));
}
break;
case MotionEvent.ACTION_MOVE:
if (TOUCH_MODE == ZOOM) {
newdistance=calcDistance(event);
if (newdistance > MIN_LENGTH) {
if (startPointA.x >= event.getX(0) && startPointB.x >= event.getX(1)) {
if (displayFrom + displayNumber + 2 < stickData.size()) {
displayFrom=displayFrom + 2;
}
}
 else if (startPointA.x <= event.getX(0) && startPointB.x <= event.getX(1)) {
if (displayFrom > 2) {
displayFrom=displayFrom - 2;
}
}
 else {
if (Math.abs(newdistance - olddistance) > MIN_LENGTH) {
if (newdistance > olddistance) {
zoomIn();
}
 else {
zoomOut();
}
olddistance=newdistance;
}
}
startPointA=new PointF(event.getX(0),event.getY(0));
startPointB=new PointF(event.getX(1),event.getY(1));
super.postInvalidate();
super.notifyEventAll(this);
}
}
 else {
if (event.getPointerCount() == 1) {
float moveXdistance=Math.abs(event.getX() - startPoint.x);
float moveYdistance=Math.abs(event.getY() - startPoint.y);
if (moveXdistance > 1 || moveYdistance > 1) {
super.onTouchEvent(event);
startPoint=new PointF(event.getX(),event.getY());
}
}
}
break;
}
return true;
}

Fixed version (ground truth):
@Override public boolean onTouchEvent(MotionEvent event){
  if (null == stickData || stickData.size() == 0) {
    return false;
  }
  final float MIN_LENGTH=(super.getWidth() / 40) < 5 ? 5 : (super.getWidth() / 50);
switch (event.getAction() & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_DOWN:
    TOUCH_MODE=DOWN;
  if (event.getPointerCount() == 1) {
    startPoint=new PointF(event.getX(),event.getY());
  }
break;
case MotionEvent.ACTION_UP:
TOUCH_MODE=NONE;
startPointA=null;
startPointB=null;
return super.onTouchEvent(event);
case MotionEvent.ACTION_POINTER_UP:
TOUCH_MODE=NONE;
startPointA=null;
startPointB=null;
return super.onTouchEvent(event);
case MotionEvent.ACTION_POINTER_DOWN:
olddistance=calcDistance(event);
if (olddistance > MIN_LENGTH) {
TOUCH_MODE=ZOOM;
startPointA=new PointF(event.getX(0),event.getY(0));
startPointB=new PointF(event.getX(1),event.getY(1));
}
break;
case MotionEvent.ACTION_MOVE:
if (TOUCH_MODE == ZOOM) {
newdistance=calcDistance(event);
if (newdistance > MIN_LENGTH) {
if (startPointA.x >= event.getX(0) && startPointB.x >= event.getX(1)) {
if (displayFrom + displayNumber + 2 < stickData.size()) {
displayFrom=displayFrom + 2;
}
}
 else if (startPointA.x <= event.getX(0) && startPointB.x <= event.getX(1)) {
if (displayFrom > 2) {
displayFrom=displayFrom - 2;
}
}
 else {
if (Math.abs(newdistance - olddistance) > MIN_LENGTH) {
if (newdistance > olddistance) {
zoomIn();
}
 else {
zoomOut();
}
olddistance=newdistance;
}
}
startPointA=new PointF(event.getX(0),event.getY(0));
startPointB=new PointF(event.getX(1),event.getY(1));
super.postInvalidate();
super.notifyEventAll(this);
}
}
 else {
if (event.getPointerCount() == 1) {
float moveXdistance=Math.abs(event.getX() - startPoint.x);
float moveYdistance=Math.abs(event.getY() - startPoint.y);
if (moveXdistance > 1 || moveYdistance > 1) {
super.onTouchEvent(event);
startPoint=new PointF(event.getX(),event.getY());
}
}
}
break;
}
return true;
}