nus-yam/ex-repair huggingface dataset:
Program: 193261
Project: 193261
Buggy source:
public ScreenPinningRequestEvent(Context context,SystemServicesProxy systemServicesProxy){
  this.applicationContext=context.getApplicationContext();
  this.systemServicesProxy=systemServicesProxy;
}

Fixed version (ground truth):
public ScreenPinningRequestEvent(Context context){
  this.applicationContext=context.getApplicationContext();
}
Program: 193262
Project: 193262
Buggy source:
private ForegroundThread(){
  super("String_Node_Str",android.os.Process.THREAD_PRIORITY_BACKGROUND);
}

Fixed version (ground truth):
private ForegroundThread(){
  super("String_Node_Str");
}
Program: 193264
Project: 193264
Buggy source:
public Task(TaskKey key,boolean isActive,int taskAffiliation,int taskAffiliationColor,String activityTitle,String contentDescription,Drawable activityIcon,int colorPrimary,boolean lockToThisTask,boolean lockToTaskEnabled,Bitmap icon,String iconFilename,Rect bounds){
  boolean isInAffiliationGroup=(taskAffiliation != key.id);
  boolean hasAffiliationGroupColor=isInAffiliationGroup && (taskAffiliationColor != 0);
  this.key=key;
  this.taskAffiliation=taskAffiliation;
  this.taskAffiliationColor=taskAffiliationColor;
  this.activityLabel=activityTitle;
  this.contentDescription=contentDescription;
  this.activityIcon=activityIcon;
  this.colorPrimary=hasAffiliationGroupColor ? taskAffiliationColor : colorPrimary;
  this.useLightOnPrimaryColor=Utilities.computeContrastBetweenColors(this.colorPrimary,Color.WHITE) > 3f;
  this.isActive=isActive;
  this.lockToThisTask=lockToTaskEnabled && lockToThisTask;
  this.lockToTaskEnabled=lockToTaskEnabled;
  this.icon=icon;
  this.iconFilename=iconFilename;
  this.bounds=bounds;
}

Fixed version (ground truth):
public Task(TaskKey key,int taskAffiliation,int taskAffiliationColor,String activityTitle,String contentDescription,Drawable activityIcon,int colorPrimary,boolean lockToThisTask,boolean lockToTaskEnabled,Bitmap icon,String iconFilename,Rect bounds){
  boolean isInAffiliationGroup=(taskAffiliation != key.id);
  boolean hasAffiliationGroupColor=isInAffiliationGroup && (taskAffiliationColor != 0);
  this.key=key;
  this.taskAffiliation=taskAffiliation;
  this.taskAffiliationColor=taskAffiliationColor;
  this.activityLabel=activityTitle;
  this.contentDescription=contentDescription;
  this.activityIcon=activityIcon;
  this.colorPrimary=hasAffiliationGroupColor ? taskAffiliationColor : colorPrimary;
  this.useLightOnPrimaryColor=Utilities.computeContrastBetweenColors(this.colorPrimary,Color.WHITE) > 3f;
  this.lockToThisTask=lockToTaskEnabled && lockToThisTask;
  this.lockToTaskEnabled=lockToTaskEnabled;
  this.icon=icon;
  this.iconFilename=iconFilename;
  this.bounds=bounds;
}
Program: 193265
Project: 193265
Buggy source:
/** 
 * Copies the other task. 
 */
public void copyFrom(Task o){
  this.key=o.key;
  this.taskAffiliation=o.taskAffiliation;
  this.taskAffiliationColor=o.taskAffiliationColor;
  this.activityLabel=o.activityLabel;
  this.contentDescription=o.contentDescription;
  this.activityIcon=o.activityIcon;
  this.colorPrimary=o.colorPrimary;
  this.useLightOnPrimaryColor=o.useLightOnPrimaryColor;
  this.isActive=o.isActive;
  this.lockToThisTask=o.lockToThisTask;
  this.lockToTaskEnabled=o.lockToTaskEnabled;
}

Fixed version (ground truth):
/** 
 * Copies the other task. 
 */
public void copyFrom(Task o){
  this.key=o.key;
  this.taskAffiliation=o.taskAffiliation;
  this.taskAffiliationColor=o.taskAffiliationColor;
  this.activityLabel=o.activityLabel;
  this.contentDescription=o.contentDescription;
  this.activityIcon=o.activityIcon;
  this.colorPrimary=o.colorPrimary;
  this.useLightOnPrimaryColor=o.useLightOnPrimaryColor;
  this.lockToThisTask=o.lockToThisTask;
  this.lockToTaskEnabled=o.lockToTaskEnabled;
}
Program: 193266
Project: 193266
Buggy source:
/** 
 * Launches the focused task from the first stack if possible 
 */
