nus-yam/ex-repair huggingface dataset:
Program: 244
Project: 244
Buggy source:
public void applyNewOwner(Object newOwner){
  if (mOwner != newOwner) {
    if (mOwner == null) {
      mOwner=newOwner;
      mProc.incActiveServices(mName);
    }
 else {
      mOwner=newOwner;
      if (mStartedState != STATE_NOTHING || mBoundState != STATE_NOTHING || mExecState != STATE_NOTHING) {
        long now=SystemClock.uptimeMillis();
        if (mStartedState != STATE_NOTHING) {
          if (DEBUG)           Slog.d(TAG,"String_Node_Str" + newOwner + "String_Node_Str"+ mOwner+ "String_Node_Str"+ mPackage+ "String_Node_Str"+ mName+ "String_Node_Str"+ mProc);
          setStarted(false,0,now);
        }
        if (mBoundState != STATE_NOTHING) {
          if (DEBUG)           Slog.d(TAG,"String_Node_Str" + newOwner + "String_Node_Str"+ mOwner+ "String_Node_Str"+ mPackage+ "String_Node_Str"+ mName+ "String_Node_Str"+ mProc);
          setBound(false,0,now);
        }
        if (mExecState != STATE_NOTHING) {
          if (DEBUG)           Slog.d(TAG,"String_Node_Str" + newOwner + "String_Node_Str"+ mOwner+ "String_Node_Str"+ mPackage+ "String_Node_Str"+ mName+ "String_Node_Str"+ mProc);
          setExecuting(false,0,now);
        }
      }
    }
  }
}

Fixed version (ground truth):
public void applyNewOwner(Object newOwner){
  if (mOwner != newOwner) {
    if (mOwner == null) {
      mOwner=newOwner;
      mProc.incActiveServices(mName);
    }
 else {
      mOwner=newOwner;
      if (mStarted || mBoundState != STATE_NOTHING || mExecState != STATE_NOTHING) {
        long now=SystemClock.uptimeMillis();
        if (mStarted) {
          if (DEBUG)           Slog.d(TAG,"String_Node_Str" + newOwner + "String_Node_Str"+ mOwner+ "String_Node_Str"+ mPackage+ "String_Node_Str"+ mName+ "String_Node_Str"+ mProc);
          setStarted(false,0,now);
        }
        if (mBoundState != STATE_NOTHING) {
          if (DEBUG)           Slog.d(TAG,"String_Node_Str" + newOwner + "String_Node_Str"+ mOwner+ "String_Node_Str"+ mPackage+ "String_Node_Str"+ mName+ "String_Node_Str"+ mProc);
          setBound(false,0,now);
        }
        if (mExecState != STATE_NOTHING) {
          if (DEBUG)           Slog.d(TAG,"String_Node_Str" + newOwner + "String_Node_Str"+ mOwner+ "String_Node_Str"+ mPackage+ "String_Node_Str"+ mName+ "String_Node_Str"+ mProc);
          setExecuting(false,0,now);
        }
      }
    }
  }
}
Program: 246
Project: 246
Buggy source:
public void setStarted(boolean started,int memFactor,long now){
  if (mOwner == null) {
    Slog.wtf(TAG,"String_Node_Str" + this + "String_Node_Str");
  }
  final boolean wasStarted=mStartedState != STATE_NOTHING;
  final int state=started ? memFactor : STATE_NOTHING;
  if (mStartedState != state) {
    if (mStartedState != STATE_NOTHING) {
      addDuration(SERVICE_STARTED + (mStartedState * SERVICE_COUNT),now - mStartedStartTime);
    }
 else     if (started) {
      mStartedCount++;
    }
    mStartedState=state;
    mStartedStartTime=now;
    mProc=mProc.pullFixedProc(mPackage);
    if (wasStarted != started) {
      if (started) {
        mProc.incStartedServices(memFactor,now);
      }
 else {
        mProc.decStartedServices(memFactor,now);
      }
    }
    updateRunning(memFactor,now);
  }
}

Fixed version (ground truth):
public void setStarted(boolean started,int memFactor,long now){
  if (mOwner == null) {
    Slog.wtf(TAG,"String_Node_Str" + this + "String_Node_Str");
  }
  mStarted=started;
  updateStartedState(memFactor,now);
}
Program: 248
Project: 248
Buggy source:
void decStartedServices(int memFactor,long now){
  if (mCommonProcess != this) {
    mCommonProcess.decStartedServices(memFactor,now);
  }
  mNumStartedServices--;
  if (mNumStartedServices == 0 && mCurState == STATE_SERVICE_RESTARTING) {
    setState(STATE_NOTHING,memFactor,now,null);
  }
 else   if (mNumStartedServices < 0) {
    Slog.wtfStack(TAG,"String_Node_Str" + mPackage + "String_Node_Str"+ mUid+ "String_Node_Str"+ mName);
    mNumStartedServices=0;
  }
}

Fixed version (ground truth):
void decStartedServices(int memFactor,long now,String serviceName){
  if (false) {
    RuntimeException here=new RuntimeException("String_Node_Str");
    here.fillInStackTrace();
    Slog.d(TAG,"String_Node_Str" + this + "String_Node_Str"+ serviceName+ "String_Node_Str"+ (mNumStartedServices - 1),here);
  }
  if (mCommonProcess != this) {
    mCommonProcess.decStartedServices(memFactor,now,serviceName);
  }
  mNumStartedServices--;
  if (mNumStartedServices == 0 && (mCurState % STATE_COUNT) == STATE_SERVICE_RESTARTING) {
    setState(STATE_NOTHING,now);
  }
 else   if (mNumStartedServices < 0) {
    Slog.wtfStack(TAG,"String_Node_Str" + mPackage + "String_Node_Str"+ mUid+ "String_Node_Str"+ mName);
    mNumStartedServices=0;
  }
}
Program: 249
Project: 249
Buggy source:
private final boolean unscheduleServiceRestartLocked(ServiceRecord r,int callingUid){
  if (r.restartDelay == 0) {
    return false;
  }
  boolean removed=mRestartingServices.remove(r);
  if (removed || callingUid != r.appInfo.uid) {
    r.resetRestartCounter();
  }
  mAm.mHandler.removeCallbacks(r.restarter);
  return true;
}

