nus-yam/ex-repair huggingface dataset:
Program: 196864
Project: 196864
Buggy source:
@Override public Bitmap getTaskDescriptionIcon(String filename){
  return mTaskPersister.getTaskDescriptionIcon(filename);
}

Fixed version (ground truth):
@Override public Bitmap getTaskDescriptionIcon(String filename){
  if (!FileUtils.isValidExtFilename(filename) || !filename.contains(ActivityRecord.ACTIVITY_ICON_SUFFIX)) {
    throw new IllegalArgumentException("String_Node_Str" + filename);
  }
  return mTaskPersister.getTaskDescriptionIcon(filename);
}
Program: 196865
Project: 196865
Buggy source:
boolean unbindServiceLocked(IServiceConnection connection){
  IBinder binder=connection.asBinder();
  if (DEBUG_SERVICE)   Slog.v(TAG,"String_Node_Str" + binder);
  ArrayList<ConnectionRecord> clist=mServiceConnections.get(binder);
  if (clist == null) {
    Slog.w(TAG,"String_Node_Str" + connection.asBinder());
    return false;
  }
  final long origId=Binder.clearCallingIdentity();
  try {
    while (clist.size() > 0) {
      ConnectionRecord r=clist.get(0);
      removeConnectionLocked(r,null,null);
      if (r.binding.service.app != null) {
        if ((r.flags & Context.BIND_TREAT_LIKE_ACTIVITY) != 0) {
          r.binding.service.app.treatLikeActivity=true;
          mAm.updateLruProcessLocked(r.binding.service.app,r.binding.service.app.hasClientActivities || r.binding.service.app.treatLikeActivity,null);
        }
        mAm.updateOomAdjLocked(r.binding.service.app);
      }
    }
  }
  finally {
    Binder.restoreCallingIdentity(origId);
  }
  return true;
}

Fixed version (ground truth):
boolean unbindServiceLocked(IServiceConnection connection){
  IBinder binder=connection.asBinder();
  if (DEBUG_SERVICE)   Slog.v(TAG,"String_Node_Str" + binder);
  ArrayList<ConnectionRecord> clist=mServiceConnections.get(binder);
  if (clist == null) {
    Slog.w(TAG,"String_Node_Str" + connection.asBinder());
    return false;
  }
  final long origId=Binder.clearCallingIdentity();
  try {
    while (clist.size() > 0) {
      ConnectionRecord r=clist.get(0);
      removeConnectionLocked(r,null,null);
      if (clist.size() > 0 && clist.get(0) == r) {
        Slog.wtf(TAG,"String_Node_Str" + r + "String_Node_Str"+ binder);
        clist.remove(0);
      }
      if (r.binding.service.app != null) {
        if ((r.flags & Context.BIND_TREAT_LIKE_ACTIVITY) != 0) {
          r.binding.service.app.treatLikeActivity=true;
          mAm.updateLruProcessLocked(r.binding.service.app,r.binding.service.app.hasClientActivities || r.binding.service.app.treatLikeActivity,null);
        }
        mAm.updateOomAdjLocked(r.binding.service.app);
      }
    }
  }
  finally {
    Binder.restoreCallingIdentity(origId);
  }
  return true;
}
Program: 196868
Project: 196868
Buggy source:
boolean unbindServiceLocked(IServiceConnection connection){
  IBinder binder=connection.asBinder();
  if (DEBUG_SERVICE)   Slog.v(TAG,"String_Node_Str" + binder);
  ArrayList<ConnectionRecord> clist=mServiceConnections.get(binder);
  if (clist == null) {
    Slog.w(TAG,"String_Node_Str" + connection.asBinder());
    return false;
  }
  final long origId=Binder.clearCallingIdentity();
  try {
    while (clist.size() > 0) {
      ConnectionRecord r=clist.get(0);
      removeConnectionLocked(r,null,null);
      if (r.binding.service.app != null) {
        if ((r.flags & Context.BIND_TREAT_LIKE_ACTIVITY) != 0) {
          r.binding.service.app.treatLikeActivity=true;
          mAm.updateLruProcessLocked(r.binding.service.app,r.binding.service.app.hasClientActivities || r.binding.service.app.treatLikeActivity,null);
        }
        mAm.updateOomAdjLocked(r.binding.service.app);
      }
    }
  }
  finally {
    Binder.restoreCallingIdentity(origId);
  }
  return true;
}

Fixed version (ground truth):
boolean unbindServiceLocked(IServiceConnection connection){
  IBinder binder=connection.asBinder();
  if (DEBUG_SERVICE)   Slog.v(TAG,"String_Node_Str" + binder);
  ArrayList<ConnectionRecord> clist=mServiceConnections.get(binder);
  if (clist == null) {
    Slog.w(TAG,"String_Node_Str" + connection.asBinder());
    return false;
  }
  final long origId=Binder.clearCallingIdentity();
  try {
    while (clist.size() > 0) {
      ConnectionRecord r=clist.get(0);
      removeConnectionLocked(r,null,null);
      if (clist.size() > 0 && clist.get(0) == r) {
        Slog.wtf(TAG,"String_Node_Str" + r + "String_Node_Str"+ binder);
        clist.remove(0);
      }
      if (r.binding.service.app != null) {
        if ((r.flags & Context.BIND_TREAT_LIKE_ACTIVITY) != 0) {
          r.binding.service.app.treatLikeActivity=true;
          mAm.updateLruProcessLocked(r.binding.service.app,r.binding.service.app.hasClientActivities || r.binding.service.app.treatLikeActivity,null);
        }
        mAm.updateOomAdjLocked(r.binding.service.app);
      }
    }
  }
  finally {
    Binder.restoreCallingIdentity(origId);
  }
  return true;
}
Program: 196871
Project: 196871
Buggy source:
boolean unbindServiceLocked(IServiceConnection connection){
  IBinder binder=connection.asBinder();
  if (DEBUG_SERVICE)   Slog.v(TAG,"String_Node_Str" + binder);
  ArrayList<ConnectionRecord> clist=mServiceConnections.get(binder);
  if (clist == null) {
    Slog.w(TAG,"String_Node_Str" + connection.asBinder());
    return false;
  }
  final long origId=Binder.clearCallingIdentity();
  try {
    while (clist.size() > 0) {
      ConnectionRecord r=clist.get(0);
      removeConnectionLocked(r,null,null);
      if (r.binding.service.app != null) {
        if ((r.flags & Context.BIND_TREAT_LIKE_ACTIVITY) != 0) {
          r.binding.service.app.treatLikeActivity=true;
          mAm.updateLruProcessLocked(r.binding.service.app,r.binding.service.app.hasClientActivities || r.binding.service.app.treatLikeActivity,null);
        }
        mAm.updateOomAdjLocked(r.binding.service.app);
      }
    }
  }
  finally {
    Binder.restoreCallingIdentity(origId);
  }
  return true;
}

