nus-yam/ex-repair huggingface dataset:
Program: 191692
Project: 191692
Buggy source:
void addTo(DataSet out,long now){
  out.mSummedTime+=getTotalTime(now);
  for (int i=mEntries.size() - 1; i >= 0; i--) {
    ArrayMap<String,PackageEntry> uidMap=mEntries.valueAt(i);
    for (int j=uidMap.size() - 1; j >= 0; j--) {
      PackageEntry pe=uidMap.valueAt(j);
      PackageEntry outPe=out.getOrCreateEntry(mEntries.keyAt(i),uidMap.keyAt(j));
      outPe.pastActiveTime+=pe.pastActiveTime;
      outPe.pastActiveTopTime+=pe.pastActiveTopTime;
      outPe.pastPendingTime+=pe.pastPendingTime;
      if (pe.activeCount > 0) {
        outPe.pastActiveTime+=now - pe.activeStartTime;
        outPe.hadActive=true;
      }
      if (pe.activeTopCount > 0) {
        outPe.pastActiveTopTime+=now - pe.activeTopStartTime;
        outPe.hadActiveTop=true;
      }
      if (pe.pendingCount > 0) {
        outPe.pastPendingTime+=now - pe.pendingStartTime;
        outPe.hadPending=true;
      }
    }
  }
}

Fixed version (ground truth):
void addTo(DataSet out,long now){
  out.mSummedTime+=getTotalTime(now);
  for (int i=mEntries.size() - 1; i >= 0; i--) {
    ArrayMap<String,PackageEntry> uidMap=mEntries.valueAt(i);
    for (int j=uidMap.size() - 1; j >= 0; j--) {
      PackageEntry pe=uidMap.valueAt(j);
      PackageEntry outPe=out.getOrCreateEntry(mEntries.keyAt(i),uidMap.keyAt(j));
      outPe.pastActiveTime+=pe.pastActiveTime;
      outPe.activeCount+=pe.activeCount;
      outPe.pastActiveTopTime+=pe.pastActiveTopTime;
      outPe.activeTopCount+=pe.activeTopCount;
      outPe.pastPendingTime+=pe.pastPendingTime;
      outPe.pendingCount+=pe.pendingCount;
      if (pe.activeNesting > 0) {
        outPe.pastActiveTime+=now - pe.activeStartTime;
        outPe.hadActive=true;
      }
      if (pe.activeTopNesting > 0) {
        outPe.pastActiveTopTime+=now - pe.activeTopStartTime;
        outPe.hadActiveTop=true;
      }
      if (pe.pendingNesting > 0) {
        outPe.pastPendingTime+=now - pe.pendingStartTime;
        outPe.hadPending=true;
      }
    }
  }
}
Program: 191693
Project: 191693
Buggy source:
public long getActiveTime(long now){
  long time=pastActiveTime;
  if (activeCount > 0) {
    time+=now - activeStartTime;
  }
  return time;
}

Fixed version (ground truth):
public long getActiveTime(long now){
  long time=pastActiveTime;
  if (activeNesting > 0) {
    time+=now - activeStartTime;
  }
  return time;
}
Program: 191694
Project: 191694
Buggy source:
void incPending(int uid,String pkg,long now){
  PackageEntry pe=getOrCreateEntry(uid,pkg);
  if (pe.pendingCount == 0) {
    pe.pendingStartTime=now;
  }
  pe.pendingCount++;
}

Fixed version (ground truth):
void incPending(int uid,String pkg,long now){
  PackageEntry pe=getOrCreateEntry(uid,pkg);
  if (pe.pendingNesting == 0) {
    pe.pendingStartTime=now;
    pe.pendingCount++;
  }
  pe.pendingNesting++;
}
Program: 191695
Project: 191695
Buggy source:
public long getPendingTime(long now){
  long time=pastPendingTime;
  if (pendingCount > 0) {
    time+=now - pendingStartTime;
  }
  return time;
}

Fixed version (ground truth):
public long getPendingTime(long now){
  long time=pastPendingTime;
  if (pendingNesting > 0) {
    time+=now - pendingStartTime;
  }
  return time;
}
Program: 191698
Project: 191698
Buggy source:
public boolean dumpHistory(PrintWriter pw,String prefix,int filterUid){
  if (mEventCmds[0] == EVENT_NULL) {
    return false;
  }
  pw.println("String_Node_Str");
  long now=SystemClock.elapsedRealtime();
  for (int i=EVENT_BUFFER_SIZE - 1; i >= 0; i--) {
    int uid=mEventUids[i];
    if (filterUid != -1 && filterUid != UserHandle.getAppId(filterUid)) {
      continue;
    }
    int cmd=mEventCmds[i];
    if (cmd == EVENT_NULL) {
      continue;
    }
    String label;
switch (mEventCmds[i]) {
case EVENT_START_JOB:
      label="String_Node_Str";
    break;
case EVENT_STOP_JOB:
  label="String_Node_Str";
break;
default :
label="String_Node_Str";
break;
}
pw.print(prefix);
TimeUtils.formatDuration(mEventTimes[i] - now,pw,TimeUtils.HUNDRED_DAY_FIELD_LEN);
pw.print("String_Node_Str");
pw.print(label);
pw.print("String_Node_Str");
UserHandle.formatUid(pw,uid);
pw.print("String_Node_Str");
pw.println(mEventTags[i]);
}
return true;
}

Fixed version (ground truth):
public boolean dumpHistory(PrintWriter pw,String prefix,int filterUid){
  final int size=mEventIndices.size();
  if (size <= 0) {
    return false;
  }
  pw.println("String_Node_Str");
  final long now=SystemClock.elapsedRealtime();
  for (int i=0; i < size; i++) {
    final int index=mEventIndices.indexOf(i);
    final int uid=mEventUids[index];
    if (filterUid != -1 && filterUid != UserHandle.getAppId(filterUid)) {
      continue;
    }
    final int cmd=mEventCmds[index];
    if (cmd == EVENT_NULL) {
      continue;
    }
    final String label;
switch (mEventCmds[index]) {
case EVENT_START_JOB:
      label="String_Node_Str";
    break;
case EVENT_STOP_JOB:
  label="String_Node_Str";
break;
default :
label="String_Node_Str";
break;
}
pw.print(prefix);
TimeUtils.formatDuration(mEventTimes[index] - now,pw,TimeUtils.HUNDRED_DAY_FIELD_LEN);
pw.print("String_Node_Str");
pw.print(label);
pw.print("String_Node_Str");
UserHandle.formatUid(pw,uid);
pw.print("String_Node_Str");
pw.println(mEventTags[index]);
}
return true;
}
Program: 191699
Project: 191699
Buggy source:
public long getActiveTopTime(long now){
  long time=pastActiveTopTime;
  if (activeTopCount > 0) {
    time+=now - activeTopStartTime;
  }
  return time;
}

Fixed version (ground truth):
public long getActiveTopTime(long now){
  long time=pastActiveTopTime;
  if (activeTopNesting > 0) {
    time+=now - activeTopStartTime;
  }
  return time;
}
Program: 191700
Project: 191700
Buggy source:
void decActive(int uid,String pkg,long now){
  PackageEntry pe=getOrCreateEntry(uid,pkg);
  if (pe.activeCount == 1) {
    pe.pastActiveTime+=now - pe.activeStartTime;
  }
  pe.activeCount--;
}

