nus-yam/ex-repair huggingface dataset:
Program: 191847
Project: 191847
Buggy source:
void moveTasksToFullscreenStackLocked(int fromStackId,boolean onTop){
  final ActivityStack stack=getStack(fromStackId);
  if (stack == null) {
    return;
  }
  mWindowManager.deferSurfaceLayout();
  try {
    if (fromStackId == DOCKED_STACK_ID) {
      for (int i=FIRST_STATIC_STACK_ID; i <= LAST_STATIC_STACK_ID; i++) {
        if (StackId.isResizeableByDockedStack(i)) {
          ActivityStack otherStack=getStack(i);
          if (otherStack != null) {
            resizeStackLocked(i,null,null,null,PRESERVE_WINDOWS,true,DEFER_RESUME);
          }
        }
      }
      mAllowDockedStackResize=false;
    }
    final ArrayList<TaskRecord> tasks=stack.getAllTasks();
    final int size=tasks.size();
    if (onTop) {
      for (int i=0; i < size; i++) {
        moveTaskToStackLocked(tasks.get(i).taskId,FULLSCREEN_WORKSPACE_STACK_ID,onTop,onTop,"String_Node_Str",ANIMATE);
      }
    }
 else {
      for (int i=size - 1; i >= 0; i--) {
        positionTaskInStackLocked(tasks.get(i).taskId,FULLSCREEN_WORKSPACE_STACK_ID,0);
      }
    }
  }
  finally {
    mAllowDockedStackResize=true;
    mWindowManager.continueSurfaceLayout();
  }
}

Fixed version (ground truth):
void moveTasksToFullscreenStackLocked(int fromStackId,boolean onTop){
  final ActivityStack stack=getStack(fromStackId);
  if (stack == null) {
    return;
  }
  mWindowManager.deferSurfaceLayout();
  try {
    if (fromStackId == DOCKED_STACK_ID) {
      for (int i=FIRST_STATIC_STACK_ID; i <= LAST_STATIC_STACK_ID; i++) {
        if (StackId.isResizeableByDockedStack(i)) {
          ActivityStack otherStack=getStack(i);
          if (otherStack != null) {
            resizeStackLocked(i,null,null,null,PRESERVE_WINDOWS,true,DEFER_RESUME);
          }
        }
      }
      mAllowDockedStackResize=false;
    }
    final ArrayList<TaskRecord> tasks=stack.getAllTasks();
    final int size=tasks.size();
    if (onTop) {
      for (int i=0; i < size; i++) {
        moveTaskToStackLocked(tasks.get(i).taskId,FULLSCREEN_WORKSPACE_STACK_ID,onTop,onTop,"String_Node_Str",ANIMATE,DEFER_RESUME);
      }
      ensureActivitiesVisibleLocked(null,0,PRESERVE_WINDOWS);
      resumeFocusedStackTopActivityLocked();
    }
 else {
      for (int i=size - 1; i >= 0; i--) {
        positionTaskInStackLocked(tasks.get(i).taskId,FULLSCREEN_WORKSPACE_STACK_ID,0);
      }
    }
  }
  finally {
    mAllowDockedStackResize=true;
    mWindowManager.continueSurfaceLayout();
  }
}
Program: 191848
Project: 191848
Buggy source:
/** 
 * Restores a recent task to a stack
 * @param task The recent task to be restored.
 * @param stackId The stack to restore the task to (default launch stack will be usedif stackId is  {@link android.app.ActivityManager.StackId#INVALID_STACK_ID}).
 * @return true if the task has been restored successfully.
 */