public boolean launchFocusedTask(){
  if (mTaskStackView != null) {
    TaskStack stack=mTaskStackView.getStack();
    List<TaskView> taskViews=mTaskStackView.getTaskViews();
    int taskViewCount=taskViews.size();
    for (int j=0; j < taskViewCount; j++) {
      TaskView tv=taskViews.get(j);
      Task task=tv.getTask();
      if (tv.isFocusedTask()) {
        onTaskViewClicked(mTaskStackView,tv,stack,task,false,false,null,INVALID_STACK_ID);
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Launches the focused task from the first stack if possible 
 */
public boolean launchFocusedTask(){
  if (mTaskStackView != null) {
    TaskStack stack=mTaskStackView.getStack();
    Task task=mTaskStackView.getFocusedTask();
    if (task != null) {
      TaskView taskView=mTaskStackView.getChildViewForTask(task);
      onTaskViewClicked(mTaskStackView,taskView,stack,task,false,false,null,INVALID_STACK_ID);
      return true;
    }
  }
  return false;
}
Program: 193268
Project: 193268
Buggy source:
@Override protected void onAttachedToWindow(){
  EventBus.getDefault().register(this,RecentsActivity.EVENT_BUS_PRIORITY + 1);
  super.onAttachedToWindow();
}

Fixed version (ground truth):
@Override protected void onAttachedToWindow(){
  SystemServicesProxy ssp=Recents.getSystemServices();
  mTouchExplorationEnabled=ssp.isTouchExplorationEnabled();
  EventBus.getDefault().register(this,RecentsActivity.EVENT_BUS_PRIORITY + 1);
  super.onAttachedToWindow();
}
Program: 193269
Project: 193269
Buggy source:
@Override public Rect getTaskBounds(int taskId){
  enforceCallingPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS,"String_Node_Str");
  long ident=Binder.clearCallingIdentity();
  Rect rect=new Rect();
  try {
synchronized (this) {
      TaskRecord task=mStackSupervisor.anyTaskForIdLocked(taskId);
      if (task == null) {
        Slog.w(TAG,"String_Node_Str" + taskId + "String_Node_Str");
        return rect;
      }
      mWindowManager.getTaskBounds(task.taskId,rect);
    }
  }
  finally {
    Binder.restoreCallingIdentity(ident);
  }
  return rect;
}

Fixed version (ground truth):
@Override public Rect getTaskBounds(int taskId){
  enforceCallingPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS,"String_Node_Str");
  long ident=Binder.clearCallingIdentity();
  Rect rect=new Rect();
  try {
synchronized (this) {
      final TaskRecord task=mStackSupervisor.anyTaskForIdLocked(taskId,!RESTORE_FROM_RECENTS,INVALID_STACK_ID);
      if (task == null) {
        Slog.w(TAG,"String_Node_Str" + taskId + "String_Node_Str");
        return rect;
      }
      if (task.stack != null) {
        mWindowManager.getTaskBounds(task.taskId,rect);
      }
 else {
        if (task.mBounds != null) {
          rect.set(task.mBounds);
        }
 else         if (task.mLastNonFullscreenBounds != null) {
          rect.set(task.mLastNonFullscreenBounds);
        }
      }
    }
  }
  finally {
    Binder.restoreCallingIdentity(ident);
  }
  return rect;
}
Program: 193270
Project: 193270
Buggy source:
final int startActivityFromRecentsInner(int taskId,int launchStackId,Bundle bOptions){
  final TaskRecord task;
  final int callingUid;
  final String callingPackage;
  final Intent intent;
  final int userId;
synchronized (this) {
    if (launchStackId == HOME_STACK_ID) {
      throw new IllegalArgumentException("String_Node_Str" + taskId + "String_Node_Str");
    }
    task=mStackSupervisor.anyTaskForIdLocked(taskId,RESTORE_FROM_RECENTS,launchStackId);
    if (task == null) {
      throw new IllegalArgumentException("String_Node_Str" + taskId + "String_Node_Str");
    }
    if (launchStackId != INVALID_STACK_ID && task.stack.mStackId != launchStackId) {
      if (launchStackId == DOCKED_STACK_ID && bOptions != null) {
        ActivityOptions activityOptions=new ActivityOptions(bOptions);
        mWindowManager.setDockedStackCreateMode(activityOptions.getDockCreateMode());
      }
      mStackSupervisor.moveTaskToStackLocked(taskId,launchStackId,ON_TOP,FORCE_FOCUS,"String_Node_Str");
    }
    if (task.getRootActivity() != null) {
      moveTaskToFrontLocked(task.taskId,0,bOptions);
      return ActivityManager.START_TASK_TO_FRONT;
    }
    callingUid=task.mCallingUid;
    callingPackage=task.mCallingPackage;
    intent=task.intent;
    intent.addFlags(Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY);
    userId=task.userId;
  }
  return startActivityInPackage(callingUid,callingPackage,intent,null,null,null,0,0,bOptions,userId,null,task);
}

Fixed version (ground truth):
final int startActivityFromRecentsInner(int taskId,int launchStackId,Bundle bOptions){
  final TaskRecord task;
  final int callingUid;
  final String callingPackage;
  final Intent intent;
  final int userId;
synchronized (this) {
    if (launchStackId == HOME_STACK_ID) {
      throw new IllegalArgumentException("String_Node_Str" + taskId + "String_Node_Str");
    }
    task=mStackSupervisor.anyTaskForIdLocked(taskId,RESTORE_FROM_RECENTS,launchStackId);
    if (task == null) {
      throw new IllegalArgumentException("String_Node_Str" + taskId + "String_Node_Str");
    }
    if (launchStackId != INVALID_STACK_ID) {
      if (launchStackId == DOCKED_STACK_ID && bOptions != null) {
        ActivityOptions activityOptions=new ActivityOptions(bOptions);
        mWindowManager.setDockedStackCreateMode(activityOptions.getDockCreateMode());
      }
      if (task.stack.mStackId != launchStackId) {
        mStackSupervisor.moveTaskToStackLocked(taskId,launchStackId,ON_TOP,FORCE_FOCUS,"String_Node_Str");
      }
    }
    if (task.getRootActivity() != null) {
      moveTaskToFrontLocked(task.taskId,0,bOptions);
      return ActivityManager.START_TASK_TO_FRONT;
    }
    callingUid=task.mCallingUid;
    callingPackage=task.mCallingPackage;
    intent=task.intent;
    intent.addFlags(Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY);
    userId=task.userId;
  }
  return startActivityInPackage(callingUid,callingPackage,intent,null,null,null,0,0,bOptions,userId,null,task);
}
Program: 193271
Project: 193271
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();
  }
  if (task.stack != null) {
    if (task.stack.mStackId == stackId) {
      return true;
    }
    task.stack.removeTask(task,"String_Node_Str",MOVING);
  }
  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,false);
  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();
  }
  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,false);
  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: 193272
Project: 193272
Buggy source:
void moveTaskToStackLocked(int taskId,int stackId,boolean toTop,boolean forceFocus,String reason){
  final TaskRecord task=anyTaskForIdLocked(taskId);
  if (task == null) {
    Slog.w(TAG,"String_Node_Str" + taskId);
    return;
  }
  if (StackId.preserveWindowOnTaskMove(stackId)) {
    ActivityRecord r=task.getTopActivity();
    mWindowManager.setReplacingWindow(r.appToken,true);
  }
  final ActivityStack stack=moveTaskToStackUncheckedLocked(task,stackId,toTop,forceFocus,"String_Node_Str" + reason);
  if (stackId == FULLSCREEN_WORKSPACE_STACK_ID && task.mBounds != null) {
    resizeTaskLocked(task,stack.mBounds,RESIZE_MODE_SYSTEM,!PRESERVE_WINDOWS);
  }
 else   if (stackId == FREEFORM_WORKSPACE_STACK_ID && task.mBounds == null && task.mLastNonFullscreenBounds != null) {
    resizeTaskLocked(task,task.mLastNonFullscreenBounds,RESIZE_MODE_SYSTEM,!PRESERVE_WINDOWS);
  }
 else   if (stackId == DOCKED_STACK_ID || stackId == PINNED_STACK_ID) {
    resizeTaskLocked(task,stack.mBounds,RESIZE_MODE_SYSTEM,!PRESERVE_WINDOWS);
  }
  ensureActivitiesVisibleLocked(null,0,!PRESERVE_WINDOWS);
  resumeTopActivitiesLocked();
}

