Program: 172694
Project: 172694
Buggy source:
@Override public boolean onTouch(View v,MotionEvent event){
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
    if (System.currentTimeMillis() - projectileTime < 350 && (!isTutorial || isUpgraded)) {
      if (ammoAnimator != null && ammoAnimator.isStarted())       ammoAnimator.end();
      if (ammo > 0) {
        weapon.fire(projectiles,shipPositionX,shipBitmap.getHeight() * shipPositionY * 1.5f);
        if (listener != null)         listener.onProjectileFired(weapon);
        ammoAnimator=ValueAnimator.ofFloat(ammo,ammo - 1);
        ammoAnimator.setDuration(500);
        ammoAnimator.setInterpolator(new DecelerateInterpolator());
        ammoAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener(){
          @Override public void onAnimationUpdate(          ValueAnimator valueAnimator){
            ammo=(float)valueAnimator.getAnimatedValue();
          }
        }
);
        ammoAnimator.start();
      }
 else       if (isTutorial) {
        FontUtils.toast(getContext(),"String_Node_Str");
        FontUtils.toast(getContext(),"String_Node_Str");
        boxes.add(new BoxData(boxBitmap,new BoxData.BoxOpenedListener(){
          @Override public void onBoxOpened(          BoxData box){
            isReplenished=true;
            new Handler(Looper.getMainLooper()).post(new Runnable(){
              @Override public void run(){
                ammoAnimator=ValueAnimator.ofFloat(ammo,weapon.capacity);
                ammoAnimator.setDuration(500);
                ammoAnimator.setInterpolator(new DecelerateInterpolator());
                ammoAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener(){
                  @Override public void onAnimationUpdate(                  ValueAnimator valueAnimator){
                    ammo=(float)valueAnimator.getAnimatedValue();
                  }
                }
);
                ammoAnimator.start();
                if (listener != null)                 listener.onAmmoReplenished();
              }
            }
);
          }
        }
));
      }
 else       if (listener != null)       listener.onOutOfAmmo();
      return false;
    }
 else     projectileTime=System.currentTimeMillis();
  if (animator != null && animator.isStarted())   animator.cancel();
if (event.getX() > getWidth() / 2) {
  if (shipPositionX < 1)   animator=ValueAnimator.ofFloat(shipPositionX,shipPositionX + 1);
 else   return false;
}
 else if (shipPositionX > 0) animator=ValueAnimator.ofFloat(shipPositionX,shipPositionX - 1);
animator.setDuration((long)(2000 / speed));
animator.setStartDelay(50);
animator.setInterpolator(new AccelerateInterpolator());
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener(){
@Override public void onAnimationUpdate(ValueAnimator valueAnimator){
float newX=(float)valueAnimator.getAnimatedValue();
if (newX <= 0) shipPositionX=0;
 else if (newX >= 1) shipPositionX=1;
 else shipPositionX=newX;
}
}
);
animator.start();
shipPositionStartX=shipPositionX;
break;
case MotionEvent.ACTION_UP:
if (animator != null && animator.isStarted()) animator.cancel();
if (isTutorial && !isMoved) {
if (System.currentTimeMillis() - projectileTime > 500) isMoved=true;
 else FontUtils.toast(getContext(),"String_Node_Str");
}
float newX=shipPositionX + ((shipPositionX - shipPositionStartX) / 1.5f);
if (newX <= 0) newX=0;
 else if (newX >= 1) newX=1;
animator=ValueAnimator.ofFloat(shipPositionX,newX);
animator.setInterpolator(new DecelerateInterpolator());
animator.setDuration((long)(1000 / speed));
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener(){
@Override public void onAnimationUpdate(ValueAnimator valueAnimator){
float newX=(float)valueAnimator.getAnimatedValue();
if (newX <= 0) shipPositionX=0;
 else if (newX >= 1) shipPositionX=1;
 else shipPositionX=newX;
}
}
);
animator.start();
break;
}
return true;
}

