nus-yam/ex-repair huggingface dataset:
Program: 191796
Project: 191796
Buggy source:
@Override public void dumpControllerStateLocked(PrintWriter pw){
  pw.println("String_Node_Str");
  for (int i=0; i < mTrackedJobs.size(); i++) {
    final JobStatus js=mTrackedJobs.get(i);
    pw.println(String.valueOf(js.getJobId() + "String_Node_Str" + js.getUid()) + "String_Node_Str" + js.hasConnectivityConstraint()+ "String_Node_Str"+ js.hasUnmeteredConstraint()+ "String_Node_Str"+ js.hasNotRoamingConstraint());
  }
}

Fixed version (ground truth):
@Override public void dumpControllerStateLocked(PrintWriter pw,int filterUid){
  pw.println("String_Node_Str");
  for (int i=0; i < mTrackedJobs.size(); i++) {
    final JobStatus js=mTrackedJobs.get(i);
    if (js.shouldDump(filterUid)) {
      pw.println(String.valueOf(js.getJobId() + "String_Node_Str" + js.getUid()) + "String_Node_Str" + js.hasConnectivityConstraint()+ "String_Node_Str"+ js.hasUnmeteredConstraint()+ "String_Node_Str"+ js.hasNotRoamingConstraint());
    }
  }
}
Program: 191798
Project: 191798
Buggy source:
/** 
 * Callback for when a job is completed.
 * @param needsReschedule Whether the implementing class should reschedule this job.
 */
public void onJobCompleted(JobStatus jobStatus,boolean needsReschedule);

Fixed version (ground truth):
/** 
 * Callback for when a job is completed.
 * @param needsReschedule Whether the implementing class should reschedule this job.
 */
void onJobCompleted(JobStatus jobStatus,boolean needsReschedule);
Program: 191799
Project: 191799
Buggy source:
public void noteInactive(JobStatus job){
  final long now=SystemClock.uptimeMillis();
  if (job.lastEvaluatedPriority >= JobInfo.PRIORITY_TOP_APP) {
    mCurDataSet.decActiveTop(job.getSourceUid(),job.getSourcePackageName(),now);
  }
 else {
    mCurDataSet.decActive(job.getSourceUid(),job.getSourcePackageName(),now);
  }
  rebatchIfNeeded(now);
}

Fixed version (ground truth):
public void noteInactive(JobStatus job){
  final long now=SystemClock.uptimeMillis();
  if (job.lastEvaluatedPriority >= JobInfo.PRIORITY_TOP_APP) {
    mCurDataSet.decActiveTop(job.getSourceUid(),job.getSourcePackageName(),now);
  }
 else {
    mCurDataSet.decActive(job.getSourceUid(),job.getSourcePackageName(),now);
  }
  rebatchIfNeeded(now);
  addEvent(EVENT_STOP_JOB,job.getSourceUid(),job.getBatteryName());
}
Program: 191800
Project: 191800
Buggy source:
public void noteActive(JobStatus job){
  final long now=SystemClock.uptimeMillis();
  rebatchIfNeeded(now);
  if (job.lastEvaluatedPriority >= JobInfo.PRIORITY_TOP_APP) {
    mCurDataSet.incActiveTop(job.getSourceUid(),job.getSourcePackageName(),now);
  }
 else {
    mCurDataSet.incActive(job.getSourceUid(),job.getSourcePackageName(),now);
  }
}

Fixed version (ground truth):
public void noteActive(JobStatus job){
  final long now=SystemClock.uptimeMillis();
  rebatchIfNeeded(now);
  if (job.lastEvaluatedPriority >= JobInfo.PRIORITY_TOP_APP) {
    mCurDataSet.incActiveTop(job.getSourceUid(),job.getSourcePackageName(),now);
  }
 else {
    mCurDataSet.incActive(job.getSourceUid(),job.getSourcePackageName(),now);
  }
  addEvent(EVENT_START_JOB,job.getSourceUid(),job.getBatteryName());
}
Program: 191801
Project: 191801
Buggy source:
public void dump(PrintWriter pw,String prefix){
  final long now=SystemClock.uptimeMillis();
  final long nowEllapsed=SystemClock.elapsedRealtime();
  final DataSet total;
  if (mLastDataSets[0] != null) {
    total=new DataSet(mLastDataSets[0]);
    mLastDataSets[0].addTo(total,now);
  }
 else {
    total=new DataSet(mCurDataSet);
  }
  mCurDataSet.addTo(total,now);
  for (int i=1; i < mLastDataSets.length; i++) {
    if (mLastDataSets[i] != null) {
      mLastDataSets[i].dump(pw,"String_Node_Str",prefix,now,nowEllapsed);
      pw.println();
    }
  }
  total.dump(pw,"String_Node_Str",prefix,now,nowEllapsed);
}

