nus-yam/ex-repair huggingface dataset:
Program: 1176
Project: 1176
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) {
    throw new IllegalStateException("String_Node_Str" + mPackage + "String_Node_Str"+ mUid+ "String_Node_Str"+ mName);
  }
}

Fixed version (ground truth):
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;
  }
}
Program: 1177
Project: 1177
Buggy source:
void decActiveServices(){
  if (mCommonProcess != this) {
    mCommonProcess.decActiveServices();
  }
  mNumActiveServices--;
  if (mNumActiveServices < 0) {
    throw new IllegalStateException("String_Node_Str" + mPackage + "String_Node_Str"+ mUid+ "String_Node_Str"+ mName);
  }
}

Fixed version (ground truth):
void decActiveServices(String serviceName){
  if (DEBUG && "String_Node_Str".equals(mName)) {
    RuntimeException here=new RuntimeException("String_Node_Str");
    here.fillInStackTrace();
    Slog.d(TAG,"String_Node_Str" + this + "String_Node_Str"+ serviceName+ "String_Node_Str"+ (mNumActiveServices - 1),here);
  }
  if (mCommonProcess != this) {
    mCommonProcess.decActiveServices(serviceName);
  }
  mNumActiveServices--;
  if (mNumActiveServices < 0) {
    Slog.wtfStack(TAG,"String_Node_Str" + mPackage + "String_Node_Str"+ mUid+ "String_Node_Str"+ mName+ "String_Node_Str"+ serviceName);
    mNumActiveServices=0;
  }
}
Program: 1178
Project: 1178
Buggy source:
private ProcessState pullFixedProc(ArrayMap<String,ProcessState> pkgList,int index){
  ProcessState proc=pkgList.valueAt(index);
  if (mDead && proc.mCommonProcess != proc) {
    Log.wtf(TAG,"String_Node_Str" + mName + "String_Node_Str"+ mPackage+ "String_Node_Str"+ mUid+ "String_Node_Str"+ mCommonProcess.mName);
    proc=mStats.getProcessStateLocked(proc.mPackage,proc.mUid,proc.mName);
  }
  if (proc.mMultiPackage) {
    PackageState pkg=mStats.mPackages.get(pkgList.keyAt(index),proc.mUid);
    if (pkg == null) {
      throw new IllegalStateException("String_Node_Str" + pkgList.keyAt(index) + "String_Node_Str"+ proc.mName);
    }
    proc=pkg.mProcesses.get(proc.mName);
    if (proc == null) {
      throw new IllegalStateException("String_Node_Str");
    }
    pkgList.setValueAt(index,proc);
  }
  return proc;
}

Fixed version (ground truth):
private ProcessState pullFixedProc(ArrayMap<String,ProcessState> pkgList,int index){
  ProcessState proc=pkgList.valueAt(index);
  if (mDead && proc.mCommonProcess != proc) {
    Log.wtf(TAG,"String_Node_Str" + mName + "String_Node_Str"+ mPackage+ "String_Node_Str"+ mUid+ "String_Node_Str"+ mCommonProcess.mName);
    proc=mStats.getProcessStateLocked(proc.mPackage,proc.mUid,proc.mName);
  }
  if (proc.mMultiPackage) {
    PackageState pkg=mStats.mPackages.get(pkgList.keyAt(index),proc.mUid);
    if (pkg == null) {
      throw new IllegalStateException("String_Node_Str" + pkgList.keyAt(index) + "String_Node_Str"+ proc.mUid+ "String_Node_Str"+ proc.mName);
    }
    proc=pkg.mProcesses.get(proc.mName);
    if (proc == null) {
      throw new IllegalStateException("String_Node_Str" + proc.mName + "String_Node_Str"+ pkg.mPackageName+ "String_Node_Str"+ pkg.mUid);
    }
    pkgList.setValueAt(index,proc);
  }
  return proc;
}
Program: 1179
Project: 1179
Buggy source:
ProcessState clone(String pkg,long now){
  ProcessState pnew=new ProcessState(this,pkg,mUid,mName,now);
  copyDurationsTo(pnew);
  if (mPssTable != null) {
    mStats.mAddLongTable=new int[mPssTable.length];
    mStats.mAddLongTableSize=0;
    for (int i=0; i < mPssTableSize; i++) {
      int origEnt=mPssTable[i];
      int type=(origEnt >> OFFSET_TYPE_SHIFT) & OFFSET_TYPE_MASK;
      int newOff=mStats.addLongData(i,type,PSS_COUNT);
      mStats.mAddLongTable[i]=newOff | type;
      for (int j=0; j < PSS_COUNT; j++) {
        mStats.setLong(newOff,j,mStats.getLong(origEnt,j));
      }
    }
    pnew.mPssTable=mStats.mAddLongTable;
    pnew.mPssTableSize=mStats.mAddLongTableSize;
  }
  pnew.mNumExcessiveWake=mNumExcessiveWake;
  pnew.mNumExcessiveCpu=mNumExcessiveCpu;
  pnew.mNumCachedKill=mNumCachedKill;
  pnew.mMinCachedKillPss=mMinCachedKillPss;
  pnew.mAvgCachedKillPss=mAvgCachedKillPss;
  pnew.mMaxCachedKillPss=mMaxCachedKillPss;
  pnew.mActive=mActive;
  pnew.mNumStartedServices=mNumStartedServices;
  return pnew;
}

Fixed version (ground truth):
ProcessState clone(String pkg,long now){
  ProcessState pnew=new ProcessState(this,pkg,mUid,mName,now);
  copyDurationsTo(pnew);
  if (mPssTable != null) {
    mStats.mAddLongTable=new int[mPssTable.length];
    mStats.mAddLongTableSize=0;
    for (int i=0; i < mPssTableSize; i++) {
      int origEnt=mPssTable[i];
      int type=(origEnt >> OFFSET_TYPE_SHIFT) & OFFSET_TYPE_MASK;
      int newOff=mStats.addLongData(i,type,PSS_COUNT);
      mStats.mAddLongTable[i]=newOff | type;
      for (int j=0; j < PSS_COUNT; j++) {
        mStats.setLong(newOff,j,mStats.getLong(origEnt,j));
      }
    }
    pnew.mPssTable=mStats.mAddLongTable;
    pnew.mPssTableSize=mStats.mAddLongTableSize;
  }
  pnew.mNumExcessiveWake=mNumExcessiveWake;
  pnew.mNumExcessiveCpu=mNumExcessiveCpu;
  pnew.mNumCachedKill=mNumCachedKill;
  pnew.mMinCachedKillPss=mMinCachedKillPss;
  pnew.mAvgCachedKillPss=mAvgCachedKillPss;
  pnew.mMaxCachedKillPss=mMaxCachedKillPss;
  pnew.mActive=mActive;
  pnew.mNumActiveServices=mNumActiveServices;
  pnew.mNumStartedServices=mNumStartedServices;
  return pnew;
}
Program: 1180
Project: 1180
Buggy source:
public void setBound(boolean bound,int memFactor,long now){
  if (mActive <= 0) {
    throw new IllegalStateException("String_Node_Str" + this + "String_Node_Str"+ mActive);
  }
  final int state=bound ? memFactor : STATE_NOTHING;
  if (mBoundState != state) {
    if (mBoundState != STATE_NOTHING) {
      addDuration(SERVICE_BOUND + (mBoundState * SERVICE_COUNT),now - mBoundStartTime);
    }
 else     if (bound) {
      mBoundCount++;
    }
    mBoundState=state;
    mBoundStartTime=now;
    updateRunning(memFactor,now);
  }
}

