nus-yam/ex-repair huggingface dataset:
Program: 196585
Project: 196585
Buggy source:
private static void dumpService(PrintWriter pw,FileDescriptor fd,String name,String[] args){
  pw.print("String_Node_Str");
  pw.print(name);
  pw.println("String_Node_Str");
  IBinder service=ServiceManager.checkService(name);
  if (service == null) {
    pw.println("String_Node_Str");
    return;
  }
  TransferPipe tp=null;
  try {
    pw.flush();
    tp=new TransferPipe();
    tp.setBufferPrefix("String_Node_Str");
    service.dumpAsync(tp.getWriteFd().getFileDescriptor(),args);
    tp.go(fd);
  }
 catch (  Throwable e) {
    if (tp != null) {
      tp.kill();
    }
    pw.println("String_Node_Str");
    e.printStackTrace(pw);
  }
}

Fixed version (ground truth):
private static void dumpService(PrintWriter pw,FileDescriptor fd,String name,String[] args){
  pw.print("String_Node_Str");
  pw.print(name);
  pw.println("String_Node_Str");
  IBinder service=ServiceManager.checkService(name);
  if (service == null) {
    pw.println("String_Node_Str");
    return;
  }
  TransferPipe tp=null;
  try {
    pw.flush();
    tp=new TransferPipe();
    tp.setBufferPrefix("String_Node_Str");
    service.dumpAsync(tp.getWriteFd().getFileDescriptor(),args);
    tp.go(fd,10000);
  }
 catch (  Throwable e) {
    if (tp != null) {
      tp.kill();
    }
    pw.println("String_Node_Str");
    e.printStackTrace(pw);
  }
}
Program: 196587
Project: 196587
Buggy source:
final void dumpDbInfo(FileDescriptor fd,PrintWriter pw,String[] args){
  ArrayList<ProcessRecord> procs=collectProcesses(pw,0,args);
  if (procs == null) {
    pw.println("String_Node_Str" + args[0]);
    return;
  }
  pw.println("String_Node_Str");
  for (int i=procs.size() - 1; i >= 0; i--) {
    ProcessRecord r=procs.get(i);
    if (r.thread != null) {
      pw.println("String_Node_Str" + r.pid + "String_Node_Str"+ r.processName+ "String_Node_Str");
      pw.flush();
      try {
        TransferPipe tp=new TransferPipe();
        try {
          r.thread.dumpDbInfo(tp.getWriteFd().getFileDescriptor(),args);
          tp.go(fd);
        }
  finally {
          tp.kill();
        }
      }
 catch (      IOException e) {
        pw.println("String_Node_Str" + r);
        pw.flush();
      }
catch (      RemoteException e) {
        pw.println("String_Node_Str" + r);
        pw.flush();
      }
    }
  }
}

Fixed version (ground truth):
final void dumpDbInfo(FileDescriptor fd,PrintWriter pw,String[] args){
  ArrayList<ProcessRecord> procs=collectProcesses(pw,0,false,args);
  if (procs == null) {
    pw.println("String_Node_Str" + args[0]);
    return;
  }
  pw.println("String_Node_Str");
  for (int i=procs.size() - 1; i >= 0; i--) {
    ProcessRecord r=procs.get(i);
    if (r.thread != null) {
      pw.println("String_Node_Str" + r.pid + "String_Node_Str"+ r.processName+ "String_Node_Str");
      pw.flush();
      try {
        TransferPipe tp=new TransferPipe();
        try {
          r.thread.dumpDbInfo(tp.getWriteFd().getFileDescriptor(),args);
          tp.go(fd);
        }
  finally {
          tp.kill();
        }
      }
 catch (      IOException e) {
        pw.println("String_Node_Str" + r);
        pw.flush();
      }
catch (      RemoteException e) {
        pw.println("String_Node_Str" + r);
        pw.flush();
      }
    }
  }
}
Program: 196589
Project: 196589
Buggy source:
ArrayList<ProcessRecord> collectProcesses(PrintWriter pw,int start,String[] args){
  ArrayList<ProcessRecord> procs;
synchronized (this) {
    if (args != null && args.length > start && args[start].charAt(0) != '-') {
      procs=new ArrayList<ProcessRecord>();
      int pid=-1;
      try {
        pid=Integer.parseInt(args[start]);
      }
 catch (      NumberFormatException e) {
      }
      for (int i=mLruProcesses.size() - 1; i >= 0; i--) {
        ProcessRecord proc=mLruProcesses.get(i);
        if (proc.pid == pid) {
          procs.add(proc);
        }
 else         if (proc.processName.equals(args[start])) {
          procs.add(proc);
        }
      }
      if (procs.size() <= 0) {
        return null;
      }
    }
 else {
      procs=new ArrayList<ProcessRecord>(mLruProcesses);
    }
  }
  return procs;
}

Fixed version (ground truth):
ArrayList<ProcessRecord> collectProcesses(PrintWriter pw,int start,boolean allPkgs,String[] args){
  ArrayList<ProcessRecord> procs;
synchronized (this) {
    if (args != null && args.length > start && args[start].charAt(0) != '-') {
      procs=new ArrayList<ProcessRecord>();
      int pid=-1;
      try {
        pid=Integer.parseInt(args[start]);
      }
 catch (      NumberFormatException e) {
      }
      for (int i=mLruProcesses.size() - 1; i >= 0; i--) {
        ProcessRecord proc=mLruProcesses.get(i);
        if (proc.pid == pid) {
          procs.add(proc);
        }
 else         if (allPkgs && proc.pkgList != null && proc.pkgList.containsKey(args[start])) {
          procs.add(proc);
        }
 else         if (proc.processName.equals(args[start])) {
          procs.add(proc);
        }
      }
      if (procs.size() <= 0) {
        return null;
      }
    }
 else {
      procs=new ArrayList<ProcessRecord>(mLruProcesses);
    }
  }
  return procs;
}
Program: 196590
Project: 196590
Buggy source:
final void dumpGraphicsHardwareUsage(FileDescriptor fd,PrintWriter pw,String[] args){
  ArrayList<ProcessRecord> procs=collectProcesses(pw,0,args);
  if (procs == null) {
    pw.println("String_Node_Str" + args[0]);
    return;
  }
  long uptime=SystemClock.uptimeMillis();
  long realtime=SystemClock.elapsedRealtime();
  pw.println("String_Node_Str");
  pw.println("String_Node_Str" + uptime + "String_Node_Str"+ realtime);
  for (int i=procs.size() - 1; i >= 0; i--) {
    ProcessRecord r=procs.get(i);
    if (r.thread != null) {
      pw.println("String_Node_Str" + r.pid + "String_Node_Str"+ r.processName+ "String_Node_Str");
      pw.flush();
      try {
        TransferPipe tp=new TransferPipe();
        try {
          r.thread.dumpGfxInfo(tp.getWriteFd().getFileDescriptor(),args);
          tp.go(fd);
        }
  finally {
          tp.kill();
        }
      }
 catch (      IOException e) {
        pw.println("String_Node_Str" + r);
        pw.flush();
      }
catch (      RemoteException e) {
        pw.println("String_Node_Str" + r);
        pw.flush();
      }
    }
  }
}