Fixed version (ground truth):
@Override public boolean onTouch(View v,MotionEvent event){
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
    if (System.currentTimeMillis() - projectileTime < 350 && (!isTutorial || isUpgraded)) {
      if (ammoAnimator != null && ammoAnimator.isStarted())       ammoAnimator.end();
      if (ammo > 0) {
        weapon.fire(projectiles,shipPositionX,shipBitmap.getHeight() * shipPositionY * 1.5f);
        if (listener != null)         listener.onProjectileFired(weapon);
        ammoAnimator=ValueAnimator.ofFloat(ammo,ammo - 1);
        ammoAnimator.setDuration(500);
        ammoAnimator.setInterpolator(new DecelerateInterpolator());
        ammoAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener(){
          @Override public void onAnimationUpdate(          ValueAnimator valueAnimator){
            ammo=(float)valueAnimator.getAnimatedValue();
          }
        }
);
        ammoAnimator.start();
      }
 else       if (isTutorial && boxes.size() == 0) {
        FontUtils.toast(getContext(),"String_Node_Str");
        FontUtils.toast(getContext(),"String_Node_Str");
        boxes.add(new BoxData(boxBitmap,new BoxData.BoxOpenedListener(){
          @Override public void onBoxOpened(          BoxData box){
            isReplenished=true;
            new Handler(Looper.getMainLooper()).post(new Runnable(){
              @Override public void run(){
                ammoAnimator=ValueAnimator.ofFloat(ammo,weapon.capacity);
                ammoAnimator.setDuration(500);
                ammoAnimator.setInterpolator(new DecelerateInterpolator());
                ammoAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener(){
                  @Override public void onAnimationUpdate(                  ValueAnimator valueAnimator){
                    ammo=(float)valueAnimator.getAnimatedValue();
                  }
                }
);
                ammoAnimator.start();
                if (listener != null)                 listener.onAmmoReplenished();
              }
            }
);
          }
        }
));
      }
 else       if (listener != null)       listener.onOutOfAmmo();
      return false;
    }
 else     projectileTime=System.currentTimeMillis();
  if (animator != null && animator.isStarted())   animator.cancel();
if (event.getX() > getWidth() / 2) {
  if (shipPositionX < 1)   animator=ValueAnimator.ofFloat(shipPositionX,shipPositionX + 1);
 else   return false;
}
 else if (shipPositionX > 0) animator=ValueAnimator.ofFloat(shipPositionX,shipPositionX - 1);
animator.setDuration((long)(2000 / speed));
animator.setStartDelay(50);
animator.setInterpolator(new AccelerateInterpolator());
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener(){
@Override public void onAnimationUpdate(ValueAnimator valueAnimator){
float newX=(float)valueAnimator.getAnimatedValue();
if (newX <= 0) shipPositionX=0;
 else if (newX >= 1) shipPositionX=1;
 else shipPositionX=newX;
}
}
);
animator.start();
shipPositionStartX=shipPositionX;
break;
case MotionEvent.ACTION_UP:
if (animator != null && animator.isStarted()) animator.cancel();
if (isTutorial && !isMoved) {
if (System.currentTimeMillis() - projectileTime > 500) isMoved=true;
 else FontUtils.toast(getContext(),"String_Node_Str");
}
float newX=shipPositionX + ((shipPositionX - shipPositionStartX) / 1.5f);
if (newX <= 0) newX=0;
 else if (newX >= 1) newX=1;
animator=ValueAnimator.ofFloat(shipPositionX,newX);
animator.setInterpolator(new DecelerateInterpolator());
animator.setDuration((long)(1000 / speed));
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener(){
@Override public void onAnimationUpdate(ValueAnimator valueAnimator){
float newX=(float)valueAnimator.getAnimatedValue();
if (newX <= 0) shipPositionX=0;
 else if (newX >= 1) shipPositionX=1;
 else shipPositionX=newX;
}
}
);
animator.start();
break;
}
return true;
}