Fixed version (ground truth):
void moveTaskToStackLocked(int taskId,int stackId,boolean toTop,boolean forceFocus,String reason){
  final TaskRecord task=anyTaskForIdLocked(taskId);
  if (task == null) {
    Slog.w(TAG,"String_Node_Str" + taskId);
    return;
  }
  final ActivityRecord topActivity=task.getTopActivity();
  if (StackId.preserveWindowOnTaskMove(stackId) && topActivity != null) {
    mWindowManager.setReplacingWindow(topActivity.appToken,true);
  }
  final ActivityStack stack=moveTaskToStackUncheckedLocked(task,stackId,toTop,forceFocus,"String_Node_Str" + reason);
  if (stackId == FULLSCREEN_WORKSPACE_STACK_ID && task.mBounds != null) {
    resizeTaskLocked(task,stack.mBounds,RESIZE_MODE_SYSTEM,!PRESERVE_WINDOWS);
  }
 else   if (stackId == FREEFORM_WORKSPACE_STACK_ID && task.mBounds == null && task.mLastNonFullscreenBounds != null) {
    resizeTaskLocked(task,task.mLastNonFullscreenBounds,RESIZE_MODE_SYSTEM,!PRESERVE_WINDOWS);
  }
 else   if (stackId == DOCKED_STACK_ID || stackId == PINNED_STACK_ID) {
    resizeTaskLocked(task,stack.mBounds,RESIZE_MODE_SYSTEM,!PRESERVE_WINDOWS);
  }
  ensureActivitiesVisibleLocked(null,0,!PRESERVE_WINDOWS);
  resumeTopActivitiesLocked();
}
Program: 193273
Project: 193273
Buggy source:
@Override public String toString(){
  StringBuilder sb=new StringBuilder(128);
  if (stringName != null) {
    sb.append(stringName);
    sb.append("String_Node_Str");
    sb.append(userId);
    sb.append("String_Node_Str");
    sb.append(mActivities.size());
    sb.append('}');
    return sb.toString();
  }
  sb.append("String_Node_Str");
  sb.append(Integer.toHexString(System.identityHashCode(this)));
  sb.append("String_Node_Str");
  sb.append(taskId);
  if (affinity != null) {
    sb.append("String_Node_Str");
    sb.append(affinity);
  }
 else   if (intent != null) {
    sb.append("String_Node_Str");
    sb.append(intent.getComponent().flattenToShortString());
  }
 else   if (affinityIntent != null) {
    sb.append("String_Node_Str");
    sb.append(affinityIntent.getComponent().flattenToShortString());
  }
 else {
    sb.append("String_Node_Str");
  }
  stringName=sb.toString();
  return toString();
}

Fixed version (ground truth):
@Override public String toString(){
  StringBuilder sb=new StringBuilder(128);
  if (stringName != null) {
    sb.append(stringName);
    sb.append("String_Node_Str");
    sb.append(userId);
    sb.append("String_Node_Str");
    sb.append(stack != null ? stack.mStackId : INVALID_STACK_ID);
    sb.append("String_Node_Str");
    sb.append(mActivities.size());
    sb.append('}');
    return sb.toString();
  }
  sb.append("String_Node_Str");
  sb.append(Integer.toHexString(System.identityHashCode(this)));
  sb.append("String_Node_Str");
  sb.append(taskId);
  if (affinity != null) {
    sb.append("String_Node_Str");
    sb.append(affinity);
  }
 else   if (intent != null) {
    sb.append("String_Node_Str");
    sb.append(intent.getComponent().flattenToShortString());
  }
 else   if (affinityIntent != null) {
    sb.append("String_Node_Str");
    sb.append(affinityIntent.getComponent().flattenToShortString());
  }
 else {
    sb.append("String_Node_Str");
  }
  stringName=sb.toString();
  return toString();
}
Program: 193274
Project: 193274
Buggy source:
@Override public Rect getTaskBounds(int taskId){
  enforceCallingPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS,"String_Node_Str");
  long ident=Binder.clearCallingIdentity();
  Rect rect=new Rect();
  try {
synchronized (this) {
      TaskRecord task=mStackSupervisor.anyTaskForIdLocked(taskId);
      if (task == null) {
        Slog.w(TAG,"String_Node_Str" + taskId + "String_Node_Str");
        return rect;
      }
      mWindowManager.getTaskBounds(task.taskId,rect);
    }
  }
  finally {
    Binder.restoreCallingIdentity(ident);
  }
  return rect;
}

Fixed version (ground truth):
@Override public Rect getTaskBounds(int taskId){
  enforceCallingPermission(android.Manifest.permission.MANAGE_ACTIVITY_STACKS,"String_Node_Str");
  long ident=Binder.clearCallingIdentity();
  Rect rect=new Rect();
  try {
synchronized (this) {
      final TaskRecord task=mStackSupervisor.anyTaskForIdLocked(taskId,!RESTORE_FROM_RECENTS,INVALID_STACK_ID);
      if (task == null) {
        Slog.w(TAG,"String_Node_Str" + taskId + "String_Node_Str");
        return rect;
      }
      if (task.stack != null) {
        mWindowManager.getTaskBounds(task.taskId,rect);
      }
 else {
        if (task.mBounds != null) {
          rect.set(task.mBounds);
        }
 else         if (task.mLastNonFullscreenBounds != null) {
          rect.set(task.mLastNonFullscreenBounds);
        }
      }
    }
  }
  finally {
    Binder.restoreCallingIdentity(ident);
  }
  return rect;
}
Program: 193275
Project: 193275
Buggy source:
final int startActivityFromRecentsInner(int taskId,int launchStackId,Bundle bOptions){
  final TaskRecord task;
  final int callingUid;
  final String callingPackage;
  final Intent intent;
  final int userId;
synchronized (this) {
    if (launchStackId == HOME_STACK_ID) {
      throw new IllegalArgumentException("String_Node_Str" + taskId + "String_Node_Str");
    }
    task=mStackSupervisor.anyTaskForIdLocked(taskId,RESTORE_FROM_RECENTS,launchStackId);
    if (task == null) {
      throw new IllegalArgumentException("String_Node_Str" + taskId + "String_Node_Str");
    }
    if (launchStackId != INVALID_STACK_ID && task.stack.mStackId != launchStackId) {
      if (launchStackId == DOCKED_STACK_ID && bOptions != null) {
        ActivityOptions activityOptions=new ActivityOptions(bOptions);
        mWindowManager.setDockedStackCreateMode(activityOptions.getDockCreateMode());
      }
      mStackSupervisor.moveTaskToStackLocked(taskId,launchStackId,ON_TOP,FORCE_FOCUS,"String_Node_Str");
    }
    if (task.getRootActivity() != null) {
      moveTaskToFrontLocked(task.taskId,0,bOptions);
      return ActivityManager.START_TASK_TO_FRONT;
    }
    callingUid=task.mCallingUid;
    callingPackage=task.mCallingPackage;
    intent=task.intent;
    intent.addFlags(Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY);
    userId=task.userId;
  }
  return startActivityInPackage(callingUid,callingPackage,intent,null,null,null,0,0,bOptions,userId,null,task);
}