Fixed version (ground truth):
boolean unbindServiceLocked(IServiceConnection connection){
  IBinder binder=connection.asBinder();
  if (DEBUG_SERVICE)   Slog.v(TAG,"String_Node_Str" + binder);
  ArrayList<ConnectionRecord> clist=mServiceConnections.get(binder);
  if (clist == null) {
    Slog.w(TAG,"String_Node_Str" + connection.asBinder());
    return false;
  }
  final long origId=Binder.clearCallingIdentity();
  try {
    while (clist.size() > 0) {
      ConnectionRecord r=clist.get(0);
      removeConnectionLocked(r,null,null);
      if (clist.size() > 0 && clist.get(0) == r) {
        Slog.wtf(TAG,"String_Node_Str" + r + "String_Node_Str"+ binder);
        clist.remove(0);
      }
      if (r.binding.service.app != null) {
        if ((r.flags & Context.BIND_TREAT_LIKE_ACTIVITY) != 0) {
          r.binding.service.app.treatLikeActivity=true;
          mAm.updateLruProcessLocked(r.binding.service.app,r.binding.service.app.hasClientActivities || r.binding.service.app.treatLikeActivity,null);
        }
        mAm.updateOomAdjLocked(r.binding.service.app);
      }
    }
  }
  finally {
    Binder.restoreCallingIdentity(origId);
  }
  return true;
}
Program: 196874
Project: 196874
Buggy source:
boolean unbindServiceLocked(IServiceConnection connection){
  IBinder binder=connection.asBinder();
  if (DEBUG_SERVICE)   Slog.v(TAG,"String_Node_Str" + binder);
  ArrayList<ConnectionRecord> clist=mServiceConnections.get(binder);
  if (clist == null) {
    Slog.w(TAG,"String_Node_Str" + connection.asBinder());
    return false;
  }
  final long origId=Binder.clearCallingIdentity();
  try {
    while (clist.size() > 0) {
      ConnectionRecord r=clist.get(0);
      removeConnectionLocked(r,null,null);
      if (r.binding.service.app != null) {
        if ((r.flags & Context.BIND_TREAT_LIKE_ACTIVITY) != 0) {
          r.binding.service.app.treatLikeActivity=true;
          mAm.updateLruProcessLocked(r.binding.service.app,r.binding.service.app.hasClientActivities || r.binding.service.app.treatLikeActivity,null);
        }
        mAm.updateOomAdjLocked(r.binding.service.app);
      }
    }
  }
  finally {
    Binder.restoreCallingIdentity(origId);
  }
  return true;
}

Fixed version (ground truth):
boolean unbindServiceLocked(IServiceConnection connection){
  IBinder binder=connection.asBinder();
  if (DEBUG_SERVICE)   Slog.v(TAG,"String_Node_Str" + binder);
  ArrayList<ConnectionRecord> clist=mServiceConnections.get(binder);
  if (clist == null) {
    Slog.w(TAG,"String_Node_Str" + connection.asBinder());
    return false;
  }
  final long origId=Binder.clearCallingIdentity();
  try {
    while (clist.size() > 0) {
      ConnectionRecord r=clist.get(0);
      removeConnectionLocked(r,null,null);
      if (clist.size() > 0 && clist.get(0) == r) {
        Slog.wtf(TAG,"String_Node_Str" + r + "String_Node_Str"+ binder);
        clist.remove(0);
      }
      if (r.binding.service.app != null) {
        if ((r.flags & Context.BIND_TREAT_LIKE_ACTIVITY) != 0) {
          r.binding.service.app.treatLikeActivity=true;
          mAm.updateLruProcessLocked(r.binding.service.app,r.binding.service.app.hasClientActivities || r.binding.service.app.treatLikeActivity,null);
        }
        mAm.updateOomAdjLocked(r.binding.service.app);
      }
    }
  }
  finally {
    Binder.restoreCallingIdentity(origId);
  }
  return true;
}
Program: 196877
Project: 196877
Buggy source:
boolean unbindServiceLocked(IServiceConnection connection){
  IBinder binder=connection.asBinder();
  if (DEBUG_SERVICE)   Slog.v(TAG,"String_Node_Str" + binder);
  ArrayList<ConnectionRecord> clist=mServiceConnections.get(binder);
  if (clist == null) {
    Slog.w(TAG,"String_Node_Str" + connection.asBinder());
    return false;
  }
  final long origId=Binder.clearCallingIdentity();
  try {
    while (clist.size() > 0) {
      ConnectionRecord r=clist.get(0);
      removeConnectionLocked(r,null,null);
      if (r.binding.service.app != null) {
        if ((r.flags & Context.BIND_TREAT_LIKE_ACTIVITY) != 0) {
          r.binding.service.app.treatLikeActivity=true;
          mAm.updateLruProcessLocked(r.binding.service.app,r.binding.service.app.hasClientActivities || r.binding.service.app.treatLikeActivity,null);
        }
        mAm.updateOomAdjLocked(r.binding.service.app);
      }
    }
  }
  finally {
    Binder.restoreCallingIdentity(origId);
  }
  return true;
}

Fixed version (ground truth):
boolean unbindServiceLocked(IServiceConnection connection){
  IBinder binder=connection.asBinder();
  if (DEBUG_SERVICE)   Slog.v(TAG,"String_Node_Str" + binder);
  ArrayList<ConnectionRecord> clist=mServiceConnections.get(binder);
  if (clist == null) {
    Slog.w(TAG,"String_Node_Str" + connection.asBinder());
    return false;
  }
  final long origId=Binder.clearCallingIdentity();
  try {
    while (clist.size() > 0) {
      ConnectionRecord r=clist.get(0);
      removeConnectionLocked(r,null,null);
      if (clist.size() > 0 && clist.get(0) == r) {
        Slog.wtf(TAG,"String_Node_Str" + r + "String_Node_Str"+ binder);
        clist.remove(0);
      }
      if (r.binding.service.app != null) {
        if ((r.flags & Context.BIND_TREAT_LIKE_ACTIVITY) != 0) {
          r.binding.service.app.treatLikeActivity=true;
          mAm.updateLruProcessLocked(r.binding.service.app,r.binding.service.app.hasClientActivities || r.binding.service.app.treatLikeActivity,null);
        }
        mAm.updateOomAdjLocked(r.binding.service.app);
      }
    }
  }
  finally {
    Binder.restoreCallingIdentity(origId);
  }
  return true;
}
Program: 196880
Project: 196880
Buggy source:
int findEffectiveRootIndex(){
  int effectiveNdx=0;
  final int topActivityNdx=mActivities.size() - 1;
  for (int activityNdx=0; activityNdx < topActivityNdx; ++activityNdx) {
    final ActivityRecord r=mActivities.get(activityNdx);
    if (r.finishing) {
      continue;
    }
    effectiveNdx=activityNdx;
    if ((r.info.flags & ActivityInfo.FLAG_RELINQUISH_TASK_IDENTITY) == 0) {
      break;
    }
  }
  return effectiveNdx;
}