Fixed version (ground truth):
private final boolean unscheduleServiceRestartLocked(ServiceRecord r,int callingUid){
  if (r.restartDelay == 0) {
    return false;
  }
  boolean removed=mRestartingServices.remove(r);
  if (removed || callingUid != r.appInfo.uid) {
    r.resetRestartCounter();
  }
  if (removed) {
    r.clearRestarting(mAm.mProcessStats.getMemFactorLocked(),SystemClock.uptimeMillis());
  }
  mAm.mHandler.removeCallbacks(r.restarter);
  return true;
}
Program: 257
Project: 257
Buggy source:
@Override public boolean getPadding(Rect padding){
  final Rect r=mDrawableContainerState.getConstantPadding();
  boolean result=true;
  if (r != null) {
    padding.set(r);
  }
 else {
    if (mCurrDrawable != null) {
      result=mCurrDrawable.getPadding(padding);
    }
 else {
      result=super.getPadding(padding);
    }
  }
  if (needsMirroring()) {
    final int left=padding.left;
    final int right=padding.right;
    padding.left=right;
    padding.right=left;
  }
  return result;
}

Fixed version (ground truth):
@Override public boolean getPadding(Rect padding){
  final Rect r=mDrawableContainerState.getConstantPadding();
  boolean result;
  if (r != null) {
    padding.set(r);
    result=(r.left | r.top | r.bottom| r.right) != 0;
  }
 else {
    if (mCurrDrawable != null) {
      result=mCurrDrawable.getPadding(padding);
    }
 else {
      result=super.getPadding(padding);
    }
  }
  if (needsMirroring()) {
    final int left=padding.left;
    final int right=padding.right;
    padding.left=right;
    padding.right=left;
  }
  return result;
}
Program: 258
Project: 258
Buggy source:
@Override public boolean getPadding(Rect padding){
  if (needsMirroring()) {
    padding.set(mPadding.right,mPadding.top,mPadding.left,mPadding.bottom);
  }
 else {
    padding.set(mPadding);
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean getPadding(Rect padding){
  if (needsMirroring()) {
    padding.set(mPadding.right,mPadding.top,mPadding.left,mPadding.bottom);
  }
 else {
    padding.set(mPadding);
  }
  return (padding.left | padding.top | padding.right| padding.bottom) != 0;
}
Program: 259
Project: 259
Buggy source:
@Override public boolean getPadding(Rect padding){
  final Rect r=mDrawableContainerState.getConstantPadding();
  boolean result=true;
  if (r != null) {
    padding.set(r);
  }
 else {
    if (mCurrDrawable != null) {
      result=mCurrDrawable.getPadding(padding);
    }
 else {
      result=super.getPadding(padding);
    }
  }
  if (needsMirroring()) {
    final int left=padding.left;
    final int right=padding.right;
    padding.left=right;
    padding.right=left;
  }
  return result;
}

Fixed version (ground truth):
@Override public boolean getPadding(Rect padding){
  final Rect r=mDrawableContainerState.getConstantPadding();
  boolean result;
  if (r != null) {
    padding.set(r);
    result=(r.left | r.top | r.bottom| r.right) != 0;
  }
 else {
    if (mCurrDrawable != null) {
      result=mCurrDrawable.getPadding(padding);
    }
 else {
      result=super.getPadding(padding);
    }
  }
  if (needsMirroring()) {
    final int left=padding.left;
    final int right=padding.right;
    padding.left=right;
    padding.right=left;
  }
  return result;
}
Program: 260
Project: 260
Buggy source:
@Override public boolean getPadding(Rect padding){
  if (needsMirroring()) {
    padding.set(mPadding.right,mPadding.top,mPadding.left,mPadding.bottom);
  }
 else {
    padding.set(mPadding);
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean getPadding(Rect padding){
  if (needsMirroring()) {
    padding.set(mPadding.right,mPadding.top,mPadding.left,mPadding.bottom);
  }
 else {
    padding.set(mPadding);
  }
  return (padding.left | padding.top | padding.right| padding.bottom) != 0;
}
Program: 261
Project: 261
Buggy source:
@Override public boolean getPadding(Rect padding){
  final Rect r=mDrawableContainerState.getConstantPadding();
  boolean result=true;
  if (r != null) {
    padding.set(r);
  }
 else {
    if (mCurrDrawable != null) {
      result=mCurrDrawable.getPadding(padding);
    }
 else {
      result=super.getPadding(padding);
    }
  }
  if (needsMirroring()) {
    final int left=padding.left;
    final int right=padding.right;
    padding.left=right;
    padding.right=left;
  }
  return result;
}

Fixed version (ground truth):
@Override public boolean getPadding(Rect padding){
  final Rect r=mDrawableContainerState.getConstantPadding();
  boolean result;
  if (r != null) {
    padding.set(r);
    result=(r.left | r.top | r.bottom| r.right) != 0;
  }
 else {
    if (mCurrDrawable != null) {
      result=mCurrDrawable.getPadding(padding);
    }
 else {
      result=super.getPadding(padding);
    }
  }
  if (needsMirroring()) {
    final int left=padding.left;
    final int right=padding.right;
    padding.left=right;
    padding.right=left;
  }
  return result;
}
Program: 262
Project: 262
Buggy source:
@Override public boolean getPadding(Rect padding){
  if (needsMirroring()) {
    padding.set(mPadding.right,mPadding.top,mPadding.left,mPadding.bottom);
  }
 else {
    padding.set(mPadding);
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean getPadding(Rect padding){
  if (needsMirroring()) {
    padding.set(mPadding.right,mPadding.top,mPadding.left,mPadding.bottom);
  }
 else {
    padding.set(mPadding);
  }
  return (padding.left | padding.top | padding.right| padding.bottom) != 0;
}
Program: 263
Project: 263
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",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,"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,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();
}
Program: 264
Project: 264
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.dump(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);
  }
 catch (  Throwable e) {
    if (tp != null) {
      tp.kill();
    }
    pw.println("String_Node_Str");
    e.printStackTrace(pw);
  }
}
Program: 265
Project: 265
Buggy source:
public void clearCurrentOwner(Object owner,boolean silently){
  if (mOwner == owner) {
    mProc.decActiveServices(mName);
    if (mStartedState != STATE_NOTHING || mBoundState != STATE_NOTHING || mExecState != STATE_NOTHING) {
      long now=SystemClock.uptimeMillis();
      if (mStartedState != STATE_NOTHING) {
        if (!silently) {
          Slog.wtfStack(TAG,"String_Node_Str" + owner + "String_Node_Str"+ mPackage+ "String_Node_Str"+ mName+ "String_Node_Str"+ mProc);
        }
        setStarted(false,0,now);
      }
      if (mBoundState != STATE_NOTHING) {
        if (!silently) {
          Slog.wtfStack(TAG,"String_Node_Str" + owner + "String_Node_Str"+ mPackage+ "String_Node_Str"+ mName+ "String_Node_Str"+ mProc);
        }
        setBound(false,0,now);
      }
      if (mExecState != STATE_NOTHING) {
        if (!silently) {
          Slog.wtfStack(TAG,"String_Node_Str" + owner + "String_Node_Str"+ mPackage+ "String_Node_Str"+ mName+ "String_Node_Str"+ mProc);
        }
        setExecuting(false,0,now);
      }
    }
    mOwner=null;
  }
}

Fixed version (ground truth):
public void clearCurrentOwner(Object owner,boolean silently){
  if (mOwner == owner) {
    mProc.decActiveServices(mName);
    if (mStarted || mBoundState != STATE_NOTHING || mExecState != STATE_NOTHING) {
      long now=SystemClock.uptimeMillis();
      if (mStarted) {
        if (!silently) {
          Slog.wtfStack(TAG,"String_Node_Str" + owner + "String_Node_Str"+ mPackage+ "String_Node_Str"+ mName+ "String_Node_Str"+ mProc);
        }
        setStarted(false,0,now);
      }
      if (mBoundState != STATE_NOTHING) {
        if (!silently) {
          Slog.wtfStack(TAG,"String_Node_Str" + owner + "String_Node_Str"+ mPackage+ "String_Node_Str"+ mName+ "String_Node_Str"+ mProc);
        }
        setBound(false,0,now);
      }
      if (mExecState != STATE_NOTHING) {
        if (!silently) {
          Slog.wtfStack(TAG,"String_Node_Str" + owner + "String_Node_Str"+ mPackage+ "String_Node_Str"+ mName+ "String_Node_Str"+ mProc);
        }
        setExecuting(false,0,now);
      }
    }
    mOwner=null;
  }
}
Program: 266
Project: 266
Buggy source:
void incStartedServices(int memFactor,long now){
  if (mCommonProcess != this) {
    mCommonProcess.incStartedServices(memFactor,now);
  }
  mNumStartedServices++;
  if (mNumStartedServices == 1 && mCurState == STATE_NOTHING) {
    setState(STATE_NOTHING,memFactor,now,null);
  }
}

Fixed version (ground truth):
void incStartedServices(int memFactor,long now,String serviceName){
  if (false) {
    RuntimeException here=new RuntimeException("String_Node_Str");
    here.fillInStackTrace();
    Slog.d(TAG,"String_Node_Str" + this + "String_Node_Str"+ serviceName+ "String_Node_Str"+ (mNumStartedServices + 1),here);
  }
  if (mCommonProcess != this) {
    mCommonProcess.incStartedServices(memFactor,now,serviceName);
  }
  mNumStartedServices++;
  if (mNumStartedServices == 1 && mCurState == STATE_NOTHING) {
    setState(STATE_SERVICE_RESTARTING + (memFactor * STATE_COUNT),now);
  }
}
Program: 267
Project: 267
Buggy source:
public void applyNewOwner(Object newOwner){
  if (mOwner != newOwner) {
    if (mOwner == null) {
      mOwner=newOwner;
      mProc.incActiveServices(mName);
    }
 else {
      mOwner=newOwner;
      if (mStartedState != STATE_NOTHING || mBoundState != STATE_NOTHING || mExecState != STATE_NOTHING) {
        long now=SystemClock.uptimeMillis();
        if (mStartedState != STATE_NOTHING) {
          if (DEBUG)           Slog.d(TAG,"String_Node_Str" + newOwner + "String_Node_Str"+ mOwner+ "String_Node_Str"+ mPackage+ "String_Node_Str"+ mName+ "String_Node_Str"+ mProc);
          setStarted(false,0,now);
        }
        if (mBoundState != STATE_NOTHING) {
          if (DEBUG)           Slog.d(TAG,"String_Node_Str" + newOwner + "String_Node_Str"+ mOwner+ "String_Node_Str"+ mPackage+ "String_Node_Str"+ mName+ "String_Node_Str"+ mProc);
          setBound(false,0,now);
        }
        if (mExecState != STATE_NOTHING) {
          if (DEBUG)           Slog.d(TAG,"String_Node_Str" + newOwner + "String_Node_Str"+ mOwner+ "String_Node_Str"+ mPackage+ "String_Node_Str"+ mName+ "String_Node_Str"+ mProc);
          setExecuting(false,0,now);
        }
      }
    }
  }
}

Fixed version (ground truth):
public void applyNewOwner(Object newOwner){
  if (mOwner != newOwner) {
    if (mOwner == null) {
      mOwner=newOwner;
      mProc.incActiveServices(mName);
    }
 else {
      mOwner=newOwner;
      if (mStarted || mBoundState != STATE_NOTHING || mExecState != STATE_NOTHING) {
        long now=SystemClock.uptimeMillis();
        if (mStarted) {
          if (DEBUG)           Slog.d(TAG,"String_Node_Str" + newOwner + "String_Node_Str"+ mOwner+ "String_Node_Str"+ mPackage+ "String_Node_Str"+ mName+ "String_Node_Str"+ mProc);
          setStarted(false,0,now);
        }
        if (mBoundState != STATE_NOTHING) {
          if (DEBUG)           Slog.d(TAG,"String_Node_Str" + newOwner + "String_Node_Str"+ mOwner+ "String_Node_Str"+ mPackage+ "String_Node_Str"+ mName+ "String_Node_Str"+ mProc);
          setBound(false,0,now);
        }
        if (mExecState != STATE_NOTHING) {
          if (DEBUG)           Slog.d(TAG,"String_Node_Str" + newOwner + "String_Node_Str"+ mOwner+ "String_Node_Str"+ mPackage+ "String_Node_Str"+ mName+ "String_Node_Str"+ mProc);
          setExecuting(false,0,now);
        }
      }
    }
  }
}
Program: 269
Project: 269
Buggy source:
public void setStarted(boolean started,int memFactor,long now){
  if (mOwner == null) {
    Slog.wtf(TAG,"String_Node_Str" + this + "String_Node_Str");
  }
  final boolean wasStarted=mStartedState != STATE_NOTHING;
  final int state=started ? memFactor : STATE_NOTHING;
  if (mStartedState != state) {
    if (mStartedState != STATE_NOTHING) {
      addDuration(SERVICE_STARTED + (mStartedState * SERVICE_COUNT),now - mStartedStartTime);
    }
 else     if (started) {
      mStartedCount++;
    }
    mStartedState=state;
    mStartedStartTime=now;
    mProc=mProc.pullFixedProc(mPackage);
    if (wasStarted != started) {
      if (started) {
        mProc.incStartedServices(memFactor,now);
      }
 else {
        mProc.decStartedServices(memFactor,now);
      }
    }
    updateRunning(memFactor,now);
  }
}

Fixed version (ground truth):
public void setStarted(boolean started,int memFactor,long now){
  if (mOwner == null) {
    Slog.wtf(TAG,"String_Node_Str" + this + "String_Node_Str");
  }
  mStarted=started;
  updateStartedState(memFactor,now);
}
Program: 271
Project: 271
Buggy source:
void decStartedServices(int memFactor,long now){
  if (mCommonProcess != this) {
    mCommonProcess.decStartedServices(memFactor,now);
  }
  mNumStartedServices--;
  if (mNumStartedServices == 0 && mCurState == STATE_SERVICE_RESTARTING) {
    setState(STATE_NOTHING,memFactor,now,null);
  }
 else   if (mNumStartedServices < 0) {
    Slog.wtfStack(TAG,"String_Node_Str" + mPackage + "String_Node_Str"+ mUid+ "String_Node_Str"+ mName);
    mNumStartedServices=0;
  }
}

Fixed version (ground truth):
void decStartedServices(int memFactor,long now,String serviceName){
  if (false) {
    RuntimeException here=new RuntimeException("String_Node_Str");
    here.fillInStackTrace();
    Slog.d(TAG,"String_Node_Str" + this + "String_Node_Str"+ serviceName+ "String_Node_Str"+ (mNumStartedServices - 1),here);
  }
  if (mCommonProcess != this) {
    mCommonProcess.decStartedServices(memFactor,now,serviceName);
  }
  mNumStartedServices--;
  if (mNumStartedServices == 0 && (mCurState % STATE_COUNT) == STATE_SERVICE_RESTARTING) {
    setState(STATE_NOTHING,now);
  }
 else   if (mNumStartedServices < 0) {
    Slog.wtfStack(TAG,"String_Node_Str" + mPackage + "String_Node_Str"+ mUid+ "String_Node_Str"+ mName);
    mNumStartedServices=0;
  }
}
Program: 272
Project: 272
Buggy source:
private final boolean unscheduleServiceRestartLocked(ServiceRecord r,int callingUid){
  if (r.restartDelay == 0) {
    return false;
  }
  boolean removed=mRestartingServices.remove(r);
  if (removed || callingUid != r.appInfo.uid) {
    r.resetRestartCounter();
  }
  mAm.mHandler.removeCallbacks(r.restarter);
  return true;
}

Fixed version (ground truth):
private final boolean unscheduleServiceRestartLocked(ServiceRecord r,int callingUid){
  if (r.restartDelay == 0) {
    return false;
  }
  boolean removed=mRestartingServices.remove(r);
  if (removed || callingUid != r.appInfo.uid) {
    r.resetRestartCounter();
  }
  if (removed) {
    r.clearRestarting(mAm.mProcessStats.getMemFactorLocked(),SystemClock.uptimeMillis());
  }
  mAm.mHandler.removeCallbacks(r.restarter);
  return true;
}
Program: 280
Project: 280
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",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,"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,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();
}
Program: 281
Project: 281
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.dump(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);
  }
 catch (  Throwable e) {
    if (tp != null) {
      tp.kill();
    }
    pw.println("String_Node_Str");
    e.printStackTrace(pw);
  }
}
Program: 282
Project: 282
Buggy source:
public void clearCurrentOwner(Object owner,boolean silently){
  if (mOwner == owner) {
    mProc.decActiveServices(mName);
    if (mStartedState != STATE_NOTHING || mBoundState != STATE_NOTHING || mExecState != STATE_NOTHING) {
      long now=SystemClock.uptimeMillis();
      if (mStartedState != STATE_NOTHING) {
        if (!silently) {
          Slog.wtfStack(TAG,"String_Node_Str" + owner + "String_Node_Str"+ mPackage+ "String_Node_Str"+ mName+ "String_Node_Str"+ mProc);
        }
        setStarted(false,0,now);
      }
      if (mBoundState != STATE_NOTHING) {
        if (!silently) {
          Slog.wtfStack(TAG,"String_Node_Str" + owner + "String_Node_Str"+ mPackage+ "String_Node_Str"+ mName+ "String_Node_Str"+ mProc);
        }
        setBound(false,0,now);
      }
      if (mExecState != STATE_NOTHING) {
        if (!silently) {
          Slog.wtfStack(TAG,"String_Node_Str" + owner + "String_Node_Str"+ mPackage+ "String_Node_Str"+ mName+ "String_Node_Str"+ mProc);
        }
        setExecuting(false,0,now);
      }
    }
    mOwner=null;
  }
}