Fixed version (ground truth):
public void setBound(boolean bound,int memFactor,long now){
  if (mOwner == null) {
    Slog.wtf(TAG,"String_Node_Str" + this + "String_Node_Str");
  }
  final int state=bound ? memFactor : STATE_NOTHING;
  if (mBoundState != state) {
    if (mBoundState != STATE_NOTHING) {
      addDuration(SERVICE_BOUND + (mBoundState * SERVICE_COUNT),now - mBoundStartTime);
    }
 else     if (bound) {
      mBoundCount++;
    }
    mBoundState=state;
    mBoundStartTime=now;
    updateRunning(memFactor,now);
  }
}
Program: 1181
Project: 1181
Buggy source:
public boolean isInUse(){
  return mActive > 0;
}

Fixed version (ground truth):
public boolean isInUse(){
  return mOwner != null;
}
Program: 1182
Project: 1182
Buggy source:
@Override public boolean onTransact(int code,Parcel data,Parcel reply,int flags) throws RemoteException {
  try {
    return super.onTransact(code,data,reply,flags);
  }
 catch (  RuntimeException e) {
    Slog.w("String_Node_Str","String_Node_Str",e);
    throw e;
  }
}

Fixed version (ground truth):
@Override public boolean onTransact(int code,Parcel data,Parcel reply,int flags) throws RemoteException {
  try {
    return super.onTransact(code,data,reply,flags);
  }
 catch (  RuntimeException e) {
    if (!(e instanceof SecurityException)) {
      Slog.wtf("String_Node_Str","String_Node_Str",e);
    }
    throw e;
  }
}
Program: 1183
Project: 1183
Buggy source:
@Override public boolean onTransact(int code,Parcel data,Parcel reply,int flags) throws RemoteException {
  try {
    return super.onTransact(code,data,reply,flags);
  }
 catch (  RuntimeException e) {
    if (!(e instanceof SecurityException)) {
      Slog.e(TAG,"String_Node_Str",e);
    }
    throw e;
  }
}

Fixed version (ground truth):
@Override public boolean onTransact(int code,Parcel data,Parcel reply,int flags) throws RemoteException {
  try {
    return super.onTransact(code,data,reply,flags);
  }
 catch (  RuntimeException e) {
    if (!(e instanceof SecurityException)) {
      Slog.wtf(TAG,"String_Node_Str",e);
    }
    throw e;
  }
}
Program: 1184
Project: 1184
Buggy source:
private void serviceDoneExecutingLocked(ServiceRecord r,boolean inStopping){
  if (DEBUG_SERVICE)   Slog.v(TAG,"String_Node_Str" + r + "String_Node_Str"+ r.executeNesting+ "String_Node_Str"+ inStopping+ "String_Node_Str"+ r.app);
 else   if (DEBUG_SERVICE_EXECUTING)   Slog.v(TAG,"String_Node_Str" + r.shortName);
  r.executeNesting--;
  if (r.executeNesting <= 0) {
    if (r.app != null) {
      if (DEBUG_SERVICE)       Slog.v(TAG,"String_Node_Str" + r.shortName);
      r.app.execServicesFg=false;
      r.app.executingServices.remove(r);
      if (r.app.executingServices.size() == 0) {
        if (DEBUG_SERVICE || DEBUG_SERVICE_EXECUTING)         Slog.v(TAG,"String_Node_Str" + r.shortName);
        mAm.mHandler.removeMessages(ActivityManagerService.SERVICE_TIMEOUT_MSG,r.app);
      }
 else       if (r.executeFg) {
        for (int i=r.app.executingServices.size() - 1; i >= 0; i--) {
          if (r.app.executingServices.valueAt(i).executeFg) {
            r.app.execServicesFg=true;
            break;
          }
        }
      }
      if (inStopping) {
        if (DEBUG_SERVICE)         Slog.v(TAG,"String_Node_Str" + r);
        mStoppingServices.remove(r);
        r.bindings.clear();
      }
      mAm.updateOomAdjLocked(r.app);
    }
    r.executeFg=false;
    if (r.tracker != null) {
      r.tracker.setExecuting(false,mAm.mProcessStats.getMemFactorLocked(),SystemClock.uptimeMillis());
      if (inStopping) {
        r.tracker.makeInactive();
        r.tracker=null;
      }
    }
  }
}

Fixed version (ground truth):
private void serviceDoneExecutingLocked(ServiceRecord r,boolean inDestroying,boolean finishing){
  if (DEBUG_SERVICE)   Slog.v(TAG,"String_Node_Str" + r + "String_Node_Str"+ r.executeNesting+ "String_Node_Str"+ inDestroying+ "String_Node_Str"+ r.app);
 else   if (DEBUG_SERVICE_EXECUTING)   Slog.v(TAG,"String_Node_Str" + r.shortName);
  r.executeNesting--;
  if (r.executeNesting <= 0) {
    if (r.app != null) {
      if (DEBUG_SERVICE)       Slog.v(TAG,"String_Node_Str" + r.shortName);
      r.app.execServicesFg=false;
      r.app.executingServices.remove(r);
      if (r.app.executingServices.size() == 0) {
        if (DEBUG_SERVICE || DEBUG_SERVICE_EXECUTING)         Slog.v(TAG,"String_Node_Str" + r.shortName);
        mAm.mHandler.removeMessages(ActivityManagerService.SERVICE_TIMEOUT_MSG,r.app);
      }
 else       if (r.executeFg) {
        for (int i=r.app.executingServices.size() - 1; i >= 0; i--) {
          if (r.app.executingServices.valueAt(i).executeFg) {
            r.app.execServicesFg=true;
            break;
          }
        }
      }
      if (inDestroying) {
        if (DEBUG_SERVICE)         Slog.v(TAG,"String_Node_Str" + r);
        mDestroyingServices.remove(r);
        r.bindings.clear();
      }
      mAm.updateOomAdjLocked(r.app);
    }
    r.executeFg=false;
    if (r.tracker != null) {
      r.tracker.setExecuting(false,mAm.mProcessStats.getMemFactorLocked(),SystemClock.uptimeMillis());
      if (finishing) {
        r.tracker.clearCurrentOwner(r);
        r.tracker=null;
      }
    }
  }
}
Program: 1188
Project: 1188
Buggy source:
void unbindFinishedLocked(ServiceRecord r,Intent intent,boolean doRebind){
  final long origId=Binder.clearCallingIdentity();
  try {
    if (r != null) {
      Intent.FilterComparison filter=new Intent.FilterComparison(intent);
      IntentBindRecord b=r.bindings.get(filter);
      if (DEBUG_SERVICE)       Slog.v(TAG,"String_Node_Str" + r + "String_Node_Str"+ b+ "String_Node_Str"+ (b != null ? b.apps.size() : 0));
      boolean inStopping=mStoppingServices.contains(r);
      if (b != null) {
        if (b.apps.size() > 0 && !inStopping) {
          boolean inFg=false;
          for (int i=b.apps.size() - 1; i >= 0; i--) {
            ProcessRecord client=b.apps.valueAt(i).client;
            if (client != null && client.setSchedGroup != Process.THREAD_GROUP_BG_NONINTERACTIVE) {
              inFg=true;
              break;
            }
          }
          requestServiceBindingLocked(r,b,inFg,true);
        }
 else {
          b.doRebind=true;
        }
      }
      serviceDoneExecutingLocked(r,inStopping);
    }
  }
  finally {
    Binder.restoreCallingIdentity(origId);
  }
}