Fixed version (ground truth):
void decActive(int uid,String pkg,long now){
  PackageEntry pe=getOrCreateEntry(uid,pkg);
  if (pe.activeNesting == 1) {
    pe.pastActiveTime+=now - pe.activeStartTime;
  }
  pe.activeNesting--;
}
Program: 191701
Project: 191701
Buggy source:
void printDuration(PrintWriter pw,long period,long duration,String suffix){
  float fraction=duration / (float)period;
  int percent=(int)((fraction * 100) + .5f);
  if (percent > 0) {
    pw.print("String_Node_Str");
    pw.print(percent);
    pw.print("String_Node_Str");
    pw.print(suffix);
  }
}

Fixed version (ground truth):
void printDuration(PrintWriter pw,long period,long duration,int count,String suffix){
  float fraction=duration / (float)period;
  int percent=(int)((fraction * 100) + .5f);
  if (percent > 0) {
    pw.print("String_Node_Str");
    pw.print(percent);
    pw.print("String_Node_Str");
    pw.print(count);
    pw.print("String_Node_Str");
    pw.print(suffix);
  }
 else   if (count > 0) {
    pw.print("String_Node_Str");
    pw.print(count);
    pw.print("String_Node_Str");
    pw.print(suffix);
  }
}
Program: 191702
Project: 191702
Buggy source:
public void addEvent(int cmd,int uid,String tag){
  System.arraycopy(mEventCmds,0,mEventCmds,1,EVENT_BUFFER_SIZE - 1);
  System.arraycopy(mEventTimes,0,mEventTimes,1,EVENT_BUFFER_SIZE - 1);
  System.arraycopy(mEventUids,0,mEventUids,1,EVENT_BUFFER_SIZE - 1);
  System.arraycopy(mEventTags,0,mEventTags,1,EVENT_BUFFER_SIZE - 1);
  mEventCmds[0]=cmd;
  mEventTimes[0]=SystemClock.elapsedRealtime();
  mEventUids[0]=uid;
  mEventTags[0]=tag;
}

Fixed version (ground truth):
public void addEvent(int cmd,int uid,String tag){
  int index=mEventIndices.add();
  mEventCmds[index]=cmd;
  mEventTimes[index]=SystemClock.elapsedRealtime();
  mEventUids[index]=uid;
  mEventTags[index]=tag;
}
Program: 191703
Project: 191703
Buggy source:
void finish(DataSet next,long now){
  for (int i=mEntries.size() - 1; i >= 0; i--) {
    ArrayMap<String,PackageEntry> uidMap=mEntries.valueAt(i);
    for (int j=uidMap.size() - 1; j >= 0; j--) {
      PackageEntry pe=uidMap.valueAt(j);
      if (pe.activeCount > 0 || pe.activeTopCount > 0 || pe.pendingCount > 0) {
        PackageEntry nextPe=next.getOrCreateEntry(mEntries.keyAt(i),uidMap.keyAt(j));
        nextPe.activeStartTime=now;
        nextPe.activeCount=pe.activeCount;
        nextPe.activeTopStartTime=now;
        nextPe.activeTopCount=pe.activeTopCount;
        nextPe.pendingStartTime=now;
        nextPe.pendingCount=pe.pendingCount;
        if (pe.activeCount > 0) {
          pe.pastActiveTime+=now - pe.activeStartTime;
          pe.activeCount=0;
        }
        if (pe.activeTopCount > 0) {
          pe.pastActiveTopTime+=now - pe.activeTopStartTime;
          pe.activeTopCount=0;
        }
        if (pe.pendingCount > 0) {
          pe.pastPendingTime+=now - pe.pendingStartTime;
          pe.pendingCount=0;
        }
      }
    }
  }
}

Fixed version (ground truth):
void finish(DataSet next,long now){
  for (int i=mEntries.size() - 1; i >= 0; i--) {
    ArrayMap<String,PackageEntry> uidMap=mEntries.valueAt(i);
    for (int j=uidMap.size() - 1; j >= 0; j--) {
      PackageEntry pe=uidMap.valueAt(j);
      if (pe.activeNesting > 0 || pe.activeTopNesting > 0 || pe.pendingNesting > 0) {
        PackageEntry nextPe=next.getOrCreateEntry(mEntries.keyAt(i),uidMap.keyAt(j));
        nextPe.activeStartTime=now;
        nextPe.activeNesting=pe.activeNesting;
        nextPe.activeTopStartTime=now;
        nextPe.activeTopNesting=pe.activeTopNesting;
        nextPe.pendingStartTime=now;
        nextPe.pendingNesting=pe.pendingNesting;
        if (pe.activeNesting > 0) {
          pe.pastActiveTime+=now - pe.activeStartTime;
          pe.activeNesting=0;
        }
        if (pe.activeTopNesting > 0) {
          pe.pastActiveTopTime+=now - pe.activeTopStartTime;
          pe.activeTopNesting=0;
        }
        if (pe.pendingNesting > 0) {
          pe.pastPendingTime+=now - pe.pendingStartTime;
          pe.pendingNesting=0;
        }
      }
    }
  }
}
Program: 191704
Project: 191704
Buggy source:
void incActiveTop(int uid,String pkg,long now){
  PackageEntry pe=getOrCreateEntry(uid,pkg);
  if (pe.activeTopCount == 0) {
    pe.activeTopStartTime=now;
  }
  pe.activeTopCount++;
}

Fixed version (ground truth):
void incActiveTop(int uid,String pkg,long now){
  PackageEntry pe=getOrCreateEntry(uid,pkg);
  if (pe.activeTopNesting == 0) {
    pe.activeTopStartTime=now;
    pe.activeTopCount++;
  }
  pe.activeTopNesting++;
}
Program: 191705
Project: 191705
Buggy source:
void decActiveTop(int uid,String pkg,long now){
  PackageEntry pe=getOrCreateEntry(uid,pkg);
  if (pe.activeTopCount == 1) {
    pe.pastActiveTopTime+=now - pe.activeTopStartTime;
  }
  pe.activeTopCount--;
}

Fixed version (ground truth):
void decActiveTop(int uid,String pkg,long now){
  PackageEntry pe=getOrCreateEntry(uid,pkg);
  if (pe.activeTopNesting == 1) {
    pe.pastActiveTopTime+=now - pe.activeTopStartTime;
  }
  pe.activeTopNesting--;
}
Program: 191706
Project: 191706
Buggy source:
void incActive(int uid,String pkg,long now){
  PackageEntry pe=getOrCreateEntry(uid,pkg);
  if (pe.activeCount == 0) {
    pe.activeStartTime=now;
  }
  pe.activeCount++;
}

Fixed version (ground truth):
void incActive(int uid,String pkg,long now){
  PackageEntry pe=getOrCreateEntry(uid,pkg);
  if (pe.activeNesting == 0) {
    pe.activeStartTime=now;
    pe.activeCount++;
  }
  pe.activeNesting++;
}
Program: 191707
Project: 191707
Buggy source:
void decPending(int uid,String pkg,long now){
  PackageEntry pe=getOrCreateEntry(uid,pkg);
  if (pe.pendingCount == 1) {
    pe.pastPendingTime+=now - pe.pendingStartTime;
  }
  pe.pendingCount--;
}