Fixed version (ground truth):
final void dumpGraphicsHardwareUsage(FileDescriptor fd,PrintWriter pw,String[] args){
  ArrayList<ProcessRecord> procs=collectProcesses(pw,0,false,args);
  if (procs == null) {
    pw.println("String_Node_Str" + args[0]);
    return;
  }
  long uptime=SystemClock.uptimeMillis();
  long realtime=SystemClock.elapsedRealtime();
  pw.println("String_Node_Str");
  pw.println("String_Node_Str" + uptime + "String_Node_Str"+ realtime);
  for (int i=procs.size() - 1; i >= 0; i--) {
    ProcessRecord r=procs.get(i);
    if (r.thread != null) {
      pw.println("String_Node_Str" + r.pid + "String_Node_Str"+ r.processName+ "String_Node_Str");
      pw.flush();
      try {
        TransferPipe tp=new TransferPipe();
        try {
          r.thread.dumpGfxInfo(tp.getWriteFd().getFileDescriptor(),args);
          tp.go(fd);
        }
  finally {
          tp.kill();
        }
      }
 catch (      IOException e) {
        pw.println("String_Node_Str" + r);
        pw.flush();
      }
catch (      RemoteException e) {
        pw.println("String_Node_Str" + r);
        pw.flush();
      }
    }
  }
}
Program: 196592
Project: 196592
Buggy source:
private void instantCollapseNotificationPanel(){
  mNotificationPanel.setExpandedFraction(0);
}

Fixed version (ground truth):
private void instantCollapseNotificationPanel(){
  mNotificationPanel.instantCollapse();
}
Program: 196593
Project: 196593
Buggy source:
private void instantCollapseNotificationPanel(){
  mNotificationPanel.setExpandedFraction(0);
}

Fixed version (ground truth):
private void instantCollapseNotificationPanel(){
  mNotificationPanel.instantCollapse();
}
Program: 196594
Project: 196594
Buggy source:
private void instantCollapseNotificationPanel(){
  mNotificationPanel.setExpandedFraction(0);
}

Fixed version (ground truth):
private void instantCollapseNotificationPanel(){
  mNotificationPanel.instantCollapse();
}
Program: 196595
Project: 196595
Buggy source:
private void updateBackground(){
  if (mDimmed) {
    mBackgroundDimmed.setVisibility(View.VISIBLE);
    mBackgroundNormal.setVisibility(View.INVISIBLE);
  }
 else {
    mBackgroundDimmed.setVisibility(View.INVISIBLE);
    mBackgroundNormal.setVisibility(View.VISIBLE);
    mBackgroundNormal.setAlpha(1f);
    removeCallbacks(mTapTimeoutRunnable);
  }
}

Fixed version (ground truth):
private void updateBackground(){
  if (mDimmed) {
    mBackgroundDimmed.setVisibility(View.VISIBLE);
    mBackgroundNormal.setVisibility(View.INVISIBLE);
  }
 else {
    cancelFadeAnimations();
    mBackgroundDimmed.setVisibility(View.INVISIBLE);
    mBackgroundNormal.setVisibility(View.VISIBLE);
    mBackgroundNormal.setAlpha(1f);
    removeCallbacks(mTapTimeoutRunnable);
  }
}
Program: 196596
Project: 196596
Buggy source:
private void fadeBackground(){
  if (mDimmed) {
    mBackgroundDimmed.setVisibility(View.VISIBLE);
  }
 else {
    mBackgroundNormal.setVisibility(View.VISIBLE);
  }
  float startAlpha=mDimmed ? 1f : 0;
  float endAlpha=mDimmed ? 0 : 1f;
  int duration=BACKGROUND_ANIMATION_LENGTH_MS;
  if (mBackgroundAnimator != null) {
    startAlpha=(Float)mBackgroundAnimator.getAnimatedValue();
    duration=(int)mBackgroundAnimator.getCurrentPlayTime();
    mBackgroundAnimator.removeAllListeners();
    mBackgroundAnimator.cancel();
    if (duration <= 0) {
      updateBackground();
      return;
    }
  }
  mBackgroundNormal.setAlpha(startAlpha);
  mBackgroundAnimator=ObjectAnimator.ofFloat(mBackgroundNormal,View.ALPHA,startAlpha,endAlpha);
  mBackgroundAnimator.setInterpolator(mFastOutSlowInInterpolator);
  mBackgroundAnimator.setDuration(duration);
  mBackgroundAnimator.addListener(new AnimatorListenerAdapter(){
    @Override public void onAnimationEnd(    Animator animation){
      if (mDimmed) {
        mBackgroundNormal.setVisibility(View.INVISIBLE);
      }
 else {
        mBackgroundDimmed.setVisibility(View.INVISIBLE);
      }
      mBackgroundAnimator=null;
    }
  }
);
  mBackgroundAnimator.start();
}

Fixed version (ground truth):
private void fadeBackground(){
  mBackgroundNormal.animate().cancel();
  if (mDimmed) {
    mBackgroundDimmed.setVisibility(View.VISIBLE);
  }
 else {
    mBackgroundNormal.setVisibility(View.VISIBLE);
  }
  float startAlpha=mDimmed ? 1f : 0;
  float endAlpha=mDimmed ? 0 : 1f;
  int duration=BACKGROUND_ANIMATION_LENGTH_MS;
  if (mBackgroundAnimator != null) {
    startAlpha=(Float)mBackgroundAnimator.getAnimatedValue();
    duration=(int)mBackgroundAnimator.getCurrentPlayTime();
    mBackgroundAnimator.removeAllListeners();
    mBackgroundAnimator.cancel();
    if (duration <= 0) {
      updateBackground();
      return;
    }
  }
  mBackgroundNormal.setAlpha(startAlpha);
  mBackgroundAnimator=ObjectAnimator.ofFloat(mBackgroundNormal,View.ALPHA,startAlpha,endAlpha);
  mBackgroundAnimator.setInterpolator(mFastOutSlowInInterpolator);
  mBackgroundAnimator.setDuration(duration);
  mBackgroundAnimator.addListener(new AnimatorListenerAdapter(){
    @Override public void onAnimationEnd(    Animator animation){
      if (mDimmed) {
        mBackgroundNormal.setVisibility(View.INVISIBLE);
      }
 else {
        mBackgroundDimmed.setVisibility(View.INVISIBLE);
      }
      mBackgroundAnimator=null;
    }
  }
);
  mBackgroundAnimator.start();
}
Program: 196599
Project: 196599
Buggy source:
/** 
 * @hide
 */
public static void dumpPackageStateStatic(FileDescriptor fd,String packageName){
  FileOutputStream fout=new FileOutputStream(fd);
  PrintWriter pw=new FastPrintWriter(fout);
  dumpService(pw,fd,Context.ACTIVITY_SERVICE,new String[]{"String_Node_Str","String_Node_Str",packageName});
  pw.println();
  dumpService(pw,fd,"String_Node_Str",new String[]{"String_Node_Str",packageName});
  pw.println();
  dumpService(pw,fd,ProcessStats.SERVICE_NAME,new String[]{"String_Node_Str",packageName});
  pw.println();
  dumpService(pw,fd,"String_Node_Str",new String[]{"String_Node_Str",packageName});
  pw.println();
  dumpService(pw,fd,"String_Node_Str",new String[]{packageName});
  pw.println();
  dumpService(pw,fd,BatteryStats.SERVICE_NAME,new String[]{packageName});
  pw.flush();
}

