Program: 1978
Project: 1978
Buggy source:
public boolean selectDrawable(int idx){
  if (idx == mCurIndex) {
    return false;
  }
  final long now=SystemClock.uptimeMillis();
  if (DEBUG)   android.util.Log.i(TAG,toString() + "String_Node_Str" + mCurIndex+ "String_Node_Str"+ idx+ "String_Node_Str"+ mDrawableContainerState.mExitFadeDuration+ "String_Node_Str"+ mDrawableContainerState.mEnterFadeDuration);
  if (mDrawableContainerState.mExitFadeDuration > 0) {
    if (mLastDrawable != null) {
      mLastDrawable.setVisible(false,false);
    }
    if (mCurrDrawable != null) {
      mLastDrawable=mCurrDrawable;
      mExitAnimationEnd=now + mDrawableContainerState.mExitFadeDuration;
    }
 else {
      mLastDrawable=null;
      mExitAnimationEnd=0;
    }
  }
 else   if (mCurrDrawable != null) {
    mCurrDrawable.setVisible(false,false);
  }
  if (idx >= 0 && idx < mDrawableContainerState.mNumChildren) {
    Drawable d=mDrawableContainerState.mDrawables[idx];
    mCurrDrawable=d;
    mCurIndex=idx;
    if (d != null) {
      d.mutate();
      if (mDrawableContainerState.mEnterFadeDuration > 0) {
        mEnterAnimationEnd=now + mDrawableContainerState.mEnterFadeDuration;
      }
 else {
        d.setAlpha(mAlpha);
      }
      d.setVisible(isVisible(),true);
      d.setDither(mDrawableContainerState.mDither);
      d.setColorFilter(mColorFilter);
      d.setState(getState());
      d.setLevel(getLevel());
      d.setBounds(getBounds());
    }
  }
 else {
    mCurrDrawable=null;
    mCurIndex=-1;
  }
  if (mEnterAnimationEnd != 0 || mExitAnimationEnd != 0) {
    if (mAnimationRunnable == null) {
      mAnimationRunnable=new Runnable(){
        @Override public void run(){
          animate(true);
          invalidateSelf();
        }
      }
;
    }
 else {
      unscheduleSelf(mAnimationRunnable);
    }
    animate(true);
  }
  invalidateSelf();
  return true;
}

Fixed version (ground truth):
public boolean selectDrawable(int idx){
  if (idx == mCurIndex) {
    return false;
  }
  final long now=SystemClock.uptimeMillis();
  if (DEBUG)   android.util.Log.i(TAG,toString() + "String_Node_Str" + mCurIndex+ "String_Node_Str"+ idx+ "String_Node_Str"+ mDrawableContainerState.mExitFadeDuration+ "String_Node_Str"+ mDrawableContainerState.mEnterFadeDuration);
  if (mDrawableContainerState.mExitFadeDuration > 0) {
    if (mLastDrawable != null) {
      mLastDrawable.setVisible(false,false);
    }
    if (mCurrDrawable != null) {
      mLastDrawable=mCurrDrawable;
      mExitAnimationEnd=now + mDrawableContainerState.mExitFadeDuration;
    }
 else {
      mLastDrawable=null;
      mExitAnimationEnd=0;
    }
  }
 else   if (mCurrDrawable != null) {
    mCurrDrawable.setVisible(false,false);
  }
  if (idx >= 0 && idx < mDrawableContainerState.mNumChildren) {
    Drawable d=mDrawableContainerState.mDrawables[idx];
    mCurrDrawable=d;
    mCurIndex=idx;
    if (d != null) {
      d.mutate();
      if (mDrawableContainerState.mEnterFadeDuration > 0) {
        mEnterAnimationEnd=now + mDrawableContainerState.mEnterFadeDuration;
      }
 else {
        d.setAlpha(mAlpha);
      }
      d.setVisible(isVisible(),true);
      d.setDither(mDrawableContainerState.mDither);
      d.setColorFilter(mColorFilter);
      d.setState(getState());
      d.setLevel(getLevel());
      d.setBounds(getBounds());
      d.setLayoutDirection(getLayoutDirection());
    }
  }
 else {
    mCurrDrawable=null;
    mCurIndex=-1;
  }
  if (mEnterAnimationEnd != 0 || mExitAnimationEnd != 0) {
    if (mAnimationRunnable == null) {
      mAnimationRunnable=new Runnable(){
        @Override public void run(){
          animate(true);
          invalidateSelf();
        }
      }
;
    }
 else {
      unscheduleSelf(mAnimationRunnable);
    }
    animate(true);
  }
  invalidateSelf();
  return true;
}