Fixed version (ground truth):
void decPending(int uid,String pkg,long now){
  PackageEntry pe=getOrCreateEntry(uid,pkg);
  if (pe.pendingNesting == 1) {
    pe.pastPendingTime+=now - pe.pendingStartTime;
  }
  pe.pendingNesting--;
}
Program: 191708
Project: 191708
Buggy source:
void addTo(DataSet out,long now){
  out.mSummedTime+=getTotalTime(now);
  for (int i=mEntries.size() - 1; i >= 0; i--) {
    ArrayMap<String,PackageEntry> uidMap=mEntries.valueAt(i);
    for (int j=uidMap.size() - 1; j >= 0; j--) {
      PackageEntry pe=uidMap.valueAt(j);
      PackageEntry outPe=out.getOrCreateEntry(mEntries.keyAt(i),uidMap.keyAt(j));
      outPe.pastActiveTime+=pe.pastActiveTime;
      outPe.pastActiveTopTime+=pe.pastActiveTopTime;
      outPe.pastPendingTime+=pe.pastPendingTime;
      if (pe.activeCount > 0) {
        outPe.pastActiveTime+=now - pe.activeStartTime;
        outPe.hadActive=true;
      }
      if (pe.activeTopCount > 0) {
        outPe.pastActiveTopTime+=now - pe.activeTopStartTime;
        outPe.hadActiveTop=true;
      }
      if (pe.pendingCount > 0) {
        outPe.pastPendingTime+=now - pe.pendingStartTime;
        outPe.hadPending=true;
      }
    }
  }
}

Fixed version (ground truth):
void addTo(DataSet out,long now){
  out.mSummedTime+=getTotalTime(now);
  for (int i=mEntries.size() - 1; i >= 0; i--) {
    ArrayMap<String,PackageEntry> uidMap=mEntries.valueAt(i);
    for (int j=uidMap.size() - 1; j >= 0; j--) {
      PackageEntry pe=uidMap.valueAt(j);
      PackageEntry outPe=out.getOrCreateEntry(mEntries.keyAt(i),uidMap.keyAt(j));
      outPe.pastActiveTime+=pe.pastActiveTime;
      outPe.activeCount+=pe.activeCount;
      outPe.pastActiveTopTime+=pe.pastActiveTopTime;
      outPe.activeTopCount+=pe.activeTopCount;
      outPe.pastPendingTime+=pe.pastPendingTime;
      outPe.pendingCount+=pe.pendingCount;
      if (pe.activeNesting > 0) {
        outPe.pastActiveTime+=now - pe.activeStartTime;
        outPe.hadActive=true;
      }
      if (pe.activeTopNesting > 0) {
        outPe.pastActiveTopTime+=now - pe.activeTopStartTime;
        outPe.hadActiveTop=true;
      }
      if (pe.pendingNesting > 0) {
        outPe.pastPendingTime+=now - pe.pendingStartTime;
        outPe.hadPending=true;
      }
    }
  }
}
Program: 191709
Project: 191709
Buggy source:
public long getActiveTime(long now){
  long time=pastActiveTime;
  if (activeCount > 0) {
    time+=now - activeStartTime;
  }
  return time;
}

Fixed version (ground truth):
public long getActiveTime(long now){
  long time=pastActiveTime;
  if (activeNesting > 0) {
    time+=now - activeStartTime;
  }
  return time;
}
Program: 191710
Project: 191710
Buggy source:
void incPending(int uid,String pkg,long now){
  PackageEntry pe=getOrCreateEntry(uid,pkg);
  if (pe.pendingCount == 0) {
    pe.pendingStartTime=now;
  }
  pe.pendingCount++;
}

Fixed version (ground truth):
void incPending(int uid,String pkg,long now){
  PackageEntry pe=getOrCreateEntry(uid,pkg);
  if (pe.pendingNesting == 0) {
    pe.pendingStartTime=now;
    pe.pendingCount++;
  }
  pe.pendingNesting++;
}
Program: 191711
Project: 191711
Buggy source:
public long getPendingTime(long now){
  long time=pastPendingTime;
  if (pendingCount > 0) {
    time+=now - pendingStartTime;
  }
  return time;
}

Fixed version (ground truth):
public long getPendingTime(long now){
  long time=pastPendingTime;
  if (pendingNesting > 0) {
    time+=now - pendingStartTime;
  }
  return time;
}
Program: 191713
Project: 191713
Buggy source:
public void onEntryUpdated(NotificationData.Entry entry,StatusBarNotification oldNotification){
  if (mGroupMap.get(getGroupKey(oldNotification)) != null) {
    onEntryRemovedInternal(entry,oldNotification);
  }
  onEntryAdded(entry);
  if (isIsolated(entry.notification)) {
    mIsolatedEntries.put(entry.key,entry.notification);
    String oldKey=oldNotification.getGroupKey();
    String newKey=entry.notification.getGroupKey();
    if (!oldKey.equals(newKey)) {
      updateSuppression(mGroupMap.get(oldKey));
      updateSuppression(mGroupMap.get(newKey));
    }
  }
}

Fixed version (ground truth):
public void onEntryUpdated(NotificationData.Entry entry,StatusBarNotification oldNotification){
  if (mGroupMap.get(getGroupKey(oldNotification)) != null) {
    onEntryRemovedInternal(entry,oldNotification);
  }
  onEntryAdded(entry);
  if (isIsolated(entry.notification)) {
    mIsolatedEntries.put(entry.key,entry.notification);
    String oldKey=oldNotification.getGroupKey();
    String newKey=entry.notification.getGroupKey();
    if (!oldKey.equals(newKey)) {
      updateSuppression(mGroupMap.get(oldKey));
      updateSuppression(mGroupMap.get(newKey));
    }
  }
 else   if (!isGroupChild(oldNotification) && isGroupChild(entry.notification)) {
    onEntryBecomingChild(entry);
  }
}
Program: 191714
Project: 191714
Buggy source:
public void onEntryAdded(final NotificationData.Entry added){
  final StatusBarNotification sbn=added.notification;
  boolean isGroupChild=isGroupChild(sbn);
  String groupKey=getGroupKey(sbn);
  NotificationGroup group=mGroupMap.get(groupKey);
  if (group == null) {
    group=new NotificationGroup();
    mGroupMap.put(groupKey,group);
  }
  if (isGroupChild) {
    group.children.add(added);
    updateSuppression(group);
  }
 else {
    group.summary=added;
    group.expanded=added.row.areChildrenExpanded();
    updateSuppression(group);
    if (!group.children.isEmpty()) {
      mListener.onGroupCreatedFromChildren(group);
    }
  }
}

Fixed version (ground truth):
public void onEntryAdded(final NotificationData.Entry added){
  final StatusBarNotification sbn=added.notification;
  boolean isGroupChild=isGroupChild(sbn);
  String groupKey=getGroupKey(sbn);
  NotificationGroup group=mGroupMap.get(groupKey);
  if (group == null) {
    group=new NotificationGroup();
    mGroupMap.put(groupKey,group);
  }
  if (isGroupChild) {
    group.children.add(added);
    updateSuppression(group);
  }
 else {
    group.summary=added;
    group.expanded=added.row.areChildrenExpanded();
    updateSuppression(group);
    if (!group.children.isEmpty()) {
      HashSet<NotificationData.Entry> childrenCopy=(HashSet<NotificationData.Entry>)group.children.clone();
      for (      NotificationData.Entry child : childrenCopy) {
        onEntryBecomingChild(child);
      }
      mListener.onGroupCreatedFromChildren(group);
    }
  }
}
Program: 191715
Project: 191715
Buggy source:
private void updateHideSensitiveForChild(View child){
  if (mAmbientState.isHideSensitive() && child instanceof ExpandableView) {
    ExpandableView expandableView=(ExpandableView)child;
    expandableView.setHideSensitiveForIntrinsicHeight(true);
  }
}