Fixed version (ground truth):
final int startActivityFromRecentsInner(int taskId,int launchStackId,Bundle bOptions){
  final TaskRecord task;
  final int callingUid;
  final String callingPackage;
  final Intent intent;
  final int userId;
synchronized (this) {
    if (launchStackId == HOME_STACK_ID) {
      throw new IllegalArgumentException("String_Node_Str" + taskId + "String_Node_Str");
    }
    task=mStackSupervisor.anyTaskForIdLocked(taskId,RESTORE_FROM_RECENTS,launchStackId);
    if (task == null) {
      throw new IllegalArgumentException("String_Node_Str" + taskId + "String_Node_Str");
    }
    if (launchStackId != INVALID_STACK_ID) {
      if (launchStackId == DOCKED_STACK_ID && bOptions != null) {
        ActivityOptions activityOptions=new ActivityOptions(bOptions);
        mWindowManager.setDockedStackCreateMode(activityOptions.getDockCreateMode());
      }
      if (task.stack.mStackId != launchStackId) {
        mStackSupervisor.moveTaskToStackLocked(taskId,launchStackId,ON_TOP,FORCE_FOCUS,"String_Node_Str");
      }
    }
    if (task.getRootActivity() != null) {
      moveTaskToFrontLocked(task.taskId,0,bOptions);
      return ActivityManager.START_TASK_TO_FRONT;
    }
    callingUid=task.mCallingUid;
    callingPackage=task.mCallingPackage;
    intent=task.intent;
    intent.addFlags(Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY);
    userId=task.userId;
  }
  return startActivityInPackage(callingUid,callingPackage,intent,null,null,null,0,0,bOptions,userId,null,task);
}
Program: 193276
Project: 193276
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();
  }
  if (task.stack != null) {
    if (task.stack.mStackId == stackId) {
      return true;
    }
    task.stack.removeTask(task,"String_Node_Str",MOVING);
  }
  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,false);
  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();
  }
  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,false);
  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: 193277
Project: 193277
Buggy source:
void moveTaskToStackLocked(int taskId,int stackId,boolean toTop,boolean forceFocus,String reason){
  final TaskRecord task=anyTaskForIdLocked(taskId);
  if (task == null) {
    Slog.w(TAG,"String_Node_Str" + taskId);
    return;
  }
  if (StackId.preserveWindowOnTaskMove(stackId)) {
    ActivityRecord r=task.getTopActivity();
    mWindowManager.setReplacingWindow(r.appToken,true);
  }
  final ActivityStack stack=moveTaskToStackUncheckedLocked(task,stackId,toTop,forceFocus,"String_Node_Str" + reason);
  if (stackId == FULLSCREEN_WORKSPACE_STACK_ID && task.mBounds != null) {
    resizeTaskLocked(task,stack.mBounds,RESIZE_MODE_SYSTEM,!PRESERVE_WINDOWS);
  }
 else   if (stackId == FREEFORM_WORKSPACE_STACK_ID && task.mBounds == null && task.mLastNonFullscreenBounds != null) {
    resizeTaskLocked(task,task.mLastNonFullscreenBounds,RESIZE_MODE_SYSTEM,!PRESERVE_WINDOWS);
  }
 else   if (stackId == DOCKED_STACK_ID || stackId == PINNED_STACK_ID) {
    resizeTaskLocked(task,stack.mBounds,RESIZE_MODE_SYSTEM,!PRESERVE_WINDOWS);
  }
  ensureActivitiesVisibleLocked(null,0,!PRESERVE_WINDOWS);
  resumeTopActivitiesLocked();
}

Fixed version (ground truth):
void moveTaskToStackLocked(int taskId,int stackId,boolean toTop,boolean forceFocus,String reason){
  final TaskRecord task=anyTaskForIdLocked(taskId);
  if (task == null) {
    Slog.w(TAG,"String_Node_Str" + taskId);
    return;
  }
  final ActivityRecord topActivity=task.getTopActivity();
  if (StackId.preserveWindowOnTaskMove(stackId) && topActivity != null) {
    mWindowManager.setReplacingWindow(topActivity.appToken,true);
  }
  final ActivityStack stack=moveTaskToStackUncheckedLocked(task,stackId,toTop,forceFocus,"String_Node_Str" + reason);
  if (stackId == FULLSCREEN_WORKSPACE_STACK_ID && task.mBounds != null) {
    resizeTaskLocked(task,stack.mBounds,RESIZE_MODE_SYSTEM,!PRESERVE_WINDOWS);
  }
 else   if (stackId == FREEFORM_WORKSPACE_STACK_ID && task.mBounds == null && task.mLastNonFullscreenBounds != null) {
    resizeTaskLocked(task,task.mLastNonFullscreenBounds,RESIZE_MODE_SYSTEM,!PRESERVE_WINDOWS);
  }
 else   if (stackId == DOCKED_STACK_ID || stackId == PINNED_STACK_ID) {
    resizeTaskLocked(task,stack.mBounds,RESIZE_MODE_SYSTEM,!PRESERVE_WINDOWS);
  }
  ensureActivitiesVisibleLocked(null,0,!PRESERVE_WINDOWS);
  resumeTopActivitiesLocked();
}
Program: 193278
Project: 193278
Buggy source:
@Override public String toString(){
  StringBuilder sb=new StringBuilder(128);
  if (stringName != null) {
    sb.append(stringName);
    sb.append("String_Node_Str");
    sb.append(userId);
    sb.append("String_Node_Str");
    sb.append(mActivities.size());
    sb.append('}');
    return sb.toString();
  }
  sb.append("String_Node_Str");
  sb.append(Integer.toHexString(System.identityHashCode(this)));
  sb.append("String_Node_Str");
  sb.append(taskId);
  if (affinity != null) {
    sb.append("String_Node_Str");
    sb.append(affinity);
  }
 else   if (intent != null) {
    sb.append("String_Node_Str");
    sb.append(intent.getComponent().flattenToShortString());
  }
 else   if (affinityIntent != null) {
    sb.append("String_Node_Str");
    sb.append(affinityIntent.getComponent().flattenToShortString());
  }
 else {
    sb.append("String_Node_Str");
  }
  stringName=sb.toString();
  return toString();
}