Fixed version (ground truth):
public void dump(PrintWriter pw,String prefix,int filterUid){
  final long now=SystemClock.uptimeMillis();
  final long nowEllapsed=SystemClock.elapsedRealtime();
  final DataSet total;
  if (mLastDataSets[0] != null) {
    total=new DataSet(mLastDataSets[0]);
    mLastDataSets[0].addTo(total,now);
  }
 else {
    total=new DataSet(mCurDataSet);
  }
  mCurDataSet.addTo(total,now);
  for (int i=1; i < mLastDataSets.length; i++) {
    if (mLastDataSets[i] != null) {
      mLastDataSets[i].dump(pw,"String_Node_Str",prefix,now,nowEllapsed,filterUid);
      pw.println();
    }
  }
  total.dump(pw,"String_Node_Str",prefix,now,nowEllapsed,filterUid);
}
Program: 191803
Project: 191803
Buggy source:
@Override public void process(JobStatus job){
  pw.print("String_Node_Str");
  pw.print(index++);
  pw.print("String_Node_Str");
  pw.println(job.toShortString());
  if (filterUidFinal != -1 && job.getUid() != filterUidFinal && job.getSourceUid() != filterUidFinal) {
    return;
  }
  job.dump(pw,"String_Node_Str",true);
  pw.print("String_Node_Str");
  pw.print(mHandler.isReadyToBeExecutedLocked(job));
  pw.print("String_Node_Str");
  pw.print(job.isReady());
  pw.print("String_Node_Str");
  pw.print(mPendingJobs.contains(job));
  pw.print("String_Node_Str");
  pw.print(isCurrentlyActiveLocked(job));
  pw.print("String_Node_Str");
  pw.print(ArrayUtils.contains(mStartedUsers,job.getUserId()));
  pw.println("String_Node_Str");
}

Fixed version (ground truth):
@Override public void process(JobStatus job){
  pw.print("String_Node_Str");
  pw.print(index++);
  pw.print("String_Node_Str");
  pw.println(job.toShortString());
  if (!job.shouldDump(filterUidFinal)) {
    return;
  }
  job.dump(pw,"String_Node_Str",true);
  pw.print("String_Node_Str");
  pw.print(mHandler.isReadyToBeExecutedLocked(job));
  pw.print("String_Node_Str");
  pw.print(job.isReady());
  pw.print("String_Node_Str");
  pw.print(mPendingJobs.contains(job));
  pw.print("String_Node_Str");
  pw.print(isCurrentlyActiveLocked(job));
  pw.print("String_Node_Str");
  pw.print(ArrayUtils.contains(mStartedUsers,job.getUserId()));
  pw.println("String_Node_Str");
}
Program: 191804
Project: 191804
Buggy source:
@Override public void process(JobStatus jobStatus){
  pw.print("String_Node_Str");
  pw.print(jobStatus.getSourcePackageName());
  pw.print("String_Node_Str");
  pw.println((jobStatus.satisfiedConstraints & JobStatus.CONSTRAINT_APP_NOT_IDLE) != 0);
}