Fixed version (ground truth):
private void updateHideSensitiveForChild(View child){
  if (child instanceof ExpandableView) {
    ExpandableView expandableView=(ExpandableView)child;
    expandableView.setHideSensitiveForIntrinsicHeight(mAmbientState.isHideSensitive());
  }
}
Program: 191716
Project: 191716
Buggy source:
@Override public void toggleRecents(int growTarget) throws RemoteException {
  mHandler.sendMessage(mHandler.obtainMessage(MSG_TOGGLE_RECENTS,growTarget));
}

Fixed version (ground truth):
@Override public void toggleRecents(int growTarget) throws RemoteException {
  SomeArgs args=SomeArgs.obtain();
  args.argi1=growTarget;
  mHandler.sendMessage(mHandler.obtainMessage(MSG_TOGGLE_RECENTS,args));
}
Program: 191717
Project: 191717
Buggy source:
@Override public void handleMessage(Message msg){
switch (msg.what) {
case MSG_PRELOAD_RECENTS:
    mImpl.preloadRecents();
  break;
case MSG_CANCEL_PRELOADING_RECENTS:
mImpl.cancelPreloadingRecents();
break;
case MSG_SHOW_RECENTS:
SomeArgs args=(SomeArgs)msg.obj;
mImpl.showRecents(args.argi1 != 0,args.argi2 != 0,args.argi3 != 0,args.argi4 != 0,args.argi5 != 0,args.argi6);
break;
case MSG_HIDE_RECENTS:
mImpl.hideRecents(msg.arg1 != 0,msg.arg2 != 0);
break;
case MSG_TOGGLE_RECENTS:
mImpl.toggleRecents(msg.arg1);
break;
case MSG_ON_CONFIGURATION_CHANGED:
mImpl.onConfigurationChanged();
break;
case MSG_DOCK_TOP_TASK:
args=(SomeArgs)msg.obj;
mImpl.dockTopTask(args.argi1,args.argi2,args.argi3=0,(Rect)args.arg1);
break;
case MSG_ON_DRAGGING_IN_RECENTS:
mImpl.onDraggingInRecents((Float)msg.obj);
break;
case MSG_ON_DRAGGING_IN_RECENTS_ENDED:
mImpl.onDraggingInRecentsEnded((Float)msg.obj);
break;
default :
super.handleMessage(msg);
}
super.handleMessage(msg);
}

Fixed version (ground truth):
@Override public void handleMessage(Message msg){
  SomeArgs args;
switch (msg.what) {
case MSG_PRELOAD_RECENTS:
    mImpl.preloadRecents();
  break;
case MSG_CANCEL_PRELOADING_RECENTS:
mImpl.cancelPreloadingRecents();
break;
case MSG_SHOW_RECENTS:
args=(SomeArgs)msg.obj;
mImpl.showRecents(args.argi1 != 0,args.argi2 != 0,args.argi3 != 0,args.argi4 != 0,args.argi5 != 0,args.argi6);
break;
case MSG_HIDE_RECENTS:
mImpl.hideRecents(msg.arg1 != 0,msg.arg2 != 0);
break;
case MSG_TOGGLE_RECENTS:
args=(SomeArgs)msg.obj;
mImpl.toggleRecents(args.argi1);
break;
case MSG_ON_CONFIGURATION_CHANGED:
mImpl.onConfigurationChanged();
break;
case MSG_DOCK_TOP_TASK:
args=(SomeArgs)msg.obj;
mImpl.dockTopTask(args.argi1,args.argi2,args.argi3=0,(Rect)args.arg1);
break;
case MSG_ON_DRAGGING_IN_RECENTS:
mImpl.onDraggingInRecents((Float)msg.obj);
break;
case MSG_ON_DRAGGING_IN_RECENTS_ENDED:
mImpl.onDraggingInRecentsEnded((Float)msg.obj);
break;
default :
super.handleMessage(msg);
}
super.handleMessage(msg);
}
Program: 191718
Project: 191718
Buggy source:
public boolean dumpHistory(PrintWriter pw,String prefix,int filterUid){
  if (mEventCmds[0] == EVENT_NULL) {
    return false;
  }
  pw.println("String_Node_Str");
  long now=SystemClock.elapsedRealtime();
  for (int i=EVENT_BUFFER_SIZE - 1; i >= 0; i--) {
    int uid=mEventUids[i];
    if (filterUid != -1 && filterUid != UserHandle.getAppId(filterUid)) {
      continue;
    }
    int cmd=mEventCmds[i];
    if (cmd == EVENT_NULL) {
      continue;
    }
    String label;
switch (mEventCmds[i]) {
case EVENT_START_JOB:
      label="String_Node_Str";
    break;
case EVENT_STOP_JOB:
  label="String_Node_Str";
break;
default :
label="String_Node_Str";
break;
}
pw.print(prefix);
TimeUtils.formatDuration(mEventTimes[i] - now,pw,TimeUtils.HUNDRED_DAY_FIELD_LEN);
pw.print("String_Node_Str");
pw.print(label);
pw.print("String_Node_Str");
UserHandle.formatUid(pw,uid);
pw.print("String_Node_Str");
pw.println(mEventTags[i]);
}
return true;
}

Fixed version (ground truth):
public boolean dumpHistory(PrintWriter pw,String prefix,int filterUid){
  final int size=mEventIndices.size();
  if (size <= 0) {
    return false;
  }
  pw.println("String_Node_Str");
  final long now=SystemClock.elapsedRealtime();
  for (int i=0; i < size; i++) {
    final int index=mEventIndices.indexOf(i);
    final int uid=mEventUids[index];
    if (filterUid != -1 && filterUid != UserHandle.getAppId(filterUid)) {
      continue;
    }
    final int cmd=mEventCmds[index];
    if (cmd == EVENT_NULL) {
      continue;
    }
    final String label;
switch (mEventCmds[index]) {
case EVENT_START_JOB:
      label="String_Node_Str";
    break;
case EVENT_STOP_JOB:
  label="String_Node_Str";
break;
default :
label="String_Node_Str";
break;
}
pw.print(prefix);
TimeUtils.formatDuration(mEventTimes[index] - now,pw,TimeUtils.HUNDRED_DAY_FIELD_LEN);
pw.print("String_Node_Str");
pw.print(label);
pw.print("String_Node_Str");
UserHandle.formatUid(pw,uid);
pw.print("String_Node_Str");
pw.println(mEventTags[index]);
}
return true;
}
Program: 191719
Project: 191719
Buggy source:
public long getActiveTopTime(long now){
  long time=pastActiveTopTime;
  if (activeTopCount > 0) {
    time+=now - activeTopStartTime;
  }
  return time;
}

Fixed version (ground truth):
public long getActiveTopTime(long now){
  long time=pastActiveTopTime;
  if (activeTopNesting > 0) {
    time+=now - activeTopStartTime;
  }
  return time;
}
Program: 191720
Project: 191720
Buggy source:
void decActive(int uid,String pkg,long now){
  PackageEntry pe=getOrCreateEntry(uid,pkg);
  if (pe.activeCount == 1) {
    pe.pastActiveTime+=now - pe.activeStartTime;
  }
  pe.activeCount--;
}

Fixed version (ground truth):
void decActive(int uid,String pkg,long now){
  PackageEntry pe=getOrCreateEntry(uid,pkg);
  if (pe.activeNesting == 1) {
    pe.pastActiveTime+=now - pe.activeStartTime;
  }
  pe.activeNesting--;
}
Program: 191721
Project: 191721
Buggy source:
void printDuration(PrintWriter pw,long period,long duration,String suffix){
  float fraction=duration / (float)period;
  int percent=(int)((fraction * 100) + .5f);
  if (percent > 0) {
    pw.print("String_Node_Str");
    pw.print(percent);
    pw.print("String_Node_Str");
    pw.print(suffix);
  }
}