Fixed version (ground truth):
@Override public String toString(){
  StringBuilder sb=new StringBuilder(128);
  if (stringName != null) {
    sb.append(stringName);
    sb.append("String_Node_Str");
    sb.append(userId);
    sb.append("String_Node_Str");
    sb.append(stack != null ? stack.mStackId : INVALID_STACK_ID);
    sb.append("String_Node_Str");
    sb.append(mActivities.size());
    sb.append('}');
    return sb.toString();
  }
  sb.append("String_Node_Str");
  sb.append(Integer.toHexString(System.identityHashCode(this)));
  sb.append("String_Node_Str");
  sb.append(taskId);
  if (affinity != null) {
    sb.append("String_Node_Str");
    sb.append(affinity);
  }
 else   if (intent != null) {
    sb.append("String_Node_Str");
    sb.append(intent.getComponent().flattenToShortString());
  }
 else   if (affinityIntent != null) {
    sb.append("String_Node_Str");
    sb.append(affinityIntent.getComponent().flattenToShortString());
  }
 else {
    sb.append("String_Node_Str");
  }
  stringName=sb.toString();
  return toString();
}
Program: 193279
Project: 193279
Buggy source:
void updateWallpaperVisibility(){
  final boolean visible=isWallpaperVisible(mWallpaperTarget);
  final DisplayContent displayContent=mWallpaperTarget.getDisplayContent();
  if (displayContent == null) {
    return;
  }
  final DisplayInfo displayInfo=displayContent.getDisplayInfo();
  final int dw=displayInfo.logicalWidth;
  final int dh=displayInfo.logicalHeight;
  for (int curTokenNdx=mWallpaperTokens.size() - 1; curTokenNdx >= 0; curTokenNdx--) {
    WindowToken token=mWallpaperTokens.get(curTokenNdx);
    if (token.hidden == visible) {
      token.hidden=!visible;
      displayContent.layoutNeeded=true;
    }
    final WindowList windows=token.windows;
    for (int wallpaperNdx=windows.size() - 1; wallpaperNdx >= 0; wallpaperNdx--) {
      WindowState wallpaper=windows.get(wallpaperNdx);
      if (visible) {
        updateWallpaperOffset(wallpaper,dw,dh,false);
      }
      dispatchWallpaperVisibility(wallpaper,visible);
    }
  }
}

Fixed version (ground truth):
void updateWallpaperVisibility(){
  final DisplayContent displayContent=mWallpaperTarget.getDisplayContent();
  if (displayContent == null) {
    return;
  }
  final boolean visible=isWallpaperVisible(mWallpaperTarget);
  final DisplayInfo displayInfo=displayContent.getDisplayInfo();
  final int dw=displayInfo.logicalWidth;
  final int dh=displayInfo.logicalHeight;
  for (int curTokenNdx=mWallpaperTokens.size() - 1; curTokenNdx >= 0; curTokenNdx--) {
    WindowToken token=mWallpaperTokens.get(curTokenNdx);
    if (token.hidden == visible) {
      token.hidden=!visible;
      displayContent.layoutNeeded=true;
    }
    final WindowList windows=token.windows;
    for (int wallpaperNdx=windows.size() - 1; wallpaperNdx >= 0; wallpaperNdx--) {
      WindowState wallpaper=windows.get(wallpaperNdx);
      if (visible) {
        updateWallpaperOffset(wallpaper,dw,dh,false);
      }
      dispatchWallpaperVisibility(wallpaper,visible);
    }
  }
}
Program: 193280
Project: 193280
Buggy source:
void hideWallpapers(final WindowState winGoingAway){
  if (mWallpaperTarget != null && (mWallpaperTarget != winGoingAway || mLowerWallpaperTarget != null)) {
    return;
  }
  if (mService.mAppTransition.isRunning()) {
    mDeferredHideWallpaper=winGoingAway;
    return;
  }
  final boolean wasDeferred=(mDeferredHideWallpaper == winGoingAway);
  for (int i=mWallpaperTokens.size() - 1; i >= 0; i--) {
    final WindowToken token=mWallpaperTokens.get(i);
    for (int j=token.windows.size() - 1; j >= 0; j--) {
      final WindowState wallpaper=token.windows.get(j);
      final WindowStateAnimator winAnimator=wallpaper.mWinAnimator;
      if (!winAnimator.mLastHidden || wasDeferred) {
        winAnimator.hide();
        dispatchWallpaperVisibility(wallpaper,false);
        final DisplayContent displayContent=wallpaper.getDisplayContent();
        if (displayContent != null) {
          displayContent.pendingLayoutChanges|=WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER;
        }
      }
    }
    if (DEBUG_WALLPAPER_LIGHT && !token.hidden)     Slog.d(TAG,"String_Node_Str" + token + "String_Node_Str"+ winGoingAway+ "String_Node_Str"+ mWallpaperTarget+ "String_Node_Str"+ mLowerWallpaperTarget+ "String_Node_Str"+ Debug.getCallers(5,"String_Node_Str"));
    token.hidden=true;
  }
}

Fixed version (ground truth):
void hideWallpapers(final WindowState winGoingAway){
  if (mWallpaperTarget != null && (mWallpaperTarget != winGoingAway || mLowerWallpaperTarget != null)) {
    return;
  }
  if (mService.mAppTransition.isRunning()) {
    mDeferredHideWallpaper=winGoingAway;
    return;
  }
  final boolean wasDeferred=(mDeferredHideWallpaper == winGoingAway);
  for (int i=mWallpaperTokens.size() - 1; i >= 0; i--) {
    final WindowToken token=mWallpaperTokens.get(i);
    for (int j=token.windows.size() - 1; j >= 0; j--) {
      final WindowState wallpaper=token.windows.get(j);
      final WindowStateAnimator winAnimator=wallpaper.mWinAnimator;
      if (!winAnimator.mLastHidden || wasDeferred) {
        winAnimator.hide("String_Node_Str");
        dispatchWallpaperVisibility(wallpaper,false);
        final DisplayContent displayContent=wallpaper.getDisplayContent();
        if (displayContent != null) {
          displayContent.pendingLayoutChanges|=WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER;
        }
      }
    }
    if (DEBUG_WALLPAPER_LIGHT && !token.hidden)     Slog.d(TAG,"String_Node_Str" + token + "String_Node_Str"+ winGoingAway+ "String_Node_Str"+ mWallpaperTarget+ "String_Node_Str"+ mLowerWallpaperTarget+ "String_Node_Str"+ Debug.getCallers(5,"String_Node_Str"));
    token.hidden=true;
  }
}
Program: 193281
Project: 193281
Buggy source:
private void prepareWindowReplacementTransition(AppWindowToken atoken){
  if (atoken == null || !atoken.mWillReplaceWindow || !atoken.mAnimateReplacingWindow) {
    return;
  }
  atoken.allDrawn=false;
  WindowState replacedWindow=null;
  for (int i=atoken.windows.size() - 1; i >= 0 && replacedWindow == null; i--) {
    WindowState candidate=atoken.windows.get(i);
    if (candidate.mExiting) {
      replacedWindow=candidate;
    }
  }
  if (replacedWindow == null) {
    return;
  }
  Rect frame=replacedWindow.mFrame;
  mOpeningApps.add(atoken);
  prepareAppTransition(AppTransition.TRANSIT_ACTIVITY_RELAUNCH,ALWAYS_KEEP_CURRENT);
  mAppTransition.overridePendingAppTransitionClipReveal(frame.left,frame.top,frame.width(),frame.height());
  executeAppTransition();
}