Fixed version (ground truth):
public void clearCurrentOwner(Object owner,boolean silently){
  if (mOwner == owner) {
    mProc.decActiveServices(mName);
    if (mStarted || mBoundState != STATE_NOTHING || mExecState != STATE_NOTHING) {
      long now=SystemClock.uptimeMillis();
      if (mStarted) {
        if (!silently) {
          Slog.wtfStack(TAG,"String_Node_Str" + owner + "String_Node_Str"+ mPackage+ "String_Node_Str"+ mName+ "String_Node_Str"+ mProc);
        }
        setStarted(false,0,now);
      }
      if (mBoundState != STATE_NOTHING) {
        if (!silently) {
          Slog.wtfStack(TAG,"String_Node_Str" + owner + "String_Node_Str"+ mPackage+ "String_Node_Str"+ mName+ "String_Node_Str"+ mProc);
        }
        setBound(false,0,now);
      }
      if (mExecState != STATE_NOTHING) {
        if (!silently) {
          Slog.wtfStack(TAG,"String_Node_Str" + owner + "String_Node_Str"+ mPackage+ "String_Node_Str"+ mName+ "String_Node_Str"+ mProc);
        }
        setExecuting(false,0,now);
      }
    }
    mOwner=null;
  }
}
Program: 283
Project: 283
Buggy source:
void incStartedServices(int memFactor,long now){
  if (mCommonProcess != this) {
    mCommonProcess.incStartedServices(memFactor,now);
  }
  mNumStartedServices++;
  if (mNumStartedServices == 1 && mCurState == STATE_NOTHING) {
    setState(STATE_NOTHING,memFactor,now,null);
  }
}