Fixed version (ground truth):
void printDuration(PrintWriter pw,long period,long duration,int count,String suffix){
  float fraction=duration / (float)period;
  int percent=(int)((fraction * 100) + .5f);
  if (percent > 0) {
    pw.print("String_Node_Str");
    pw.print(percent);
    pw.print("String_Node_Str");
    pw.print(count);
    pw.print("String_Node_Str");
    pw.print(suffix);
  }
 else   if (count > 0) {
    pw.print("String_Node_Str");
    pw.print(count);
    pw.print("String_Node_Str");
    pw.print(suffix);
  }
}
Program: 191722
Project: 191722
Buggy source:
public void addEvent(int cmd,int uid,String tag){
  System.arraycopy(mEventCmds,0,mEventCmds,1,EVENT_BUFFER_SIZE - 1);
  System.arraycopy(mEventTimes,0,mEventTimes,1,EVENT_BUFFER_SIZE - 1);
  System.arraycopy(mEventUids,0,mEventUids,1,EVENT_BUFFER_SIZE - 1);
  System.arraycopy(mEventTags,0,mEventTags,1,EVENT_BUFFER_SIZE - 1);
  mEventCmds[0]=cmd;
  mEventTimes[0]=SystemClock.elapsedRealtime();
  mEventUids[0]=uid;
  mEventTags[0]=tag;
}

Fixed version (ground truth):
public void addEvent(int cmd,int uid,String tag){
  int index=mEventIndices.add();
  mEventCmds[index]=cmd;
  mEventTimes[index]=SystemClock.elapsedRealtime();
  mEventUids[index]=uid;
  mEventTags[index]=tag;
}
Program: 191723
Project: 191723
Buggy source:
void finish(DataSet next,long now){
  for (int i=mEntries.size() - 1; i >= 0; i--) {
    ArrayMap<String,PackageEntry> uidMap=mEntries.valueAt(i);
    for (int j=uidMap.size() - 1; j >= 0; j--) {
      PackageEntry pe=uidMap.valueAt(j);
      if (pe.activeCount > 0 || pe.activeTopCount > 0 || pe.pendingCount > 0) {
        PackageEntry nextPe=next.getOrCreateEntry(mEntries.keyAt(i),uidMap.keyAt(j));
        nextPe.activeStartTime=now;
        nextPe.activeCount=pe.activeCount;
        nextPe.activeTopStartTime=now;
        nextPe.activeTopCount=pe.activeTopCount;
        nextPe.pendingStartTime=now;
        nextPe.pendingCount=pe.pendingCount;
        if (pe.activeCount > 0) {
          pe.pastActiveTime+=now - pe.activeStartTime;
          pe.activeCount=0;
        }
        if (pe.activeTopCount > 0) {
          pe.pastActiveTopTime+=now - pe.activeTopStartTime;
          pe.activeTopCount=0;
        }
        if (pe.pendingCount > 0) {
          pe.pastPendingTime+=now - pe.pendingStartTime;
          pe.pendingCount=0;
        }
      }
    }
  }
}

Fixed version (ground truth):
void finish(DataSet next,long now){
  for (int i=mEntries.size() - 1; i >= 0; i--) {
    ArrayMap<String,PackageEntry> uidMap=mEntries.valueAt(i);
    for (int j=uidMap.size() - 1; j >= 0; j--) {
      PackageEntry pe=uidMap.valueAt(j);
      if (pe.activeNesting > 0 || pe.activeTopNesting > 0 || pe.pendingNesting > 0) {
        PackageEntry nextPe=next.getOrCreateEntry(mEntries.keyAt(i),uidMap.keyAt(j));
        nextPe.activeStartTime=now;
        nextPe.activeNesting=pe.activeNesting;
        nextPe.activeTopStartTime=now;
        nextPe.activeTopNesting=pe.activeTopNesting;
        nextPe.pendingStartTime=now;
        nextPe.pendingNesting=pe.pendingNesting;
        if (pe.activeNesting > 0) {
          pe.pastActiveTime+=now - pe.activeStartTime;
          pe.activeNesting=0;
        }
        if (pe.activeTopNesting > 0) {
          pe.pastActiveTopTime+=now - pe.activeTopStartTime;
          pe.activeTopNesting=0;
        }
        if (pe.pendingNesting > 0) {
          pe.pastPendingTime+=now - pe.pendingStartTime;
          pe.pendingNesting=0;
        }
      }
    }
  }
}
Program: 191724
Project: 191724
Buggy source:
void incActiveTop(int uid,String pkg,long now){
  PackageEntry pe=getOrCreateEntry(uid,pkg);
  if (pe.activeTopCount == 0) {
    pe.activeTopStartTime=now;
  }
  pe.activeTopCount++;
}

Fixed version (ground truth):
void incActiveTop(int uid,String pkg,long now){
  PackageEntry pe=getOrCreateEntry(uid,pkg);
  if (pe.activeTopNesting == 0) {
    pe.activeTopStartTime=now;
    pe.activeTopCount++;
  }
  pe.activeTopNesting++;
}
Program: 191725
Project: 191725
Buggy source:
void decActiveTop(int uid,String pkg,long now){
  PackageEntry pe=getOrCreateEntry(uid,pkg);
  if (pe.activeTopCount == 1) {
    pe.pastActiveTopTime+=now - pe.activeTopStartTime;
  }
  pe.activeTopCount--;
}

Fixed version (ground truth):
void decActiveTop(int uid,String pkg,long now){
  PackageEntry pe=getOrCreateEntry(uid,pkg);
  if (pe.activeTopNesting == 1) {
    pe.pastActiveTopTime+=now - pe.activeTopStartTime;
  }
  pe.activeTopNesting--;
}
Program: 191726
Project: 191726
Buggy source:
void incActive(int uid,String pkg,long now){
  PackageEntry pe=getOrCreateEntry(uid,pkg);
  if (pe.activeCount == 0) {
    pe.activeStartTime=now;
  }
  pe.activeCount++;
}

Fixed version (ground truth):
void incActive(int uid,String pkg,long now){
  PackageEntry pe=getOrCreateEntry(uid,pkg);
  if (pe.activeNesting == 0) {
    pe.activeStartTime=now;
    pe.activeCount++;
  }
  pe.activeNesting++;
}
Program: 191727
Project: 191727
Buggy source:
void decPending(int uid,String pkg,long now){
  PackageEntry pe=getOrCreateEntry(uid,pkg);
  if (pe.pendingCount == 1) {
    pe.pastPendingTime+=now - pe.pendingStartTime;
  }
  pe.pendingCount--;
}