Fixed version (ground truth):
private void prepareWindowReplacementTransition(AppWindowToken atoken){
  if (atoken == null || !atoken.mWillReplaceWindow || !atoken.mAnimateReplacingWindow) {
    return;
  }
  atoken.allDrawn=false;
  WindowState replacedWindow=null;
  for (int i=atoken.windows.size() - 1; i >= 0 && replacedWindow == null; i--) {
    WindowState candidate=atoken.windows.get(i);
    if (candidate.mExiting) {
      replacedWindow=candidate;
    }
  }
  if (replacedWindow == null) {
    return;
  }
  Rect frame=replacedWindow.mVisibleFrame;
  mOpeningApps.add(atoken);
  prepareAppTransition(AppTransition.TRANSIT_ACTIVITY_RELAUNCH,ALWAYS_KEEP_CURRENT);
  mAppTransition.overridePendingAppTransitionClipReveal(frame.left,frame.top,frame.width(),frame.height());
  executeAppTransition();
}
Program: 193282
Project: 193282
Buggy source:
void checkPolicyVisibilityChange(){
  if (mPolicyVisibility != mPolicyVisibilityAfterAnim) {
    if (DEBUG_VISIBILITY) {
      Slog.v(TAG,"String_Node_Str" + mWinAnimator + "String_Node_Str"+ mPolicyVisibilityAfterAnim);
    }
    mPolicyVisibility=mPolicyVisibilityAfterAnim;
    if (mDisplayContent != null) {
      mDisplayContent.layoutNeeded=true;
    }
    if (!mPolicyVisibility) {
      if (mService.mCurrentFocus == this) {
        if (DEBUG_FOCUS_LIGHT)         Slog.i(TAG,"String_Node_Str");
        mService.mFocusMayChange=true;
      }
      mService.enableScreenIfNeededLocked();
    }
  }
}

Fixed version (ground truth):
void checkPolicyVisibilityChange(){
  if (mPolicyVisibility != mPolicyVisibilityAfterAnim) {
    if (DEBUG_VISIBILITY) {
      Slog.v(TAG,"String_Node_Str" + mWinAnimator + "String_Node_Str"+ mPolicyVisibilityAfterAnim);
    }
    mPolicyVisibility=mPolicyVisibilityAfterAnim;
    setDisplayLayoutNeeded();
    if (!mPolicyVisibility) {
      if (mService.mCurrentFocus == this) {
        if (DEBUG_FOCUS_LIGHT)         Slog.i(TAG,"String_Node_Str");
        mService.mFocusMayChange=true;
      }
      mService.enableScreenIfNeededLocked();
    }
  }
}
Program: 193283
Project: 193283
Buggy source:
void finishExit(){
  if (WindowManagerService.DEBUG_ANIM)   Slog.v(TAG,"String_Node_Str" + this + "String_Node_Str"+ mWin.mExiting+ "String_Node_Str"+ mWin.mRemoveOnExit+ "String_Node_Str"+ isWindowAnimating());
  final int N=mWin.mChildWindows.size();
  for (int i=0; i < N; i++) {
    mWin.mChildWindows.get(i).mWinAnimator.finishExit();
  }
  if (mEnteringAnimation) {
    mEnteringAnimation=false;
    mService.requestTraversal();
    if (mWin.mAppToken == null) {
      try {
        mWin.mClient.dispatchWindowShown();
      }
 catch (      RemoteException e) {
      }
    }
  }
  if (!isWindowAnimating()) {
    if (mService.mAccessibilityController != null && mWin.getDisplayId() == Display.DEFAULT_DISPLAY) {
      mService.mAccessibilityController.onSomeWindowResizedOrMovedLocked();
    }
  }
  if (!mWin.mExiting) {
    return;
  }
  if (isWindowAnimating()) {
    return;
  }
  if (WindowManagerService.localLOGV)   Slog.v(TAG,"String_Node_Str" + this + "String_Node_Str"+ mWin.mRemoveOnExit);
  if (mSurfaceController != null && mSurfaceController.hasSurface()) {
    mService.mDestroySurface.add(mWin);
    mWin.mDestroying=true;
    if (SHOW_TRANSACTIONS)     WindowManagerService.logSurface(mWin,"String_Node_Str",null);
    hide();
  }
  mWin.mExiting=false;
  if (mWin.mRemoveOnExit) {
    mService.mPendingRemove.add(mWin);
    mWin.mRemoveOnExit=false;
  }
  mWallpaperControllerLocked.hideWallpapers(mWin);
}

Fixed version (ground truth):
void finishExit(){
  if (WindowManagerService.DEBUG_ANIM)   Slog.v(TAG,"String_Node_Str" + this + "String_Node_Str"+ mWin.mExiting+ "String_Node_Str"+ mWin.mRemoveOnExit+ "String_Node_Str"+ isWindowAnimating());
  final int N=mWin.mChildWindows.size();
  for (int i=0; i < N; i++) {
    mWin.mChildWindows.get(i).mWinAnimator.finishExit();
  }
  if (mEnteringAnimation) {
    mEnteringAnimation=false;
    mService.requestTraversal();
    if (mWin.mAppToken == null) {
      try {
        mWin.mClient.dispatchWindowShown();
      }
 catch (      RemoteException e) {
      }
    }
  }
  if (!isWindowAnimating()) {
    if (mService.mAccessibilityController != null && mWin.getDisplayId() == Display.DEFAULT_DISPLAY) {
      mService.mAccessibilityController.onSomeWindowResizedOrMovedLocked();
    }
  }
  if (!mWin.mExiting) {
    return;
  }
  if (isWindowAnimating()) {
    return;
  }
  if (WindowManagerService.localLOGV)   Slog.v(TAG,"String_Node_Str" + this + "String_Node_Str"+ mWin.mRemoveOnExit);
  if (mSurfaceController != null && mSurfaceController.hasSurface()) {
    mService.mDestroySurface.add(mWin);
    mWin.mDestroying=true;
    hide("String_Node_Str");
  }
  mWin.mExiting=false;
  if (mWin.mRemoveOnExit) {
    mService.mPendingRemove.add(mWin);
    mWin.mRemoveOnExit=false;
  }
  mWallpaperControllerLocked.hideWallpapers(mWin);
}
Program: 193284
Project: 193284
Buggy source:
void preserveSurfaceLocked(){
  if (mDestroyPreservedSurfaceUponRedraw) {
    return;
  }
  mSurfaceController.setLayer(WINDOW_FREEZE_LAYER);
  mDestroyPreservedSurfaceUponRedraw=true;
  mSurfaceDestroyDeferred=true;
  destroySurfaceLocked();
}