Fixed version (ground truth):
int findEffectiveRootIndex(){
  int effectiveNdx=0;
  final int topActivityNdx=mActivities.size() - 1;
  for (int activityNdx=0; activityNdx <= topActivityNdx; ++activityNdx) {
    final ActivityRecord r=mActivities.get(activityNdx);
    if (r.finishing) {
      continue;
    }
    effectiveNdx=activityNdx;
    if ((r.info.flags & ActivityInfo.FLAG_RELINQUISH_TASK_IDENTITY) == 0) {
      break;
    }
  }
  return effectiveNdx;
}
Program: 196881
Project: 196881
Buggy source:
int findEffectiveRootIndex(){
  int effectiveNdx=0;
  final int topActivityNdx=mActivities.size() - 1;
  for (int activityNdx=0; activityNdx < topActivityNdx; ++activityNdx) {
    final ActivityRecord r=mActivities.get(activityNdx);
    if (r.finishing) {
      continue;
    }
    effectiveNdx=activityNdx;
    if ((r.info.flags & ActivityInfo.FLAG_RELINQUISH_TASK_IDENTITY) == 0) {
      break;
    }
  }
  return effectiveNdx;
}

Fixed version (ground truth):
int findEffectiveRootIndex(){
  int effectiveNdx=0;
  final int topActivityNdx=mActivities.size() - 1;
  for (int activityNdx=0; activityNdx <= topActivityNdx; ++activityNdx) {
    final ActivityRecord r=mActivities.get(activityNdx);
    if (r.finishing) {
      continue;
    }
    effectiveNdx=activityNdx;
    if ((r.info.flags & ActivityInfo.FLAG_RELINQUISH_TASK_IDENTITY) == 0) {
      break;
    }
  }
  return effectiveNdx;
}
Program: 196882
Project: 196882
Buggy source:
boolean unbindServiceLocked(IServiceConnection connection){
  IBinder binder=connection.asBinder();
  if (DEBUG_SERVICE)   Slog.v(TAG,"String_Node_Str" + binder);
  ArrayList<ConnectionRecord> clist=mServiceConnections.get(binder);
  if (clist == null) {
    Slog.w(TAG,"String_Node_Str" + connection.asBinder());
    return false;
  }
  final long origId=Binder.clearCallingIdentity();
  try {
    while (clist.size() > 0) {
      ConnectionRecord r=clist.get(0);
      removeConnectionLocked(r,null,null);
      if (r.binding.service.app != null) {
        if ((r.flags & Context.BIND_TREAT_LIKE_ACTIVITY) != 0) {
          r.binding.service.app.treatLikeActivity=true;
          mAm.updateLruProcessLocked(r.binding.service.app,r.binding.service.app.hasClientActivities || r.binding.service.app.treatLikeActivity,null);
        }
        mAm.updateOomAdjLocked(r.binding.service.app);
      }
    }
  }
  finally {
    Binder.restoreCallingIdentity(origId);
  }
  return true;
}

Fixed version (ground truth):
boolean unbindServiceLocked(IServiceConnection connection){
  IBinder binder=connection.asBinder();
  if (DEBUG_SERVICE)   Slog.v(TAG,"String_Node_Str" + binder);
  ArrayList<ConnectionRecord> clist=mServiceConnections.get(binder);
  if (clist == null) {
    Slog.w(TAG,"String_Node_Str" + connection.asBinder());
    return false;
  }
  final long origId=Binder.clearCallingIdentity();
  try {
    while (clist.size() > 0) {
      ConnectionRecord r=clist.get(0);
      removeConnectionLocked(r,null,null);
      if (clist.size() > 0 && clist.get(0) == r) {
        Slog.wtf(TAG,"String_Node_Str" + r + "String_Node_Str"+ binder);
        clist.remove(0);
      }
      if (r.binding.service.app != null) {
        if ((r.flags & Context.BIND_TREAT_LIKE_ACTIVITY) != 0) {
          r.binding.service.app.treatLikeActivity=true;
          mAm.updateLruProcessLocked(r.binding.service.app,r.binding.service.app.hasClientActivities || r.binding.service.app.treatLikeActivity,null);
        }
        mAm.updateOomAdjLocked(r.binding.service.app);
      }
    }
  }
  finally {
    Binder.restoreCallingIdentity(origId);
  }
  return true;
}
Program: 196885
Project: 196885
Buggy source:
int findEffectiveRootIndex(){
  int effectiveNdx=0;
  final int topActivityNdx=mActivities.size() - 1;
  for (int activityNdx=0; activityNdx < topActivityNdx; ++activityNdx) {
    final ActivityRecord r=mActivities.get(activityNdx);
    if (r.finishing) {
      continue;
    }
    effectiveNdx=activityNdx;
    if ((r.info.flags & ActivityInfo.FLAG_RELINQUISH_TASK_IDENTITY) == 0) {
      break;
    }
  }
  return effectiveNdx;
}

Fixed version (ground truth):
int findEffectiveRootIndex(){
  int effectiveNdx=0;
  final int topActivityNdx=mActivities.size() - 1;
  for (int activityNdx=0; activityNdx <= topActivityNdx; ++activityNdx) {
    final ActivityRecord r=mActivities.get(activityNdx);
    if (r.finishing) {
      continue;
    }
    effectiveNdx=activityNdx;
    if ((r.info.flags & ActivityInfo.FLAG_RELINQUISH_TASK_IDENTITY) == 0) {
      break;
    }
  }
  return effectiveNdx;
}
Program: 196886
Project: 196886
Buggy source:
int findEffectiveRootIndex(){
  int effectiveNdx=0;
  final int topActivityNdx=mActivities.size() - 1;
  for (int activityNdx=0; activityNdx < topActivityNdx; ++activityNdx) {
    final ActivityRecord r=mActivities.get(activityNdx);
    if (r.finishing) {
      continue;
    }
    effectiveNdx=activityNdx;
    if ((r.info.flags & ActivityInfo.FLAG_RELINQUISH_TASK_IDENTITY) == 0) {
      break;
    }
  }
  return effectiveNdx;
}

Fixed version (ground truth):
int findEffectiveRootIndex(){
  int effectiveNdx=0;
  final int topActivityNdx=mActivities.size() - 1;
  for (int activityNdx=0; activityNdx <= topActivityNdx; ++activityNdx) {
    final ActivityRecord r=mActivities.get(activityNdx);
    if (r.finishing) {
      continue;
    }
    effectiveNdx=activityNdx;
    if ((r.info.flags & ActivityInfo.FLAG_RELINQUISH_TASK_IDENTITY) == 0) {
      break;
    }
  }
  return effectiveNdx;
}
Program: 196887
Project: 196887
Buggy source:
int findEffectiveRootIndex(){
  int effectiveNdx=0;
  final int topActivityNdx=mActivities.size() - 1;
  for (int activityNdx=0; activityNdx < topActivityNdx; ++activityNdx) {
    final ActivityRecord r=mActivities.get(activityNdx);
    if (r.finishing) {
      continue;
    }
    effectiveNdx=activityNdx;
    if ((r.info.flags & ActivityInfo.FLAG_RELINQUISH_TASK_IDENTITY) == 0) {
      break;
    }
  }
  return effectiveNdx;
}

