Program: 193226
Project: 193226
Buggy source:
private void updateAppWindowsLocked(int displayId){
  ArrayList<TaskStack> stacks=mService.getDisplayContentLocked(displayId).getStacks();
  for (int stackNdx=stacks.size() - 1; stackNdx >= 0; --stackNdx) {
    final TaskStack stack=stacks.get(stackNdx);
    final ArrayList<Task> tasks=stack.getTasks();
    for (int taskNdx=tasks.size() - 1; taskNdx >= 0; --taskNdx) {
      final AppTokenList tokens=tasks.get(taskNdx).mAppTokens;
      for (int tokenNdx=tokens.size() - 1; tokenNdx >= 0; --tokenNdx) {
        final AppWindowAnimator appAnimator=tokens.get(tokenNdx).mAppAnimator;
        appAnimator.wasAnimating=appAnimator.animating;
        if (appAnimator.stepAnimationLocked(mCurrentTime,displayId)) {
          appAnimator.animating=true;
          mAnimating=mAppWindowAnimating=true;
        }
 else         if (appAnimator.wasAnimating) {
          setAppLayoutChanges(appAnimator,WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER,"String_Node_Str" + appAnimator.mAppToken + "String_Node_Str",displayId);
          if (DEBUG_ANIM)           Slog.v(TAG,"String_Node_Str" + appAnimator.mAppToken);
        }
      }
    }
    final AppTokenList exitingAppTokens=stack.mExitingAppTokens;
    final int exitingCount=exitingAppTokens.size();
    for (int i=0; i < exitingCount; i++) {
      final AppWindowAnimator appAnimator=exitingAppTokens.get(i).mAppAnimator;
      appAnimator.wasAnimating=appAnimator.animating;
      if (appAnimator.stepAnimationLocked(mCurrentTime,displayId)) {
        mAnimating=mAppWindowAnimating=true;
      }
 else       if (appAnimator.wasAnimating) {
        setAppLayoutChanges(appAnimator,WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER,"String_Node_Str" + appAnimator.mAppToken + "String_Node_Str",displayId);
        if (DEBUG_ANIM)         Slog.v(TAG,"String_Node_Str" + appAnimator.mAppToken);
      }
    }
  }
}

Fixed version (ground truth):
private void updateAppWindowsLocked(int displayId){
  ArrayList<TaskStack> stacks=mService.getDisplayContentLocked(displayId).getStacks();
  for (int stackNdx=stacks.size() - 1; stackNdx >= 0; --stackNdx) {
    final TaskStack stack=stacks.get(stackNdx);
    final ArrayList<Task> tasks=stack.getTasks();
    for (int taskNdx=tasks.size() - 1; taskNdx >= 0; --taskNdx) {
      final AppTokenList tokens=tasks.get(taskNdx).mAppTokens;
      for (int tokenNdx=tokens.size() - 1; tokenNdx >= 0; --tokenNdx) {
        final AppWindowAnimator appAnimator=tokens.get(tokenNdx).mAppAnimator;
        appAnimator.wasAnimating=appAnimator.animating;
        if (appAnimator.stepAnimationLocked(mCurrentTime,displayId)) {
          appAnimator.animating=true;
          setAnimating(true);
          mAppWindowAnimating=true;
        }
 else         if (appAnimator.wasAnimating) {
          setAppLayoutChanges(appAnimator,WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER,"String_Node_Str" + appAnimator.mAppToken + "String_Node_Str",displayId);
          if (DEBUG_ANIM)           Slog.v(TAG,"String_Node_Str" + appAnimator.mAppToken);
        }
      }
    }
    final AppTokenList exitingAppTokens=stack.mExitingAppTokens;
    final int exitingCount=exitingAppTokens.size();
    for (int i=0; i < exitingCount; i++) {
      final AppWindowAnimator appAnimator=exitingAppTokens.get(i).mAppAnimator;
      appAnimator.wasAnimating=appAnimator.animating;
      if (appAnimator.stepAnimationLocked(mCurrentTime,displayId)) {
        setAnimating(true);
        mAppWindowAnimating=true;
      }
 else       if (appAnimator.wasAnimating) {
        setAppLayoutChanges(appAnimator,WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER,"String_Node_Str" + appAnimator.mAppToken + "String_Node_Str",displayId);
        if (DEBUG_ANIM)         Slog.v(TAG,"String_Node_Str" + appAnimator.mAppToken);
      }
    }
  }
}