Fixed version (ground truth):
void incStartedServices(int memFactor,long now,String serviceName){
  if (false) {
    RuntimeException here=new RuntimeException("String_Node_Str");
    here.fillInStackTrace();
    Slog.d(TAG,"String_Node_Str" + this + "String_Node_Str"+ serviceName+ "String_Node_Str"+ (mNumStartedServices + 1),here);
  }
  if (mCommonProcess != this) {
    mCommonProcess.incStartedServices(memFactor,now,serviceName);
  }
  mNumStartedServices++;
  if (mNumStartedServices == 1 && mCurState == STATE_NOTHING) {
    setState(STATE_SERVICE_RESTARTING + (memFactor * STATE_COUNT),now);
  }
}
Program: 284
Project: 284
Buggy source:
public void applyNewOwner(Object newOwner){
  if (mOwner != newOwner) {
    if (mOwner == null) {
      mOwner=newOwner;
      mProc.incActiveServices(mName);
    }
 else {
      mOwner=newOwner;
      if (mStartedState != STATE_NOTHING || mBoundState != STATE_NOTHING || mExecState != STATE_NOTHING) {
        long now=SystemClock.uptimeMillis();
        if (mStartedState != STATE_NOTHING) {
          if (DEBUG)           Slog.d(TAG,"String_Node_Str" + newOwner + "String_Node_Str"+ mOwner+ "String_Node_Str"+ mPackage+ "String_Node_Str"+ mName+ "String_Node_Str"+ mProc);
          setStarted(false,0,now);
        }
        if (mBoundState != STATE_NOTHING) {
          if (DEBUG)           Slog.d(TAG,"String_Node_Str" + newOwner + "String_Node_Str"+ mOwner+ "String_Node_Str"+ mPackage+ "String_Node_Str"+ mName+ "String_Node_Str"+ mProc);
          setBound(false,0,now);
        }
        if (mExecState != STATE_NOTHING) {
          if (DEBUG)           Slog.d(TAG,"String_Node_Str" + newOwner + "String_Node_Str"+ mOwner+ "String_Node_Str"+ mPackage+ "String_Node_Str"+ mName+ "String_Node_Str"+ mProc);
          setExecuting(false,0,now);
        }
      }
    }
  }
}