Fixed version (ground truth):
/** 
 * @hide
 */
public static void dumpPackageStateStatic(FileDescriptor fd,String packageName){
  FileOutputStream fout=new FileOutputStream(fd);
  PrintWriter pw=new FastPrintWriter(fout);
  dumpService(pw,fd,"String_Node_Str",new String[]{packageName});
  pw.println();
  dumpService(pw,fd,Context.ACTIVITY_SERVICE,new String[]{"String_Node_Str","String_Node_Str",packageName});
  pw.println();
  dumpService(pw,fd,"String_Node_Str",new String[]{"String_Node_Str","String_Node_Str",packageName});
  pw.println();
  dumpService(pw,fd,ProcessStats.SERVICE_NAME,new String[]{packageName});
  pw.println();
  dumpService(pw,fd,"String_Node_Str",new String[]{"String_Node_Str",packageName});
  pw.println();
  dumpService(pw,fd,BatteryStats.SERVICE_NAME,new String[]{packageName});
  pw.flush();
}
Program: 196600
Project: 196600
Buggy source:
private static void dumpService(PrintWriter pw,FileDescriptor fd,String name,String[] args){
  pw.print("String_Node_Str");
  pw.print(name);
  pw.println("String_Node_Str");
  IBinder service=ServiceManager.checkService(name);
  if (service == null) {
    pw.println("String_Node_Str");
    return;
  }
  TransferPipe tp=null;
  try {
    pw.flush();
    tp=new TransferPipe();
    tp.setBufferPrefix("String_Node_Str");
    service.dumpAsync(tp.getWriteFd().getFileDescriptor(),args);
    tp.go(fd);
  }
 catch (  Throwable e) {
    if (tp != null) {
      tp.kill();
    }
    pw.println("String_Node_Str");
    e.printStackTrace(pw);
  }
}

Fixed version (ground truth):
private static void dumpService(PrintWriter pw,FileDescriptor fd,String name,String[] args){
  pw.print("String_Node_Str");
  pw.print(name);
  pw.println("String_Node_Str");
  IBinder service=ServiceManager.checkService(name);
  if (service == null) {
    pw.println("String_Node_Str");
    return;
  }
  TransferPipe tp=null;
  try {
    pw.flush();
    tp=new TransferPipe();
    tp.setBufferPrefix("String_Node_Str");
    service.dumpAsync(tp.getWriteFd().getFileDescriptor(),args);
    tp.go(fd,10000);
  }
 catch (  Throwable e) {
    if (tp != null) {
      tp.kill();
    }
    pw.println("String_Node_Str");
    e.printStackTrace(pw);
  }
}
Program: 196602
Project: 196602
Buggy source:
final void dumpDbInfo(FileDescriptor fd,PrintWriter pw,String[] args){
  ArrayList<ProcessRecord> procs=collectProcesses(pw,0,args);
  if (procs == null) {
    pw.println("String_Node_Str" + args[0]);
    return;
  }
  pw.println("String_Node_Str");
  for (int i=procs.size() - 1; i >= 0; i--) {
    ProcessRecord r=procs.get(i);
    if (r.thread != null) {
      pw.println("String_Node_Str" + r.pid + "String_Node_Str"+ r.processName+ "String_Node_Str");
      pw.flush();
      try {
        TransferPipe tp=new TransferPipe();
        try {
          r.thread.dumpDbInfo(tp.getWriteFd().getFileDescriptor(),args);
          tp.go(fd);
        }
  finally {
          tp.kill();
        }
      }
 catch (      IOException e) {
        pw.println("String_Node_Str" + r);
        pw.flush();
      }
catch (      RemoteException e) {
        pw.println("String_Node_Str" + r);
        pw.flush();
      }
    }
  }
}

Fixed version (ground truth):
final void dumpDbInfo(FileDescriptor fd,PrintWriter pw,String[] args){
  ArrayList<ProcessRecord> procs=collectProcesses(pw,0,false,args);
  if (procs == null) {
    pw.println("String_Node_Str" + args[0]);
    return;
  }
  pw.println("String_Node_Str");
  for (int i=procs.size() - 1; i >= 0; i--) {
    ProcessRecord r=procs.get(i);
    if (r.thread != null) {
      pw.println("String_Node_Str" + r.pid + "String_Node_Str"+ r.processName+ "String_Node_Str");
      pw.flush();
      try {
        TransferPipe tp=new TransferPipe();
        try {
          r.thread.dumpDbInfo(tp.getWriteFd().getFileDescriptor(),args);
          tp.go(fd);
        }
  finally {
          tp.kill();
        }
      }
 catch (      IOException e) {
        pw.println("String_Node_Str" + r);
        pw.flush();
      }
catch (      RemoteException e) {
        pw.println("String_Node_Str" + r);
        pw.flush();
      }
    }
  }
}
Program: 196604
Project: 196604
Buggy source:
ArrayList<ProcessRecord> collectProcesses(PrintWriter pw,int start,String[] args){
  ArrayList<ProcessRecord> procs;
synchronized (this) {
    if (args != null && args.length > start && args[start].charAt(0) != '-') {
      procs=new ArrayList<ProcessRecord>();
      int pid=-1;
      try {
        pid=Integer.parseInt(args[start]);
      }
 catch (      NumberFormatException e) {
      }
      for (int i=mLruProcesses.size() - 1; i >= 0; i--) {
        ProcessRecord proc=mLruProcesses.get(i);
        if (proc.pid == pid) {
          procs.add(proc);
        }
 else         if (proc.processName.equals(args[start])) {
          procs.add(proc);
        }
      }
      if (procs.size() <= 0) {
        return null;
      }
    }
 else {
      procs=new ArrayList<ProcessRecord>(mLruProcesses);
    }
  }
  return procs;
}