Fixed version (ground truth):
void decPending(int uid,String pkg,long now){
  PackageEntry pe=getOrCreateEntry(uid,pkg);
  if (pe.pendingNesting == 1) {
    pe.pastPendingTime+=now - pe.pendingStartTime;
  }
  pe.pendingNesting--;
}
Program: 191728
Project: 191728
Buggy source:
void addTo(DataSet out,long now){
  out.mSummedTime+=getTotalTime(now);
  for (int i=mEntries.size() - 1; i >= 0; i--) {
    ArrayMap<String,PackageEntry> uidMap=mEntries.valueAt(i);
    for (int j=uidMap.size() - 1; j >= 0; j--) {
      PackageEntry pe=uidMap.valueAt(j);
      PackageEntry outPe=out.getOrCreateEntry(mEntries.keyAt(i),uidMap.keyAt(j));
      outPe.pastActiveTime+=pe.pastActiveTime;
      outPe.pastActiveTopTime+=pe.pastActiveTopTime;
      outPe.pastPendingTime+=pe.pastPendingTime;
      if (pe.activeCount > 0) {
        outPe.pastActiveTime+=now - pe.activeStartTime;
        outPe.hadActive=true;
      }
      if (pe.activeTopCount > 0) {
        outPe.pastActiveTopTime+=now - pe.activeTopStartTime;
        outPe.hadActiveTop=true;
      }
      if (pe.pendingCount > 0) {
        outPe.pastPendingTime+=now - pe.pendingStartTime;
        outPe.hadPending=true;
      }
    }
  }
}

Fixed version (ground truth):
void addTo(DataSet out,long now){
  out.mSummedTime+=getTotalTime(now);
  for (int i=mEntries.size() - 1; i >= 0; i--) {
    ArrayMap<String,PackageEntry> uidMap=mEntries.valueAt(i);
    for (int j=uidMap.size() - 1; j >= 0; j--) {
      PackageEntry pe=uidMap.valueAt(j);
      PackageEntry outPe=out.getOrCreateEntry(mEntries.keyAt(i),uidMap.keyAt(j));
      outPe.pastActiveTime+=pe.pastActiveTime;
      outPe.activeCount+=pe.activeCount;
      outPe.pastActiveTopTime+=pe.pastActiveTopTime;
      outPe.activeTopCount+=pe.activeTopCount;
      outPe.pastPendingTime+=pe.pastPendingTime;
      outPe.pendingCount+=pe.pendingCount;
      if (pe.activeNesting > 0) {
        outPe.pastActiveTime+=now - pe.activeStartTime;
        outPe.hadActive=true;
      }
      if (pe.activeTopNesting > 0) {
        outPe.pastActiveTopTime+=now - pe.activeTopStartTime;
        outPe.hadActiveTop=true;
      }
      if (pe.pendingNesting > 0) {
        outPe.pastPendingTime+=now - pe.pendingStartTime;
        outPe.hadPending=true;
      }
    }
  }
}
Program: 191729
Project: 191729
Buggy source:
public long getActiveTime(long now){
  long time=pastActiveTime;
  if (activeCount > 0) {
    time+=now - activeStartTime;
  }
  return time;
}

Fixed version (ground truth):
public long getActiveTime(long now){
  long time=pastActiveTime;
  if (activeNesting > 0) {
    time+=now - activeStartTime;
  }
  return time;
}
Program: 191730
Project: 191730
Buggy source:
void incPending(int uid,String pkg,long now){
  PackageEntry pe=getOrCreateEntry(uid,pkg);
  if (pe.pendingCount == 0) {
    pe.pendingStartTime=now;
  }
  pe.pendingCount++;
}

Fixed version (ground truth):
void incPending(int uid,String pkg,long now){
  PackageEntry pe=getOrCreateEntry(uid,pkg);
  if (pe.pendingNesting == 0) {
    pe.pendingStartTime=now;
    pe.pendingCount++;
  }
  pe.pendingNesting++;
}
Program: 191731
Project: 191731
Buggy source:
public long getPendingTime(long now){
  long time=pastPendingTime;
  if (pendingCount > 0) {
    time+=now - pendingStartTime;
  }
  return time;
}

Fixed version (ground truth):
public long getPendingTime(long now){
  long time=pastPendingTime;
  if (pendingNesting > 0) {
    time+=now - pendingStartTime;
  }
  return time;
}
Program: 191732
Project: 191732
Buggy source:
@Override public void toggleRecents(int growTarget) throws RemoteException {
  mHandler.sendMessage(mHandler.obtainMessage(MSG_TOGGLE_RECENTS,growTarget));
}

Fixed version (ground truth):
@Override public void toggleRecents(int growTarget) throws RemoteException {
  SomeArgs args=SomeArgs.obtain();
  args.argi1=growTarget;
  mHandler.sendMessage(mHandler.obtainMessage(MSG_TOGGLE_RECENTS,args));
}
Program: 191733
Project: 191733
Buggy source:
@Override public void handleMessage(Message msg){
switch (msg.what) {
case MSG_PRELOAD_RECENTS:
    mImpl.preloadRecents();
  break;
case MSG_CANCEL_PRELOADING_RECENTS:
mImpl.cancelPreloadingRecents();
break;
case MSG_SHOW_RECENTS:
SomeArgs args=(SomeArgs)msg.obj;
mImpl.showRecents(args.argi1 != 0,args.argi2 != 0,args.argi3 != 0,args.argi4 != 0,args.argi5 != 0,args.argi6);
break;
case MSG_HIDE_RECENTS:
mImpl.hideRecents(msg.arg1 != 0,msg.arg2 != 0);
break;
case MSG_TOGGLE_RECENTS:
mImpl.toggleRecents(msg.arg1);
break;
case MSG_ON_CONFIGURATION_CHANGED:
mImpl.onConfigurationChanged();
break;
case MSG_DOCK_TOP_TASK:
args=(SomeArgs)msg.obj;
mImpl.dockTopTask(args.argi1,args.argi2,args.argi3=0,(Rect)args.arg1);
break;
case MSG_ON_DRAGGING_IN_RECENTS:
mImpl.onDraggingInRecents((Float)msg.obj);
break;
case MSG_ON_DRAGGING_IN_RECENTS_ENDED:
mImpl.onDraggingInRecentsEnded((Float)msg.obj);
break;
default :
super.handleMessage(msg);
}
super.handleMessage(msg);
}

Fixed version (ground truth):
@Override public void handleMessage(Message msg){
  SomeArgs args;
switch (msg.what) {
case MSG_PRELOAD_RECENTS:
    mImpl.preloadRecents();
  break;
case MSG_CANCEL_PRELOADING_RECENTS:
mImpl.cancelPreloadingRecents();
break;
case MSG_SHOW_RECENTS:
args=(SomeArgs)msg.obj;
mImpl.showRecents(args.argi1 != 0,args.argi2 != 0,args.argi3 != 0,args.argi4 != 0,args.argi5 != 0,args.argi6);
break;
case MSG_HIDE_RECENTS:
mImpl.hideRecents(msg.arg1 != 0,msg.arg2 != 0);
break;
case MSG_TOGGLE_RECENTS:
args=(SomeArgs)msg.obj;
mImpl.toggleRecents(args.argi1);
break;
case MSG_ON_CONFIGURATION_CHANGED:
mImpl.onConfigurationChanged();
break;
case MSG_DOCK_TOP_TASK:
args=(SomeArgs)msg.obj;
mImpl.dockTopTask(args.argi1,args.argi2,args.argi3=0,(Rect)args.arg1);
break;
case MSG_ON_DRAGGING_IN_RECENTS:
mImpl.onDraggingInRecents((Float)msg.obj);
break;
case MSG_ON_DRAGGING_IN_RECENTS_ENDED:
mImpl.onDraggingInRecentsEnded((Float)msg.obj);
break;
default :
super.handleMessage(msg);
}
super.handleMessage(msg);
}
Program: 191734
Project: 191734
Buggy source:
@Override public void onAnimationEnd(Animator animation){
  if (mOnAnimationFinished != null) {
    mOnAnimationFinished.run();
    mOnAnimationFinished=null;
    mKeyguardFadingOutInProgress=false;
  }
  scrim.setTag(TAG_KEY_ANIM,null);
  scrim.setTag(TAG_KEY_ANIM_TARGET,null);
}