Fixed version (ground truth):
public void applyNewOwner(Object newOwner){
  if (mOwner != newOwner) {
    if (mOwner == null) {
      mOwner=newOwner;
      mProc.incActiveServices(mName);
    }
 else {
      mOwner=newOwner;
      if (mStarted || mBoundState != STATE_NOTHING || mExecState != STATE_NOTHING) {
        long now=SystemClock.uptimeMillis();
        if (mStarted) {
          if (DEBUG)           Slog.d(TAG,"String_Node_Str" + newOwner + "String_Node_Str"+ mOwner+ "String_Node_Str"+ mPackage+ "String_Node_Str"+ mName+ "String_Node_Str"+ mProc);
          setStarted(false,0,now);
        }
        if (mBoundState != STATE_NOTHING) {
          if (DEBUG)           Slog.d(TAG,"String_Node_Str" + newOwner + "String_Node_Str"+ mOwner+ "String_Node_Str"+ mPackage+ "String_Node_Str"+ mName+ "String_Node_Str"+ mProc);
          setBound(false,0,now);
        }
        if (mExecState != STATE_NOTHING) {
          if (DEBUG)           Slog.d(TAG,"String_Node_Str" + newOwner + "String_Node_Str"+ mOwner+ "String_Node_Str"+ mPackage+ "String_Node_Str"+ mName+ "String_Node_Str"+ mProc);
          setExecuting(false,0,now);
        }
      }
    }
  }
}
Program: 286
Project: 286
Buggy source:
public void setStarted(boolean started,int memFactor,long now){
  if (mOwner == null) {
    Slog.wtf(TAG,"String_Node_Str" + this + "String_Node_Str");
  }
  final boolean wasStarted=mStartedState != STATE_NOTHING;
  final int state=started ? memFactor : STATE_NOTHING;
  if (mStartedState != state) {
    if (mStartedState != STATE_NOTHING) {
      addDuration(SERVICE_STARTED + (mStartedState * SERVICE_COUNT),now - mStartedStartTime);
    }
 else     if (started) {
      mStartedCount++;
    }
    mStartedState=state;
    mStartedStartTime=now;
    mProc=mProc.pullFixedProc(mPackage);
    if (wasStarted != started) {
      if (started) {
        mProc.incStartedServices(memFactor,now);
      }
 else {
        mProc.decStartedServices(memFactor,now);
      }
    }
    updateRunning(memFactor,now);
  }
}