Fixed version (ground truth):
ArrayList<ProcessRecord> collectProcesses(PrintWriter pw,int start,boolean allPkgs,String[] args){
  ArrayList<ProcessRecord> procs;
synchronized (this) {
    if (args != null && args.length > start && args[start].charAt(0) != '-') {
      procs=new ArrayList<ProcessRecord>();
      int pid=-1;
      try {
        pid=Integer.parseInt(args[start]);
      }
 catch (      NumberFormatException e) {
      }
      for (int i=mLruProcesses.size() - 1; i >= 0; i--) {
        ProcessRecord proc=mLruProcesses.get(i);
        if (proc.pid == pid) {
          procs.add(proc);
        }
 else         if (allPkgs && proc.pkgList != null && proc.pkgList.containsKey(args[start])) {
          procs.add(proc);
        }
 else         if (proc.processName.equals(args[start])) {
          procs.add(proc);
        }
      }
      if (procs.size() <= 0) {
        return null;
      }
    }
 else {
      procs=new ArrayList<ProcessRecord>(mLruProcesses);
    }
  }
  return procs;
}
Program: 196605
Project: 196605
Buggy source:
final void dumpGraphicsHardwareUsage(FileDescriptor fd,PrintWriter pw,String[] args){
  ArrayList<ProcessRecord> procs=collectProcesses(pw,0,args);
  if (procs == null) {
    pw.println("String_Node_Str" + args[0]);
    return;
  }
  long uptime=SystemClock.uptimeMillis();
  long realtime=SystemClock.elapsedRealtime();
  pw.println("String_Node_Str");
  pw.println("String_Node_Str" + uptime + "String_Node_Str"+ realtime);
  for (int i=procs.size() - 1; i >= 0; i--) {
    ProcessRecord r=procs.get(i);
    if (r.thread != null) {
      pw.println("String_Node_Str" + r.pid + "String_Node_Str"+ r.processName+ "String_Node_Str");
      pw.flush();
      try {
        TransferPipe tp=new TransferPipe();
        try {
          r.thread.dumpGfxInfo(tp.getWriteFd().getFileDescriptor(),args);
          tp.go(fd);
        }
  finally {
          tp.kill();
        }
      }
 catch (      IOException e) {
        pw.println("String_Node_Str" + r);
        pw.flush();
      }
catch (      RemoteException e) {
        pw.println("String_Node_Str" + r);
        pw.flush();
      }
    }
  }
}

Fixed version (ground truth):
final void dumpGraphicsHardwareUsage(FileDescriptor fd,PrintWriter pw,String[] args){
  ArrayList<ProcessRecord> procs=collectProcesses(pw,0,false,args);
  if (procs == null) {
    pw.println("String_Node_Str" + args[0]);
    return;
  }
  long uptime=SystemClock.uptimeMillis();
  long realtime=SystemClock.elapsedRealtime();
  pw.println("String_Node_Str");
  pw.println("String_Node_Str" + uptime + "String_Node_Str"+ realtime);
  for (int i=procs.size() - 1; i >= 0; i--) {
    ProcessRecord r=procs.get(i);
    if (r.thread != null) {
      pw.println("String_Node_Str" + r.pid + "String_Node_Str"+ r.processName+ "String_Node_Str");
      pw.flush();
      try {
        TransferPipe tp=new TransferPipe();
        try {
          r.thread.dumpGfxInfo(tp.getWriteFd().getFileDescriptor(),args);
          tp.go(fd);
        }
  finally {
          tp.kill();
        }
      }
 catch (      IOException e) {
        pw.println("String_Node_Str" + r);
        pw.flush();
      }
catch (      RemoteException e) {
        pw.println("String_Node_Str" + r);
        pw.flush();
      }
    }
  }
}
Program: 196608
Project: 196608
Buggy source:
/** 
 * @hide
 */
public static void dumpPackageStateStatic(FileDescriptor fd,String packageName){
  FileOutputStream fout=new FileOutputStream(fd);
  PrintWriter pw=new FastPrintWriter(fout);
  dumpService(pw,fd,Context.ACTIVITY_SERVICE,new String[]{"String_Node_Str","String_Node_Str",packageName});
  pw.println();
  dumpService(pw,fd,"String_Node_Str",new String[]{"String_Node_Str",packageName});
  pw.println();
  dumpService(pw,fd,ProcessStats.SERVICE_NAME,new String[]{"String_Node_Str",packageName});
  pw.println();
  dumpService(pw,fd,"String_Node_Str",new String[]{"String_Node_Str",packageName});
  pw.println();
  dumpService(pw,fd,"String_Node_Str",new String[]{packageName});
  pw.println();
  dumpService(pw,fd,BatteryStats.SERVICE_NAME,new String[]{packageName});
  pw.flush();
}

Fixed version (ground truth):
/** 
 * @hide
 */
public static void dumpPackageStateStatic(FileDescriptor fd,String packageName){
  FileOutputStream fout=new FileOutputStream(fd);
  PrintWriter pw=new FastPrintWriter(fout);
  dumpService(pw,fd,"String_Node_Str",new String[]{packageName});
  pw.println();
  dumpService(pw,fd,Context.ACTIVITY_SERVICE,new String[]{"String_Node_Str","String_Node_Str",packageName});
  pw.println();
  dumpService(pw,fd,"String_Node_Str",new String[]{"String_Node_Str","String_Node_Str",packageName});
  pw.println();
  dumpService(pw,fd,ProcessStats.SERVICE_NAME,new String[]{packageName});
  pw.println();
  dumpService(pw,fd,"String_Node_Str",new String[]{"String_Node_Str",packageName});
  pw.println();
  dumpService(pw,fd,BatteryStats.SERVICE_NAME,new String[]{packageName});
  pw.flush();
}
Program: 196609
Project: 196609
Buggy source:
private static void dumpService(PrintWriter pw,FileDescriptor fd,String name,String[] args){
  pw.print("String_Node_Str");
  pw.print(name);
  pw.println("String_Node_Str");
  IBinder service=ServiceManager.checkService(name);
  if (service == null) {
    pw.println("String_Node_Str");
    return;
  }
  TransferPipe tp=null;
  try {
    pw.flush();
    tp=new TransferPipe();
    tp.setBufferPrefix("String_Node_Str");
    service.dumpAsync(tp.getWriteFd().getFileDescriptor(),args);
    tp.go(fd);
  }
 catch (  Throwable e) {
    if (tp != null) {
      tp.kill();
    }
    pw.println("String_Node_Str");
    e.printStackTrace(pw);
  }
}

Fixed version (ground truth):
private static void dumpService(PrintWriter pw,FileDescriptor fd,String name,String[] args){
  pw.print("String_Node_Str");
  pw.print(name);
  pw.println("String_Node_Str");
  IBinder service=ServiceManager.checkService(name);
  if (service == null) {
    pw.println("String_Node_Str");
    return;
  }
  TransferPipe tp=null;
  try {
    pw.flush();
    tp=new TransferPipe();
    tp.setBufferPrefix("String_Node_Str");
    service.dumpAsync(tp.getWriteFd().getFileDescriptor(),args);
    tp.go(fd,10000);
  }
 catch (  Throwable e) {
    if (tp != null) {
      tp.kill();
    }
    pw.println("String_Node_Str");
    e.printStackTrace(pw);
  }
}
Program: 196611
Project: 196611
Buggy source:
final void dumpDbInfo(FileDescriptor fd,PrintWriter pw,String[] args){
  ArrayList<ProcessRecord> procs=collectProcesses(pw,0,args);
  if (procs == null) {
    pw.println("String_Node_Str" + args[0]);
    return;
  }
  pw.println("String_Node_Str");
  for (int i=procs.size() - 1; i >= 0; i--) {
    ProcessRecord r=procs.get(i);
    if (r.thread != null) {
      pw.println("String_Node_Str" + r.pid + "String_Node_Str"+ r.processName+ "String_Node_Str");
      pw.flush();
      try {
        TransferPipe tp=new TransferPipe();
        try {
          r.thread.dumpDbInfo(tp.getWriteFd().getFileDescriptor(),args);
          tp.go(fd);
        }
  finally {
          tp.kill();
        }
      }
 catch (      IOException e) {
        pw.println("String_Node_Str" + r);
        pw.flush();
      }
catch (      RemoteException e) {
        pw.println("String_Node_Str" + r);
        pw.flush();
      }
    }
  }
}