Fixed version (ground truth):
void preserveSurfaceLocked(){
  if (mDestroyPreservedSurfaceUponRedraw) {
    return;
  }
  if (SHOW_TRANSACTIONS)   WindowManagerService.logSurface(mWin,"String_Node_Str",null);
  mSurfaceController.setLayer(mAnimLayer + 1);
  mDestroyPreservedSurfaceUponRedraw=true;
  mSurfaceDestroyDeferred=true;
  destroySurfaceLocked();
}
Program: 193286
Project: 193286
Buggy source:
void hide(){
  if (!mLastHidden) {
    mLastHidden=true;
    mSurfaceController.hideInTransaction();
  }
}

Fixed version (ground truth):
void hide(String reason){
  if (!mLastHidden) {
    mLastHidden=true;
    mSurfaceController.hideInTransaction(reason);
  }
}
Program: 193287
Project: 193287
Buggy source:
void setCropInTransaction(Rect clipRect,boolean recoveringMemory){
  if (SHOW_TRANSACTIONS)   logSurface("String_Node_Str" + clipRect.toShortString(),null);
  try {
    if (clipRect.width() > 0 && clipRect.height() > 0) {
      mSurfaceControl.setWindowCrop(clipRect);
      mHiddenForCrop=false;
    }
 else {
      hideInTransaction();
      mHiddenForCrop=true;
    }
  }
 catch (  RuntimeException e) {
    Slog.w(TAG,"String_Node_Str" + this + "String_Node_Str"+ clipRect.toShortString(),e);
    if (!recoveringMemory) {
      mAnimator.reclaimSomeSurfaceMemory("String_Node_Str",true);
    }
  }
}

Fixed version (ground truth):
void setCropInTransaction(Rect clipRect,boolean recoveringMemory){
  if (SHOW_TRANSACTIONS)   logSurface("String_Node_Str" + clipRect.toShortString(),null);
  try {
    if (clipRect.width() > 0 && clipRect.height() > 0) {
      mSurfaceControl.setWindowCrop(clipRect);
      mHiddenForCrop=false;
    }
 else {
      hideInTransaction("String_Node_Str");
      mHiddenForCrop=true;
    }
  }
 catch (  RuntimeException e) {
    Slog.w(TAG,"String_Node_Str" + this + "String_Node_Str"+ clipRect.toShortString(),e);
    if (!recoveringMemory) {
      mAnimator.reclaimSomeSurfaceMemory("String_Node_Str",true);
    }
  }
}
Program: 193288
Project: 193288
Buggy source:
void hideInTransaction(){
  if (SHOW_TRANSACTIONS)   logSurface("String_Node_Str",null);
  if (mSurfaceControl != null) {
    mSurfaceShown=false;
    try {
      mSurfaceControl.hide();
    }
 catch (    RuntimeException e) {
      Slog.w(TAG,"String_Node_Str" + this);
    }
  }
}

Fixed version (ground truth):
void hideInTransaction(String reason){
  if (SHOW_TRANSACTIONS)   logSurface("String_Node_Str" + reason + "String_Node_Str",null);
  if (mSurfaceControl != null) {
    mSurfaceShown=false;
    try {
      mSurfaceControl.hide();
    }
 catch (    RuntimeException e) {
      Slog.w(TAG,"String_Node_Str" + this);
    }
  }
}
Program: 193289
Project: 193289
Buggy source:
void updateWallpaperVisibility(){
  final boolean visible=isWallpaperVisible(mWallpaperTarget);
  final DisplayContent displayContent=mWallpaperTarget.getDisplayContent();
  if (displayContent == null) {
    return;
  }
  final DisplayInfo displayInfo=displayContent.getDisplayInfo();
  final int dw=displayInfo.logicalWidth;
  final int dh=displayInfo.logicalHeight;
  for (int curTokenNdx=mWallpaperTokens.size() - 1; curTokenNdx >= 0; curTokenNdx--) {
    WindowToken token=mWallpaperTokens.get(curTokenNdx);
    if (token.hidden == visible) {
      token.hidden=!visible;
      displayContent.layoutNeeded=true;
    }
    final WindowList windows=token.windows;
    for (int wallpaperNdx=windows.size() - 1; wallpaperNdx >= 0; wallpaperNdx--) {
      WindowState wallpaper=windows.get(wallpaperNdx);
      if (visible) {
        updateWallpaperOffset(wallpaper,dw,dh,false);
      }
      dispatchWallpaperVisibility(wallpaper,visible);
    }
  }
}