Fixed version (ground truth):
public void setStarted(boolean started,int memFactor,long now){
  if (mOwner == null) {
    Slog.wtf(TAG,"String_Node_Str" + this + "String_Node_Str");
  }
  mStarted=started;
  updateStartedState(memFactor,now);
}
Program: 288
Project: 288
Buggy source:
void decStartedServices(int memFactor,long now){
  if (mCommonProcess != this) {
    mCommonProcess.decStartedServices(memFactor,now);
  }
  mNumStartedServices--;
  if (mNumStartedServices == 0 && mCurState == STATE_SERVICE_RESTARTING) {
    setState(STATE_NOTHING,memFactor,now,null);
  }
 else   if (mNumStartedServices < 0) {
    Slog.wtfStack(TAG,"String_Node_Str" + mPackage + "String_Node_Str"+ mUid+ "String_Node_Str"+ mName);
    mNumStartedServices=0;
  }
}

Fixed version (ground truth):
void decStartedServices(int memFactor,long now,String serviceName){
  if (false) {
    RuntimeException here=new RuntimeException("String_Node_Str");
    here.fillInStackTrace();
    Slog.d(TAG,"String_Node_Str" + this + "String_Node_Str"+ serviceName+ "String_Node_Str"+ (mNumStartedServices - 1),here);
  }
  if (mCommonProcess != this) {
    mCommonProcess.decStartedServices(memFactor,now,serviceName);
  }
  mNumStartedServices--;
  if (mNumStartedServices == 0 && (mCurState % STATE_COUNT) == STATE_SERVICE_RESTARTING) {
    setState(STATE_NOTHING,now);
  }
 else   if (mNumStartedServices < 0) {
    Slog.wtfStack(TAG,"String_Node_Str" + mPackage + "String_Node_Str"+ mUid+ "String_Node_Str"+ mName);
    mNumStartedServices=0;
  }
}
Program: 289
Project: 289
Buggy source:
private final boolean unscheduleServiceRestartLocked(ServiceRecord r,int callingUid){
  if (r.restartDelay == 0) {
    return false;
  }
  boolean removed=mRestartingServices.remove(r);
  if (removed || callingUid != r.appInfo.uid) {
    r.resetRestartCounter();
  }
  mAm.mHandler.removeCallbacks(r.restarter);
  return true;
}