Fixed version (ground truth):
final void dumpDbInfo(FileDescriptor fd,PrintWriter pw,String[] args){
  ArrayList<ProcessRecord> procs=collectProcesses(pw,0,false,args);
  if (procs == null) {
    pw.println("String_Node_Str" + args[0]);
    return;
  }
  pw.println("String_Node_Str");
  for (int i=procs.size() - 1; i >= 0; i--) {
    ProcessRecord r=procs.get(i);
    if (r.thread != null) {
      pw.println("String_Node_Str" + r.pid + "String_Node_Str"+ r.processName+ "String_Node_Str");
      pw.flush();
      try {
        TransferPipe tp=new TransferPipe();
        try {
          r.thread.dumpDbInfo(tp.getWriteFd().getFileDescriptor(),args);
          tp.go(fd);
        }
  finally {
          tp.kill();
        }
      }
 catch (      IOException e) {
        pw.println("String_Node_Str" + r);
        pw.flush();
      }
catch (      RemoteException e) {
        pw.println("String_Node_Str" + r);
        pw.flush();
      }
    }
  }
}
Program: 196613
Project: 196613
Buggy source:
ArrayList<ProcessRecord> collectProcesses(PrintWriter pw,int start,String[] args){
  ArrayList<ProcessRecord> procs;
synchronized (this) {
    if (args != null && args.length > start && args[start].charAt(0) != '-') {
      procs=new ArrayList<ProcessRecord>();
      int pid=-1;
      try {
        pid=Integer.parseInt(args[start]);
      }
 catch (      NumberFormatException e) {
      }
      for (int i=mLruProcesses.size() - 1; i >= 0; i--) {
        ProcessRecord proc=mLruProcesses.get(i);
        if (proc.pid == pid) {
          procs.add(proc);
        }
 else         if (proc.processName.equals(args[start])) {
          procs.add(proc);
        }
      }
      if (procs.size() <= 0) {
        return null;
      }
    }
 else {
      procs=new ArrayList<ProcessRecord>(mLruProcesses);
    }
  }
  return procs;
}

Fixed version (ground truth):
ArrayList<ProcessRecord> collectProcesses(PrintWriter pw,int start,boolean allPkgs,String[] args){
  ArrayList<ProcessRecord> procs;
synchronized (this) {
    if (args != null && args.length > start && args[start].charAt(0) != '-') {
      procs=new ArrayList<ProcessRecord>();
      int pid=-1;
      try {
        pid=Integer.parseInt(args[start]);
      }
 catch (      NumberFormatException e) {
      }
      for (int i=mLruProcesses.size() - 1; i >= 0; i--) {
        ProcessRecord proc=mLruProcesses.get(i);
        if (proc.pid == pid) {
          procs.add(proc);
        }
 else         if (allPkgs && proc.pkgList != null && proc.pkgList.containsKey(args[start])) {
          procs.add(proc);
        }
 else         if (proc.processName.equals(args[start])) {
          procs.add(proc);
        }
      }
      if (procs.size() <= 0) {
        return null;
      }
    }
 else {
      procs=new ArrayList<ProcessRecord>(mLruProcesses);
    }
  }
  return procs;
}
Program: 196614
Project: 196614
Buggy source:
final void dumpGraphicsHardwareUsage(FileDescriptor fd,PrintWriter pw,String[] args){
  ArrayList<ProcessRecord> procs=collectProcesses(pw,0,args);
  if (procs == null) {
    pw.println("String_Node_Str" + args[0]);
    return;
  }
  long uptime=SystemClock.uptimeMillis();
  long realtime=SystemClock.elapsedRealtime();
  pw.println("String_Node_Str");
  pw.println("String_Node_Str" + uptime + "String_Node_Str"+ realtime);
  for (int i=procs.size() - 1; i >= 0; i--) {
    ProcessRecord r=procs.get(i);
    if (r.thread != null) {
      pw.println("String_Node_Str" + r.pid + "String_Node_Str"+ r.processName+ "String_Node_Str");
      pw.flush();
      try {
        TransferPipe tp=new TransferPipe();
        try {
          r.thread.dumpGfxInfo(tp.getWriteFd().getFileDescriptor(),args);
          tp.go(fd);
        }
  finally {
          tp.kill();
        }
      }
 catch (      IOException e) {
        pw.println("String_Node_Str" + r);
        pw.flush();
      }
catch (      RemoteException e) {
        pw.println("String_Node_Str" + r);
        pw.flush();
      }
    }
  }
}

Fixed version (ground truth):
final void dumpGraphicsHardwareUsage(FileDescriptor fd,PrintWriter pw,String[] args){
  ArrayList<ProcessRecord> procs=collectProcesses(pw,0,false,args);
  if (procs == null) {
    pw.println("String_Node_Str" + args[0]);
    return;
  }
  long uptime=SystemClock.uptimeMillis();
  long realtime=SystemClock.elapsedRealtime();
  pw.println("String_Node_Str");
  pw.println("String_Node_Str" + uptime + "String_Node_Str"+ realtime);
  for (int i=procs.size() - 1; i >= 0; i--) {
    ProcessRecord r=procs.get(i);
    if (r.thread != null) {
      pw.println("String_Node_Str" + r.pid + "String_Node_Str"+ r.processName+ "String_Node_Str");
      pw.flush();
      try {
        TransferPipe tp=new TransferPipe();
        try {
          r.thread.dumpGfxInfo(tp.getWriteFd().getFileDescriptor(),args);
          tp.go(fd);
        }
  finally {
          tp.kill();
        }
      }
 catch (      IOException e) {
        pw.println("String_Node_Str" + r);
        pw.flush();
      }
catch (      RemoteException e) {
        pw.println("String_Node_Str" + r);
        pw.flush();
      }
    }
  }
}
Program: 196617
Project: 196617
Buggy source:
/** 
 * @hide
 */
public static void dumpPackageStateStatic(FileDescriptor fd,String packageName){
  FileOutputStream fout=new FileOutputStream(fd);
  PrintWriter pw=new FastPrintWriter(fout);
  dumpService(pw,fd,Context.ACTIVITY_SERVICE,new String[]{"String_Node_Str","String_Node_Str",packageName});
  pw.println();
  dumpService(pw,fd,"String_Node_Str",new String[]{"String_Node_Str",packageName});
  pw.println();
  dumpService(pw,fd,ProcessStats.SERVICE_NAME,new String[]{"String_Node_Str",packageName});
  pw.println();
  dumpService(pw,fd,"String_Node_Str",new String[]{"String_Node_Str",packageName});
  pw.println();
  dumpService(pw,fd,"String_Node_Str",new String[]{packageName});
  pw.println();
  dumpService(pw,fd,BatteryStats.SERVICE_NAME,new String[]{packageName});
  pw.flush();
}

Fixed version (ground truth):
/** 
 * @hide
 */