Fixed version (ground truth):
@Override public void onAnimationEnd(Animator animation){
  if (mOnAnimationFinished != null) {
    mOnAnimationFinished.run();
    mOnAnimationFinished=null;
  }
  mKeyguardFadingOutInProgress=false;
  scrim.setTag(TAG_KEY_ANIM,null);
  scrim.setTag(TAG_KEY_ANIM_TARGET,null);
}
Program: 191735
Project: 191735
Buggy source:
private void startScrimAnimation(final View scrim,float target){
  float current=getCurrentScrimAlpha(scrim);
  ValueAnimator anim=ValueAnimator.ofFloat(current,target);
  anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener(){
    @Override public void onAnimationUpdate(    ValueAnimator animation){
      float alpha=(float)animation.getAnimatedValue();
      setCurrentScrimAlpha(scrim,alpha);
      updateScrimColor(scrim);
    }
  }
);
  anim.setInterpolator(getInterpolator());
  anim.setStartDelay(mAnimationDelay);
  anim.setDuration(mDurationOverride != -1 ? mDurationOverride : ANIMATION_DURATION);
  anim.addListener(new AnimatorListenerAdapter(){
    @Override public void onAnimationEnd(    Animator animation){
      if (mOnAnimationFinished != null) {
        mOnAnimationFinished.run();
        mOnAnimationFinished=null;
        mKeyguardFadingOutInProgress=false;
      }
      scrim.setTag(TAG_KEY_ANIM,null);
      scrim.setTag(TAG_KEY_ANIM_TARGET,null);
    }
  }
);
  anim.start();
  if (mAnimateKeyguardFadingOut) {
    mKeyguardFadingOutInProgress=true;
  }
  if (mSkipFirstFrame) {
    anim.setCurrentPlayTime(16);
  }
  scrim.setTag(TAG_KEY_ANIM,anim);
  scrim.setTag(TAG_KEY_ANIM_TARGET,target);
}

Fixed version (ground truth):
private void startScrimAnimation(final View scrim,float target){
  float current=getCurrentScrimAlpha(scrim);
  ValueAnimator anim=ValueAnimator.ofFloat(current,target);
  anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener(){
    @Override public void onAnimationUpdate(    ValueAnimator animation){
      float alpha=(float)animation.getAnimatedValue();
      setCurrentScrimAlpha(scrim,alpha);
      updateScrimColor(scrim);
    }
  }
);
  anim.setInterpolator(getInterpolator());
  anim.setStartDelay(mAnimationDelay);
  anim.setDuration(mDurationOverride != -1 ? mDurationOverride : ANIMATION_DURATION);
  anim.addListener(new AnimatorListenerAdapter(){
    @Override public void onAnimationEnd(    Animator animation){
      if (mOnAnimationFinished != null) {
        mOnAnimationFinished.run();
        mOnAnimationFinished=null;
      }
      mKeyguardFadingOutInProgress=false;
      scrim.setTag(TAG_KEY_ANIM,null);
      scrim.setTag(TAG_KEY_ANIM_TARGET,null);
    }
  }
);
  anim.start();
  if (mAnimateKeyguardFadingOut) {
    mKeyguardFadingOutInProgress=true;
  }
  if (mSkipFirstFrame) {
    anim.setCurrentPlayTime(16);
  }
  scrim.setTag(TAG_KEY_ANIM,anim);
  scrim.setTag(TAG_KEY_ANIM_TARGET,target);
}
Program: 191736
Project: 191736
Buggy source:
private void endAnimateKeyguardFadingOut(boolean force){
  mAnimateKeyguardFadingOut=false;
  if ((force || (!isAnimating(mScrimInFront) && !isAnimating(mScrimBehind))) && mOnAnimationFinished != null) {
    mOnAnimationFinished.run();
    mOnAnimationFinished=null;
    mKeyguardFadingOutInProgress=false;
  }
}

Fixed version (ground truth):
private void endAnimateKeyguardFadingOut(boolean force){
  mAnimateKeyguardFadingOut=false;
  if (force || (!isAnimating(mScrimInFront) && !isAnimating(mScrimBehind))) {
    if (mOnAnimationFinished != null) {
      mOnAnimationFinished.run();
      mOnAnimationFinished=null;
    }
    mKeyguardFadingOutInProgress=false;
  }
}
Program: 191737
Project: 191737
Buggy source:
@Override public void onAnimationEnd(Animator animation){
  if (mOnAnimationFinished != null) {
    mOnAnimationFinished.run();
    mOnAnimationFinished=null;
  }
  mKeyguardFadingOutInProgress=false;
  scrim.setTag(TAG_KEY_ANIM,null);
  scrim.setTag(TAG_KEY_ANIM_TARGET,null);
}

Fixed version (ground truth):
@Override public void onAnimationEnd(Animator animation){
  if (mOnAnimationFinished != null) {
    mOnAnimationFinished.run();
    mOnAnimationFinished=null;
  }
  if (mKeyguardFadingOutInProgress) {
    mKeyguardFadeoutAnimation=null;
    mKeyguardFadingOutInProgress=false;
  }
  scrim.setTag(TAG_KEY_ANIM,null);
  scrim.setTag(TAG_KEY_ANIM_TARGET,null);
}
Program: 191738
Project: 191738
Buggy source:
private void startScrimAnimation(final View scrim,float target){
  float current=getCurrentScrimAlpha(scrim);
  ValueAnimator anim=ValueAnimator.ofFloat(current,target);
  anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener(){
    @Override public void onAnimationUpdate(    ValueAnimator animation){
      float alpha=(float)animation.getAnimatedValue();
      setCurrentScrimAlpha(scrim,alpha);
      updateScrimColor(scrim);
    }
  }
);
  anim.setInterpolator(getInterpolator());
  anim.setStartDelay(mAnimationDelay);
  anim.setDuration(mDurationOverride != -1 ? mDurationOverride : ANIMATION_DURATION);
  anim.addListener(new AnimatorListenerAdapter(){
    @Override public void onAnimationEnd(    Animator animation){
      if (mOnAnimationFinished != null) {
        mOnAnimationFinished.run();
        mOnAnimationFinished=null;
      }
      mKeyguardFadingOutInProgress=false;
      scrim.setTag(TAG_KEY_ANIM,null);
      scrim.setTag(TAG_KEY_ANIM_TARGET,null);
    }
  }
);
  anim.start();
  if (mAnimateKeyguardFadingOut) {
    mKeyguardFadingOutInProgress=true;
  }
  if (mSkipFirstFrame) {
    anim.setCurrentPlayTime(16);
  }
  scrim.setTag(TAG_KEY_ANIM,anim);
  scrim.setTag(TAG_KEY_ANIM_TARGET,target);
}