Fixed version (ground truth):
private final boolean unscheduleServiceRestartLocked(ServiceRecord r,int callingUid){
  if (r.restartDelay == 0) {
    return false;
  }
  boolean removed=mRestartingServices.remove(r);
  if (removed || callingUid != r.appInfo.uid) {
    r.resetRestartCounter();
  }
  if (removed) {
    r.clearRestarting(mAm.mProcessStats.getMemFactorLocked(),SystemClock.uptimeMillis());
  }
  mAm.mHandler.removeCallbacks(r.restarter);
  return true;
}
Program: 297
Project: 297
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",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,"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,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();
}
Program: 298
Project: 298
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.dump(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);
  }
 catch (  Throwable e) {
    if (tp != null) {
      tp.kill();
    }
    pw.println("String_Node_Str");
    e.printStackTrace(pw);
  }
}
Program: 299
Project: 299
Buggy source:
public void clearCurrentOwner(Object owner,boolean silently){
  if (mOwner == owner) {
    mProc.decActiveServices(mName);
    if (mStartedState != STATE_NOTHING || mBoundState != STATE_NOTHING || mExecState != STATE_NOTHING) {
      long now=SystemClock.uptimeMillis();
      if (mStartedState != STATE_NOTHING) {
        if (!silently) {
          Slog.wtfStack(TAG,"String_Node_Str" + owner + "String_Node_Str"+ mPackage+ "String_Node_Str"+ mName+ "String_Node_Str"+ mProc);
        }
        setStarted(false,0,now);
      }
      if (mBoundState != STATE_NOTHING) {
        if (!silently) {
          Slog.wtfStack(TAG,"String_Node_Str" + owner + "String_Node_Str"+ mPackage+ "String_Node_Str"+ mName+ "String_Node_Str"+ mProc);
        }
        setBound(false,0,now);
      }
      if (mExecState != STATE_NOTHING) {
        if (!silently) {
          Slog.wtfStack(TAG,"String_Node_Str" + owner + "String_Node_Str"+ mPackage+ "String_Node_Str"+ mName+ "String_Node_Str"+ mProc);
        }
        setExecuting(false,0,now);
      }
    }
    mOwner=null;
  }
}

Fixed version (ground truth):
public void clearCurrentOwner(Object owner,boolean silently){
  if (mOwner == owner) {
    mProc.decActiveServices(mName);
    if (mStarted || mBoundState != STATE_NOTHING || mExecState != STATE_NOTHING) {
      long now=SystemClock.uptimeMillis();
      if (mStarted) {
        if (!silently) {
          Slog.wtfStack(TAG,"String_Node_Str" + owner + "String_Node_Str"+ mPackage+ "String_Node_Str"+ mName+ "String_Node_Str"+ mProc);
        }
        setStarted(false,0,now);
      }
      if (mBoundState != STATE_NOTHING) {
        if (!silently) {
          Slog.wtfStack(TAG,"String_Node_Str" + owner + "String_Node_Str"+ mPackage+ "String_Node_Str"+ mName+ "String_Node_Str"+ mProc);
        }
        setBound(false,0,now);
      }
      if (mExecState != STATE_NOTHING) {
        if (!silently) {
          Slog.wtfStack(TAG,"String_Node_Str" + owner + "String_Node_Str"+ mPackage+ "String_Node_Str"+ mName+ "String_Node_Str"+ mProc);
        }
        setExecuting(false,0,now);
      }
    }
    mOwner=null;
  }
}
Program: 300
Project: 300
Buggy source:
void incStartedServices(int memFactor,long now){
  if (mCommonProcess != this) {
    mCommonProcess.incStartedServices(memFactor,now);
  }
  mNumStartedServices++;
  if (mNumStartedServices == 1 && mCurState == STATE_NOTHING) {
    setState(STATE_NOTHING,memFactor,now,null);
  }
}

Fixed version (ground truth):
void incStartedServices(int memFactor,long now,String serviceName){
  if (false) {
    RuntimeException here=new RuntimeException("String_Node_Str");
    here.fillInStackTrace();
    Slog.d(TAG,"String_Node_Str" + this + "String_Node_Str"+ serviceName+ "String_Node_Str"+ (mNumStartedServices + 1),here);
  }
  if (mCommonProcess != this) {
    mCommonProcess.incStartedServices(memFactor,now,serviceName);
  }
  mNumStartedServices++;
  if (mNumStartedServices == 1 && mCurState == STATE_NOTHING) {
    setState(STATE_SERVICE_RESTARTING + (memFactor * STATE_COUNT),now);
  }
}
Program: 301
Project: 301
Buggy source:
public void applyNewOwner(Object newOwner){
  if (mOwner != newOwner) {
    if (mOwner == null) {
      mOwner=newOwner;
      mProc.incActiveServices(mName);
    }
 else {
      mOwner=newOwner;
      if (mStartedState != STATE_NOTHING || mBoundState != STATE_NOTHING || mExecState != STATE_NOTHING) {
        long now=SystemClock.uptimeMillis();
        if (mStartedState != STATE_NOTHING) {
          if (DEBUG)           Slog.d(TAG,"String_Node_Str" + newOwner + "String_Node_Str"+ mOwner+ "String_Node_Str"+ mPackage+ "String_Node_Str"+ mName+ "String_Node_Str"+ mProc);
          setStarted(false,0,now);
        }
        if (mBoundState != STATE_NOTHING) {
          if (DEBUG)           Slog.d(TAG,"String_Node_Str" + newOwner + "String_Node_Str"+ mOwner+ "String_Node_Str"+ mPackage+ "String_Node_Str"+ mName+ "String_Node_Str"+ mProc);
          setBound(false,0,now);
        }
        if (mExecState != STATE_NOTHING) {
          if (DEBUG)           Slog.d(TAG,"String_Node_Str" + newOwner + "String_Node_Str"+ mOwner+ "String_Node_Str"+ mPackage+ "String_Node_Str"+ mName+ "String_Node_Str"+ mProc);
          setExecuting(false,0,now);
        }
      }
    }
  }
}