Fixed version (ground truth):
void unbindFinishedLocked(ServiceRecord r,Intent intent,boolean doRebind){
  final long origId=Binder.clearCallingIdentity();
  try {
    if (r != null) {
      Intent.FilterComparison filter=new Intent.FilterComparison(intent);
      IntentBindRecord b=r.bindings.get(filter);
      if (DEBUG_SERVICE)       Slog.v(TAG,"String_Node_Str" + r + "String_Node_Str"+ b+ "String_Node_Str"+ (b != null ? b.apps.size() : 0));
      boolean inDestroying=mDestroyingServices.contains(r);
      if (b != null) {
        if (b.apps.size() > 0 && !inDestroying) {
          boolean inFg=false;
          for (int i=b.apps.size() - 1; i >= 0; i--) {
            ProcessRecord client=b.apps.valueAt(i).client;
            if (client != null && client.setSchedGroup != Process.THREAD_GROUP_BG_NONINTERACTIVE) {
              inFg=true;
              break;
            }
          }
          requestServiceBindingLocked(r,b,inFg,true);
        }
 else {
          b.doRebind=true;
        }
      }
      serviceDoneExecutingLocked(r,inDestroying,false);
    }
  }
  finally {
    Binder.restoreCallingIdentity(origId);
  }
}
Program: 1189
Project: 1189
Buggy source:
private final void bringDownServiceIfNeededLocked(ServiceRecord r,boolean knowConn,boolean hasConn){
  if (r.startRequested) {
    return;
  }
  if (!knowConn) {
    hasConn=r.hasAutoCreateConnections();
  }
  if (hasConn) {
    return;
  }
  if (mPendingServices.contains(r)) {
    return;
  }
  bringDownServiceLocked(r);
}

Fixed version (ground truth):
private final void bringDownServiceIfNeededLocked(ServiceRecord r,boolean knowConn,boolean hasConn){
  if (isServiceNeeded(r,knowConn,hasConn)) {
    return;
  }
  if (mPendingServices.contains(r)) {
    return;
  }
  bringDownServiceLocked(r);
}
Program: 1192
Project: 1192
Buggy source:
@Override public boolean onTransact(int code,Parcel data,Parcel reply,int flags) throws RemoteException {
  if (code == SYSPROPS_TRANSACTION) {
    ArrayList<IBinder> procs=new ArrayList<IBinder>();
synchronized (this) {
      final int NP=mProcessNames.getMap().size();
      for (int ip=0; ip < NP; ip++) {
        SparseArray<ProcessRecord> apps=mProcessNames.getMap().valueAt(ip);
        final int NA=apps.size();
        for (int ia=0; ia < NA; ia++) {
          ProcessRecord app=apps.valueAt(ia);
          if (app.thread != null) {
            procs.add(app.thread.asBinder());
          }
        }
      }
    }
    int N=procs.size();
    for (int i=0; i < N; i++) {
      Parcel data2=Parcel.obtain();
      try {
        procs.get(i).transact(IBinder.SYSPROPS_TRANSACTION,data2,null,0);
      }
 catch (      RemoteException e) {
      }
      data2.recycle();
    }
  }
  try {
    return super.onTransact(code,data,reply,flags);
  }
 catch (  RuntimeException e) {
    if (!(e instanceof SecurityException)) {
      Slog.e(TAG,"String_Node_Str",e);
    }
    throw e;
  }
}