Fixed version (ground truth):
void updateWallpaperVisibility(){
  final DisplayContent displayContent=mWallpaperTarget.getDisplayContent();
  if (displayContent == null) {
    return;
  }
  final boolean visible=isWallpaperVisible(mWallpaperTarget);
  final DisplayInfo displayInfo=displayContent.getDisplayInfo();
  final int dw=displayInfo.logicalWidth;
  final int dh=displayInfo.logicalHeight;
  for (int curTokenNdx=mWallpaperTokens.size() - 1; curTokenNdx >= 0; curTokenNdx--) {
    WindowToken token=mWallpaperTokens.get(curTokenNdx);
    if (token.hidden == visible) {
      token.hidden=!visible;
      displayContent.layoutNeeded=true;
    }
    final WindowList windows=token.windows;
    for (int wallpaperNdx=windows.size() - 1; wallpaperNdx >= 0; wallpaperNdx--) {
      WindowState wallpaper=windows.get(wallpaperNdx);
      if (visible) {
        updateWallpaperOffset(wallpaper,dw,dh,false);
      }
      dispatchWallpaperVisibility(wallpaper,visible);
    }
  }
}
Program: 193290
Project: 193290
Buggy source:
void hideWallpapers(final WindowState winGoingAway){
  if (mWallpaperTarget != null && (mWallpaperTarget != winGoingAway || mLowerWallpaperTarget != null)) {
    return;
  }
  if (mService.mAppTransition.isRunning()) {
    mDeferredHideWallpaper=winGoingAway;
    return;
  }
  final boolean wasDeferred=(mDeferredHideWallpaper == winGoingAway);
  for (int i=mWallpaperTokens.size() - 1; i >= 0; i--) {
    final WindowToken token=mWallpaperTokens.get(i);
    for (int j=token.windows.size() - 1; j >= 0; j--) {
      final WindowState wallpaper=token.windows.get(j);
      final WindowStateAnimator winAnimator=wallpaper.mWinAnimator;
      if (!winAnimator.mLastHidden || wasDeferred) {
        winAnimator.hide();
        dispatchWallpaperVisibility(wallpaper,false);
        final DisplayContent displayContent=wallpaper.getDisplayContent();
        if (displayContent != null) {
          displayContent.pendingLayoutChanges|=WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER;
        }
      }
    }
    if (DEBUG_WALLPAPER_LIGHT && !token.hidden)     Slog.d(TAG,"String_Node_Str" + token + "String_Node_Str"+ winGoingAway+ "String_Node_Str"+ mWallpaperTarget+ "String_Node_Str"+ mLowerWallpaperTarget+ "String_Node_Str"+ Debug.getCallers(5,"String_Node_Str"));
    token.hidden=true;
  }
}

Fixed version (ground truth):
void hideWallpapers(final WindowState winGoingAway){
  if (mWallpaperTarget != null && (mWallpaperTarget != winGoingAway || mLowerWallpaperTarget != null)) {
    return;
  }
  if (mService.mAppTransition.isRunning()) {
    mDeferredHideWallpaper=winGoingAway;
    return;
  }
  final boolean wasDeferred=(mDeferredHideWallpaper == winGoingAway);
  for (int i=mWallpaperTokens.size() - 1; i >= 0; i--) {
    final WindowToken token=mWallpaperTokens.get(i);
    for (int j=token.windows.size() - 1; j >= 0; j--) {
      final WindowState wallpaper=token.windows.get(j);
      final WindowStateAnimator winAnimator=wallpaper.mWinAnimator;
      if (!winAnimator.mLastHidden || wasDeferred) {
        winAnimator.hide("String_Node_Str");
        dispatchWallpaperVisibility(wallpaper,false);
        final DisplayContent displayContent=wallpaper.getDisplayContent();
        if (displayContent != null) {
          displayContent.pendingLayoutChanges|=WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER;
        }
      }
    }
    if (DEBUG_WALLPAPER_LIGHT && !token.hidden)     Slog.d(TAG,"String_Node_Str" + token + "String_Node_Str"+ winGoingAway+ "String_Node_Str"+ mWallpaperTarget+ "String_Node_Str"+ mLowerWallpaperTarget+ "String_Node_Str"+ Debug.getCallers(5,"String_Node_Str"));
    token.hidden=true;
  }
}
Program: 193291
Project: 193291
Buggy source:
private void prepareWindowReplacementTransition(AppWindowToken atoken){
  if (atoken == null || !atoken.mWillReplaceWindow || !atoken.mAnimateReplacingWindow) {
    return;
  }
  atoken.allDrawn=false;
  WindowState replacedWindow=null;
  for (int i=atoken.windows.size() - 1; i >= 0 && replacedWindow == null; i--) {
    WindowState candidate=atoken.windows.get(i);
    if (candidate.mExiting) {
      replacedWindow=candidate;
    }
  }
  if (replacedWindow == null) {
    return;
  }
  Rect frame=replacedWindow.mFrame;
  mOpeningApps.add(atoken);
  prepareAppTransition(AppTransition.TRANSIT_ACTIVITY_RELAUNCH,ALWAYS_KEEP_CURRENT);
  mAppTransition.overridePendingAppTransitionClipReveal(frame.left,frame.top,frame.width(),frame.height());
  executeAppTransition();
}

Fixed version (ground truth):
private void prepareWindowReplacementTransition(AppWindowToken atoken){
  if (atoken == null || !atoken.mWillReplaceWindow || !atoken.mAnimateReplacingWindow) {
    return;
  }
  atoken.allDrawn=false;
  WindowState replacedWindow=null;
  for (int i=atoken.windows.size() - 1; i >= 0 && replacedWindow == null; i--) {
    WindowState candidate=atoken.windows.get(i);
    if (candidate.mExiting) {
      replacedWindow=candidate;
    }
  }
  if (replacedWindow == null) {
    return;
  }
  Rect frame=replacedWindow.mVisibleFrame;
  mOpeningApps.add(atoken);
  prepareAppTransition(AppTransition.TRANSIT_ACTIVITY_RELAUNCH,ALWAYS_KEEP_CURRENT);
  mAppTransition.overridePendingAppTransitionClipReveal(frame.left,frame.top,frame.width(),frame.height());
  executeAppTransition();
}
Program: 193292
Project: 193292
Buggy source:
void checkPolicyVisibilityChange(){
  if (mPolicyVisibility != mPolicyVisibilityAfterAnim) {
    if (DEBUG_VISIBILITY) {
      Slog.v(TAG,"String_Node_Str" + mWinAnimator + "String_Node_Str"+ mPolicyVisibilityAfterAnim);
    }
    mPolicyVisibility=mPolicyVisibilityAfterAnim;
    if (mDisplayContent != null) {
      mDisplayContent.layoutNeeded=true;
    }
    if (!mPolicyVisibility) {
      if (mService.mCurrentFocus == this) {
        if (DEBUG_FOCUS_LIGHT)         Slog.i(TAG,"String_Node_Str");
        mService.mFocusMayChange=true;
      }
      mService.enableScreenIfNeededLocked();
    }
  }
}

Fixed version (ground truth):
void checkPolicyVisibilityChange(){
  if (mPolicyVisibility != mPolicyVisibilityAfterAnim) {
    if (DEBUG_VISIBILITY) {
      Slog.v(TAG,"String_Node_Str" + mWinAnimator + "String_Node_Str"+ mPolicyVisibilityAfterAnim);
    }
    mPolicyVisibility=mPolicyVisibilityAfterAnim;
    setDisplayLayoutNeeded();
    if (!mPolicyVisibility) {
      if (mService.mCurrentFocus == this) {
        if (DEBUG_FOCUS_LIGHT)         Slog.i(TAG,"String_Node_Str");
        mService.mFocusMayChange=true;
      }
      mService.enableScreenIfNeededLocked();
    }
  }
}