Fixed version (ground truth):
int findEffectiveRootIndex(){
  int effectiveNdx=0;
  final int topActivityNdx=mActivities.size() - 1;
  for (int activityNdx=0; activityNdx <= topActivityNdx; ++activityNdx) {
    final ActivityRecord r=mActivities.get(activityNdx);
    if (r.finishing) {
      continue;
    }
    effectiveNdx=activityNdx;
    if ((r.info.flags & ActivityInfo.FLAG_RELINQUISH_TASK_IDENTITY) == 0) {
      break;
    }
  }
  return effectiveNdx;
}
Program: 196888
Project: 196888
Buggy source:
int findEffectiveRootIndex(){
  int effectiveNdx=0;
  final int topActivityNdx=mActivities.size() - 1;
  for (int activityNdx=0; activityNdx < topActivityNdx; ++activityNdx) {
    final ActivityRecord r=mActivities.get(activityNdx);
    if (r.finishing) {
      continue;
    }
    effectiveNdx=activityNdx;
    if ((r.info.flags & ActivityInfo.FLAG_RELINQUISH_TASK_IDENTITY) == 0) {
      break;
    }
  }
  return effectiveNdx;
}

Fixed version (ground truth):
int findEffectiveRootIndex(){
  int effectiveNdx=0;
  final int topActivityNdx=mActivities.size() - 1;
  for (int activityNdx=0; activityNdx <= topActivityNdx; ++activityNdx) {
    final ActivityRecord r=mActivities.get(activityNdx);
    if (r.finishing) {
      continue;
    }
    effectiveNdx=activityNdx;
    if ((r.info.flags & ActivityInfo.FLAG_RELINQUISH_TASK_IDENTITY) == 0) {
      break;
    }
  }
  return effectiveNdx;
}
Program: 196889
Project: 196889
Buggy source:
int findEffectiveRootIndex(){
  int effectiveNdx=0;
  final int topActivityNdx=mActivities.size() - 1;
  for (int activityNdx=0; activityNdx < topActivityNdx; ++activityNdx) {
    final ActivityRecord r=mActivities.get(activityNdx);
    if (r.finishing) {
      continue;
    }
    effectiveNdx=activityNdx;
    if ((r.info.flags & ActivityInfo.FLAG_RELINQUISH_TASK_IDENTITY) == 0) {
      break;
    }
  }
  return effectiveNdx;
}

Fixed version (ground truth):
int findEffectiveRootIndex(){
  int effectiveNdx=0;
  final int topActivityNdx=mActivities.size() - 1;
  for (int activityNdx=0; activityNdx <= topActivityNdx; ++activityNdx) {
    final ActivityRecord r=mActivities.get(activityNdx);
    if (r.finishing) {
      continue;
    }
    effectiveNdx=activityNdx;
    if ((r.info.flags & ActivityInfo.FLAG_RELINQUISH_TASK_IDENTITY) == 0) {
      break;
    }
  }
  return effectiveNdx;
}
Program: 196890
Project: 196890
Buggy source:
int findEffectiveRootIndex(){
  int effectiveNdx=0;
  final int topActivityNdx=mActivities.size() - 1;
  for (int activityNdx=0; activityNdx < topActivityNdx; ++activityNdx) {
    final ActivityRecord r=mActivities.get(activityNdx);
    if (r.finishing) {
      continue;
    }
    effectiveNdx=activityNdx;
    if ((r.info.flags & ActivityInfo.FLAG_RELINQUISH_TASK_IDENTITY) == 0) {
      break;
    }
  }
  return effectiveNdx;
}

Fixed version (ground truth):
int findEffectiveRootIndex(){
  int effectiveNdx=0;
  final int topActivityNdx=mActivities.size() - 1;
  for (int activityNdx=0; activityNdx <= topActivityNdx; ++activityNdx) {
    final ActivityRecord r=mActivities.get(activityNdx);
    if (r.finishing) {
      continue;
    }
    effectiveNdx=activityNdx;
    if ((r.info.flags & ActivityInfo.FLAG_RELINQUISH_TASK_IDENTITY) == 0) {
      break;
    }
  }
  return effectiveNdx;
}
Program: 196891
Project: 196891
Buggy source:
boolean unbindServiceLocked(IServiceConnection connection){
  IBinder binder=connection.asBinder();
  if (DEBUG_SERVICE)   Slog.v(TAG,"String_Node_Str" + binder);
  ArrayList<ConnectionRecord> clist=mServiceConnections.get(binder);
  if (clist == null) {
    Slog.w(TAG,"String_Node_Str" + connection.asBinder());
    return false;
  }
  final long origId=Binder.clearCallingIdentity();
  try {
    while (clist.size() > 0) {
      ConnectionRecord r=clist.get(0);
      removeConnectionLocked(r,null,null);
      if (r.binding.service.app != null) {
        if ((r.flags & Context.BIND_TREAT_LIKE_ACTIVITY) != 0) {
          r.binding.service.app.treatLikeActivity=true;
          mAm.updateLruProcessLocked(r.binding.service.app,r.binding.service.app.hasClientActivities || r.binding.service.app.treatLikeActivity,null);
        }
        mAm.updateOomAdjLocked(r.binding.service.app);
      }
    }
  }
  finally {
    Binder.restoreCallingIdentity(origId);
  }
  return true;
}

Fixed version (ground truth):
boolean unbindServiceLocked(IServiceConnection connection){
  IBinder binder=connection.asBinder();
  if (DEBUG_SERVICE)   Slog.v(TAG,"String_Node_Str" + binder);
  ArrayList<ConnectionRecord> clist=mServiceConnections.get(binder);
  if (clist == null) {
    Slog.w(TAG,"String_Node_Str" + connection.asBinder());
    return false;
  }
  final long origId=Binder.clearCallingIdentity();
  try {
    while (clist.size() > 0) {
      ConnectionRecord r=clist.get(0);
      removeConnectionLocked(r,null,null);
      if (clist.size() > 0 && clist.get(0) == r) {
        Slog.wtf(TAG,"String_Node_Str" + r + "String_Node_Str"+ binder);
        clist.remove(0);
      }
      if (r.binding.service.app != null) {
        if ((r.flags & Context.BIND_TREAT_LIKE_ACTIVITY) != 0) {
          r.binding.service.app.treatLikeActivity=true;
          mAm.updateLruProcessLocked(r.binding.service.app,r.binding.service.app.hasClientActivities || r.binding.service.app.treatLikeActivity,null);
        }
        mAm.updateOomAdjLocked(r.binding.service.app);
      }
    }
  }
  finally {
    Binder.restoreCallingIdentity(origId);
  }
  return true;
}
Program: 196898
Project: 196898
Buggy source:
/** 
 * Invokes IApplicationThread.dumpService() on the thread of the specified service if there is a thread associated with the service.
 */
private void dumpService(String prefix,FileDescriptor fd,PrintWriter pw,final ServiceRecord r,String[] args,boolean dumpAll){
  String innerPrefix=prefix + "String_Node_Str";
synchronized (this) {
    pw.print(prefix);
    pw.print("String_Node_Str");
    pw.print(r.shortName);
    pw.print("String_Node_Str");
    pw.print(Integer.toHexString(System.identityHashCode(r)));
    pw.print("String_Node_Str");
    if (r.app != null)     pw.println(r.app.pid);
 else     pw.println("String_Node_Str");
    if (dumpAll) {
      r.dump(pw,innerPrefix);
    }
  }
  if (r.app != null && r.app.thread != null) {
    pw.print(prefix);
    pw.println("String_Node_Str");
    pw.flush();
    try {
      TransferPipe tp=new TransferPipe();
      try {
        r.app.thread.dumpService(tp.getWriteFd().getFileDescriptor(),r,args);
        tp.setBufferPrefix(prefix + "String_Node_Str");
        tp.go(fd);
      }
  finally {
        tp.kill();
      }
    }
 catch (    IOException e) {
      pw.println(prefix + "String_Node_Str" + e);
    }
catch (    RemoteException e) {
      pw.println(prefix + "String_Node_Str");
    }
  }
}