Fixed version (ground truth):
@Override public void process(JobStatus jobStatus){
  if (!jobStatus.shouldDump(filterUid)) {
    return;
  }
  pw.print("String_Node_Str");
  pw.print(jobStatus.getSourcePackageName());
  pw.print("String_Node_Str");
  pw.println((jobStatus.satisfiedConstraints & JobStatus.CONSTRAINT_APP_NOT_IDLE) != 0);
}
Program: 191805
Project: 191805
Buggy source:
@Override public void dumpControllerStateLocked(final PrintWriter pw){
  pw.println("String_Node_Str");
  pw.println("String_Node_Str" + mAppIdleParoleOn);
  mJobSchedulerService.getJobStore().forEachJob(new JobStore.JobStatusFunctor(){
    @Override public void process(    JobStatus jobStatus){
      pw.print("String_Node_Str");
      pw.print(jobStatus.getSourcePackageName());
      pw.print("String_Node_Str");
      pw.println((jobStatus.satisfiedConstraints & JobStatus.CONSTRAINT_APP_NOT_IDLE) != 0);
    }
  }
);
  pw.println();
}

Fixed version (ground truth):
@Override public void dumpControllerStateLocked(final PrintWriter pw,final int filterUid){
  pw.println("String_Node_Str");
  pw.println("String_Node_Str" + mAppIdleParoleOn);
  mJobSchedulerService.getJobStore().forEachJob(new JobStore.JobStatusFunctor(){
    @Override public void process(    JobStatus jobStatus){
      if (!jobStatus.shouldDump(filterUid)) {
        return;
      }
      pw.print("String_Node_Str");
      pw.print(jobStatus.getSourcePackageName());
      pw.print("String_Node_Str");
      pw.println((jobStatus.satisfiedConstraints & JobStatus.CONSTRAINT_APP_NOT_IDLE) != 0);
    }
  }
);
  pw.println();
}
Program: 191806
Project: 191806
Buggy source:
@Override public void dumpControllerStateLocked(PrintWriter pw){
  pw.println("String_Node_Str");
  pw.println("String_Node_Str" + mChargeTracker.isOnStablePower());
  Iterator<JobStatus> it=mTrackedTasks.iterator();
  if (it.hasNext()) {
    pw.print(String.valueOf(it.next().hashCode()));
  }
  while (it.hasNext()) {
    pw.print("String_Node_Str" + String.valueOf(it.next().hashCode()));
  }
  pw.println();
}

Fixed version (ground truth):
@Override public void dumpControllerStateLocked(PrintWriter pw,int filterUid){
  pw.println("String_Node_Str");
  pw.println("String_Node_Str" + mChargeTracker.isOnStablePower());
  Iterator<JobStatus> it=mTrackedTasks.iterator();
  if (it.hasNext()) {
    JobStatus jobStatus=it.next();
    if (jobStatus.shouldDump(filterUid)) {
      pw.print(String.valueOf(jobStatus.hashCode()));
    }
  }
  while (it.hasNext()) {
    JobStatus jobStatus=it.next();
    if (jobStatus.shouldDump(filterUid)) {
      pw.print("String_Node_Str" + String.valueOf(jobStatus.hashCode()));
    }
  }
  pw.println();
}
Program: 191807
Project: 191807
Buggy source:
@Override public void dumpControllerStateLocked(PrintWriter pw){
  pw.println("String_Node_Str");
  for (int i=0; i < mTrackedJobs.size(); i++) {
    final JobStatus js=mTrackedJobs.get(i);
    pw.println(String.valueOf(js.getJobId() + "String_Node_Str" + js.getUid()) + "String_Node_Str" + js.hasConnectivityConstraint()+ "String_Node_Str"+ js.hasUnmeteredConstraint()+ "String_Node_Str"+ js.hasNotRoamingConstraint());
  }
}

Fixed version (ground truth):
@Override public void dumpControllerStateLocked(PrintWriter pw,int filterUid){
  pw.println("String_Node_Str");
  for (int i=0; i < mTrackedJobs.size(); i++) {
    final JobStatus js=mTrackedJobs.get(i);
    if (js.shouldDump(filterUid)) {
      pw.println(String.valueOf(js.getJobId() + "String_Node_Str" + js.getUid()) + "String_Node_Str" + js.hasConnectivityConstraint()+ "String_Node_Str"+ js.hasUnmeteredConstraint()+ "String_Node_Str"+ js.hasNotRoamingConstraint());
    }
  }
}
Program: 191810
Project: 191810
Buggy source:
public void removeAllChildren(){
  List<ExpandableNotificationRow> notificationChildren=mChildrenContainer.getNotificationChildren();
  ArrayList<ExpandableNotificationRow> clonedList=new ArrayList<>(notificationChildren);
  for (int i=0; i < clonedList.size(); i++) {
    ExpandableNotificationRow row=clonedList.get(i);
    mChildrenContainer.removeNotification(row);
    mHeaderUtil.restoreNotificationHeader(row);
    row.setIsChildInGroup(false,null);
  }
  onChildrenCountChanged();
}