public static void dumpPackageStateStatic(FileDescriptor fd,String packageName){
  FileOutputStream fout=new FileOutputStream(fd);
  PrintWriter pw=new FastPrintWriter(fout);
  dumpService(pw,fd,"String_Node_Str",new String[]{packageName});
  pw.println();
  dumpService(pw,fd,Context.ACTIVITY_SERVICE,new String[]{"String_Node_Str","String_Node_Str",packageName});
  pw.println();
  dumpService(pw,fd,"String_Node_Str",new String[]{"String_Node_Str","String_Node_Str",packageName});
  pw.println();
  dumpService(pw,fd,ProcessStats.SERVICE_NAME,new String[]{packageName});
  pw.println();
  dumpService(pw,fd,"String_Node_Str",new String[]{"String_Node_Str",packageName});
  pw.println();
  dumpService(pw,fd,BatteryStats.SERVICE_NAME,new String[]{packageName});
  pw.flush();
}
Program: 196618
Project: 196618
Buggy source:
private static void dumpService(PrintWriter pw,FileDescriptor fd,String name,String[] args){
  pw.print("String_Node_Str");
  pw.print(name);
  pw.println("String_Node_Str");
  IBinder service=ServiceManager.checkService(name);
  if (service == null) {
    pw.println("String_Node_Str");
    return;
  }
  TransferPipe tp=null;
  try {
    pw.flush();
    tp=new TransferPipe();
    tp.setBufferPrefix("String_Node_Str");
    service.dumpAsync(tp.getWriteFd().getFileDescriptor(),args);
    tp.go(fd);
  }
 catch (  Throwable e) {
    if (tp != null) {
      tp.kill();
    }
    pw.println("String_Node_Str");
    e.printStackTrace(pw);
  }
}

Fixed version (ground truth):
private static void dumpService(PrintWriter pw,FileDescriptor fd,String name,String[] args){
  pw.print("String_Node_Str");
  pw.print(name);
  pw.println("String_Node_Str");
  IBinder service=ServiceManager.checkService(name);
  if (service == null) {
    pw.println("String_Node_Str");
    return;
  }
  TransferPipe tp=null;
  try {
    pw.flush();
    tp=new TransferPipe();
    tp.setBufferPrefix("String_Node_Str");
    service.dumpAsync(tp.getWriteFd().getFileDescriptor(),args);
    tp.go(fd,10000);
  }
 catch (  Throwable e) {
    if (tp != null) {
      tp.kill();
    }
    pw.println("String_Node_Str");
    e.printStackTrace(pw);
  }
}
Program: 196620
Project: 196620
Buggy source:
final void dumpDbInfo(FileDescriptor fd,PrintWriter pw,String[] args){
  ArrayList<ProcessRecord> procs=collectProcesses(pw,0,args);
  if (procs == null) {
    pw.println("String_Node_Str" + args[0]);
    return;
  }
  pw.println("String_Node_Str");
  for (int i=procs.size() - 1; i >= 0; i--) {
    ProcessRecord r=procs.get(i);
    if (r.thread != null) {
      pw.println("String_Node_Str" + r.pid + "String_Node_Str"+ r.processName+ "String_Node_Str");
      pw.flush();
      try {
        TransferPipe tp=new TransferPipe();
        try {
          r.thread.dumpDbInfo(tp.getWriteFd().getFileDescriptor(),args);
          tp.go(fd);
        }
  finally {
          tp.kill();
        }
      }
 catch (      IOException e) {
        pw.println("String_Node_Str" + r);
        pw.flush();
      }
catch (      RemoteException e) {
        pw.println("String_Node_Str" + r);
        pw.flush();
      }
    }
  }
}

Fixed version (ground truth):
final void dumpDbInfo(FileDescriptor fd,PrintWriter pw,String[] args){
  ArrayList<ProcessRecord> procs=collectProcesses(pw,0,false,args);
  if (procs == null) {
    pw.println("String_Node_Str" + args[0]);
    return;
  }
  pw.println("String_Node_Str");
  for (int i=procs.size() - 1; i >= 0; i--) {
    ProcessRecord r=procs.get(i);
    if (r.thread != null) {
      pw.println("String_Node_Str" + r.pid + "String_Node_Str"+ r.processName+ "String_Node_Str");
      pw.flush();
      try {
        TransferPipe tp=new TransferPipe();
        try {
          r.thread.dumpDbInfo(tp.getWriteFd().getFileDescriptor(),args);
          tp.go(fd);
        }
  finally {
          tp.kill();
        }
      }
 catch (      IOException e) {
        pw.println("String_Node_Str" + r);
        pw.flush();
      }
catch (      RemoteException e) {
        pw.println("String_Node_Str" + r);
        pw.flush();
      }
    }
  }
}
Program: 196622
Project: 196622
Buggy source:
ArrayList<ProcessRecord> collectProcesses(PrintWriter pw,int start,String[] args){
  ArrayList<ProcessRecord> procs;
synchronized (this) {
    if (args != null && args.length > start && args[start].charAt(0) != '-') {
      procs=new ArrayList<ProcessRecord>();
      int pid=-1;
      try {
        pid=Integer.parseInt(args[start]);
      }
 catch (      NumberFormatException e) {
      }
      for (int i=mLruProcesses.size() - 1; i >= 0; i--) {
        ProcessRecord proc=mLruProcesses.get(i);
        if (proc.pid == pid) {
          procs.add(proc);
        }
 else         if (proc.processName.equals(args[start])) {
          procs.add(proc);
        }
      }
      if (procs.size() <= 0) {
        return null;
      }
    }
 else {
      procs=new ArrayList<ProcessRecord>(mLruProcesses);
    }
  }
  return procs;
}

Fixed version (ground truth):
ArrayList<ProcessRecord> collectProcesses(PrintWriter pw,int start,boolean allPkgs,String[] args){
  ArrayList<ProcessRecord> procs;
synchronized (this) {
    if (args != null && args.length > start && args[start].charAt(0) != '-') {
      procs=new ArrayList<ProcessRecord>();
      int pid=-1;
      try {
        pid=Integer.parseInt(args[start]);
      }
 catch (      NumberFormatException e) {
      }
      for (int i=mLruProcesses.size() - 1; i >= 0; i--) {
        ProcessRecord proc=mLruProcesses.get(i);
        if (proc.pid == pid) {
          procs.add(proc);
        }
 else         if (allPkgs && proc.pkgList != null && proc.pkgList.containsKey(args[start])) {
          procs.add(proc);
        }
 else         if (proc.processName.equals(args[start])) {
          procs.add(proc);
        }
      }
      if (procs.size() <= 0) {
        return null;
      }
    }
 else {
      procs=new ArrayList<ProcessRecord>(mLruProcesses);
    }
  }
  return procs;
}
Program: 196623
Project: 196623
Buggy source:
final void dumpGraphicsHardwareUsage(FileDescriptor fd,PrintWriter pw,String[] args){
  ArrayList<ProcessRecord> procs=collectProcesses(pw,0,args);
  if (procs == null) {
    pw.println("String_Node_Str" + args[0]);
    return;
  }
  long uptime=SystemClock.uptimeMillis();
  long realtime=SystemClock.elapsedRealtime();
  pw.println("String_Node_Str");
  pw.println("String_Node_Str" + uptime + "String_Node_Str"+ realtime);
  for (int i=procs.size() - 1; i >= 0; i--) {
    ProcessRecord r=procs.get(i);
    if (r.thread != null) {
      pw.println("String_Node_Str" + r.pid + "String_Node_Str"+ r.processName+ "String_Node_Str");
      pw.flush();
      try {
        TransferPipe tp=new TransferPipe();
        try {
          r.thread.dumpGfxInfo(tp.getWriteFd().getFileDescriptor(),args);
          tp.go(fd);
        }
  finally {
          tp.kill();
        }
      }
 catch (      IOException e) {
        pw.println("String_Node_Str" + r);
        pw.flush();
      }
catch (      RemoteException e) {
        pw.println("String_Node_Str" + r);
        pw.flush();
      }
    }
  }
}