private boolean restoreRecentTaskLocked(TaskRecord task,int stackId){
  if (stackId == INVALID_STACK_ID) {
    stackId=task.getLaunchStackId();
  }
 else   if (stackId == DOCKED_STACK_ID && !task.canGoInDockedStack()) {
    stackId=FULLSCREEN_WORKSPACE_STACK_ID;
  }
  if (task.stack != null) {
    if (task.stack.mStackId == stackId) {
      return true;
    }
    task.stack.removeTask(task,"String_Node_Str",MOVING);
  }
  final ActivityStack stack=getStack(stackId,CREATE_IF_NEEDED,!ON_TOP);
  if (stack == null) {
    if (DEBUG_RECENTS)     Slog.v(TAG_RECENTS,"String_Node_Str" + task);
    return false;
  }
  stack.addTask(task,false,"String_Node_Str");
  if (DEBUG_RECENTS)   Slog.v(TAG_RECENTS,"String_Node_Str" + task + "String_Node_Str"+ stack);
  final ArrayList<ActivityRecord> activities=task.mActivities;
  for (int activityNdx=activities.size() - 1; activityNdx >= 0; --activityNdx) {
    stack.addConfigOverride(activities.get(activityNdx),task);
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Restores a recent task to a stack
 * @param task The recent task to be restored.
 * @param stackId The stack to restore the task to (default launch stack will be usedif stackId is  {@link android.app.ActivityManager.StackId#INVALID_STACK_ID}).
 * @return true if the task has been restored successfully.
 */
private boolean restoreRecentTaskLocked(TaskRecord task,int stackId){
  if (stackId == INVALID_STACK_ID) {
    stackId=task.getLaunchStackId();
  }
 else   if (stackId == DOCKED_STACK_ID && !task.canGoInDockedStack()) {
    stackId=FULLSCREEN_WORKSPACE_STACK_ID;
  }
  if (task.stack != null) {
    if (task.stack.mStackId == stackId) {
      return true;
    }
    task.stack.removeTask(task,"String_Node_Str",REMOVE_TASK_MODE_MOVING);
  }
  final ActivityStack stack=getStack(stackId,CREATE_IF_NEEDED,!ON_TOP);
  if (stack == null) {
    if (DEBUG_RECENTS)     Slog.v(TAG_RECENTS,"String_Node_Str" + task);
    return false;
  }
  stack.addTask(task,false,"String_Node_Str");
  if (DEBUG_RECENTS)   Slog.v(TAG_RECENTS,"String_Node_Str" + task + "String_Node_Str"+ stack);
  final ArrayList<ActivityRecord> activities=task.mActivities;
  for (int activityNdx=activities.size() - 1; activityNdx >= 0; --activityNdx) {
    stack.addConfigOverride(activities.get(activityNdx),task);
  }
  return true;
}
Program: 191849
Project: 191849
Buggy source:
boolean resumeFocusedStackTopActivityLocked(ActivityStack targetStack,ActivityRecord target,ActivityOptions targetOptions){
  if (targetStack != null && isFocusedStack(targetStack)) {
    return targetStack.resumeTopActivityUncheckedLocked(target,targetOptions);
  }
  mFocusedStack.resumeTopActivityUncheckedLocked(null,null);
  return false;
}

Fixed version (ground truth):
boolean resumeFocusedStackTopActivityLocked(ActivityStack targetStack,ActivityRecord target,ActivityOptions targetOptions){
  if (targetStack != null && isFocusedStack(targetStack)) {
    return targetStack.resumeTopActivityUncheckedLocked(target,targetOptions);
  }
  final ActivityRecord r=mFocusedStack.topRunningActivityLocked();
  if (r == null || r.state != RESUMED) {
    mFocusedStack.resumeTopActivityUncheckedLocked(null,null);
  }
  return false;
}
Program: 191851
Project: 191851
Buggy source:
public TaskViewDismissedEvent(Task task,TaskView taskView){
  this.task=task;
  this.taskView=taskView;
}

Fixed version (ground truth):
public TaskViewDismissedEvent(Task task,TaskView taskView,AnimationProps animation){
  this.task=task;
  this.taskView=taskView;
  this.animation=animation;
}
Program: 191852
Project: 191852
Buggy source:
/** 
 * Starts the delete animation for the specified   {@link TaskView}.
 */
public void startDeleteTaskAnimation(final TaskView deleteTaskView,final ReferenceCountedTrigger postAnimationTrigger){
  TaskStackViewTouchHandler touchHandler=mStackView.getTouchHandler();
  touchHandler.onBeginDrag(deleteTaskView);
  postAnimationTrigger.increment();
  postAnimationTrigger.addLastDecrementRunnable(() -> {
    touchHandler.onChildDismissed(deleteTaskView);
  }
);
  final float dismissSize=touchHandler.getScaledDismissSize();
  ValueAnimator animator=ValueAnimator.ofFloat(0f,1f);
  animator.setDuration(400);
  animator.addUpdateListener((animation) -> {
    float progress=(Float)animation.getAnimatedValue();
    deleteTaskView.setTranslationX(progress * dismissSize);
    touchHandler.updateSwipeProgress(deleteTaskView,true,progress);
  }
);
  animator.addListener(new AnimatorListenerAdapter(){
    @Override public void onAnimationEnd(    Animator animation){
      postAnimationTrigger.decrement();
    }
  }
);
  animator.start();
}

Fixed version (ground truth):
/** 
 * Starts the delete animation for the specified   {@link TaskView}.
 */
public void startDeleteTaskAnimation(final TaskView deleteTaskView,final ReferenceCountedTrigger postAnimationTrigger){
  TaskStackViewTouchHandler touchHandler=mStackView.getTouchHandler();
  touchHandler.onBeginManualDrag(deleteTaskView);
  postAnimationTrigger.increment();
  postAnimationTrigger.addLastDecrementRunnable(() -> {
    touchHandler.onChildDismissed(deleteTaskView);
  }
);
  final float dismissSize=touchHandler.getScaledDismissSize();
  ValueAnimator animator=ValueAnimator.ofFloat(0f,1f);
  animator.setDuration(400);
  animator.addUpdateListener((animation) -> {
    float progress=(Float)animation.getAnimatedValue();
    deleteTaskView.setTranslationX(progress * dismissSize);
    touchHandler.updateSwipeProgress(deleteTaskView,true,progress);
  }
);
  animator.addListener(new AnimatorListenerAdapter(){
    @Override public void onAnimationEnd(    Animator animation){
      postAnimationTrigger.decrement();
    }
  }
);
  animator.start();
}
Program: 191853
Project: 191853
Buggy source:
/** 
 * Starts an in-app animation to hide all the task views so that we can transition back home.
 */
public void startExitToHomeAnimation(boolean animated,ReferenceCountedTrigger postAnimationTrigger){
  TaskStackLayoutAlgorithm stackLayout=mStackView.getStackAlgorithm();
  TaskStack stack=mStackView.getStack();
  if (stack.getTaskCount() == 0) {
    return;
  }
  int offscreenYOffset=stackLayout.mStackRect.height();
  List<TaskView> taskViews=mStackView.getTaskViews();
  int taskViewCount=taskViews.size();
  for (int i=0; i < taskViewCount; i++) {
    int taskIndexFromFront=taskViewCount - i - 1;
    TaskView tv=taskViews.get(i);
    AnimationProps taskAnimation;
    if (animated) {
      int delay=Math.min(ENTER_EXIT_NUM_ANIMATING_TASKS,taskIndexFromFront) * DOUBLE_FRAME_OFFSET_MS;
      taskAnimation=new AnimationProps().setStartDelay(AnimationProps.BOUNDS,delay).setDuration(AnimationProps.BOUNDS,EXIT_TO_HOME_TRANSLATION_DURATION).setInterpolator(AnimationProps.BOUNDS,EXIT_TO_HOME_TRANSLATION_INTERPOLATOR).setListener(postAnimationTrigger.decrementOnAnimationEnd());
      postAnimationTrigger.increment();
    }
 else {
      taskAnimation=AnimationProps.IMMEDIATE;
    }
    mTmpTransform.fillIn(tv);
    mTmpTransform.rect.offset(0,offscreenYOffset);
    mStackView.updateTaskViewToTransform(tv,mTmpTransform,taskAnimation);
  }
}

Fixed version (ground truth):
/** 
 * Starts an in-app animation to hide all the task views so that we can transition back home.
 */
public void startExitToHomeAnimation(boolean animated,ReferenceCountedTrigger postAnimationTrigger){
  TaskStackLayoutAlgorithm stackLayout=mStackView.getStackAlgorithm();
  TaskStack stack=mStackView.getStack();
  if (stack.getTaskCount() == 0) {
    return;
  }
  int offscreenYOffset=stackLayout.mStackRect.height();
  List<TaskView> taskViews=mStackView.getTaskViews();
  int taskViewCount=taskViews.size();
  for (int i=0; i < taskViewCount; i++) {
    int taskIndexFromFront=taskViewCount - i - 1;
    TaskView tv=taskViews.get(i);
    Task task=tv.getTask();
    if (mStackView.isIgnoredTask(task)) {
      continue;
    }
    AnimationProps taskAnimation;
    if (animated) {
      int delay=Math.min(ENTER_EXIT_NUM_ANIMATING_TASKS,taskIndexFromFront) * DOUBLE_FRAME_OFFSET_MS;
      taskAnimation=new AnimationProps().setStartDelay(AnimationProps.BOUNDS,delay).setDuration(AnimationProps.BOUNDS,EXIT_TO_HOME_TRANSLATION_DURATION).setInterpolator(AnimationProps.BOUNDS,EXIT_TO_HOME_TRANSLATION_INTERPOLATOR).setListener(postAnimationTrigger.decrementOnAnimationEnd());
      postAnimationTrigger.increment();
    }
 else {
      taskAnimation=AnimationProps.IMMEDIATE;
    }
    mTmpTransform.fillIn(tv);
    mTmpTransform.rect.offset(0,offscreenYOffset);
    mStackView.updateTaskViewToTransform(tv,mTmpTransform,taskAnimation);
  }
}
Program: 191854
Project: 191854
Buggy source:
/** 
 * Adds and override task progress for the given task when transitioning from focused to unfocused state.
 */
public void addUnfocusedTaskOverride(Task task,float stackScroll){
  if (mFocusState != STATE_UNFOCUSED) {
    mFocusedRange.offset(stackScroll);
    mUnfocusedRange.offset(stackScroll);
    float focusedRangeX=mFocusedRange.getNormalizedX(mTaskIndexMap.get(task.key.id));
    float focusedY=mFocusedCurveInterpolator.getInterpolation(focusedRangeX);
    float unfocusedRangeX=mUnfocusedCurveInterpolator.getX(focusedY);
    float unfocusedTaskProgress=stackScroll + mUnfocusedRange.getAbsoluteX(unfocusedRangeX);
    if (Float.compare(focusedRangeX,unfocusedRangeX) != 0) {
      mTaskIndexOverrideMap.put(task.key.id,unfocusedTaskProgress);
    }
  }
}

Fixed version (ground truth):
/** 
 * Adds and override task progress for the given task when transitioning from focused to unfocused state.
 */
public void addUnfocusedTaskOverride(TaskView taskView,float stackScroll){
  mFocusedRange.offset(stackScroll);
  mUnfocusedRange.offset(stackScroll);
  Task task=taskView.getTask();
  int top=taskView.getTop() - mTaskRect.top;
  float focusedRangeX=getNormalizedXFromFocusedY(top,FROM_TOP);
  float unfocusedRangeX=getNormalizedXFromUnfocusedY(top,FROM_TOP);
  float unfocusedTaskProgress=stackScroll + mUnfocusedRange.getAbsoluteX(unfocusedRangeX);
  if (Float.compare(focusedRangeX,unfocusedRangeX) != 0) {
    mTaskIndexOverrideMap.put(task.key.id,unfocusedTaskProgress);
  }
}
Program: 191855
Project: 191855
Buggy source:
@Override public boolean updateSwipeProgress(View v,boolean dismissable,float swipeProgress){
  updateTaskViewTransforms(Interpolators.FAST_OUT_SLOW_IN.getInterpolation(swipeProgress));
  return true;
}

Fixed version (ground truth):
@Override public boolean updateSwipeProgress(View v,boolean dismissable,float swipeProgress){
  if (mActiveTaskView == v || mSwipeHelperAnimations.containsKey(v)) {
    updateTaskViewTransforms(Interpolators.FAST_OUT_SLOW_IN.getInterpolation(swipeProgress));
  }
  return true;
}
Program: 191857
Project: 191857
Buggy source:
@Override public boolean canChildBeDismissed(View v){
  TaskView tv=(TaskView)v;
  return !mSwipeHelperAnimations.containsKey(v) && (mSv.getStack().indexOfStackTask(tv.getTask()) != -1);
}

Fixed version (ground truth):
@Override public boolean canChildBeDismissed(View v){
  TaskView tv=(TaskView)v;
  Task task=tv.getTask();
  return !mSwipeHelperAnimations.containsKey(v) && (mSv.getStack().indexOfStackTask(task) != -1);
}
Program: 191858
Project: 191858
Buggy source:
/** 
 * Called after the   {@link TaskView} is finished animating away.
 */
@Override public void onChildDismissed(View v){
  TaskView tv=(TaskView)v;
  tv.setClipViewInStack(true);
  tv.setTouchEnabled(true);
  EventBus.getDefault().send(new TaskViewDismissedEvent(tv.getTask(),tv));
  mSv.getScroller().setStackScroll(mTargetStackScroll,null);
  mSv.getStackAlgorithm().setFocusState(TaskStackLayoutAlgorithm.STATE_UNFOCUSED);
  mSv.getStackAlgorithm().clearUnfocusedTaskOverrides();
  mSwipeHelperAnimations.remove(v);
  MetricsLogger.histogram(tv.getContext(),"String_Node_Str",Constants.Metrics.DismissSourceSwipeGesture);
}

Fixed version (ground truth):
/** 
 * Called after the   {@link TaskView} is finished animating away.
 */
@Override public void onChildDismissed(View v){
  TaskView tv=(TaskView)v;
  tv.setClipViewInStack(true);
  tv.setTouchEnabled(true);
  EventBus.getDefault().send(new TaskViewDismissedEvent(tv.getTask(),tv,mSwipeHelperAnimations.containsKey(v) ? new AnimationProps(TaskStackView.DEFAULT_SYNC_STACK_DURATION,Interpolators.FAST_OUT_SLOW_IN) : null));
  if (mSwipeHelperAnimations.containsKey(v)) {
    mSv.getScroller().setStackScroll(mTargetStackScroll,null);
    mSv.getStackAlgorithm().setFocusState(TaskStackLayoutAlgorithm.STATE_UNFOCUSED);
    mSv.getStackAlgorithm().clearUnfocusedTaskOverrides();
    mSwipeHelperAnimations.remove(v);
  }
  MetricsLogger.histogram(tv.getContext(),"String_Node_Str",Constants.Metrics.DismissSourceSwipeGesture);
}
Program: 191860
Project: 191860
Buggy source:
/** 
 * Dismisses this task. 
 */
void dismissTask(){
  final TaskView tv=this;
  DismissTaskViewEvent dismissEvent=new DismissTaskViewEvent(tv);
  dismissEvent.addPostAnimationCallback(new Runnable(){
    @Override public void run(){
      EventBus.getDefault().send(new TaskViewDismissedEvent(mTask,tv));
    }
  }
);
  EventBus.getDefault().send(dismissEvent);
}

Fixed version (ground truth):
/** 
 * Dismisses this task. 
 */
void dismissTask(){
  final TaskView tv=this;
  DismissTaskViewEvent dismissEvent=new DismissTaskViewEvent(tv);
  dismissEvent.addPostAnimationCallback(new Runnable(){
    @Override public void run(){
      EventBus.getDefault().send(new TaskViewDismissedEvent(mTask,tv,new AnimationProps(TaskStackView.DEFAULT_SYNC_STACK_DURATION,Interpolators.FAST_OUT_SLOW_IN)));
    }
  }
);
  EventBus.getDefault().send(dismissEvent);
}
Program: 191861
Project: 191861
Buggy source:
@RemotableViewMethod public void setHasImage(boolean hasImage){
  mIndentLines=hasImage ? 2 : 0;
}

Fixed version (ground truth):
@RemotableViewMethod public void setHasImage(boolean hasImage){
  setNumIndentLines(hasImage ? 2 : 0);
}
Program: 191862
Project: 191862
Buggy source:
public static DividerSnapAlgorithm create(Context ctx,Rect insets){
  DisplayInfo displayInfo=new DisplayInfo();
  ctx.getSystemService(DisplayManager.class).getDisplay(Display.DEFAULT_DISPLAY).getDisplayInfo(displayInfo);
  int dividerWindowWidth=ctx.getResources().getDimensionPixelSize(com.android.internal.R.dimen.docked_stack_divider_thickness);
  int dividerInsets=ctx.getResources().getDimensionPixelSize(com.android.internal.R.dimen.docked_stack_divider_insets);
  return new DividerSnapAlgorithm(ctx.getResources(),displayInfo.logicalWidth,displayInfo.logicalHeight,dividerWindowWidth - 2 * dividerInsets,ctx.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT,insets);
}

Fixed version (ground truth):
public static DividerSnapAlgorithm create(Context ctx,Rect insets){
  DisplayInfo displayInfo=new DisplayInfo();
  ctx.getSystemService(DisplayManager.class).getDisplay(Display.DEFAULT_DISPLAY).getDisplayInfo(displayInfo);
  int dividerWindowWidth=ctx.getResources().getDimensionPixelSize(com.android.internal.R.dimen.docked_stack_divider_thickness);
  int dividerInsets=ctx.getResources().getDimensionPixelSize(com.android.internal.R.dimen.docked_stack_divider_insets);
  return new DividerSnapAlgorithm(ctx.getResources(),displayInfo.logicalWidth,displayInfo.logicalHeight,dividerWindowWidth - 2 * dividerInsets,ctx.getApplicationContext().getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT,insets);
}
Program: 191863
Project: 191863
Buggy source:
public final void onBusEvent(ConfigurationChangedEvent event){
  if (event.fromDisplayDensityChange) {
    updateSnapAlgorithm();
  }
}

Fixed version (ground truth):
public final void onBusEvent(ConfigurationChangedEvent event){
  if (event.fromDisplayDensityChange || event.fromDeviceOrientationChange) {
    updateSnapAlgorithm();
  }
}
Program: 191864
Project: 191864
Buggy source:
@RemotableViewMethod public void setHasImage(boolean hasImage){
  mIndentLines=hasImage ? 2 : 0;
}

Fixed version (ground truth):
@RemotableViewMethod public void setHasImage(boolean hasImage){
  setNumIndentLines(hasImage ? 2 : 0);
}
Program: 191865
Project: 191865
Buggy source:
@RemotableViewMethod public void setHasImage(boolean hasImage){
  mIndentLines=hasImage ? 2 : 0;
}

Fixed version (ground truth):
@RemotableViewMethod public void setHasImage(boolean hasImage){
  setNumIndentLines(hasImage ? 2 : 0);
}
Program: 191866
Project: 191866
Buggy source:
void positionTask(final TaskRecord task,int position){
  final ActivityRecord topRunningActivity=task.topRunningActivityLocked();
  final boolean wasResumed=topRunningActivity == task.stack.mResumedActivity;
  final ActivityStack prevStack=preAddTask(task,"String_Node_Str");
  task.stack=this;
  insertTaskAtPosition(task,position);
  postAddTask(task,prevStack);
  if (wasResumed) {
    if (mResumedActivity != null) {
      Log.wtf(TAG,"String_Node_Str" + "String_Node_Str" + mResumedActivity + "String_Node_Str"+ topRunningActivity);
    }
    mResumedActivity=topRunningActivity;
  }
}

Fixed version (ground truth):
void positionTask(final TaskRecord task,int position){
  final ActivityRecord topRunningActivity=task.topRunningActivityLocked();
  final boolean wasResumed=topRunningActivity == task.stack.mResumedActivity;
  final ActivityStack prevStack=preAddTask(task,"String_Node_Str",ON_TOP);
  task.stack=this;
  insertTaskAtPosition(task,position);
  postAddTask(task,prevStack);
  if (wasResumed) {
    if (mResumedActivity != null) {
      Log.wtf(TAG,"String_Node_Str" + "String_Node_Str" + mResumedActivity + "String_Node_Str"+ topRunningActivity);
    }
    mResumedActivity=topRunningActivity;
  }
}
Program: 191867
Project: 191867
Buggy source:
void addTask(final TaskRecord task,final boolean toTop,String reason){
  final ActivityStack prevStack=preAddTask(task,reason);
  task.stack=this;
  if (toTop) {
    insertTaskAtTop(task,null);
  }
 else {
    mTaskHistory.add(0,task);
    updateTaskMovement(task,false);
  }
  postAddTask(task,prevStack);
}

Fixed version (ground truth):
void addTask(final TaskRecord task,final boolean toTop,String reason){
  final ActivityStack prevStack=preAddTask(task,reason,toTop);
  task.stack=this;
  if (toTop) {
    insertTaskAtTop(task,null);
  }
 else {
    mTaskHistory.add(0,task);
    updateTaskMovement(task,false);
  }
  postAddTask(task,prevStack);
}
Program: 191869
Project: 191869
Buggy source:
private ActivityStack preAddTask(TaskRecord task,String reason){
  final ActivityStack prevStack=task.stack;
  if (prevStack != null && prevStack != this) {
    prevStack.removeTask(task,reason,MOVING);
  }
  return prevStack;
}

Fixed version (ground truth):
private ActivityStack preAddTask(TaskRecord task,String reason,boolean toTop){
  final ActivityStack prevStack=task.stack;
  if (prevStack != null && prevStack != this) {
    prevStack.removeTask(task,reason,toTop ? REMOVE_TASK_MODE_MOVING_TO_TOP : REMOVE_TASK_MODE_MOVING);
  }
  return prevStack;
}
Program: 191870
Project: 191870
Buggy source:
void moveTasksToFullscreenStackLocked(int fromStackId,boolean onTop){
  final ActivityStack stack=getStack(fromStackId);
  if (stack == null) {
    return;
  }
  mWindowManager.deferSurfaceLayout();
  try {
    if (fromStackId == DOCKED_STACK_ID) {
      for (int i=FIRST_STATIC_STACK_ID; i <= LAST_STATIC_STACK_ID; i++) {
        if (StackId.isResizeableByDockedStack(i)) {
          ActivityStack otherStack=getStack(i);
          if (otherStack != null) {
            resizeStackLocked(i,null,null,null,PRESERVE_WINDOWS,true,DEFER_RESUME);
          }
        }
      }
      mAllowDockedStackResize=false;
    }
    final ArrayList<TaskRecord> tasks=stack.getAllTasks();
    final int size=tasks.size();
    if (onTop) {
      for (int i=0; i < size; i++) {
        moveTaskToStackLocked(tasks.get(i).taskId,FULLSCREEN_WORKSPACE_STACK_ID,onTop,onTop,"String_Node_Str",ANIMATE);
      }
    }
 else {
      for (int i=size - 1; i >= 0; i--) {
        positionTaskInStackLocked(tasks.get(i).taskId,FULLSCREEN_WORKSPACE_STACK_ID,0);
      }
    }
  }
  finally {
    mAllowDockedStackResize=true;
    mWindowManager.continueSurfaceLayout();
  }
}

Fixed version (ground truth):
void moveTasksToFullscreenStackLocked(int fromStackId,boolean onTop){
  final ActivityStack stack=getStack(fromStackId);
  if (stack == null) {
    return;
  }
  mWindowManager.deferSurfaceLayout();
  try {
    if (fromStackId == DOCKED_STACK_ID) {
      for (int i=FIRST_STATIC_STACK_ID; i <= LAST_STATIC_STACK_ID; i++) {
        if (StackId.isResizeableByDockedStack(i)) {
          ActivityStack otherStack=getStack(i);
          if (otherStack != null) {
            resizeStackLocked(i,null,null,null,PRESERVE_WINDOWS,true,DEFER_RESUME);
          }
        }
      }
      mAllowDockedStackResize=false;
    }
    final ArrayList<TaskRecord> tasks=stack.getAllTasks();
    final int size=tasks.size();
    if (onTop) {
      for (int i=0; i < size; i++) {
        moveTaskToStackLocked(tasks.get(i).taskId,FULLSCREEN_WORKSPACE_STACK_ID,onTop,onTop,"String_Node_Str",ANIMATE,DEFER_RESUME);
      }
      ensureActivitiesVisibleLocked(null,0,PRESERVE_WINDOWS);
      resumeFocusedStackTopActivityLocked();
    }
 else {
      for (int i=size - 1; i >= 0; i--) {
        positionTaskInStackLocked(tasks.get(i).taskId,FULLSCREEN_WORKSPACE_STACK_ID,0);
      }
    }
  }
  finally {
    mAllowDockedStackResize=true;
    mWindowManager.continueSurfaceLayout();
  }
}
Program: 191871
Project: 191871
Buggy source:
/** 
 * Restores a recent task to a stack
 * @param task The recent task to be restored.
 * @param stackId The stack to restore the task to (default launch stack will be usedif stackId is  {@link android.app.ActivityManager.StackId#INVALID_STACK_ID}).
 * @return true if the task has been restored successfully.
 */
private boolean restoreRecentTaskLocked(TaskRecord task,int stackId){
  if (stackId == INVALID_STACK_ID) {
    stackId=task.getLaunchStackId();
  }
 else   if (stackId == DOCKED_STACK_ID && !task.canGoInDockedStack()) {
    stackId=FULLSCREEN_WORKSPACE_STACK_ID;
  }
  if (task.stack != null) {
    if (task.stack.mStackId == stackId) {
      return true;
    }
    task.stack.removeTask(task,"String_Node_Str",MOVING);
  }
  final ActivityStack stack=getStack(stackId,CREATE_IF_NEEDED,!ON_TOP);
  if (stack == null) {
    if (DEBUG_RECENTS)     Slog.v(TAG_RECENTS,"String_Node_Str" + task);
    return false;
  }
  stack.addTask(task,false,"String_Node_Str");
  if (DEBUG_RECENTS)   Slog.v(TAG_RECENTS,"String_Node_Str" + task + "String_Node_Str"+ stack);
  final ArrayList<ActivityRecord> activities=task.mActivities;
  for (int activityNdx=activities.size() - 1; activityNdx >= 0; --activityNdx) {
    stack.addConfigOverride(activities.get(activityNdx),task);
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Restores a recent task to a stack
 * @param task The recent task to be restored.
 * @param stackId The stack to restore the task to (default launch stack will be usedif stackId is  {@link android.app.ActivityManager.StackId#INVALID_STACK_ID}).
 * @return true if the task has been restored successfully.
 */
private boolean restoreRecentTaskLocked(TaskRecord task,int stackId){
  if (stackId == INVALID_STACK_ID) {
    stackId=task.getLaunchStackId();
  }
 else   if (stackId == DOCKED_STACK_ID && !task.canGoInDockedStack()) {
    stackId=FULLSCREEN_WORKSPACE_STACK_ID;
  }
  if (task.stack != null) {
    if (task.stack.mStackId == stackId) {
      return true;
    }
    task.stack.removeTask(task,"String_Node_Str",REMOVE_TASK_MODE_MOVING);
  }
  final ActivityStack stack=getStack(stackId,CREATE_IF_NEEDED,!ON_TOP);
  if (stack == null) {
    if (DEBUG_RECENTS)     Slog.v(TAG_RECENTS,"String_Node_Str" + task);
    return false;
  }
  stack.addTask(task,false,"String_Node_Str");
  if (DEBUG_RECENTS)   Slog.v(TAG_RECENTS,"String_Node_Str" + task + "String_Node_Str"+ stack);
  final ArrayList<ActivityRecord> activities=task.mActivities;
  for (int activityNdx=activities.size() - 1; activityNdx >= 0; --activityNdx) {
    stack.addConfigOverride(activities.get(activityNdx),task);
  }
  return true;
}
Program: 191872
Project: 191872
Buggy source:
boolean resumeFocusedStackTopActivityLocked(ActivityStack targetStack,ActivityRecord target,ActivityOptions targetOptions){
  if (targetStack != null && isFocusedStack(targetStack)) {
    return targetStack.resumeTopActivityUncheckedLocked(target,targetOptions);
  }
  mFocusedStack.resumeTopActivityUncheckedLocked(null,null);
  return false;
}

Fixed version (ground truth):
boolean resumeFocusedStackTopActivityLocked(ActivityStack targetStack,ActivityRecord target,ActivityOptions targetOptions){
  if (targetStack != null && isFocusedStack(targetStack)) {
    return targetStack.resumeTopActivityUncheckedLocked(target,targetOptions);
  }
  final ActivityRecord r=mFocusedStack.topRunningActivityLocked();
  if (r == null || r.state != RESUMED) {
    mFocusedStack.resumeTopActivityUncheckedLocked(null,null);
  }
  return false;
}
Program: 191874
Project: 191874
Buggy source:
/** 
 * Requests a copy of the pixels from a   {@link Surface} to be copied intoa provided  {@link Bitmap}. The contents of the source will be scaled to fit exactly inside the bitmap. The pixel format of the source buffer will be converted, as part of the copy, to fit the the bitmap's   {@link Bitmap.Config}. The most recently queued buffer in the Surface will be used as the source of the copy.
 * @param source The source from which to copy
 * @param dest The destination of the copy. The source will be scaled tomatch the width, height, and format of this bitmap.
 * @param listener Callback for when the pixel copy request completes
 * @param listenerThread The callback will be invoked on this Handler whenthe copy is finished.
 */
public static void request(@NonNull Surface source,@NonNull Bitmap dest,@NonNull OnPixelCopyFinishedListener listener,@NonNull Handler listenerThread){
  validateBitmapDest(dest);
  int result=ThreadedRenderer.copySurfaceInto(source,dest);
  listenerThread.post(new Runnable(){
    @Override public void run(){
      listener.onPixelCopyFinished(result);
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Requests a copy of the pixels from a   {@link Surface} to be copied intoa provided  {@link Bitmap}. The contents of the source will be scaled to fit exactly inside the bitmap. The pixel format of the source buffer will be converted, as part of the copy, to fit the the bitmap's   {@link Bitmap.Config}. The most recently queued buffer in the Surface will be used as the source of the copy.
 * @param source The source from which to copy
 * @param dest The destination of the copy. The source will be scaled tomatch the width, height, and format of this bitmap.
 * @param listener Callback for when the pixel copy request completes
 * @param listenerThread The callback will be invoked on this Handler whenthe copy is finished.
 */
public static void request(@NonNull Surface source,@NonNull Bitmap dest,@NonNull OnPixelCopyFinishedListener listener,@NonNull Handler listenerThread){
  validateBitmapDest(dest);
  if (!source.isValid()) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  int result=ThreadedRenderer.copySurfaceInto(source,dest);
  listenerThread.post(new Runnable(){
    @Override public void run(){
      listener.onPixelCopyFinished(result);
    }
  }
);
}
Program: 191875
Project: 191875
Buggy source:
/** 
 * Requests a copy of the pixels from a   {@link Surface} to be copied intoa provided  {@link Bitmap}. The contents of the source will be scaled to fit exactly inside the bitmap. The pixel format of the source buffer will be converted, as part of the copy, to fit the the bitmap's   {@link Bitmap.Config}. The most recently queued buffer in the Surface will be used as the source of the copy.
 * @param source The source from which to copy
 * @param dest The destination of the copy. The source will be scaled tomatch the width, height, and format of this bitmap.
 * @param listener Callback for when the pixel copy request completes
 * @param listenerThread The callback will be invoked on this Handler whenthe copy is finished.
 */
public static void request(@NonNull Surface source,@NonNull Bitmap dest,@NonNull OnPixelCopyFinishedListener listener,@NonNull Handler listenerThread){
  validateBitmapDest(dest);
  int result=ThreadedRenderer.copySurfaceInto(source,dest);
  listenerThread.post(new Runnable(){
    @Override public void run(){
      listener.onPixelCopyFinished(result);
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Requests a copy of the pixels from a   {@link Surface} to be copied intoa provided  {@link Bitmap}. The contents of the source will be scaled to fit exactly inside the bitmap. The pixel format of the source buffer will be converted, as part of the copy, to fit the the bitmap's   {@link Bitmap.Config}. The most recently queued buffer in the Surface will be used as the source of the copy.
 * @param source The source from which to copy
 * @param dest The destination of the copy. The source will be scaled tomatch the width, height, and format of this bitmap.
 * @param listener Callback for when the pixel copy request completes
 * @param listenerThread The callback will be invoked on this Handler whenthe copy is finished.
 */
public static void request(@NonNull Surface source,@NonNull Bitmap dest,@NonNull OnPixelCopyFinishedListener listener,@NonNull Handler listenerThread){
  validateBitmapDest(dest);
  if (!source.isValid()) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  int result=ThreadedRenderer.copySurfaceInto(source,dest);
  listenerThread.post(new Runnable(){
    @Override public void run(){
      listener.onPixelCopyFinished(result);
    }
  }
);
}
Program: 191876
Project: 191876
Buggy source:
private boolean animateForMinimizedDockedStack(long now){
  final TaskStack stack=mDisplayContent.getDockedStackVisibleForUserLocked();
  if (!mAnimationStarted) {
    mAnimationStarted=true;
    mAnimationStartTime=now;
    final long transitionDuration=isAnimationMaximizing() ? mService.mAppTransition.getLastClipRevealTransitionDuration() : DEFAULT_APP_TRANSITION_DURATION;
    mAnimationDuration=(long)(transitionDuration * mService.getTransitionAnimationScaleLocked());
    mMaximizeMeetFraction=getClipRevealMeetFraction(stack);
    notifyDockedStackMinimizedChanged(mMinimizedDock,(long)(mAnimationDuration * mMaximizeMeetFraction));
  }
  float t=Math.min(1f,(float)(now - mAnimationStartTime) / mAnimationDuration);
  t=(isAnimationMaximizing() ? TOUCH_RESPONSE_INTERPOLATOR : mMinimizedDockInterpolator).getInterpolation(t);
  if (stack != null) {
    if (stack.setAdjustedForMinimizedDock(getMinimizeAmount(stack,t))) {
      mService.mWindowPlacerLocked.performSurfacePlacement();
    }
  }
  if (t >= 1.0f) {
    mAnimatingForMinimizedDockedStack=false;
    return false;
  }
 else {
    return true;
  }
}

Fixed version (ground truth):
private boolean animateForMinimizedDockedStack(long now){
  final TaskStack stack=mService.mStackIdToStack.get(DOCKED_STACK_ID);
  if (!mAnimationStarted) {
    mAnimationStarted=true;
    mAnimationStartTime=now;
    final long transitionDuration=isAnimationMaximizing() ? mService.mAppTransition.getLastClipRevealTransitionDuration() : DEFAULT_APP_TRANSITION_DURATION;
    mAnimationDuration=(long)(transitionDuration * mService.getTransitionAnimationScaleLocked());
    mMaximizeMeetFraction=getClipRevealMeetFraction(stack);
    notifyDockedStackMinimizedChanged(mMinimizedDock,(long)(mAnimationDuration * mMaximizeMeetFraction));
  }
  float t=Math.min(1f,(float)(now - mAnimationStartTime) / mAnimationDuration);
  t=(isAnimationMaximizing() ? TOUCH_RESPONSE_INTERPOLATOR : mMinimizedDockInterpolator).getInterpolation(t);
  if (stack != null) {
    if (stack.setAdjustedForMinimizedDock(getMinimizeAmount(stack,t))) {
      mService.mWindowPlacerLocked.performSurfacePlacement();
    }
  }
  if (t >= 1.0f) {
    mAnimatingForMinimizedDockedStack=false;
    return false;
  }
 else {
    return true;
  }
}
Program: 191877
Project: 191877
Buggy source:
/** 
 * Notifies the docked stack divider controller of a visibility change that happens without an animation.
 */
void notifyAppVisibilityChanged(AppWindowToken wtoken,boolean visible){
  final Task task=wtoken.mTask;
  if (!task.isHomeTask() || !task.isVisibleForUser()) {
    return;
  }
  if (task.getTopVisibleAppToken() == null || task.getTopVisibleAppToken() != wtoken) {
    return;
  }
  if (isWithinDisplay(task) && mDisplayContent.getDockedStackVisibleForUserLocked() != null) {
    setMinimizedDockedStack(visible,false);
  }
}

Fixed version (ground truth):
/** 
 * Notifies the docked stack divider controller of a visibility change that happens without an animation.
 */
void notifyAppVisibilityChanged(AppWindowToken wtoken,boolean visible){
  final Task task=wtoken.mTask;
  if (!task.isHomeTask() || !task.isVisibleForUser()) {
    return;
  }
  if (task.getTopAppToken() == null || task.getTopAppToken() != wtoken) {
    return;
  }
  if (isWithinDisplay(task) && mDisplayContent.getDockedStackVisibleForUserLocked() != null) {
    setMinimizedDockedStack(visible,false);
  }
}
Program: 191878
Project: 191878
Buggy source:
public void dump(String prefix,PrintWriter pw){
  pw.println(prefix + "String_Node_Str" + mStackId);
  pw.println(prefix + "String_Node_Str" + mDeferDetach);
  pw.println(prefix + "String_Node_Str" + mFullscreen);
  pw.println(prefix + "String_Node_Str" + mBounds.toShortString());
  if (!mAdjustedBounds.isEmpty()) {
    pw.println(prefix + "String_Node_Str" + mAdjustedBounds.toShortString());
  }
  for (int taskNdx=mTasks.size() - 1; taskNdx >= 0; taskNdx--) {
    mTasks.get(taskNdx).dump(prefix + "String_Node_Str",pw);
  }
  if (mAnimationBackgroundSurface.isDimming()) {
    pw.println(prefix + "String_Node_Str");
    mAnimationBackgroundSurface.printTo(prefix + "String_Node_Str",pw);
  }
  if (!mExitingAppTokens.isEmpty()) {
    pw.println();
    pw.println("String_Node_Str");
    for (int i=mExitingAppTokens.size() - 1; i >= 0; i--) {
      WindowToken token=mExitingAppTokens.get(i);
      pw.print("String_Node_Str");
      pw.print(i);
      pw.print(' ');
      pw.print(token);
      pw.println(':');
      token.dump(pw,"String_Node_Str");
    }
  }
}

Fixed version (ground truth):
public void dump(String prefix,PrintWriter pw){
  pw.println(prefix + "String_Node_Str" + mStackId);
  pw.println(prefix + "String_Node_Str" + mDeferDetach);
  pw.println(prefix + "String_Node_Str" + mFullscreen);
  pw.println(prefix + "String_Node_Str" + mBounds.toShortString());
  if (mMinimizeAmount != 0f) {
    pw.println(prefix + "String_Node_Str" + mMinimizeAmount);
  }
  if (mAdjustedForIme) {
    pw.println(prefix + "String_Node_Str");
    pw.println(prefix + "String_Node_Str" + mAdjustImeAmount);
    pw.println(prefix + "String_Node_Str" + mAdjustDividerAmount);
  }
  if (!mAdjustedBounds.isEmpty()) {
    pw.println(prefix + "String_Node_Str" + mAdjustedBounds.toShortString());
  }
  for (int taskNdx=mTasks.size() - 1; taskNdx >= 0; taskNdx--) {
    mTasks.get(taskNdx).dump(prefix + "String_Node_Str",pw);
  }
  if (mAnimationBackgroundSurface.isDimming()) {
    pw.println(prefix + "String_Node_Str");
    mAnimationBackgroundSurface.printTo(prefix + "String_Node_Str",pw);
  }
  if (!mExitingAppTokens.isEmpty()) {
    pw.println();
    pw.println("String_Node_Str");
    for (int i=mExitingAppTokens.size() - 1; i >= 0; i--) {
      WindowToken token=mExitingAppTokens.get(i);
      pw.print("String_Node_Str");
      pw.print(i);
      pw.print(' ');
      pw.print(token);
      pw.println(':');
      token.dump(pw,"String_Node_Str");
    }
  }
}
Program: 191880
Project: 191880
Buggy source:
private boolean animateForMinimizedDockedStack(long now){
  final TaskStack stack=mDisplayContent.getDockedStackVisibleForUserLocked();
  if (!mAnimationStarted) {
    mAnimationStarted=true;
    mAnimationStartTime=now;
    final long transitionDuration=isAnimationMaximizing() ? mService.mAppTransition.getLastClipRevealTransitionDuration() : DEFAULT_APP_TRANSITION_DURATION;
    mAnimationDuration=(long)(transitionDuration * mService.getTransitionAnimationScaleLocked());
    mMaximizeMeetFraction=getClipRevealMeetFraction(stack);
    notifyDockedStackMinimizedChanged(mMinimizedDock,(long)(mAnimationDuration * mMaximizeMeetFraction));
  }
  float t=Math.min(1f,(float)(now - mAnimationStartTime) / mAnimationDuration);
  t=(isAnimationMaximizing() ? TOUCH_RESPONSE_INTERPOLATOR : mMinimizedDockInterpolator).getInterpolation(t);
  if (stack != null) {
    if (stack.setAdjustedForMinimizedDock(getMinimizeAmount(stack,t))) {
      mService.mWindowPlacerLocked.performSurfacePlacement();
    }
  }
  if (t >= 1.0f) {
    mAnimatingForMinimizedDockedStack=false;
    return false;
  }
 else {
    return true;
  }
}

Fixed version (ground truth):
private boolean animateForMinimizedDockedStack(long now){
  final TaskStack stack=mService.mStackIdToStack.get(DOCKED_STACK_ID);
  if (!mAnimationStarted) {
    mAnimationStarted=true;
    mAnimationStartTime=now;
    final long transitionDuration=isAnimationMaximizing() ? mService.mAppTransition.getLastClipRevealTransitionDuration() : DEFAULT_APP_TRANSITION_DURATION;
    mAnimationDuration=(long)(transitionDuration * mService.getTransitionAnimationScaleLocked());
    mMaximizeMeetFraction=getClipRevealMeetFraction(stack);
    notifyDockedStackMinimizedChanged(mMinimizedDock,(long)(mAnimationDuration * mMaximizeMeetFraction));
  }
  float t=Math.min(1f,(float)(now - mAnimationStartTime) / mAnimationDuration);
  t=(isAnimationMaximizing() ? TOUCH_RESPONSE_INTERPOLATOR : mMinimizedDockInterpolator).getInterpolation(t);
  if (stack != null) {
    if (stack.setAdjustedForMinimizedDock(getMinimizeAmount(stack,t))) {
      mService.mWindowPlacerLocked.performSurfacePlacement();
    }
  }
  if (t >= 1.0f) {
    mAnimatingForMinimizedDockedStack=false;
    return false;
  }
 else {
    return true;
  }
}
Program: 191881
Project: 191881
Buggy source:
/** 
 * Notifies the docked stack divider controller of a visibility change that happens without an animation.
 */
void notifyAppVisibilityChanged(AppWindowToken wtoken,boolean visible){
  final Task task=wtoken.mTask;
  if (!task.isHomeTask() || !task.isVisibleForUser()) {
    return;
  }
  if (task.getTopVisibleAppToken() == null || task.getTopVisibleAppToken() != wtoken) {
    return;
  }
  if (isWithinDisplay(task) && mDisplayContent.getDockedStackVisibleForUserLocked() != null) {
    setMinimizedDockedStack(visible,false);
  }
}

Fixed version (ground truth):
/** 
 * Notifies the docked stack divider controller of a visibility change that happens without an animation.
 */
void notifyAppVisibilityChanged(AppWindowToken wtoken,boolean visible){
  final Task task=wtoken.mTask;
  if (!task.isHomeTask() || !task.isVisibleForUser()) {
    return;
  }
  if (task.getTopAppToken() == null || task.getTopAppToken() != wtoken) {
    return;
  }
  if (isWithinDisplay(task) && mDisplayContent.getDockedStackVisibleForUserLocked() != null) {
    setMinimizedDockedStack(visible,false);
  }
}
Program: 191882
Project: 191882
Buggy source:
public void dump(String prefix,PrintWriter pw){
  pw.println(prefix + "String_Node_Str" + mStackId);
  pw.println(prefix + "String_Node_Str" + mDeferDetach);
  pw.println(prefix + "String_Node_Str" + mFullscreen);
  pw.println(prefix + "String_Node_Str" + mBounds.toShortString());
  if (!mAdjustedBounds.isEmpty()) {
    pw.println(prefix + "String_Node_Str" + mAdjustedBounds.toShortString());
  }
  for (int taskNdx=mTasks.size() - 1; taskNdx >= 0; taskNdx--) {
    mTasks.get(taskNdx).dump(prefix + "String_Node_Str",pw);
  }
  if (mAnimationBackgroundSurface.isDimming()) {
    pw.println(prefix + "String_Node_Str");
    mAnimationBackgroundSurface.printTo(prefix + "String_Node_Str",pw);
  }
  if (!mExitingAppTokens.isEmpty()) {
    pw.println();
    pw.println("String_Node_Str");
    for (int i=mExitingAppTokens.size() - 1; i >= 0; i--) {
      WindowToken token=mExitingAppTokens.get(i);
      pw.print("String_Node_Str");
      pw.print(i);
      pw.print(' ');
      pw.print(token);
      pw.println(':');
      token.dump(pw,"String_Node_Str");
    }
  }
}

Fixed version (ground truth):
public void dump(String prefix,PrintWriter pw){
  pw.println(prefix + "String_Node_Str" + mStackId);
  pw.println(prefix + "String_Node_Str" + mDeferDetach);
  pw.println(prefix + "String_Node_Str" + mFullscreen);
  pw.println(prefix + "String_Node_Str" + mBounds.toShortString());
  if (mMinimizeAmount != 0f) {
    pw.println(prefix + "String_Node_Str" + mMinimizeAmount);
  }
  if (mAdjustedForIme) {
    pw.println(prefix + "String_Node_Str");
    pw.println(prefix + "String_Node_Str" + mAdjustImeAmount);
    pw.println(prefix + "String_Node_Str" + mAdjustDividerAmount);
  }
  if (!mAdjustedBounds.isEmpty()) {
    pw.println(prefix + "String_Node_Str" + mAdjustedBounds.toShortString());
  }
  for (int taskNdx=mTasks.size() - 1; taskNdx >= 0; taskNdx--) {
    mTasks.get(taskNdx).dump(prefix + "String_Node_Str",pw);
  }
  if (mAnimationBackgroundSurface.isDimming()) {
    pw.println(prefix + "String_Node_Str");
    mAnimationBackgroundSurface.printTo(prefix + "String_Node_Str",pw);
  }
  if (!mExitingAppTokens.isEmpty()) {
    pw.println();
    pw.println("String_Node_Str");
    for (int i=mExitingAppTokens.size() - 1; i >= 0; i--) {
      WindowToken token=mExitingAppTokens.get(i);
      pw.print("String_Node_Str");
      pw.print(i);
      pw.print(' ');
      pw.print(token);
      pw.println(':');
      token.dump(pw,"String_Node_Str");
    }
  }
}
Program: 191884
Project: 191884
Buggy source:
/** 
 * Requests a copy of the pixels from a   {@link Surface} to be copied intoa provided  {@link Bitmap}. The contents of the source will be scaled to fit exactly inside the bitmap. The pixel format of the source buffer will be converted, as part of the copy, to fit the the bitmap's   {@link Bitmap.Config}. The most recently queued buffer in the Surface will be used as the source of the copy.
 * @param source The source from which to copy
 * @param dest The destination of the copy. The source will be scaled tomatch the width, height, and format of this bitmap.
 * @param listener Callback for when the pixel copy request completes
 * @param listenerThread The callback will be invoked on this Handler whenthe copy is finished.
 */
public static void request(@NonNull Surface source,@NonNull Bitmap dest,@NonNull OnPixelCopyFinishedListener listener,@NonNull Handler listenerThread){
  validateBitmapDest(dest);
  int result=ThreadedRenderer.copySurfaceInto(source,dest);
  listenerThread.post(new Runnable(){
    @Override public void run(){
      listener.onPixelCopyFinished(result);
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Requests a copy of the pixels from a   {@link Surface} to be copied intoa provided  {@link Bitmap}. The contents of the source will be scaled to fit exactly inside the bitmap. The pixel format of the source buffer will be converted, as part of the copy, to fit the the bitmap's   {@link Bitmap.Config}. The most recently queued buffer in the Surface will be used as the source of the copy.
 * @param source The source from which to copy
 * @param dest The destination of the copy. The source will be scaled tomatch the width, height, and format of this bitmap.
 * @param listener Callback for when the pixel copy request completes
 * @param listenerThread The callback will be invoked on this Handler whenthe copy is finished.
 */
public static void request(@NonNull Surface source,@NonNull Bitmap dest,@NonNull OnPixelCopyFinishedListener listener,@NonNull Handler listenerThread){
  validateBitmapDest(dest);
  if (!source.isValid()) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  int result=ThreadedRenderer.copySurfaceInto(source,dest);
  listenerThread.post(new Runnable(){
    @Override public void run(){
      listener.onPixelCopyFinished(result);
    }
  }
);
}