Program: 26757
Project: 26757
Buggy source:
@SuppressLint("String_Node_Str") @Override public boolean onTouch(View v,MotionEvent event){
  if (mTouchMode == NONE) {
    mGestureDetector.onTouchEvent(event);
  }
  if (!mChart.isDragEnabled() && !mChart.isScaleEnabled())   return true;
switch (event.getAction() & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_DOWN:
    saveTouchStart(event);
  break;
case MotionEvent.ACTION_POINTER_DOWN:
if (event.getPointerCount() >= 2) {
  mChart.disableScroll();
  saveTouchStart(event);
  mSavedXDist=getXDist(event);
  mSavedYDist=getYDist(event);
  mSavedDist=spacing(event);
  if (mSavedDist > 10f) {
    if (mChart.isPinchZoomEnabled()) {
      mTouchMode=PINCH_ZOOM;
    }
 else {
      if (mSavedXDist > mSavedYDist)       mTouchMode=X_ZOOM;
 else       mTouchMode=Y_ZOOM;
    }
  }
  midPoint(mTouchPointCenter,event);
}
break;
case MotionEvent.ACTION_MOVE:
if (mTouchMode == DRAG) {
mChart.disableScroll();
if (mChart.isDragEnabled()) performDrag(event);
}
 else if (mTouchMode == X_ZOOM || mTouchMode == Y_ZOOM || mTouchMode == PINCH_ZOOM) {
mChart.disableScroll();
if (mChart.isScaleEnabled()) performZoom(event);
}
 else if (mTouchMode == NONE && Math.abs(distance(event.getX(),mTouchStartPoint.x,event.getY(),mTouchStartPoint.y)) > 25f) {
if (mChart.hasNoDragOffset()) {
if (!mChart.isFullyZoomedOut()) mTouchMode=DRAG;
}
 else {
mTouchMode=DRAG;
}
}
break;
case MotionEvent.ACTION_UP:
mTouchMode=NONE;
mChart.enableScroll();
break;
case MotionEvent.ACTION_POINTER_UP:
mTouchMode=POST_ZOOM;
break;
}
mMatrix=mChart.getViewPortHandler().refresh(mMatrix,mChart);
return true;
}

Fixed version (ground truth):
@SuppressLint("String_Node_Str") @Override public boolean onTouch(View v,MotionEvent event){
  if (mTouchMode == NONE) {
    mGestureDetector.onTouchEvent(event);
  }
  if (!mChart.isDragEnabled() && !mChart.isScaleEnabled())   return true;
switch (event.getAction() & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_DOWN:
    saveTouchStart(event);
  break;
case MotionEvent.ACTION_POINTER_DOWN:
if (event.getPointerCount() >= 2) {
  mChart.disableScroll();
  saveTouchStart(event);
  mSavedXDist=getXDist(event);
  mSavedYDist=getYDist(event);
  mSavedDist=spacing(event);
  if (mSavedDist > 10f) {
    if (mChart.isPinchZoomEnabled()) {
      mTouchMode=PINCH_ZOOM;
    }
 else {
      if (mSavedXDist > mSavedYDist)       mTouchMode=X_ZOOM;
 else       mTouchMode=Y_ZOOM;
    }
  }
  midPoint(mTouchPointCenter,event);
}
break;
case MotionEvent.ACTION_MOVE:
if (mTouchMode == DRAG) {
mChart.disableScroll();
if (mChart.isDragEnabled()) performDrag(event);
}
 else if (mTouchMode == X_ZOOM || mTouchMode == Y_ZOOM || mTouchMode == PINCH_ZOOM) {
mChart.disableScroll();
if (mChart.isScaleEnabled()) performZoom(event);
}
 else if (mTouchMode == NONE && Math.abs(distance(event.getX(),mTouchStartPoint.x,event.getY(),mTouchStartPoint.y)) > 5f) {
if (mChart.hasNoDragOffset()) {
if (!mChart.isFullyZoomedOut()) mTouchMode=DRAG;
}
 else {
mTouchMode=DRAG;
}
}
break;
case MotionEvent.ACTION_UP:
mTouchMode=NONE;
mChart.enableScroll();
break;
case MotionEvent.ACTION_POINTER_UP:
mTouchMode=POST_ZOOM;
break;
}
mMatrix=mChart.getViewPortHandler().refresh(mMatrix,mChart);
return true;
}