Fixed version (ground truth):
/** 
 * Invokes IApplicationThread.dumpService() on the thread of the specified service if there is a thread associated with the service.
 */
private void dumpService(String prefix,FileDescriptor fd,PrintWriter pw,final ServiceRecord r,String[] args,boolean dumpAll){
  String innerPrefix=prefix + "String_Node_Str";
synchronized (mAm) {
    pw.print(prefix);
    pw.print("String_Node_Str");
    pw.print(r.shortName);
    pw.print("String_Node_Str");
    pw.print(Integer.toHexString(System.identityHashCode(r)));
    pw.print("String_Node_Str");
    if (r.app != null)     pw.println(r.app.pid);
 else     pw.println("String_Node_Str");
    if (dumpAll) {
      r.dump(pw,innerPrefix);
    }
  }
  if (r.app != null && r.app.thread != null) {
    pw.print(prefix);
    pw.println("String_Node_Str");
    pw.flush();
    try {
      TransferPipe tp=new TransferPipe();
      try {
        r.app.thread.dumpService(tp.getWriteFd().getFileDescriptor(),r,args);
        tp.setBufferPrefix(prefix + "String_Node_Str");
        tp.go(fd);
      }
  finally {
        tp.kill();
      }
    }
 catch (    IOException e) {
      pw.println(prefix + "String_Node_Str" + e);
    }
catch (    RemoteException e) {
      pw.println(prefix + "String_Node_Str");
    }
  }
}
Program: 196899
Project: 196899
Buggy source:
void serviceTimeout(ProcessRecord proc){
  String anrMessage=null;
synchronized (this) {
    if (proc.executingServices.size() == 0 || proc.thread == null) {
      return;
    }
    long maxTime=SystemClock.uptimeMillis() - (proc.execServicesFg ? SERVICE_TIMEOUT : SERVICE_BACKGROUND_TIMEOUT);
    ServiceRecord timeout=null;
    long nextTime=0;
    for (int i=proc.executingServices.size() - 1; i >= 0; i--) {
      ServiceRecord sr=proc.executingServices.valueAt(i);
      if (sr.executingStart < maxTime) {
        timeout=sr;
        break;
      }
      if (sr.executingStart > nextTime) {
        nextTime=sr.executingStart;
      }
    }
    if (timeout != null && mAm.mLruProcesses.contains(proc)) {
      Slog.w(TAG,"String_Node_Str" + timeout);
      anrMessage="String_Node_Str" + timeout.shortName;
    }
 else {
      Message msg=mAm.mHandler.obtainMessage(ActivityManagerService.SERVICE_TIMEOUT_MSG);
      msg.obj=proc;
      mAm.mHandler.sendMessageAtTime(msg,proc.execServicesFg ? (nextTime + SERVICE_TIMEOUT) : (nextTime + SERVICE_BACKGROUND_TIMEOUT));
    }
  }
  if (anrMessage != null) {
    mAm.appNotResponding(proc,null,null,false,anrMessage);
  }
}

Fixed version (ground truth):
void serviceTimeout(ProcessRecord proc){
  String anrMessage=null;
synchronized (mAm) {
    if (proc.executingServices.size() == 0 || proc.thread == null) {
      return;
    }
    long maxTime=SystemClock.uptimeMillis() - (proc.execServicesFg ? SERVICE_TIMEOUT : SERVICE_BACKGROUND_TIMEOUT);
    ServiceRecord timeout=null;
    long nextTime=0;
    for (int i=proc.executingServices.size() - 1; i >= 0; i--) {
      ServiceRecord sr=proc.executingServices.valueAt(i);
      if (sr.executingStart < maxTime) {
        timeout=sr;
        break;
      }
      if (sr.executingStart > nextTime) {
        nextTime=sr.executingStart;
      }
    }
    if (timeout != null && mAm.mLruProcesses.contains(proc)) {
      Slog.w(TAG,"String_Node_Str" + timeout);
      anrMessage="String_Node_Str" + timeout.shortName;
    }
 else {
      Message msg=mAm.mHandler.obtainMessage(ActivityManagerService.SERVICE_TIMEOUT_MSG);
      msg.obj=proc;
      mAm.mHandler.sendMessageAtTime(msg,proc.execServicesFg ? (nextTime + SERVICE_TIMEOUT) : (nextTime + SERVICE_BACKGROUND_TIMEOUT));
    }
  }
  if (anrMessage != null) {
    mAm.appNotResponding(proc,null,null,false,anrMessage);
  }
}
Program: 196900
Project: 196900
Buggy source:
private void ensureGroupStateLoadedLocked(int userId){
  final int[] profileIds=mSecurityPolicy.getEnabledGroupProfileIds(userId);
  int newMemberCount=0;
  final int profileIdCount=profileIds.length;
  for (int i=0; i < profileIdCount; i++) {
    final int profileId=profileIds[i];
    if (mLoadedUserIds.indexOfKey(profileId) >= 0) {
      profileIds[i]=LOADED_PROFILE_ID;
    }
 else {
      newMemberCount++;
    }
  }
  if (newMemberCount <= 0) {
    return;
  }
  int newMemberIndex=0;
  final int[] newProfileIds=new int[newMemberCount];
  for (int i=0; i < profileIdCount; i++) {
    final int profileId=profileIds[i];
    if (profileId != LOADED_PROFILE_ID) {
      mLoadedUserIds.put(profileId,profileId);
      newProfileIds[newMemberIndex]=profileId;
      newMemberIndex++;
    }
  }
  loadGroupWidgetProvidersLocked(newProfileIds);
  loadGroupStateLocked(newProfileIds);
}

Fixed version (ground truth):
private void ensureGroupStateLoadedLocked(int userId){
  final int[] profileIds=mSecurityPolicy.getEnabledGroupProfileIds(userId);
  int newMemberCount=0;
  final int profileIdCount=profileIds.length;
  for (int i=0; i < profileIdCount; i++) {
    final int profileId=profileIds[i];
    if (mLoadedUserIds.indexOfKey(profileId) >= 0) {
      profileIds[i]=LOADED_PROFILE_ID;
    }
 else {
      newMemberCount++;
    }
  }
  if (newMemberCount <= 0) {
    return;
  }
  int newMemberIndex=0;
  final int[] newProfileIds=new int[newMemberCount];
  for (int i=0; i < profileIdCount; i++) {
    final int profileId=profileIds[i];
    if (profileId != LOADED_PROFILE_ID) {
      mLoadedUserIds.put(profileId,profileId);
      newProfileIds[newMemberIndex]=profileId;
      newMemberIndex++;
    }
  }
  clearProvidersAndHostsTagsLocked();
  loadGroupWidgetProvidersLocked(newProfileIds);
  loadGroupStateLocked(newProfileIds);
}
Program: 196904
Project: 196904
Buggy source:
private void ensureGroupStateLoadedLocked(int userId){
  final int[] profileIds=mSecurityPolicy.getEnabledGroupProfileIds(userId);
  int newMemberCount=0;
  final int profileIdCount=profileIds.length;
  for (int i=0; i < profileIdCount; i++) {
    final int profileId=profileIds[i];
    if (mLoadedUserIds.indexOfKey(profileId) >= 0) {
      profileIds[i]=LOADED_PROFILE_ID;
    }
 else {
      newMemberCount++;
    }
  }
  if (newMemberCount <= 0) {
    return;
  }
  int newMemberIndex=0;
  final int[] newProfileIds=new int[newMemberCount];
  for (int i=0; i < profileIdCount; i++) {
    final int profileId=profileIds[i];
    if (profileId != LOADED_PROFILE_ID) {
      mLoadedUserIds.put(profileId,profileId);
      newProfileIds[newMemberIndex]=profileId;
      newMemberIndex++;
    }
  }
  loadGroupWidgetProvidersLocked(newProfileIds);
  loadGroupStateLocked(newProfileIds);
}