Fixed version (ground truth):
final void dumpGraphicsHardwareUsage(FileDescriptor fd,PrintWriter pw,String[] args){
  ArrayList<ProcessRecord> procs=collectProcesses(pw,0,false,args);
  if (procs == null) {
    pw.println("String_Node_Str" + args[0]);
    return;
  }
  long uptime=SystemClock.uptimeMillis();
  long realtime=SystemClock.elapsedRealtime();
  pw.println("String_Node_Str");
  pw.println("String_Node_Str" + uptime + "String_Node_Str"+ realtime);
  for (int i=procs.size() - 1; i >= 0; i--) {
    ProcessRecord r=procs.get(i);
    if (r.thread != null) {
      pw.println("String_Node_Str" + r.pid + "String_Node_Str"+ r.processName+ "String_Node_Str");
      pw.flush();
      try {
        TransferPipe tp=new TransferPipe();
        try {
          r.thread.dumpGfxInfo(tp.getWriteFd().getFileDescriptor(),args);
          tp.go(fd);
        }
  finally {
          tp.kill();
        }
      }
 catch (      IOException e) {
        pw.println("String_Node_Str" + r);
        pw.flush();
      }
catch (      RemoteException e) {
        pw.println("String_Node_Str" + r);
        pw.flush();
      }
    }
  }
}
Program: 196625
Project: 196625
Buggy source:
private void instantCollapseNotificationPanel(){
  mNotificationPanel.setExpandedFraction(0);
}

Fixed version (ground truth):
private void instantCollapseNotificationPanel(){
  mNotificationPanel.instantCollapse();
}
Program: 196626
Project: 196626
Buggy source:
private void updateBackground(){
  if (mDimmed) {
    mBackgroundDimmed.setVisibility(View.VISIBLE);
    mBackgroundNormal.setVisibility(View.INVISIBLE);
  }
 else {
    mBackgroundDimmed.setVisibility(View.INVISIBLE);
    mBackgroundNormal.setVisibility(View.VISIBLE);
    mBackgroundNormal.setAlpha(1f);
    removeCallbacks(mTapTimeoutRunnable);
  }
}

Fixed version (ground truth):
private void updateBackground(){
  if (mDimmed) {
    mBackgroundDimmed.setVisibility(View.VISIBLE);
    mBackgroundNormal.setVisibility(View.INVISIBLE);
  }
 else {
    cancelFadeAnimations();
    mBackgroundDimmed.setVisibility(View.INVISIBLE);
    mBackgroundNormal.setVisibility(View.VISIBLE);
    mBackgroundNormal.setAlpha(1f);
    removeCallbacks(mTapTimeoutRunnable);
  }
}
Program: 196627
Project: 196627
Buggy source:
private void fadeBackground(){
  if (mDimmed) {
    mBackgroundDimmed.setVisibility(View.VISIBLE);
  }
 else {
    mBackgroundNormal.setVisibility(View.VISIBLE);
  }
  float startAlpha=mDimmed ? 1f : 0;
  float endAlpha=mDimmed ? 0 : 1f;
  int duration=BACKGROUND_ANIMATION_LENGTH_MS;
  if (mBackgroundAnimator != null) {
    startAlpha=(Float)mBackgroundAnimator.getAnimatedValue();
    duration=(int)mBackgroundAnimator.getCurrentPlayTime();
    mBackgroundAnimator.removeAllListeners();
    mBackgroundAnimator.cancel();
    if (duration <= 0) {
      updateBackground();
      return;
    }
  }
  mBackgroundNormal.setAlpha(startAlpha);
  mBackgroundAnimator=ObjectAnimator.ofFloat(mBackgroundNormal,View.ALPHA,startAlpha,endAlpha);
  mBackgroundAnimator.setInterpolator(mFastOutSlowInInterpolator);
  mBackgroundAnimator.setDuration(duration);
  mBackgroundAnimator.addListener(new AnimatorListenerAdapter(){
    @Override public void onAnimationEnd(    Animator animation){
      if (mDimmed) {
        mBackgroundNormal.setVisibility(View.INVISIBLE);
      }
 else {
        mBackgroundDimmed.setVisibility(View.INVISIBLE);
      }
      mBackgroundAnimator=null;
    }
  }
);
  mBackgroundAnimator.start();
}

Fixed version (ground truth):
private void fadeBackground(){
  mBackgroundNormal.animate().cancel();
  if (mDimmed) {
    mBackgroundDimmed.setVisibility(View.VISIBLE);
  }
 else {
    mBackgroundNormal.setVisibility(View.VISIBLE);
  }
  float startAlpha=mDimmed ? 1f : 0;
  float endAlpha=mDimmed ? 0 : 1f;
  int duration=BACKGROUND_ANIMATION_LENGTH_MS;
  if (mBackgroundAnimator != null) {
    startAlpha=(Float)mBackgroundAnimator.getAnimatedValue();
    duration=(int)mBackgroundAnimator.getCurrentPlayTime();
    mBackgroundAnimator.removeAllListeners();
    mBackgroundAnimator.cancel();
    if (duration <= 0) {
      updateBackground();
      return;
    }
  }
  mBackgroundNormal.setAlpha(startAlpha);
  mBackgroundAnimator=ObjectAnimator.ofFloat(mBackgroundNormal,View.ALPHA,startAlpha,endAlpha);
  mBackgroundAnimator.setInterpolator(mFastOutSlowInInterpolator);
  mBackgroundAnimator.setDuration(duration);
  mBackgroundAnimator.addListener(new AnimatorListenerAdapter(){
    @Override public void onAnimationEnd(    Animator animation){
      if (mDimmed) {
        mBackgroundNormal.setVisibility(View.INVISIBLE);
      }
 else {
        mBackgroundDimmed.setVisibility(View.INVISIBLE);
      }
      mBackgroundAnimator=null;
    }
  }
);
  mBackgroundAnimator.start();
}
Program: 196628
Project: 196628
Buggy source:
private void updateBackground(){
  if (mDimmed) {
    mBackgroundDimmed.setVisibility(View.VISIBLE);
    mBackgroundNormal.setVisibility(View.INVISIBLE);
  }
 else {
    mBackgroundDimmed.setVisibility(View.INVISIBLE);
    mBackgroundNormal.setVisibility(View.VISIBLE);
    mBackgroundNormal.setAlpha(1f);
    removeCallbacks(mTapTimeoutRunnable);
  }
}