Fixed version (ground truth):
public void applyNewOwner(Object newOwner){
  if (mOwner != newOwner) {
    if (mOwner == null) {
      mOwner=newOwner;
      mProc.incActiveServices(mName);
    }
 else {
      mOwner=newOwner;
      if (mStarted || mBoundState != STATE_NOTHING || mExecState != STATE_NOTHING) {
        long now=SystemClock.uptimeMillis();
        if (mStarted) {
          if (DEBUG)           Slog.d(TAG,"String_Node_Str" + newOwner + "String_Node_Str"+ mOwner+ "String_Node_Str"+ mPackage+ "String_Node_Str"+ mName+ "String_Node_Str"+ mProc);
          setStarted(false,0,now);
        }
        if (mBoundState != STATE_NOTHING) {
          if (DEBUG)           Slog.d(TAG,"String_Node_Str" + newOwner + "String_Node_Str"+ mOwner+ "String_Node_Str"+ mPackage+ "String_Node_Str"+ mName+ "String_Node_Str"+ mProc);
          setBound(false,0,now);
        }
        if (mExecState != STATE_NOTHING) {
          if (DEBUG)           Slog.d(TAG,"String_Node_Str" + newOwner + "String_Node_Str"+ mOwner+ "String_Node_Str"+ mPackage+ "String_Node_Str"+ mName+ "String_Node_Str"+ mProc);
          setExecuting(false,0,now);
        }
      }
    }
  }
}
Program: 303
Project: 303
Buggy source:
public void setStarted(boolean started,int memFactor,long now){
  if (mOwner == null) {
    Slog.wtf(TAG,"String_Node_Str" + this + "String_Node_Str");
  }
  final boolean wasStarted=mStartedState != STATE_NOTHING;
  final int state=started ? memFactor : STATE_NOTHING;
  if (mStartedState != state) {
    if (mStartedState != STATE_NOTHING) {
      addDuration(SERVICE_STARTED + (mStartedState * SERVICE_COUNT),now - mStartedStartTime);
    }
 else     if (started) {
      mStartedCount++;
    }
    mStartedState=state;
    mStartedStartTime=now;
    mProc=mProc.pullFixedProc(mPackage);
    if (wasStarted != started) {
      if (started) {
        mProc.incStartedServices(memFactor,now);
      }
 else {
        mProc.decStartedServices(memFactor,now);
      }
    }
    updateRunning(memFactor,now);
  }
}

Fixed version (ground truth):
public void setStarted(boolean started,int memFactor,long now){
  if (mOwner == null) {
    Slog.wtf(TAG,"String_Node_Str" + this + "String_Node_Str");
  }
  mStarted=started;
  updateStartedState(memFactor,now);
}
Program: 305
Project: 305
Buggy source:
void decStartedServices(int memFactor,long now){
  if (mCommonProcess != this) {
    mCommonProcess.decStartedServices(memFactor,now);
  }
  mNumStartedServices--;
  if (mNumStartedServices == 0 && mCurState == STATE_SERVICE_RESTARTING) {
    setState(STATE_NOTHING,memFactor,now,null);
  }
 else   if (mNumStartedServices < 0) {
    Slog.wtfStack(TAG,"String_Node_Str" + mPackage + "String_Node_Str"+ mUid+ "String_Node_Str"+ mName);
    mNumStartedServices=0;
  }
}

Fixed version (ground truth):
void decStartedServices(int memFactor,long now,String serviceName){
  if (false) {
    RuntimeException here=new RuntimeException("String_Node_Str");
    here.fillInStackTrace();
    Slog.d(TAG,"String_Node_Str" + this + "String_Node_Str"+ serviceName+ "String_Node_Str"+ (mNumStartedServices - 1),here);
  }
  if (mCommonProcess != this) {
    mCommonProcess.decStartedServices(memFactor,now,serviceName);
  }
  mNumStartedServices--;
  if (mNumStartedServices == 0 && (mCurState % STATE_COUNT) == STATE_SERVICE_RESTARTING) {
    setState(STATE_NOTHING,now);
  }
 else   if (mNumStartedServices < 0) {
    Slog.wtfStack(TAG,"String_Node_Str" + mPackage + "String_Node_Str"+ mUid+ "String_Node_Str"+ mName);
    mNumStartedServices=0;
  }
}
Program: 306
Project: 306
Buggy source:
private final boolean unscheduleServiceRestartLocked(ServiceRecord r,int callingUid){
  if (r.restartDelay == 0) {
    return false;
  }
  boolean removed=mRestartingServices.remove(r);
  if (removed || callingUid != r.appInfo.uid) {
    r.resetRestartCounter();
  }
  mAm.mHandler.removeCallbacks(r.restarter);
  return true;
}

Fixed version (ground truth):
private final boolean unscheduleServiceRestartLocked(ServiceRecord r,int callingUid){
  if (r.restartDelay == 0) {
    return false;
  }
  boolean removed=mRestartingServices.remove(r);
  if (removed || callingUid != r.appInfo.uid) {
    r.resetRestartCounter();
  }
  if (removed) {
    r.clearRestarting(mAm.mProcessStats.getMemFactorLocked(),SystemClock.uptimeMillis());
  }
  mAm.mHandler.removeCallbacks(r.restarter);
  return true;
}
Program: 314
Project: 314
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",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,"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,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();
}
Program: 315
Project: 315
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.dump(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);
  }
 catch (  Throwable e) {
    if (tp != null) {
      tp.kill();
    }
    pw.println("String_Node_Str");
    e.printStackTrace(pw);
  }
}