Fixed version (ground truth):
private void ensureGroupStateLoadedLocked(int userId){
  final int[] profileIds=mSecurityPolicy.getEnabledGroupProfileIds(userId);
  int newMemberCount=0;
  final int profileIdCount=profileIds.length;
  for (int i=0; i < profileIdCount; i++) {
    final int profileId=profileIds[i];
    if (mLoadedUserIds.indexOfKey(profileId) >= 0) {
      profileIds[i]=LOADED_PROFILE_ID;
    }
 else {
      newMemberCount++;
    }
  }
  if (newMemberCount <= 0) {
    return;
  }
  int newMemberIndex=0;
  final int[] newProfileIds=new int[newMemberCount];
  for (int i=0; i < profileIdCount; i++) {
    final int profileId=profileIds[i];
    if (profileId != LOADED_PROFILE_ID) {
      mLoadedUserIds.put(profileId,profileId);
      newProfileIds[newMemberIndex]=profileId;
      newMemberIndex++;
    }
  }
  clearProvidersAndHostsTagsLocked();
  loadGroupWidgetProvidersLocked(newProfileIds);
  loadGroupStateLocked(newProfileIds);
}
Program: 196905
Project: 196905
Buggy source:
/** 
 * Invokes IApplicationThread.dumpService() on the thread of the specified service if there is a thread associated with the service.
 */
private void dumpService(String prefix,FileDescriptor fd,PrintWriter pw,final ServiceRecord r,String[] args,boolean dumpAll){
  String innerPrefix=prefix + "String_Node_Str";
synchronized (this) {
    pw.print(prefix);
    pw.print("String_Node_Str");
    pw.print(r.shortName);
    pw.print("String_Node_Str");
    pw.print(Integer.toHexString(System.identityHashCode(r)));
    pw.print("String_Node_Str");
    if (r.app != null)     pw.println(r.app.pid);
 else     pw.println("String_Node_Str");
    if (dumpAll) {
      r.dump(pw,innerPrefix);
    }
  }
  if (r.app != null && r.app.thread != null) {
    pw.print(prefix);
    pw.println("String_Node_Str");
    pw.flush();
    try {
      TransferPipe tp=new TransferPipe();
      try {
        r.app.thread.dumpService(tp.getWriteFd().getFileDescriptor(),r,args);
        tp.setBufferPrefix(prefix + "String_Node_Str");
        tp.go(fd);
      }
  finally {
        tp.kill();
      }
    }
 catch (    IOException e) {
      pw.println(prefix + "String_Node_Str" + e);
    }
catch (    RemoteException e) {
      pw.println(prefix + "String_Node_Str");
    }
  }
}

Fixed version (ground truth):
/** 
 * Invokes IApplicationThread.dumpService() on the thread of the specified service if there is a thread associated with the service.
 */
private void dumpService(String prefix,FileDescriptor fd,PrintWriter pw,final ServiceRecord r,String[] args,boolean dumpAll){
  String innerPrefix=prefix + "String_Node_Str";
synchronized (mAm) {
    pw.print(prefix);
    pw.print("String_Node_Str");
    pw.print(r.shortName);
    pw.print("String_Node_Str");
    pw.print(Integer.toHexString(System.identityHashCode(r)));
    pw.print("String_Node_Str");
    if (r.app != null)     pw.println(r.app.pid);
 else     pw.println("String_Node_Str");
    if (dumpAll) {
      r.dump(pw,innerPrefix);
    }
  }
  if (r.app != null && r.app.thread != null) {
    pw.print(prefix);
    pw.println("String_Node_Str");
    pw.flush();
    try {
      TransferPipe tp=new TransferPipe();
      try {
        r.app.thread.dumpService(tp.getWriteFd().getFileDescriptor(),r,args);
        tp.setBufferPrefix(prefix + "String_Node_Str");
        tp.go(fd);
      }
  finally {
        tp.kill();
      }
    }
 catch (    IOException e) {
      pw.println(prefix + "String_Node_Str" + e);
    }
catch (    RemoteException e) {
      pw.println(prefix + "String_Node_Str");
    }
  }
}
Program: 196906
Project: 196906
Buggy source:
void serviceTimeout(ProcessRecord proc){
  String anrMessage=null;
synchronized (this) {
    if (proc.executingServices.size() == 0 || proc.thread == null) {
      return;
    }
    long maxTime=SystemClock.uptimeMillis() - (proc.execServicesFg ? SERVICE_TIMEOUT : SERVICE_BACKGROUND_TIMEOUT);
    ServiceRecord timeout=null;
    long nextTime=0;
    for (int i=proc.executingServices.size() - 1; i >= 0; i--) {
      ServiceRecord sr=proc.executingServices.valueAt(i);
      if (sr.executingStart < maxTime) {
        timeout=sr;
        break;
      }
      if (sr.executingStart > nextTime) {
        nextTime=sr.executingStart;
      }
    }
    if (timeout != null && mAm.mLruProcesses.contains(proc)) {
      Slog.w(TAG,"String_Node_Str" + timeout);
      anrMessage="String_Node_Str" + timeout.shortName;
    }
 else {
      Message msg=mAm.mHandler.obtainMessage(ActivityManagerService.SERVICE_TIMEOUT_MSG);
      msg.obj=proc;
      mAm.mHandler.sendMessageAtTime(msg,proc.execServicesFg ? (nextTime + SERVICE_TIMEOUT) : (nextTime + SERVICE_BACKGROUND_TIMEOUT));
    }
  }
  if (anrMessage != null) {
    mAm.appNotResponding(proc,null,null,false,anrMessage);
  }
}