Fixed version (ground truth):
private void updateBackground(){
  if (mDimmed) {
    mBackgroundDimmed.setVisibility(View.VISIBLE);
    mBackgroundNormal.setVisibility(View.INVISIBLE);
  }
 else {
    cancelFadeAnimations();
    mBackgroundDimmed.setVisibility(View.INVISIBLE);
    mBackgroundNormal.setVisibility(View.VISIBLE);
    mBackgroundNormal.setAlpha(1f);
    removeCallbacks(mTapTimeoutRunnable);
  }
}
Program: 196629
Project: 196629
Buggy source:
private void fadeBackground(){
  if (mDimmed) {
    mBackgroundDimmed.setVisibility(View.VISIBLE);
  }
 else {
    mBackgroundNormal.setVisibility(View.VISIBLE);
  }
  float startAlpha=mDimmed ? 1f : 0;
  float endAlpha=mDimmed ? 0 : 1f;
  int duration=BACKGROUND_ANIMATION_LENGTH_MS;
  if (mBackgroundAnimator != null) {
    startAlpha=(Float)mBackgroundAnimator.getAnimatedValue();
    duration=(int)mBackgroundAnimator.getCurrentPlayTime();
    mBackgroundAnimator.removeAllListeners();
    mBackgroundAnimator.cancel();
    if (duration <= 0) {
      updateBackground();
      return;
    }
  }
  mBackgroundNormal.setAlpha(startAlpha);
  mBackgroundAnimator=ObjectAnimator.ofFloat(mBackgroundNormal,View.ALPHA,startAlpha,endAlpha);
  mBackgroundAnimator.setInterpolator(mFastOutSlowInInterpolator);
  mBackgroundAnimator.setDuration(duration);
  mBackgroundAnimator.addListener(new AnimatorListenerAdapter(){
    @Override public void onAnimationEnd(    Animator animation){
      if (mDimmed) {
        mBackgroundNormal.setVisibility(View.INVISIBLE);
      }
 else {
        mBackgroundDimmed.setVisibility(View.INVISIBLE);
      }
      mBackgroundAnimator=null;
    }
  }
);
  mBackgroundAnimator.start();
}

Fixed version (ground truth):
private void fadeBackground(){
  mBackgroundNormal.animate().cancel();
  if (mDimmed) {
    mBackgroundDimmed.setVisibility(View.VISIBLE);
  }
 else {
    mBackgroundNormal.setVisibility(View.VISIBLE);
  }
  float startAlpha=mDimmed ? 1f : 0;
  float endAlpha=mDimmed ? 0 : 1f;
  int duration=BACKGROUND_ANIMATION_LENGTH_MS;
  if (mBackgroundAnimator != null) {
    startAlpha=(Float)mBackgroundAnimator.getAnimatedValue();
    duration=(int)mBackgroundAnimator.getCurrentPlayTime();
    mBackgroundAnimator.removeAllListeners();
    mBackgroundAnimator.cancel();
    if (duration <= 0) {
      updateBackground();
      return;
    }
  }
  mBackgroundNormal.setAlpha(startAlpha);
  mBackgroundAnimator=ObjectAnimator.ofFloat(mBackgroundNormal,View.ALPHA,startAlpha,endAlpha);
  mBackgroundAnimator.setInterpolator(mFastOutSlowInInterpolator);
  mBackgroundAnimator.setDuration(duration);
  mBackgroundAnimator.addListener(new AnimatorListenerAdapter(){
    @Override public void onAnimationEnd(    Animator animation){
      if (mDimmed) {
        mBackgroundNormal.setVisibility(View.INVISIBLE);
      }
 else {
        mBackgroundDimmed.setVisibility(View.INVISIBLE);
      }
      mBackgroundAnimator=null;
    }
  }
);
  mBackgroundAnimator.start();
}
Program: 196632
Project: 196632
Buggy source:
/** 
 * @hide
 */
public static void dumpPackageStateStatic(FileDescriptor fd,String packageName){
  FileOutputStream fout=new FileOutputStream(fd);
  PrintWriter pw=new FastPrintWriter(fout);
  dumpService(pw,fd,Context.ACTIVITY_SERVICE,new String[]{"String_Node_Str","String_Node_Str",packageName});
  pw.println();
  dumpService(pw,fd,"String_Node_Str",new String[]{"String_Node_Str",packageName});
  pw.println();
  dumpService(pw,fd,ProcessStats.SERVICE_NAME,new String[]{"String_Node_Str",packageName});
  pw.println();
  dumpService(pw,fd,"String_Node_Str",new String[]{"String_Node_Str",packageName});
  pw.println();
  dumpService(pw,fd,"String_Node_Str",new String[]{packageName});
  pw.println();
  dumpService(pw,fd,BatteryStats.SERVICE_NAME,new String[]{packageName});
  pw.flush();
}

Fixed version (ground truth):
/** 
 * @hide
 */
public static void dumpPackageStateStatic(FileDescriptor fd,String packageName){
  FileOutputStream fout=new FileOutputStream(fd);
  PrintWriter pw=new FastPrintWriter(fout);
  dumpService(pw,fd,"String_Node_Str",new String[]{packageName});
  pw.println();
  dumpService(pw,fd,Context.ACTIVITY_SERVICE,new String[]{"String_Node_Str","String_Node_Str",packageName});
  pw.println();
  dumpService(pw,fd,"String_Node_Str",new String[]{"String_Node_Str","String_Node_Str",packageName});
  pw.println();
  dumpService(pw,fd,ProcessStats.SERVICE_NAME,new String[]{packageName});
  pw.println();
  dumpService(pw,fd,"String_Node_Str",new String[]{"String_Node_Str",packageName});
  pw.println();
  dumpService(pw,fd,BatteryStats.SERVICE_NAME,new String[]{packageName});
  pw.flush();
}
Program: 196633
Project: 196633
Buggy source:
private static void dumpService(PrintWriter pw,FileDescriptor fd,String name,String[] args){
  pw.print("String_Node_Str");
  pw.print(name);
  pw.println("String_Node_Str");
  IBinder service=ServiceManager.checkService(name);
  if (service == null) {
    pw.println("String_Node_Str");
    return;
  }
  TransferPipe tp=null;
  try {
    pw.flush();
    tp=new TransferPipe();
    tp.setBufferPrefix("String_Node_Str");
    service.dumpAsync(tp.getWriteFd().getFileDescriptor(),args);
    tp.go(fd);
  }
 catch (  Throwable e) {
    if (tp != null) {
      tp.kill();
    }
    pw.println("String_Node_Str");
    e.printStackTrace(pw);
  }
}

Fixed version (ground truth):
private static void dumpService(PrintWriter pw,FileDescriptor fd,String name,String[] args){
  pw.print("String_Node_Str");
  pw.print(name);
  pw.println("String_Node_Str");
  IBinder service=ServiceManager.checkService(name);
  if (service == null) {
    pw.println("String_Node_Str");
    return;
  }
  TransferPipe tp=null;
  try {
    pw.flush();
    tp=new TransferPipe();
    tp.setBufferPrefix("String_Node_Str");
    service.dumpAsync(tp.getWriteFd().getFileDescriptor(),args);
    tp.go(fd,10000);
  }
 catch (  Throwable e) {
    if (tp != null) {
      tp.kill();
    }
    pw.println("String_Node_Str");
    e.printStackTrace(pw);
  }
}