Fixed version (ground truth):
public void removeAllChildren(){
  List<ExpandableNotificationRow> notificationChildren=mChildrenContainer.getNotificationChildren();
  ArrayList<ExpandableNotificationRow> clonedList=new ArrayList<>(notificationChildren);
  for (int i=0; i < clonedList.size(); i++) {
    ExpandableNotificationRow row=clonedList.get(i);
    if (row.keepInParent()) {
      continue;
    }
    mChildrenContainer.removeNotification(row);
    mHeaderUtil.restoreNotificationHeader(row);
    row.setIsChildInGroup(false,null);
  }
  onChildrenCountChanged();
}
Program: 191811
Project: 191811
Buggy source:
/** 
 * @return whether a given notification is a child in a group which has a summary
 */
public boolean isChildInGroupWithSummary(StatusBarNotification sbn){
  if (!isGroupChild(sbn)) {
    return false;
  }
  NotificationGroup group=mGroupMap.get(getGroupKey(sbn));
  if (group == null || group.summary == null || group.suppressed) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
/** 
 * @return whether a given notification is a child in a group which has a summary
 */
public boolean isChildInGroupWithSummary(StatusBarNotification sbn){
  if (!isGroupChild(sbn)) {
    return false;
  }
  NotificationGroup group=mGroupMap.get(getGroupKey(sbn));
  if (group == null || group.summary == null || group.suppressed) {
    return false;
  }
  if (group.children.isEmpty()) {
    return false;
  }
  return true;
}
Program: 191812
Project: 191812
Buggy source:
private void removeNotificationChildren(){
  ArrayList<ExpandableNotificationRow> toRemove=new ArrayList<>();
  for (int i=0; i < mStackScroller.getChildCount(); i++) {
    View view=mStackScroller.getChildAt(i);
    if (!(view instanceof ExpandableNotificationRow)) {
      continue;
    }
    ExpandableNotificationRow parent=(ExpandableNotificationRow)view;
    List<ExpandableNotificationRow> children=parent.getNotificationChildren();
    List<ExpandableNotificationRow> orderedChildren=mTmpChildOrderMap.get(parent);
    if (children != null) {
      toRemove.clear();
      for (      ExpandableNotificationRow childRow : children) {
        if (orderedChildren == null || !orderedChildren.contains(childRow)) {
          toRemove.add(childRow);
        }
      }
      for (      ExpandableNotificationRow remove : toRemove) {
        parent.removeChildNotification(remove);
        if (mNotificationData.get(remove.getStatusBarNotification().getKey()) == null) {
          mStackScroller.notifyGroupChildRemoved(remove);
        }
      }
    }
  }
}

Fixed version (ground truth):
private void removeNotificationChildren(){
  ArrayList<ExpandableNotificationRow> toRemove=new ArrayList<>();
  for (int i=0; i < mStackScroller.getChildCount(); i++) {
    View view=mStackScroller.getChildAt(i);
    if (!(view instanceof ExpandableNotificationRow)) {
      continue;
    }
    ExpandableNotificationRow parent=(ExpandableNotificationRow)view;
    List<ExpandableNotificationRow> children=parent.getNotificationChildren();
    List<ExpandableNotificationRow> orderedChildren=mTmpChildOrderMap.get(parent);
    if (children != null) {
      toRemove.clear();
      for (      ExpandableNotificationRow childRow : children) {
        if ((orderedChildren == null || !orderedChildren.contains(childRow)) && !childRow.keepInParent()) {
          toRemove.add(childRow);
        }
      }
      for (      ExpandableNotificationRow remove : toRemove) {
        parent.removeChildNotification(remove);
        if (mNotificationData.get(remove.getStatusBarNotification().getKey()) == null) {
          mStackScroller.notifyGroupChildRemoved(remove);
        }
      }
    }
  }
}
Program: 191814
Project: 191814
Buggy source:
private void performDismiss(View v){
  if (v instanceof ExpandableNotificationRow) {
    ExpandableNotificationRow row=(ExpandableNotificationRow)v;
    if (mGroupManager.isOnlyChildInSuppressedGroup(row.getStatusBarNotification())) {
      ExpandableNotificationRow groupSummary=mGroupManager.getLogicalGroupSummary(row.getStatusBarNotification());
      if (groupSummary.isClearable()) {
        performDismiss(groupSummary);
      }
    }
  }
  final View veto=v.findViewById(R.id.veto);
  if (veto != null && veto.getVisibility() != View.GONE) {
    veto.performClick();
  }
  if (DEBUG)   Log.v(TAG,"String_Node_Str" + v);
}

Fixed version (ground truth):
private void performDismiss(View v){
  if (v instanceof ExpandableNotificationRow) {
    ExpandableNotificationRow row=(ExpandableNotificationRow)v;
    if (mGroupManager.isOnlyChildInSuppressedGroup(row.getStatusBarNotification())) {
      ExpandableNotificationRow groupSummary=mGroupManager.getLogicalGroupSummary(row.getStatusBarNotification());
      if (groupSummary.isClearable()) {
        performDismiss(groupSummary);
      }
    }
    row.setDismissed(true);
  }
  final View veto=v.findViewById(R.id.veto);
  if (veto != null && veto.getVisibility() != View.GONE) {
    veto.performClick();
  }
  if (DEBUG)   Log.v(TAG,"String_Node_Str" + v);
}
Program: 191815
Project: 191815
Buggy source:
/** 
 * Cancels a notification ONLY if it has all of the   {@code mustHaveFlags}and none of the   {@code mustNotHaveFlags}.
 */
void cancelNotification(final int callingUid,final int callingPid,final String pkg,final String tag,final int id,final int mustHaveFlags,final int mustNotHaveFlags,final boolean sendDelete,final int userId,final int reason,final ManagedServiceInfo listener){
  mHandler.post(new Runnable(){
    @Override public void run(){
      String listenerName=listener == null ? null : listener.component.toShortString();
      if (DBG)       EventLogTags.writeNotificationCancel(callingUid,callingPid,pkg,id,tag,userId,mustHaveFlags,mustNotHaveFlags,reason,listenerName);
synchronized (mNotificationList) {
        int index=indexOfNotificationLocked(pkg,tag,id,userId);
        if (index >= 0) {
          NotificationRecord r=mNotificationList.get(index);
          if (reason == REASON_DELEGATE_CLICK) {
            mUsageStats.registerClickedByUser(r);
          }
          if ((r.getNotification().flags & mustHaveFlags) != mustHaveFlags) {
            return;
          }
          if ((r.getNotification().flags & mustNotHaveFlags) != 0) {
            return;
          }
          mNotificationList.remove(index);
          cancelGroupChildrenLocked(r,callingUid,callingPid,listenerName,REASON_GROUP_SUMMARY_CANCELED);
          cancelNotificationLocked(r,sendDelete,reason);
          updateLightsLocked();
        }
      }
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Cancels a notification ONLY if it has all of the   {@code mustHaveFlags}and none of the   {@code mustNotHaveFlags}.
 */
void cancelNotification(final int callingUid,final int callingPid,final String pkg,final String tag,final int id,final int mustHaveFlags,final int mustNotHaveFlags,final boolean sendDelete,final int userId,final int reason,final ManagedServiceInfo listener){
  mHandler.post(new Runnable(){
    @Override public void run(){
      String listenerName=listener == null ? null : listener.component.toShortString();
      if (DBG)       EventLogTags.writeNotificationCancel(callingUid,callingPid,pkg,id,tag,userId,mustHaveFlags,mustNotHaveFlags,reason,listenerName);
synchronized (mNotificationList) {
        int index=indexOfNotificationLocked(pkg,tag,id,userId);
        if (index >= 0) {
          NotificationRecord r=mNotificationList.get(index);
          if (reason == REASON_DELEGATE_CLICK) {
            mUsageStats.registerClickedByUser(r);
          }
          if ((r.getNotification().flags & mustHaveFlags) != mustHaveFlags) {
            return;
          }
          if ((r.getNotification().flags & mustNotHaveFlags) != 0) {
            return;
          }
          mNotificationList.remove(index);
          cancelNotificationLocked(r,sendDelete,reason);
          cancelGroupChildrenLocked(r,callingUid,callingPid,listenerName,REASON_GROUP_SUMMARY_CANCELED);
          updateLightsLocked();
        }
      }
    }
  }
);
}
Program: 191816
Project: 191816
Buggy source:
/** 
 * Callback for when a job is completed.
 * @param needsReschedule Whether the implementing class should reschedule this job.
 */
public void onJobCompleted(JobStatus jobStatus,boolean needsReschedule);

Fixed version (ground truth):
/** 
 * Callback for when a job is completed.
 * @param needsReschedule Whether the implementing class should reschedule this job.
 */
void onJobCompleted(JobStatus jobStatus,boolean needsReschedule);
Program: 191817
Project: 191817
Buggy source:
public void noteInactive(JobStatus job){
  final long now=SystemClock.uptimeMillis();
  if (job.lastEvaluatedPriority >= JobInfo.PRIORITY_TOP_APP) {
    mCurDataSet.decActiveTop(job.getSourceUid(),job.getSourcePackageName(),now);
  }
 else {
    mCurDataSet.decActive(job.getSourceUid(),job.getSourcePackageName(),now);
  }
  rebatchIfNeeded(now);
}

Fixed version (ground truth):
public void noteInactive(JobStatus job){
  final long now=SystemClock.uptimeMillis();
  if (job.lastEvaluatedPriority >= JobInfo.PRIORITY_TOP_APP) {
    mCurDataSet.decActiveTop(job.getSourceUid(),job.getSourcePackageName(),now);
  }
 else {
    mCurDataSet.decActive(job.getSourceUid(),job.getSourcePackageName(),now);
  }
  rebatchIfNeeded(now);
  addEvent(EVENT_STOP_JOB,job.getSourceUid(),job.getBatteryName());
}
Program: 191818
Project: 191818
Buggy source:
public void noteActive(JobStatus job){
  final long now=SystemClock.uptimeMillis();
  rebatchIfNeeded(now);
  if (job.lastEvaluatedPriority >= JobInfo.PRIORITY_TOP_APP) {
    mCurDataSet.incActiveTop(job.getSourceUid(),job.getSourcePackageName(),now);
  }
 else {
    mCurDataSet.incActive(job.getSourceUid(),job.getSourcePackageName(),now);
  }
}

Fixed version (ground truth):
public void noteActive(JobStatus job){
  final long now=SystemClock.uptimeMillis();
  rebatchIfNeeded(now);
  if (job.lastEvaluatedPriority >= JobInfo.PRIORITY_TOP_APP) {
    mCurDataSet.incActiveTop(job.getSourceUid(),job.getSourcePackageName(),now);
  }
 else {
    mCurDataSet.incActive(job.getSourceUid(),job.getSourcePackageName(),now);
  }
  addEvent(EVENT_START_JOB,job.getSourceUid(),job.getBatteryName());
}
Program: 191819
Project: 191819
Buggy source:
public void dump(PrintWriter pw,String prefix){
  final long now=SystemClock.uptimeMillis();
  final long nowEllapsed=SystemClock.elapsedRealtime();
  final DataSet total;
  if (mLastDataSets[0] != null) {
    total=new DataSet(mLastDataSets[0]);
    mLastDataSets[0].addTo(total,now);
  }
 else {
    total=new DataSet(mCurDataSet);
  }
  mCurDataSet.addTo(total,now);
  for (int i=1; i < mLastDataSets.length; i++) {
    if (mLastDataSets[i] != null) {
      mLastDataSets[i].dump(pw,"String_Node_Str",prefix,now,nowEllapsed);
      pw.println();
    }
  }
  total.dump(pw,"String_Node_Str",prefix,now,nowEllapsed);
}

Fixed version (ground truth):
public void dump(PrintWriter pw,String prefix,int filterUid){
  final long now=SystemClock.uptimeMillis();
  final long nowEllapsed=SystemClock.elapsedRealtime();
  final DataSet total;
  if (mLastDataSets[0] != null) {
    total=new DataSet(mLastDataSets[0]);
    mLastDataSets[0].addTo(total,now);
  }
 else {
    total=new DataSet(mCurDataSet);
  }
  mCurDataSet.addTo(total,now);
  for (int i=1; i < mLastDataSets.length; i++) {
    if (mLastDataSets[i] != null) {
      mLastDataSets[i].dump(pw,"String_Node_Str",prefix,now,nowEllapsed,filterUid);
      pw.println();
    }
  }
  total.dump(pw,"String_Node_Str",prefix,now,nowEllapsed,filterUid);
}
Program: 191821
Project: 191821
Buggy source:
@Override public void process(JobStatus job){
  pw.print("String_Node_Str");
  pw.print(index++);
  pw.print("String_Node_Str");
  pw.println(job.toShortString());
  if (filterUidFinal != -1 && job.getUid() != filterUidFinal && job.getSourceUid() != filterUidFinal) {
    return;
  }
  job.dump(pw,"String_Node_Str",true);
  pw.print("String_Node_Str");
  pw.print(mHandler.isReadyToBeExecutedLocked(job));
  pw.print("String_Node_Str");
  pw.print(job.isReady());
  pw.print("String_Node_Str");
  pw.print(mPendingJobs.contains(job));
  pw.print("String_Node_Str");
  pw.print(isCurrentlyActiveLocked(job));
  pw.print("String_Node_Str");
  pw.print(ArrayUtils.contains(mStartedUsers,job.getUserId()));
  pw.println("String_Node_Str");
}

Fixed version (ground truth):
@Override public void process(JobStatus job){
  pw.print("String_Node_Str");
  pw.print(index++);
  pw.print("String_Node_Str");
  pw.println(job.toShortString());
  if (!job.shouldDump(filterUidFinal)) {
    return;
  }
  job.dump(pw,"String_Node_Str",true);
  pw.print("String_Node_Str");
  pw.print(mHandler.isReadyToBeExecutedLocked(job));
  pw.print("String_Node_Str");
  pw.print(job.isReady());
  pw.print("String_Node_Str");
  pw.print(mPendingJobs.contains(job));
  pw.print("String_Node_Str");
  pw.print(isCurrentlyActiveLocked(job));
  pw.print("String_Node_Str");
  pw.print(ArrayUtils.contains(mStartedUsers,job.getUserId()));
  pw.println("String_Node_Str");
}
Program: 191822
Project: 191822
Buggy source:
@Override public void process(JobStatus jobStatus){
  pw.print("String_Node_Str");
  pw.print(jobStatus.getSourcePackageName());
  pw.print("String_Node_Str");
  pw.println((jobStatus.satisfiedConstraints & JobStatus.CONSTRAINT_APP_NOT_IDLE) != 0);
}

Fixed version (ground truth):
@Override public void process(JobStatus jobStatus){
  if (!jobStatus.shouldDump(filterUid)) {
    return;
  }
  pw.print("String_Node_Str");
  pw.print(jobStatus.getSourcePackageName());
  pw.print("String_Node_Str");
  pw.println((jobStatus.satisfiedConstraints & JobStatus.CONSTRAINT_APP_NOT_IDLE) != 0);
}
Program: 191823
Project: 191823
Buggy source:
@Override public void dumpControllerStateLocked(final PrintWriter pw){
  pw.println("String_Node_Str");
  pw.println("String_Node_Str" + mAppIdleParoleOn);
  mJobSchedulerService.getJobStore().forEachJob(new JobStore.JobStatusFunctor(){
    @Override public void process(    JobStatus jobStatus){
      pw.print("String_Node_Str");
      pw.print(jobStatus.getSourcePackageName());
      pw.print("String_Node_Str");
      pw.println((jobStatus.satisfiedConstraints & JobStatus.CONSTRAINT_APP_NOT_IDLE) != 0);
    }
  }
);
  pw.println();
}

Fixed version (ground truth):
@Override public void dumpControllerStateLocked(final PrintWriter pw,final int filterUid){
  pw.println("String_Node_Str");
  pw.println("String_Node_Str" + mAppIdleParoleOn);
  mJobSchedulerService.getJobStore().forEachJob(new JobStore.JobStatusFunctor(){
    @Override public void process(    JobStatus jobStatus){
      if (!jobStatus.shouldDump(filterUid)) {
        return;
      }
      pw.print("String_Node_Str");
      pw.print(jobStatus.getSourcePackageName());
      pw.print("String_Node_Str");
      pw.println((jobStatus.satisfiedConstraints & JobStatus.CONSTRAINT_APP_NOT_IDLE) != 0);
    }
  }
);
  pw.println();
}
Program: 191824
Project: 191824
Buggy source:
@Override public void dumpControllerStateLocked(PrintWriter pw){
  pw.println("String_Node_Str");
  pw.println("String_Node_Str" + mChargeTracker.isOnStablePower());
  Iterator<JobStatus> it=mTrackedTasks.iterator();
  if (it.hasNext()) {
    pw.print(String.valueOf(it.next().hashCode()));
  }
  while (it.hasNext()) {
    pw.print("String_Node_Str" + String.valueOf(it.next().hashCode()));
  }
  pw.println();
}

Fixed version (ground truth):
@Override public void dumpControllerStateLocked(PrintWriter pw,int filterUid){
  pw.println("String_Node_Str");
  pw.println("String_Node_Str" + mChargeTracker.isOnStablePower());
  Iterator<JobStatus> it=mTrackedTasks.iterator();
  if (it.hasNext()) {
    JobStatus jobStatus=it.next();
    if (jobStatus.shouldDump(filterUid)) {
      pw.print(String.valueOf(jobStatus.hashCode()));
    }
  }
  while (it.hasNext()) {
    JobStatus jobStatus=it.next();
    if (jobStatus.shouldDump(filterUid)) {
      pw.print("String_Node_Str" + String.valueOf(jobStatus.hashCode()));
    }
  }
  pw.println();
}
Program: 191825
Project: 191825
Buggy source:
@Override public void dumpControllerStateLocked(PrintWriter pw){
  pw.println("String_Node_Str");
  for (int i=0; i < mTrackedJobs.size(); i++) {
    final JobStatus js=mTrackedJobs.get(i);
    pw.println(String.valueOf(js.getJobId() + "String_Node_Str" + js.getUid()) + "String_Node_Str" + js.hasConnectivityConstraint()+ "String_Node_Str"+ js.hasUnmeteredConstraint()+ "String_Node_Str"+ js.hasNotRoamingConstraint());
  }
}

Fixed version (ground truth):
@Override public void dumpControllerStateLocked(PrintWriter pw,int filterUid){
  pw.println("String_Node_Str");
  for (int i=0; i < mTrackedJobs.size(); i++) {
    final JobStatus js=mTrackedJobs.get(i);
    if (js.shouldDump(filterUid)) {
      pw.println(String.valueOf(js.getJobId() + "String_Node_Str" + js.getUid()) + "String_Node_Str" + js.hasConnectivityConstraint()+ "String_Node_Str"+ js.hasUnmeteredConstraint()+ "String_Node_Str"+ js.hasNotRoamingConstraint());
    }
  }
}
Program: 191827
Project: 191827
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: 191828
Project: 191828
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: 191830
Project: 191830
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: 191831
Project: 191831
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: 191832
Project: 191832
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: 191833
Project: 191833
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: 191835
Project: 191835
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: 191836
Project: 191836
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: 191838
Project: 191838
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: 191839
Project: 191839
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: 191840
Project: 191840
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: 191841
Project: 191841
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: 191843
Project: 191843
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: 191844
Project: 191844
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: 191846
Project: 191846
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;
}