Fixed version (ground truth):
void serviceTimeout(ProcessRecord proc){
  String anrMessage=null;
synchronized (mAm) {
    if (proc.executingServices.size() == 0 || proc.thread == null) {
      return;
    }
    long maxTime=SystemClock.uptimeMillis() - (proc.execServicesFg ? SERVICE_TIMEOUT : SERVICE_BACKGROUND_TIMEOUT);
    ServiceRecord timeout=null;
    long nextTime=0;
    for (int i=proc.executingServices.size() - 1; i >= 0; i--) {
      ServiceRecord sr=proc.executingServices.valueAt(i);
      if (sr.executingStart < maxTime) {
        timeout=sr;
        break;
      }
      if (sr.executingStart > nextTime) {
        nextTime=sr.executingStart;
      }
    }
    if (timeout != null && mAm.mLruProcesses.contains(proc)) {
      Slog.w(TAG,"String_Node_Str" + timeout);
      anrMessage="String_Node_Str" + timeout.shortName;
    }
 else {
      Message msg=mAm.mHandler.obtainMessage(ActivityManagerService.SERVICE_TIMEOUT_MSG);
      msg.obj=proc;
      mAm.mHandler.sendMessageAtTime(msg,proc.execServicesFg ? (nextTime + SERVICE_TIMEOUT) : (nextTime + SERVICE_BACKGROUND_TIMEOUT));
    }
  }
  if (anrMessage != null) {
    mAm.appNotResponding(proc,null,null,false,anrMessage);
  }
}
Program: 196907
Project: 196907
Buggy source:
/** 
 * Invokes IApplicationThread.dumpService() on the thread of the specified service if there is a thread associated with the service.
 */
private void dumpService(String prefix,FileDescriptor fd,PrintWriter pw,final ServiceRecord r,String[] args,boolean dumpAll){
  String innerPrefix=prefix + "String_Node_Str";
synchronized (this) {
    pw.print(prefix);
    pw.print("String_Node_Str");
    pw.print(r.shortName);
    pw.print("String_Node_Str");
    pw.print(Integer.toHexString(System.identityHashCode(r)));
    pw.print("String_Node_Str");
    if (r.app != null)     pw.println(r.app.pid);
 else     pw.println("String_Node_Str");
    if (dumpAll) {
      r.dump(pw,innerPrefix);
    }
  }
  if (r.app != null && r.app.thread != null) {
    pw.print(prefix);
    pw.println("String_Node_Str");
    pw.flush();
    try {
      TransferPipe tp=new TransferPipe();
      try {
        r.app.thread.dumpService(tp.getWriteFd().getFileDescriptor(),r,args);
        tp.setBufferPrefix(prefix + "String_Node_Str");
        tp.go(fd);
      }
  finally {
        tp.kill();
      }
    }
 catch (    IOException e) {
      pw.println(prefix + "String_Node_Str" + e);
    }
catch (    RemoteException e) {
      pw.println(prefix + "String_Node_Str");
    }
  }
}

Fixed version (ground truth):
/** 
 * Invokes IApplicationThread.dumpService() on the thread of the specified service if there is a thread associated with the service.
 */
private void dumpService(String prefix,FileDescriptor fd,PrintWriter pw,final ServiceRecord r,String[] args,boolean dumpAll){
  String innerPrefix=prefix + "String_Node_Str";
synchronized (mAm) {
    pw.print(prefix);
    pw.print("String_Node_Str");
    pw.print(r.shortName);
    pw.print("String_Node_Str");
    pw.print(Integer.toHexString(System.identityHashCode(r)));
    pw.print("String_Node_Str");
    if (r.app != null)     pw.println(r.app.pid);
 else     pw.println("String_Node_Str");
    if (dumpAll) {
      r.dump(pw,innerPrefix);
    }
  }
  if (r.app != null && r.app.thread != null) {
    pw.print(prefix);
    pw.println("String_Node_Str");
    pw.flush();
    try {
      TransferPipe tp=new TransferPipe();
      try {
        r.app.thread.dumpService(tp.getWriteFd().getFileDescriptor(),r,args);
        tp.setBufferPrefix(prefix + "String_Node_Str");
        tp.go(fd);
      }
  finally {
        tp.kill();
      }
    }
 catch (    IOException e) {
      pw.println(prefix + "String_Node_Str" + e);
    }
catch (    RemoteException e) {
      pw.println(prefix + "String_Node_Str");
    }
  }
}
Program: 196908
Project: 196908
Buggy source:
void serviceTimeout(ProcessRecord proc){
  String anrMessage=null;
synchronized (this) {
    if (proc.executingServices.size() == 0 || proc.thread == null) {
      return;
    }
    long maxTime=SystemClock.uptimeMillis() - (proc.execServicesFg ? SERVICE_TIMEOUT : SERVICE_BACKGROUND_TIMEOUT);
    ServiceRecord timeout=null;
    long nextTime=0;
    for (int i=proc.executingServices.size() - 1; i >= 0; i--) {
      ServiceRecord sr=proc.executingServices.valueAt(i);
      if (sr.executingStart < maxTime) {
        timeout=sr;
        break;
      }
      if (sr.executingStart > nextTime) {
        nextTime=sr.executingStart;
      }
    }
    if (timeout != null && mAm.mLruProcesses.contains(proc)) {
      Slog.w(TAG,"String_Node_Str" + timeout);
      anrMessage="String_Node_Str" + timeout.shortName;
    }
 else {
      Message msg=mAm.mHandler.obtainMessage(ActivityManagerService.SERVICE_TIMEOUT_MSG);
      msg.obj=proc;
      mAm.mHandler.sendMessageAtTime(msg,proc.execServicesFg ? (nextTime + SERVICE_TIMEOUT) : (nextTime + SERVICE_BACKGROUND_TIMEOUT));
    }
  }
  if (anrMessage != null) {
    mAm.appNotResponding(proc,null,null,false,anrMessage);
  }
}

Fixed version (ground truth):
void serviceTimeout(ProcessRecord proc){
  String anrMessage=null;
synchronized (mAm) {
    if (proc.executingServices.size() == 0 || proc.thread == null) {
      return;
    }
    long maxTime=SystemClock.uptimeMillis() - (proc.execServicesFg ? SERVICE_TIMEOUT : SERVICE_BACKGROUND_TIMEOUT);
    ServiceRecord timeout=null;
    long nextTime=0;
    for (int i=proc.executingServices.size() - 1; i >= 0; i--) {
      ServiceRecord sr=proc.executingServices.valueAt(i);
      if (sr.executingStart < maxTime) {
        timeout=sr;
        break;
      }
      if (sr.executingStart > nextTime) {
        nextTime=sr.executingStart;
      }
    }
    if (timeout != null && mAm.mLruProcesses.contains(proc)) {
      Slog.w(TAG,"String_Node_Str" + timeout);
      anrMessage="String_Node_Str" + timeout.shortName;
    }
 else {
      Message msg=mAm.mHandler.obtainMessage(ActivityManagerService.SERVICE_TIMEOUT_MSG);
      msg.obj=proc;
      mAm.mHandler.sendMessageAtTime(msg,proc.execServicesFg ? (nextTime + SERVICE_TIMEOUT) : (nextTime + SERVICE_BACKGROUND_TIMEOUT));
    }
  }
  if (anrMessage != null) {
    mAm.appNotResponding(proc,null,null,false,anrMessage);
  }
}
Program: 196909
Project: 196909
Buggy source:
private void ensureGroupStateLoadedLocked(int userId){
  final int[] profileIds=mSecurityPolicy.getEnabledGroupProfileIds(userId);
  int newMemberCount=0;
  final int profileIdCount=profileIds.length;
  for (int i=0; i < profileIdCount; i++) {
    final int profileId=profileIds[i];
    if (mLoadedUserIds.indexOfKey(profileId) >= 0) {
      profileIds[i]=LOADED_PROFILE_ID;
    }
 else {
      newMemberCount++;
    }
  }
  if (newMemberCount <= 0) {
    return;
  }
  int newMemberIndex=0;
  final int[] newProfileIds=new int[newMemberCount];
  for (int i=0; i < profileIdCount; i++) {
    final int profileId=profileIds[i];
    if (profileId != LOADED_PROFILE_ID) {
      mLoadedUserIds.put(profileId,profileId);
      newProfileIds[newMemberIndex]=profileId;
      newMemberIndex++;
    }
  }
  loadGroupWidgetProvidersLocked(newProfileIds);
  loadGroupStateLocked(newProfileIds);
}