Fixed version (ground truth):
private void startScrimAnimation(final View scrim,float target){
  float current=getCurrentScrimAlpha(scrim);
  ValueAnimator anim=ValueAnimator.ofFloat(current,target);
  anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener(){
    @Override public void onAnimationUpdate(    ValueAnimator animation){
      float alpha=(float)animation.getAnimatedValue();
      setCurrentScrimAlpha(scrim,alpha);
      updateScrimColor(scrim);
    }
  }
);
  anim.setInterpolator(getInterpolator());
  anim.setStartDelay(mAnimationDelay);
  anim.setDuration(mDurationOverride != -1 ? mDurationOverride : ANIMATION_DURATION);
  anim.addListener(new AnimatorListenerAdapter(){
    @Override public void onAnimationEnd(    Animator animation){
      if (mOnAnimationFinished != null) {
        mOnAnimationFinished.run();
        mOnAnimationFinished=null;
      }
      if (mKeyguardFadingOutInProgress) {
        mKeyguardFadeoutAnimation=null;
        mKeyguardFadingOutInProgress=false;
      }
      scrim.setTag(TAG_KEY_ANIM,null);
      scrim.setTag(TAG_KEY_ANIM_TARGET,null);
    }
  }
);
  anim.start();
  if (mAnimateKeyguardFadingOut) {
    mKeyguardFadingOutInProgress=true;
    mKeyguardFadeoutAnimation=anim;
  }
  if (mSkipFirstFrame) {
    anim.setCurrentPlayTime(16);
  }
  scrim.setTag(TAG_KEY_ANIM,anim);
  scrim.setTag(TAG_KEY_ANIM_TARGET,target);
}
Program: 191739
Project: 191739
Buggy source:
public void setPanelExpansion(float fraction){
  if (mFraction != fraction) {
    mFraction=fraction;
    scheduleUpdate();
    if (mPinnedHeadsUpCount != 0) {
      updateHeadsUpScrim(false);
    }
  }
}

Fixed version (ground truth):
public void setPanelExpansion(float fraction){
  if (mFraction != fraction) {
    mFraction=fraction;
    scheduleUpdate();
    if (mPinnedHeadsUpCount != 0) {
      updateHeadsUpScrim(false);
    }
    if (mKeyguardFadeoutAnimation != null) {
      mKeyguardFadeoutAnimation.cancel();
    }
  }
}
Program: 191740
Project: 191740
Buggy source:
@Override protected void onDensityOrFontScaleChanged(){
  super.onDensityOrFontScaleChanged();
  mScrimController.onDensityOrFontScaleChanged();
  mStatusBarView.onDensityOrFontScaleChanged();
  mBrightnessMirrorController.onDensityOrFontScaleChanged();
  inflateSignalClusters();
  mIconController.onDensityOrFontScaleChanged();
  inflateDismissView();
  updateClearAll();
  inflateEmptyShadeView();
  updateEmptyShadeView();
  inflateOverflowContainer();
}

Fixed version (ground truth):
@Override protected void onDensityOrFontScaleChanged(){
  super.onDensityOrFontScaleChanged();
  mScrimController.onDensityOrFontScaleChanged();
  mStatusBarView.onDensityOrFontScaleChanged();
  mBrightnessMirrorController.onDensityOrFontScaleChanged();
  inflateSignalClusters();
  mIconController.onDensityOrFontScaleChanged();
  inflateDismissView();
  updateClearAll();
  inflateEmptyShadeView();
  updateEmptyShadeView();
  inflateOverflowContainer();
  mStatusBarKeyguardViewManager.onDensityOrFontScaleChanged();
}
Program: 191741
Project: 191741
Buggy source:
@Override public void onAnimationEnd(Animator animation){
  if (mOnAnimationFinished != null) {
    mOnAnimationFinished.run();
    mOnAnimationFinished=null;
    mKeyguardFadingOutInProgress=false;
  }
  scrim.setTag(TAG_KEY_ANIM,null);
  scrim.setTag(TAG_KEY_ANIM_TARGET,null);
}

Fixed version (ground truth):
@Override public void onAnimationEnd(Animator animation){
  if (mOnAnimationFinished != null) {
    mOnAnimationFinished.run();
    mOnAnimationFinished=null;
  }
  mKeyguardFadingOutInProgress=false;
  scrim.setTag(TAG_KEY_ANIM,null);
  scrim.setTag(TAG_KEY_ANIM_TARGET,null);
}
Program: 191742
Project: 191742
Buggy source:
private void startScrimAnimation(final View scrim,float target){
  float current=getCurrentScrimAlpha(scrim);
  ValueAnimator anim=ValueAnimator.ofFloat(current,target);
  anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener(){
    @Override public void onAnimationUpdate(    ValueAnimator animation){
      float alpha=(float)animation.getAnimatedValue();
      setCurrentScrimAlpha(scrim,alpha);
      updateScrimColor(scrim);
    }
  }
);
  anim.setInterpolator(getInterpolator());
  anim.setStartDelay(mAnimationDelay);
  anim.setDuration(mDurationOverride != -1 ? mDurationOverride : ANIMATION_DURATION);
  anim.addListener(new AnimatorListenerAdapter(){
    @Override public void onAnimationEnd(    Animator animation){
      if (mOnAnimationFinished != null) {
        mOnAnimationFinished.run();
        mOnAnimationFinished=null;
        mKeyguardFadingOutInProgress=false;
      }
      scrim.setTag(TAG_KEY_ANIM,null);
      scrim.setTag(TAG_KEY_ANIM_TARGET,null);
    }
  }
);
  anim.start();
  if (mAnimateKeyguardFadingOut) {
    mKeyguardFadingOutInProgress=true;
  }
  if (mSkipFirstFrame) {
    anim.setCurrentPlayTime(16);
  }
  scrim.setTag(TAG_KEY_ANIM,anim);
  scrim.setTag(TAG_KEY_ANIM_TARGET,target);
}

Fixed version (ground truth):
private void startScrimAnimation(final View scrim,float target){
  float current=getCurrentScrimAlpha(scrim);
  ValueAnimator anim=ValueAnimator.ofFloat(current,target);
  anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener(){
    @Override public void onAnimationUpdate(    ValueAnimator animation){
      float alpha=(float)animation.getAnimatedValue();
      setCurrentScrimAlpha(scrim,alpha);
      updateScrimColor(scrim);
    }
  }
);
  anim.setInterpolator(getInterpolator());
  anim.setStartDelay(mAnimationDelay);
  anim.setDuration(mDurationOverride != -1 ? mDurationOverride : ANIMATION_DURATION);
  anim.addListener(new AnimatorListenerAdapter(){
    @Override public void onAnimationEnd(    Animator animation){
      if (mOnAnimationFinished != null) {
        mOnAnimationFinished.run();
        mOnAnimationFinished=null;
      }
      mKeyguardFadingOutInProgress=false;
      scrim.setTag(TAG_KEY_ANIM,null);
      scrim.setTag(TAG_KEY_ANIM_TARGET,null);
    }
  }
);
  anim.start();
  if (mAnimateKeyguardFadingOut) {
    mKeyguardFadingOutInProgress=true;
  }
  if (mSkipFirstFrame) {
    anim.setCurrentPlayTime(16);
  }
  scrim.setTag(TAG_KEY_ANIM,anim);
  scrim.setTag(TAG_KEY_ANIM_TARGET,target);
}
Program: 191743
Project: 191743
Buggy source:
private void endAnimateKeyguardFadingOut(boolean force){
  mAnimateKeyguardFadingOut=false;
  if ((force || (!isAnimating(mScrimInFront) && !isAnimating(mScrimBehind))) && mOnAnimationFinished != null) {
    mOnAnimationFinished.run();
    mOnAnimationFinished=null;
    mKeyguardFadingOutInProgress=false;
  }
}

Fixed version (ground truth):
private void endAnimateKeyguardFadingOut(boolean force){
  mAnimateKeyguardFadingOut=false;
  if (force || (!isAnimating(mScrimInFront) && !isAnimating(mScrimBehind))) {
    if (mOnAnimationFinished != null) {
      mOnAnimationFinished.run();
      mOnAnimationFinished=null;
    }
    mKeyguardFadingOutInProgress=false;
  }
}