Fixed version (ground truth):
@Override public boolean onTransact(int code,Parcel data,Parcel reply,int flags) throws RemoteException {
  if (code == SYSPROPS_TRANSACTION) {
    ArrayList<IBinder> procs=new ArrayList<IBinder>();
synchronized (this) {
      final int NP=mProcessNames.getMap().size();
      for (int ip=0; ip < NP; ip++) {
        SparseArray<ProcessRecord> apps=mProcessNames.getMap().valueAt(ip);
        final int NA=apps.size();
        for (int ia=0; ia < NA; ia++) {
          ProcessRecord app=apps.valueAt(ia);
          if (app.thread != null) {
            procs.add(app.thread.asBinder());
          }
        }
      }
    }
    int N=procs.size();
    for (int i=0; i < N; i++) {
      Parcel data2=Parcel.obtain();
      try {
        procs.get(i).transact(IBinder.SYSPROPS_TRANSACTION,data2,null,0);
      }
 catch (      RemoteException e) {
      }
      data2.recycle();
    }
  }
  try {
    return super.onTransact(code,data,reply,flags);
  }
 catch (  RuntimeException e) {
    if (!(e instanceof SecurityException)) {
      Slog.wtf(TAG,"String_Node_Str",e);
    }
    throw e;
  }
}
Program: 1193
Project: 1193
Buggy source:
public long getCurrentTimeUs(boolean refreshTime,boolean monotonic) throws IllegalStateException {
synchronized (this) {
    if (mPaused && !refreshTime) {
      return mLastReportedTime;
    }
    long nanoTime=System.nanoTime();
    if (refreshTime || nanoTime >= mLastNanoTime + MAX_NS_WITHOUT_POSITION_CHECK) {
      try {
        mLastTimeUs=mPlayer.getCurrentPosition() * 1000;
        mPaused=!mPlayer.isPlaying();
        if (DEBUG)         Log.v(TAG,(mPaused ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str" + mLastTimeUs);
      }
 catch (      IllegalStateException e) {
        if (mPausing) {
          mPausing=false;
          getEstimatedTime(nanoTime,monotonic);
          mPaused=true;
          if (DEBUG)           Log.d(TAG,"String_Node_Str" + mLastReportedTime);
          return mLastReportedTime;
        }
        throw e;
      }
      mLastNanoTime=nanoTime;
      if (monotonic && mLastTimeUs < mLastReportedTime) {
        mTimeAdjustment=mLastReportedTime - mLastTimeUs;
      }
 else {
        mTimeAdjustment=0;
      }
    }
    return getEstimatedTime(nanoTime,monotonic);
  }
}

Fixed version (ground truth):
public long getCurrentTimeUs(boolean refreshTime,boolean monotonic) throws IllegalStateException {
synchronized (this) {
    if (mPaused && !refreshTime) {
      return mLastReportedTime;
    }
    long nanoTime=System.nanoTime();
    if (refreshTime || nanoTime >= mLastNanoTime + MAX_NS_WITHOUT_POSITION_CHECK) {
      try {
        mLastTimeUs=mPlayer.getCurrentPosition() * 1000;
        mPaused=!mPlayer.isPlaying();
        if (DEBUG)         Log.v(TAG,(mPaused ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str" + mLastTimeUs);
      }
 catch (      IllegalStateException e) {
        if (mPausing) {
          mPausing=false;
          getEstimatedTime(nanoTime,monotonic);
          mPaused=true;
          if (DEBUG)           Log.d(TAG,"String_Node_Str" + mLastReportedTime);
          return mLastReportedTime;
        }
        throw e;
      }
      mLastNanoTime=nanoTime;
      if (monotonic && mLastTimeUs < mLastReportedTime) {
        mTimeAdjustment=mLastReportedTime - mLastTimeUs;
        if (mTimeAdjustment > 1000000) {
          scheduleNotification(NOTIFY_SEEK,0);
        }
      }
 else {
        mTimeAdjustment=0;
      }
    }
    return getEstimatedTime(nanoTime,monotonic);
  }
}
Program: 1194
Project: 1194
Buggy source:
/** 
 * @hide 
 */
public void onPaused(boolean paused){
synchronized (this) {
    if (DEBUG)     Log.d(TAG,"String_Node_Str" + paused);
    if (mStopped) {
      mStopped=false;
      scheduleNotification(NOTIFY_SEEK,0);
    }
 else {
      mPausing=paused;
      scheduleNotification(REFRESH_AND_NOTIFY_TIME,0);
    }
  }
}

Fixed version (ground truth):
/** 
 * @hide 
 */
public void onPaused(boolean paused){
synchronized (this) {
    if (DEBUG)     Log.d(TAG,"String_Node_Str" + paused);
    if (mStopped) {
      scheduleNotification(NOTIFY_SEEK,0);
    }
 else {
      mPausing=paused;
      scheduleNotification(REFRESH_AND_NOTIFY_TIME,0);
    }
  }
}
Program: 1195
Project: 1195
Buggy source:
private void scheduleNotification(int type,long delayUs){
  if (DEBUG)   Log.v(TAG,"String_Node_Str" + type + "String_Node_Str"+ delayUs);
  mEventHandler.removeMessages(NOTIFY);
  Message msg=mEventHandler.obtainMessage(NOTIFY,type,0);
  mEventHandler.sendMessageDelayed(msg,(int)(delayUs / 1000));
}

Fixed version (ground truth):
private void scheduleNotification(int type,long delayUs){
  if (mSeeking && (type == NOTIFY_TIME || type == REFRESH_AND_NOTIFY_TIME)) {
    return;
  }
  if (DEBUG)   Log.v(TAG,"String_Node_Str" + type + "String_Node_Str"+ delayUs);
  mStopped=type == NOTIFY_STOP;
  mSeeking=type == NOTIFY_SEEK;
  mEventHandler.removeMessages(NOTIFY);
  Message msg=mEventHandler.obtainMessage(NOTIFY,type,0);
  mEventHandler.sendMessageDelayed(msg,(int)(delayUs / 1000));
}
Program: 1196
Project: 1196
Buggy source:
/** 
 * @hide 
 */
@Override public void onSeekComplete(MediaPlayer mp){
synchronized (this) {
    mStopped=false;
    scheduleNotification(NOTIFY_SEEK,0);
  }
}

Fixed version (ground truth):
/** 
 * @hide 
 */
@Override public void onSeekComplete(MediaPlayer mp){
synchronized (this) {
    scheduleNotification(NOTIFY_SEEK,0);
  }
}
Program: 1198
Project: 1198
Buggy source:
/** 
 * @hide 
 */
public void onStopped(){
synchronized (this) {
    if (DEBUG)     Log.d(TAG,"String_Node_Str");
    mPaused=true;
    mStopped=true;
    scheduleNotification(NOTIFY_STOP,0);
  }
}

Fixed version (ground truth):
/** 
 * @hide 
 */
public void onStopped(){
synchronized (this) {
    if (DEBUG)     Log.d(TAG,"String_Node_Str");
    mPaused=true;
    scheduleNotification(NOTIFY_STOP,0);
  }
}
Program: 1199
Project: 1199
Buggy source:
private synchronized void notifySeek(){
  try {
    long timeUs=getCurrentTimeUs(true,false);
    if (DEBUG)     Log.d(TAG,"String_Node_Str" + timeUs);
    for (    MediaTimeProvider.OnMediaTimeListener listener : mListeners) {
      if (listener == null) {
        break;
      }
      listener.onSeek(timeUs);
    }
  }
 catch (  IllegalStateException e) {
    if (DEBUG)     Log.d(TAG,"String_Node_Str");
    mPausing=true;
    notifyTimedEvent(false);
  }
}

Fixed version (ground truth):
private synchronized void notifySeek(){
  mSeeking=false;
  try {
    long timeUs=getCurrentTimeUs(true,false);
    if (DEBUG)     Log.d(TAG,"String_Node_Str" + timeUs);
    for (    MediaTimeProvider.OnMediaTimeListener listener : mListeners) {
      if (listener == null) {
        break;
      }
      listener.onSeek(timeUs);
    }
  }
 catch (  IllegalStateException e) {
    if (DEBUG)     Log.d(TAG,"String_Node_Str");
    mPausing=true;
    notifyTimedEvent(false);
  }
}
Program: 1200
Project: 1200
Buggy source:
public long getCurrentTimeUs(boolean refreshTime,boolean monotonic) throws IllegalStateException {
synchronized (this) {
    if (mPaused && !refreshTime) {
      return mLastReportedTime;
    }
    long nanoTime=System.nanoTime();
    if (refreshTime || nanoTime >= mLastNanoTime + MAX_NS_WITHOUT_POSITION_CHECK) {
      try {
        mLastTimeUs=mPlayer.getCurrentPosition() * 1000;
        mPaused=!mPlayer.isPlaying();
        if (DEBUG)         Log.v(TAG,(mPaused ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str" + mLastTimeUs);
      }
 catch (      IllegalStateException e) {
        if (mPausing) {
          mPausing=false;
          getEstimatedTime(nanoTime,monotonic);
          mPaused=true;
          if (DEBUG)           Log.d(TAG,"String_Node_Str" + mLastReportedTime);
          return mLastReportedTime;
        }
        throw e;
      }
      mLastNanoTime=nanoTime;
      if (monotonic && mLastTimeUs < mLastReportedTime) {
        mTimeAdjustment=mLastReportedTime - mLastTimeUs;
      }
 else {
        mTimeAdjustment=0;
      }
    }
    return getEstimatedTime(nanoTime,monotonic);
  }
}

Fixed version (ground truth):
public long getCurrentTimeUs(boolean refreshTime,boolean monotonic) throws IllegalStateException {
synchronized (this) {
    if (mPaused && !refreshTime) {
      return mLastReportedTime;
    }
    long nanoTime=System.nanoTime();
    if (refreshTime || nanoTime >= mLastNanoTime + MAX_NS_WITHOUT_POSITION_CHECK) {
      try {
        mLastTimeUs=mPlayer.getCurrentPosition() * 1000;
        mPaused=!mPlayer.isPlaying();
        if (DEBUG)         Log.v(TAG,(mPaused ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str" + mLastTimeUs);
      }
 catch (      IllegalStateException e) {
        if (mPausing) {
          mPausing=false;
          getEstimatedTime(nanoTime,monotonic);
          mPaused=true;
          if (DEBUG)           Log.d(TAG,"String_Node_Str" + mLastReportedTime);
          return mLastReportedTime;
        }
        throw e;
      }
      mLastNanoTime=nanoTime;
      if (monotonic && mLastTimeUs < mLastReportedTime) {
        mTimeAdjustment=mLastReportedTime - mLastTimeUs;
        if (mTimeAdjustment > 1000000) {
          scheduleNotification(NOTIFY_SEEK,0);
        }
      }
 else {
        mTimeAdjustment=0;
      }
    }
    return getEstimatedTime(nanoTime,monotonic);
  }
}
Program: 1201
Project: 1201
Buggy source:
/** 
 * @hide 
 */
public void onPaused(boolean paused){
synchronized (this) {
    if (DEBUG)     Log.d(TAG,"String_Node_Str" + paused);
    if (mStopped) {
      mStopped=false;
      scheduleNotification(NOTIFY_SEEK,0);
    }
 else {
      mPausing=paused;
      scheduleNotification(REFRESH_AND_NOTIFY_TIME,0);
    }
  }
}

Fixed version (ground truth):
/** 
 * @hide 
 */
public void onPaused(boolean paused){
synchronized (this) {
    if (DEBUG)     Log.d(TAG,"String_Node_Str" + paused);
    if (mStopped) {
      scheduleNotification(NOTIFY_SEEK,0);
    }
 else {
      mPausing=paused;
      scheduleNotification(REFRESH_AND_NOTIFY_TIME,0);
    }
  }
}
Program: 1202
Project: 1202
Buggy source:
private void scheduleNotification(int type,long delayUs){
  if (DEBUG)   Log.v(TAG,"String_Node_Str" + type + "String_Node_Str"+ delayUs);
  mEventHandler.removeMessages(NOTIFY);
  Message msg=mEventHandler.obtainMessage(NOTIFY,type,0);
  mEventHandler.sendMessageDelayed(msg,(int)(delayUs / 1000));
}

Fixed version (ground truth):
private void scheduleNotification(int type,long delayUs){
  if (mSeeking && (type == NOTIFY_TIME || type == REFRESH_AND_NOTIFY_TIME)) {
    return;
  }
  if (DEBUG)   Log.v(TAG,"String_Node_Str" + type + "String_Node_Str"+ delayUs);
  mStopped=type == NOTIFY_STOP;
  mSeeking=type == NOTIFY_SEEK;
  mEventHandler.removeMessages(NOTIFY);
  Message msg=mEventHandler.obtainMessage(NOTIFY,type,0);
  mEventHandler.sendMessageDelayed(msg,(int)(delayUs / 1000));
}
Program: 1203
Project: 1203
Buggy source:
/** 
 * @hide 
 */
@Override public void onSeekComplete(MediaPlayer mp){
synchronized (this) {
    mStopped=false;
    scheduleNotification(NOTIFY_SEEK,0);
  }
}

Fixed version (ground truth):
/** 
 * @hide 
 */
@Override public void onSeekComplete(MediaPlayer mp){
synchronized (this) {
    scheduleNotification(NOTIFY_SEEK,0);
  }
}
Program: 1205
Project: 1205
Buggy source:
/** 
 * @hide 
 */
public void onStopped(){
synchronized (this) {
    if (DEBUG)     Log.d(TAG,"String_Node_Str");
    mPaused=true;
    mStopped=true;
    scheduleNotification(NOTIFY_STOP,0);
  }
}

Fixed version (ground truth):
/** 
 * @hide 
 */
public void onStopped(){
synchronized (this) {
    if (DEBUG)     Log.d(TAG,"String_Node_Str");
    mPaused=true;
    scheduleNotification(NOTIFY_STOP,0);
  }
}
Program: 1206
Project: 1206
Buggy source:
private synchronized void notifySeek(){
  try {
    long timeUs=getCurrentTimeUs(true,false);
    if (DEBUG)     Log.d(TAG,"String_Node_Str" + timeUs);
    for (    MediaTimeProvider.OnMediaTimeListener listener : mListeners) {
      if (listener == null) {
        break;
      }
      listener.onSeek(timeUs);
    }
  }
 catch (  IllegalStateException e) {
    if (DEBUG)     Log.d(TAG,"String_Node_Str");
    mPausing=true;
    notifyTimedEvent(false);
  }
}

Fixed version (ground truth):
private synchronized void notifySeek(){
  mSeeking=false;
  try {
    long timeUs=getCurrentTimeUs(true,false);
    if (DEBUG)     Log.d(TAG,"String_Node_Str" + timeUs);
    for (    MediaTimeProvider.OnMediaTimeListener listener : mListeners) {
      if (listener == null) {
        break;
      }
      listener.onSeek(timeUs);
    }
  }
 catch (  IllegalStateException e) {
    if (DEBUG)     Log.d(TAG,"String_Node_Str");
    mPausing=true;
    notifyTimedEvent(false);
  }
}
Program: 1207
Project: 1207
Buggy source:
/** 
 * Set whether SELinux is permissive or enforcing.
 * @param boolean representing whether to set SELinux to enforcing
 * @return a boolean representing whether the desired mode was set
 */
public static final native boolean setSELinuxEnforce(boolean value);

Fixed version (ground truth):
/** 
 * Set whether SELinux is permissive or enforcing.
 * @param value representing whether to set SELinux to enforcing
 * @return a boolean representing whether the desired mode was set
 */
public static final native boolean setSELinuxEnforce(boolean value);
Program: 1208
Project: 1208
Buggy source:
/** 
 * Gets the security context of a given process id. Use of this function is discouraged for Binder transactions. Use Binder.getCallingSecctx() instead.
 * @param pid an int representing the process id to check.
 * @return a String representing the security context of the given pid.
 */
public static final native String getPidContext(int pid);

Fixed version (ground truth):
/** 
 * Gets the security context of a given process id.
 * @param pid an int representing the process id to check.
 * @return a String representing the security context of the given pid.
 */
public static final native String getPidContext(int pid);
Program: 1209
Project: 1209
Buggy source:
/** 
 * Sets the value for the given SELinux boolean name.
 * @param String The name of the SELinux boolean.
 * @param Boolean The new value of the SELinux boolean.
 * @return a boolean indicating whether or not the operation succeeded.
 */
public static final native boolean setBooleanValue(String name,boolean value);

Fixed version (ground truth):
/** 
 * Sets the value for the given SELinux boolean name.
 * @param name The name of the SELinux boolean.
 * @param value The new value of the SELinux boolean.
 * @return a boolean indicating whether or not the operation succeeded.
 */
public static final native boolean setBooleanValue(String name,boolean value);
Program: 1210
Project: 1210
Buggy source:
/** 
 * Change the security context of an existing file object.
 * @param path representing the path of file object to relabel.
 * @param con new security context given as a String.
 * @return a boolean indicating whether the operation succeeded.
 */
public static final native boolean setFileContext(String path,String context);

Fixed version (ground truth):
/** 
 * Change the security context of an existing file object.
 * @param path representing the path of file object to relabel.
 * @param context new security context given as a String.
 * @return a boolean indicating whether the operation succeeded.
 */
public static final native boolean setFileContext(String path,String context);
Program: 1211
Project: 1211
Buggy source:
/** 
 * Gets the value for the given SELinux boolean name.
 * @param String The name of the SELinux boolean.
 * @return a boolean indicating whether the SELinux boolean is set.
 */
public static final native boolean getBooleanValue(String name);

Fixed version (ground truth):
/** 
 * Gets the value for the given SELinux boolean name.
 * @param name The name of the SELinux boolean.
 * @return a boolean indicating whether the SELinux boolean is set.
 */
public static final native boolean getBooleanValue(String name);
Program: 1212
Project: 1212
Buggy source:
/** 
 * Set whether SELinux is permissive or enforcing.
 * @param boolean representing whether to set SELinux to enforcing
 * @return a boolean representing whether the desired mode was set
 */
public static final native boolean setSELinuxEnforce(boolean value);

Fixed version (ground truth):
/** 
 * Set whether SELinux is permissive or enforcing.
 * @param value representing whether to set SELinux to enforcing
 * @return a boolean representing whether the desired mode was set
 */
public static final native boolean setSELinuxEnforce(boolean value);
Program: 1213
Project: 1213
Buggy source:
/** 
 * Gets the security context of a given process id. Use of this function is discouraged for Binder transactions. Use Binder.getCallingSecctx() instead.
 * @param pid an int representing the process id to check.
 * @return a String representing the security context of the given pid.
 */
public static final native String getPidContext(int pid);

Fixed version (ground truth):
/** 
 * Gets the security context of a given process id.
 * @param pid an int representing the process id to check.
 * @return a String representing the security context of the given pid.
 */
public static final native String getPidContext(int pid);
Program: 1214
Project: 1214
Buggy source:
/** 
 * Sets the value for the given SELinux boolean name.
 * @param String The name of the SELinux boolean.
 * @param Boolean The new value of the SELinux boolean.
 * @return a boolean indicating whether or not the operation succeeded.
 */
public static final native boolean setBooleanValue(String name,boolean value);

Fixed version (ground truth):
/** 
 * Sets the value for the given SELinux boolean name.
 * @param name The name of the SELinux boolean.
 * @param value The new value of the SELinux boolean.
 * @return a boolean indicating whether or not the operation succeeded.
 */
public static final native boolean setBooleanValue(String name,boolean value);
Program: 1215
Project: 1215
Buggy source:
/** 
 * Change the security context of an existing file object.
 * @param path representing the path of file object to relabel.
 * @param con new security context given as a String.
 * @return a boolean indicating whether the operation succeeded.
 */
public static final native boolean setFileContext(String path,String context);

Fixed version (ground truth):
/** 
 * Change the security context of an existing file object.
 * @param path representing the path of file object to relabel.
 * @param context new security context given as a String.
 * @return a boolean indicating whether the operation succeeded.
 */
public static final native boolean setFileContext(String path,String context);
Program: 1216
Project: 1216
Buggy source:
/** 
 * Gets the value for the given SELinux boolean name.
 * @param String The name of the SELinux boolean.
 * @return a boolean indicating whether the SELinux boolean is set.
 */
public static final native boolean getBooleanValue(String name);

Fixed version (ground truth):
/** 
 * Gets the value for the given SELinux boolean name.
 * @param name The name of the SELinux boolean.
 * @return a boolean indicating whether the SELinux boolean is set.
 */
public static final native boolean getBooleanValue(String name);
Program: 1217
Project: 1217
Buggy source:
/** 
 * Set whether SELinux is permissive or enforcing.
 * @param boolean representing whether to set SELinux to enforcing
 * @return a boolean representing whether the desired mode was set
 */
public static final native boolean setSELinuxEnforce(boolean value);

Fixed version (ground truth):
/** 
 * Set whether SELinux is permissive or enforcing.
 * @param value representing whether to set SELinux to enforcing
 * @return a boolean representing whether the desired mode was set
 */
public static final native boolean setSELinuxEnforce(boolean value);
Program: 1218
Project: 1218
Buggy source:
/** 
 * Gets the security context of a given process id. Use of this function is discouraged for Binder transactions. Use Binder.getCallingSecctx() instead.
 * @param pid an int representing the process id to check.
 * @return a String representing the security context of the given pid.
 */
public static final native String getPidContext(int pid);

Fixed version (ground truth):
/** 
 * Gets the security context of a given process id.
 * @param pid an int representing the process id to check.
 * @return a String representing the security context of the given pid.
 */
public static final native String getPidContext(int pid);
Program: 1219
Project: 1219
Buggy source:
/** 
 * Sets the value for the given SELinux boolean name.
 * @param String The name of the SELinux boolean.
 * @param Boolean The new value of the SELinux boolean.
 * @return a boolean indicating whether or not the operation succeeded.
 */
public static final native boolean setBooleanValue(String name,boolean value);

Fixed version (ground truth):
/** 
 * Sets the value for the given SELinux boolean name.
 * @param name The name of the SELinux boolean.
 * @param value The new value of the SELinux boolean.
 * @return a boolean indicating whether or not the operation succeeded.
 */
public static final native boolean setBooleanValue(String name,boolean value);
Program: 1220
Project: 1220
Buggy source:
/** 
 * Change the security context of an existing file object.
 * @param path representing the path of file object to relabel.
 * @param con new security context given as a String.
 * @return a boolean indicating whether the operation succeeded.
 */
public static final native boolean setFileContext(String path,String context);

Fixed version (ground truth):
/** 
 * Change the security context of an existing file object.
 * @param path representing the path of file object to relabel.
 * @param context new security context given as a String.
 * @return a boolean indicating whether the operation succeeded.
 */
public static final native boolean setFileContext(String path,String context);
Program: 1221
Project: 1221
Buggy source:
/** 
 * Gets the value for the given SELinux boolean name.
 * @param String The name of the SELinux boolean.
 * @return a boolean indicating whether the SELinux boolean is set.
 */
public static final native boolean getBooleanValue(String name);

Fixed version (ground truth):
/** 
 * Gets the value for the given SELinux boolean name.
 * @param name The name of the SELinux boolean.
 * @return a boolean indicating whether the SELinux boolean is set.
 */
public static final native boolean getBooleanValue(String name);
Program: 1222
Project: 1222
Buggy source:
/** 
 * Set whether SELinux is permissive or enforcing.
 * @param boolean representing whether to set SELinux to enforcing
 * @return a boolean representing whether the desired mode was set
 */
public static final native boolean setSELinuxEnforce(boolean value);

Fixed version (ground truth):
/** 
 * Set whether SELinux is permissive or enforcing.
 * @param value representing whether to set SELinux to enforcing
 * @return a boolean representing whether the desired mode was set
 */
public static final native boolean setSELinuxEnforce(boolean value);
Program: 1223
Project: 1223
Buggy source:
/** 
 * Gets the security context of a given process id. Use of this function is discouraged for Binder transactions. Use Binder.getCallingSecctx() instead.
 * @param pid an int representing the process id to check.
 * @return a String representing the security context of the given pid.
 */
public static final native String getPidContext(int pid);

Fixed version (ground truth):
/** 
 * Gets the security context of a given process id.
 * @param pid an int representing the process id to check.
 * @return a String representing the security context of the given pid.
 */
public static final native String getPidContext(int pid);
Program: 1224
Project: 1224
Buggy source:
/** 
 * Sets the value for the given SELinux boolean name.
 * @param String The name of the SELinux boolean.
 * @param Boolean The new value of the SELinux boolean.
 * @return a boolean indicating whether or not the operation succeeded.
 */
public static final native boolean setBooleanValue(String name,boolean value);

Fixed version (ground truth):
/** 
 * Sets the value for the given SELinux boolean name.
 * @param name The name of the SELinux boolean.
 * @param value The new value of the SELinux boolean.
 * @return a boolean indicating whether or not the operation succeeded.
 */
public static final native boolean setBooleanValue(String name,boolean value);
Program: 1225
Project: 1225
Buggy source:
/** 
 * Change the security context of an existing file object.
 * @param path representing the path of file object to relabel.
 * @param con new security context given as a String.
 * @return a boolean indicating whether the operation succeeded.
 */
public static final native boolean setFileContext(String path,String context);

Fixed version (ground truth):
/** 
 * Change the security context of an existing file object.
 * @param path representing the path of file object to relabel.
 * @param context new security context given as a String.
 * @return a boolean indicating whether the operation succeeded.
 */
public static final native boolean setFileContext(String path,String context);
Program: 1226
Project: 1226
Buggy source:
/** 
 * Gets the value for the given SELinux boolean name.
 * @param String The name of the SELinux boolean.
 * @return a boolean indicating whether the SELinux boolean is set.
 */
public static final native boolean getBooleanValue(String name);

Fixed version (ground truth):
/** 
 * Gets the value for the given SELinux boolean name.
 * @param name The name of the SELinux boolean.
 * @return a boolean indicating whether the SELinux boolean is set.
 */
public static final native boolean getBooleanValue(String name);
Program: 1232
Project: 1232
Buggy source:
public long getCachedSize(){
  return mCachedSize;
}

Fixed version (ground truth):
public long getCachedSize(){
  return mInfos[Debug.MEMINFO_CACHED] * 1024;
}
Program: 1233
Project: 1233
Buggy source:
public long getTotalSize(){
  return mTotalSize;
}

Fixed version (ground truth):
public long getTotalSize(){
  return mInfos[Debug.MEMINFO_TOTAL] * 1024;
}
Program: 1234
Project: 1234
Buggy source:
public long getFreeSize(){
  return mFreeSize;
}

Fixed version (ground truth):
public long getFreeSize(){
  return mInfos[Debug.MEMINFO_FREE] * 1024;
}
Program: 1235
Project: 1235
Buggy source:
public void readMemInfo(){
  StrictMode.ThreadPolicy savedPolicy=StrictMode.allowThreadDiskReads();
  try {
    long[] infos=new long[Debug.MEMINFO_COUNT];
    Debug.getMemInfo(infos);
    mTotalSize=infos[Debug.MEMINFO_TOTAL] * 1024;
    mFreeSize=infos[Debug.MEMINFO_FREE] * 1024;
    mCachedSize=infos[Debug.MEMINFO_CACHED] * 1024;
  }
  finally {
    StrictMode.setThreadPolicy(savedPolicy);
  }
}

Fixed version (ground truth):
public void readMemInfo(){
  StrictMode.ThreadPolicy savedPolicy=StrictMode.allowThreadDiskReads();
  try {
    Debug.getMemInfo(mInfos);
  }
  finally {
    StrictMode.setThreadPolicy(savedPolicy);
  }
}
Program: 1237
Project: 1237
Buggy source:
public long getCachedSize(){
  return mCachedSize;
}

Fixed version (ground truth):
public long getCachedSize(){
  return mInfos[Debug.MEMINFO_CACHED] * 1024;
}
Program: 1238
Project: 1238
Buggy source:
public long getTotalSize(){
  return mTotalSize;
}

Fixed version (ground truth):
public long getTotalSize(){
  return mInfos[Debug.MEMINFO_TOTAL] * 1024;
}
Program: 1239
Project: 1239
Buggy source:
public long getFreeSize(){
  return mFreeSize;
}

Fixed version (ground truth):
public long getFreeSize(){
  return mInfos[Debug.MEMINFO_FREE] * 1024;
}
Program: 1240
Project: 1240
Buggy source:
public void readMemInfo(){
  StrictMode.ThreadPolicy savedPolicy=StrictMode.allowThreadDiskReads();
  try {
    long[] infos=new long[Debug.MEMINFO_COUNT];
    Debug.getMemInfo(infos);
    mTotalSize=infos[Debug.MEMINFO_TOTAL] * 1024;
    mFreeSize=infos[Debug.MEMINFO_FREE] * 1024;
    mCachedSize=infos[Debug.MEMINFO_CACHED] * 1024;
  }
  finally {
    StrictMode.setThreadPolicy(savedPolicy);
  }
}

Fixed version (ground truth):
public void readMemInfo(){
  StrictMode.ThreadPolicy savedPolicy=StrictMode.allowThreadDiskReads();
  try {
    Debug.getMemInfo(mInfos);
  }
  finally {
    StrictMode.setThreadPolicy(savedPolicy);
  }
}
Program: 1242
Project: 1242
Buggy source:
public long getCachedSize(){
  return mCachedSize;
}

Fixed version (ground truth):
public long getCachedSize(){
  return mInfos[Debug.MEMINFO_CACHED] * 1024;
}
Program: 1243
Project: 1243
Buggy source:
public long getTotalSize(){
  return mTotalSize;
}

Fixed version (ground truth):
public long getTotalSize(){
  return mInfos[Debug.MEMINFO_TOTAL] * 1024;
}
Program: 1244
Project: 1244
Buggy source:
public long getFreeSize(){
  return mFreeSize;
}

Fixed version (ground truth):
public long getFreeSize(){
  return mInfos[Debug.MEMINFO_FREE] * 1024;
}
Program: 1245
Project: 1245
Buggy source:
public void readMemInfo(){
  StrictMode.ThreadPolicy savedPolicy=StrictMode.allowThreadDiskReads();
  try {
    long[] infos=new long[Debug.MEMINFO_COUNT];
    Debug.getMemInfo(infos);
    mTotalSize=infos[Debug.MEMINFO_TOTAL] * 1024;
    mFreeSize=infos[Debug.MEMINFO_FREE] * 1024;
    mCachedSize=infos[Debug.MEMINFO_CACHED] * 1024;
  }
  finally {
    StrictMode.setThreadPolicy(savedPolicy);
  }
}

Fixed version (ground truth):
public void readMemInfo(){
  StrictMode.ThreadPolicy savedPolicy=StrictMode.allowThreadDiskReads();
  try {
    Debug.getMemInfo(mInfos);
  }
  finally {
    StrictMode.setThreadPolicy(savedPolicy);
  }
}
Program: 1247
Project: 1247
Buggy source:
public long getCachedSize(){
  return mCachedSize;
}

Fixed version (ground truth):
public long getCachedSize(){
  return mInfos[Debug.MEMINFO_CACHED] * 1024;
}
Program: 1248
Project: 1248
Buggy source:
public long getTotalSize(){
  return mTotalSize;
}

Fixed version (ground truth):
public long getTotalSize(){
  return mInfos[Debug.MEMINFO_TOTAL] * 1024;
}
Program: 1249
Project: 1249
Buggy source:
public long getFreeSize(){
  return mFreeSize;
}

Fixed version (ground truth):
public long getFreeSize(){
  return mInfos[Debug.MEMINFO_FREE] * 1024;
}
Program: 1250
Project: 1250
Buggy source:
public void readMemInfo(){
  StrictMode.ThreadPolicy savedPolicy=StrictMode.allowThreadDiskReads();
  try {
    long[] infos=new long[Debug.MEMINFO_COUNT];
    Debug.getMemInfo(infos);
    mTotalSize=infos[Debug.MEMINFO_TOTAL] * 1024;
    mFreeSize=infos[Debug.MEMINFO_FREE] * 1024;
    mCachedSize=infos[Debug.MEMINFO_CACHED] * 1024;
  }
  finally {
    StrictMode.setThreadPolicy(savedPolicy);
  }
}

Fixed version (ground truth):
public void readMemInfo(){
  StrictMode.ThreadPolicy savedPolicy=StrictMode.allowThreadDiskReads();
  try {
    Debug.getMemInfo(mInfos);
  }
  finally {
    StrictMode.setThreadPolicy(savedPolicy);
  }
}
Program: 1251
Project: 1251
Buggy source:
@Override protected void onAttachedToWindow(){
  super.onAttachedToWindow();
  final ViewTreeObserver treeObserver=getViewTreeObserver();
  treeObserver.addOnTouchModeChangeListener(this);
  if (mTextFilterEnabled && mPopup != null && !mGlobalLayoutListenerAddedFilter) {
    treeObserver.addOnGlobalLayoutListener(this);
  }
  if (mAdapter != null && mDataSetObserver == null) {
    mDataSetObserver=new AdapterDataSetObserver();
    mAdapter.registerDataSetObserver(mDataSetObserver);
    mDataChanged=true;
    mOldItemCount=mItemCount;
    mItemCount=mAdapter.getCount();
  }
  mIsAttached=true;
}

Fixed version (ground truth):
@Override protected void onAttachedToWindow(){
  super.onAttachedToWindow();
  final ViewTreeObserver treeObserver=getViewTreeObserver();
  treeObserver.addOnTouchModeChangeListener(this);
  if (mTextFilterEnabled && mPopup != null && !mGlobalLayoutListenerAddedFilter) {
    treeObserver.addOnGlobalLayoutListener(this);
  }
  if (mAdapter != null && mDataSetObserver == null) {
    mDataSetObserver=new AdapterDataSetObserver();
    mAdapter.registerDataSetObserver(mDataSetObserver);
    mDataChanged=true;
    mOldItemCount=mItemCount;
    mItemCount=mAdapter.getCount();
  }
}
Program: 1252
Project: 1252
Buggy source:
@Override protected void onFocusChanged(boolean gainFocus,int direction,Rect previouslyFocusedRect){
  super.onFocusChanged(gainFocus,direction,previouslyFocusedRect);
  if (gainFocus && mSelectedPosition < 0 && !isInTouchMode()) {
    if (!mIsAttached && mAdapter != null) {
      mDataChanged=true;
      mOldItemCount=mItemCount;
      mItemCount=mAdapter.getCount();
    }
    resurrectSelection();
  }
}

Fixed version (ground truth):
@Override protected void onFocusChanged(boolean gainFocus,int direction,Rect previouslyFocusedRect){
  super.onFocusChanged(gainFocus,direction,previouslyFocusedRect);
  if (gainFocus && mSelectedPosition < 0 && !isInTouchMode()) {
    if (!isAttachedToWindow() && mAdapter != null) {
      mDataChanged=true;
      mOldItemCount=mItemCount;
      mItemCount=mAdapter.getCount();
    }
    resurrectSelection();
  }
}