Fixed version (ground truth):
private void ensureGroupStateLoadedLocked(int userId){
  final int[] profileIds=mSecurityPolicy.getEnabledGroupProfileIds(userId);
  int newMemberCount=0;
  final int profileIdCount=profileIds.length;
  for (int i=0; i < profileIdCount; i++) {
    final int profileId=profileIds[i];
    if (mLoadedUserIds.indexOfKey(profileId) >= 0) {
      profileIds[i]=LOADED_PROFILE_ID;
    }
 else {
      newMemberCount++;
    }
  }
  if (newMemberCount <= 0) {
    return;
  }
  int newMemberIndex=0;
  final int[] newProfileIds=new int[newMemberCount];
  for (int i=0; i < profileIdCount; i++) {
    final int profileId=profileIds[i];
    if (profileId != LOADED_PROFILE_ID) {
      mLoadedUserIds.put(profileId,profileId);
      newProfileIds[newMemberIndex]=profileId;
      newMemberIndex++;
    }
  }
  clearProvidersAndHostsTagsLocked();
  loadGroupWidgetProvidersLocked(newProfileIds);
  loadGroupStateLocked(newProfileIds);
}
Program: 196910
Project: 196910
Buggy source:
private void ensureGroupStateLoadedLocked(int userId){
  final int[] profileIds=mSecurityPolicy.getEnabledGroupProfileIds(userId);
  int newMemberCount=0;
  final int profileIdCount=profileIds.length;
  for (int i=0; i < profileIdCount; i++) {
    final int profileId=profileIds[i];
    if (mLoadedUserIds.indexOfKey(profileId) >= 0) {
      profileIds[i]=LOADED_PROFILE_ID;
    }
 else {
      newMemberCount++;
    }
  }
  if (newMemberCount <= 0) {
    return;
  }
  int newMemberIndex=0;
  final int[] newProfileIds=new int[newMemberCount];
  for (int i=0; i < profileIdCount; i++) {
    final int profileId=profileIds[i];
    if (profileId != LOADED_PROFILE_ID) {
      mLoadedUserIds.put(profileId,profileId);
      newProfileIds[newMemberIndex]=profileId;
      newMemberIndex++;
    }
  }
  loadGroupWidgetProvidersLocked(newProfileIds);
  loadGroupStateLocked(newProfileIds);
}

Fixed version (ground truth):
private void ensureGroupStateLoadedLocked(int userId){
  final int[] profileIds=mSecurityPolicy.getEnabledGroupProfileIds(userId);
  int newMemberCount=0;
  final int profileIdCount=profileIds.length;
  for (int i=0; i < profileIdCount; i++) {
    final int profileId=profileIds[i];
    if (mLoadedUserIds.indexOfKey(profileId) >= 0) {
      profileIds[i]=LOADED_PROFILE_ID;
    }
 else {
      newMemberCount++;
    }
  }
  if (newMemberCount <= 0) {
    return;
  }
  int newMemberIndex=0;
  final int[] newProfileIds=new int[newMemberCount];
  for (int i=0; i < profileIdCount; i++) {
    final int profileId=profileIds[i];
    if (profileId != LOADED_PROFILE_ID) {
      mLoadedUserIds.put(profileId,profileId);
      newProfileIds[newMemberIndex]=profileId;
      newMemberIndex++;
    }
  }
  clearProvidersAndHostsTagsLocked();
  loadGroupWidgetProvidersLocked(newProfileIds);
  loadGroupStateLocked(newProfileIds);
}
Program: 196911
Project: 196911
Buggy source:
/** 
 * Invokes IApplicationThread.dumpService() on the thread of the specified service if there is a thread associated with the service.
 */
private void dumpService(String prefix,FileDescriptor fd,PrintWriter pw,final ServiceRecord r,String[] args,boolean dumpAll){
  String innerPrefix=prefix + "String_Node_Str";
synchronized (this) {
    pw.print(prefix);
    pw.print("String_Node_Str");
    pw.print(r.shortName);
    pw.print("String_Node_Str");
    pw.print(Integer.toHexString(System.identityHashCode(r)));
    pw.print("String_Node_Str");
    if (r.app != null)     pw.println(r.app.pid);
 else     pw.println("String_Node_Str");
    if (dumpAll) {
      r.dump(pw,innerPrefix);
    }
  }
  if (r.app != null && r.app.thread != null) {
    pw.print(prefix);
    pw.println("String_Node_Str");
    pw.flush();
    try {
      TransferPipe tp=new TransferPipe();
      try {
        r.app.thread.dumpService(tp.getWriteFd().getFileDescriptor(),r,args);
        tp.setBufferPrefix(prefix + "String_Node_Str");
        tp.go(fd);
      }
  finally {
        tp.kill();
      }
    }
 catch (    IOException e) {
      pw.println(prefix + "String_Node_Str" + e);
    }
catch (    RemoteException e) {
      pw.println(prefix + "String_Node_Str");
    }
  }
}

Fixed version (ground truth):
/** 
 * Invokes IApplicationThread.dumpService() on the thread of the specified service if there is a thread associated with the service.
 */
private void dumpService(String prefix,FileDescriptor fd,PrintWriter pw,final ServiceRecord r,String[] args,boolean dumpAll){
  String innerPrefix=prefix + "String_Node_Str";
synchronized (mAm) {
    pw.print(prefix);
    pw.print("String_Node_Str");
    pw.print(r.shortName);
    pw.print("String_Node_Str");
    pw.print(Integer.toHexString(System.identityHashCode(r)));
    pw.print("String_Node_Str");
    if (r.app != null)     pw.println(r.app.pid);
 else     pw.println("String_Node_Str");
    if (dumpAll) {
      r.dump(pw,innerPrefix);
    }
  }
  if (r.app != null && r.app.thread != null) {
    pw.print(prefix);
    pw.println("String_Node_Str");
    pw.flush();
    try {
      TransferPipe tp=new TransferPipe();
      try {
        r.app.thread.dumpService(tp.getWriteFd().getFileDescriptor(),r,args);
        tp.setBufferPrefix(prefix + "String_Node_Str");
        tp.go(fd);
      }
  finally {
        tp.kill();
      }
    }
 catch (    IOException e) {
      pw.println(prefix + "String_Node_Str" + e);
    }
catch (    RemoteException e) {
      pw.println(prefix + "String_Node_Str");
    }
  }
}