Program: 197966
Project: 197966
Buggy source:
/** 
 * Process the animationEvents for a new animation
 * @param animationEvents the animation events for the animation to perform
 * @param finalState the final state to animate to
 */
private void processAnimationEvents(ArrayList<NotificationStackScrollLayout.AnimationEvent> animationEvents,StackScrollState finalState){
  for (  NotificationStackScrollLayout.AnimationEvent event : animationEvents) {
    final ExpandableView changingView=(ExpandableView)event.changingView;
    if (event.animationType == NotificationStackScrollLayout.AnimationEvent.ANIMATION_TYPE_ADD) {
      StackScrollState.ViewState viewState=finalState.getViewStateForView(changingView);
      if (viewState == null) {
        continue;
      }
      if (changingView.getVisibility() == View.GONE) {
        finalState.removeViewStateForView(changingView);
        continue;
      }
      changingView.setAlpha(viewState.alpha);
      changingView.setTranslationY(viewState.yTranslation);
      changingView.setTranslationZ(viewState.zTranslation);
      changingView.setActualHeight(viewState.height,false);
      mNewAddChildren.add(changingView);
    }
 else     if (event.animationType == NotificationStackScrollLayout.AnimationEvent.ANIMATION_TYPE_REMOVE) {
      if (changingView.getVisibility() == View.GONE) {
        continue;
      }
      StackScrollState.ViewState viewState=finalState.getViewStateForView(event.viewAfterChangingView);
      int actualHeight=changingView.getActualHeight();
      float translationDirection=-1.0f;
      if (viewState != null) {
        translationDirection=((viewState.yTranslation - (changingView.getTranslationY() + actualHeight / 2.0f)) * 2 / actualHeight);
        translationDirection=Math.max(Math.min(translationDirection,1.0f),-1.0f);
      }
      changingView.performRemoveAnimation(ANIMATION_DURATION_APPEAR_DISAPPEAR,translationDirection,new Runnable(){
        @Override public void run(){
          mHostLayout.getOverlay().remove(changingView);
        }
      }
);
    }
    mNewEvents.add(event);
  }
}

Fixed version (ground truth):
/** 
 * Process the animationEvents for a new animation
 * @param animationEvents the animation events for the animation to perform
 * @param finalState the final state to animate to
 */
private void processAnimationEvents(ArrayList<NotificationStackScrollLayout.AnimationEvent> animationEvents,StackScrollState finalState){
  for (  NotificationStackScrollLayout.AnimationEvent event : animationEvents) {
    final ExpandableView changingView=(ExpandableView)event.changingView;
    if (event.animationType == NotificationStackScrollLayout.AnimationEvent.ANIMATION_TYPE_ADD) {
      StackScrollState.ViewState viewState=finalState.getViewStateForView(changingView);
      if (viewState == null) {
        continue;
      }
      if (changingView.getVisibility() == View.GONE) {
        finalState.removeViewStateForView(changingView);
        continue;
      }
      changingView.setAlpha(viewState.alpha);
      changingView.setTranslationY(viewState.yTranslation);
      changingView.setTranslationZ(viewState.zTranslation);
      changingView.setActualHeight(viewState.height,false);
      mNewAddChildren.add(changingView);
    }
 else     if (event.animationType == NotificationStackScrollLayout.AnimationEvent.ANIMATION_TYPE_REMOVE) {
      if (changingView.getVisibility() == View.GONE) {
        mHostLayout.getOverlay().remove(changingView);
        continue;
      }
      StackScrollState.ViewState viewState=finalState.getViewStateForView(event.viewAfterChangingView);
      int actualHeight=changingView.getActualHeight();
      float translationDirection=-1.0f;
      if (viewState != null) {
        translationDirection=((viewState.yTranslation - (changingView.getTranslationY() + actualHeight / 2.0f)) * 2 / actualHeight);
        translationDirection=Math.max(Math.min(translationDirection,1.0f),-1.0f);
      }
      changingView.performRemoveAnimation(ANIMATION_DURATION_APPEAR_DISAPPEAR,translationDirection,new Runnable(){
        @Override public void run(){
          mHostLayout.getOverlay().remove(changingView);
        }
      }
);
    }
    mNewEvents.add(event);
  }
}