Program: 79791
Project: 79791
Buggy source:
public boolean onTouchEvent(MotionEvent ev){
  if (mLongPressSent) {
    return true;
  }
  if (!mDragging) {
    removeLongPressCallback();
    return false;
  }
  mVelocityTracker.addMovement(ev);
  final int action=ev.getAction();
switch (action) {
case MotionEvent.ACTION_OUTSIDE:
case MotionEvent.ACTION_MOVE:
    if (mCurrView != null) {
      float delta=getPos(ev) - mInitialTouchPos;
      if (CONSTRAIN_SWIPE && !mCallback.canChildBeDismissed(mCurrView)) {
        float size=getSize(mCurrAnimView);
        float maxScrollDistance=0.15f * size;
        if (Math.abs(delta) >= size) {
          delta=delta > 0 ? maxScrollDistance : -maxScrollDistance;
        }
 else {
          delta=maxScrollDistance * (float)Math.sin((delta / size) * (Math.PI / 2));
        }
      }
      setTranslation(mCurrAnimView,delta);
      updateAlphaFromOffset(mCurrAnimView,mCanCurrViewBeDimissed);
    }
  break;
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL:
if (mCurrView != null) {
  float maxVelocity=MAX_DISMISS_VELOCITY * mDensityScale;
  mVelocityTracker.computeCurrentVelocity(1000,maxVelocity);
  float escapeVelocity=SWIPE_ESCAPE_VELOCITY * mDensityScale;
  float velocity=getVelocity(mVelocityTracker);
  float perpendicularVelocity=getPerpendicularVelocity(mVelocityTracker);
  boolean childSwipedFarEnough=DISMISS_IF_SWIPED_FAR_ENOUGH && Math.abs(getTranslation(mCurrAnimView)) > 0.4 * getSize(mCurrAnimView);
  boolean childSwipedFastEnough=(Math.abs(velocity) > escapeVelocity) && (Math.abs(velocity) > Math.abs(perpendicularVelocity)) && (velocity > 0) == (getTranslation(mCurrAnimView) > 0);
  boolean dismissChild=mCallback.canChildBeDismissed(mCurrView) && (childSwipedFastEnough || childSwipedFarEnough);
  if (dismissChild) {
    dismissChild(mCurrView,childSwipedFastEnough ? velocity : 0f);
  }
 else {
    mCallback.onDragCancelled(mCurrView);
    snapChild(mCurrView,velocity);
  }
}
break;
}
return true;
}

Fixed version (ground truth):
public boolean onTouchEvent(MotionEvent ev){
  if (mLongPressSent) {
    return true;
  }
  if (!mDragging) {
    removeLongPressCallback();
    removeShowContentCallback();
    return false;
  }
  mVelocityTracker.addMovement(ev);
  final int action=ev.getAction();
switch (action) {
case MotionEvent.ACTION_OUTSIDE:
case MotionEvent.ACTION_MOVE:
    if (mCurrView != null) {
      float delta=getPos(ev) - mInitialTouchPos;
      if (CONSTRAIN_SWIPE && !mCallback.canChildBeDismissed(mCurrView)) {
        float size=getSize(mCurrAnimView);
        float maxScrollDistance=0.15f * size;
        if (Math.abs(delta) >= size) {
          delta=delta > 0 ? maxScrollDistance : -maxScrollDistance;
        }
 else {
          delta=maxScrollDistance * (float)Math.sin((delta / size) * (Math.PI / 2));
        }
      }
      setTranslation(mCurrAnimView,delta);
      updateAlphaFromOffset(mCurrAnimView,mCanCurrViewBeDimissed);
    }
  break;
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL:
if (mCurrView != null) {
  float maxVelocity=MAX_DISMISS_VELOCITY * mDensityScale;
  mVelocityTracker.computeCurrentVelocity(1000,maxVelocity);
  float escapeVelocity=SWIPE_ESCAPE_VELOCITY * mDensityScale;
  float velocity=getVelocity(mVelocityTracker);
  float perpendicularVelocity=getPerpendicularVelocity(mVelocityTracker);
  boolean childSwipedFarEnough=DISMISS_IF_SWIPED_FAR_ENOUGH && Math.abs(getTranslation(mCurrAnimView)) > 0.4 * getSize(mCurrAnimView);
  boolean childSwipedFastEnough=(Math.abs(velocity) > escapeVelocity) && (Math.abs(velocity) > Math.abs(perpendicularVelocity)) && (velocity > 0) == (getTranslation(mCurrAnimView) > 0);
  boolean dismissChild=mCallback.canChildBeDismissed(mCurrView) && (childSwipedFastEnough || childSwipedFarEnough);
  if (dismissChild) {
    dismissChild(mCurrView,childSwipedFastEnough ? velocity : 0f);
  }
 else {
    mCallback.onDragCancelled(mCurrView);
    snapChild(mCurrView,velocity);
  }
}
break;
}
return true;
}