nus-yam/ex-repair huggingface dataset:
Program: 41397
Project: 41397
Buggy source:
private final void sendServiceArgsLocked(ServiceRecord r,boolean oomAdjusted){
  final int N=r.pendingStarts.size();
  if (N == 0) {
    return;
  }
  int i=0;
  while (i < N) {
    try {
      ServiceRecord.StartItem si=r.pendingStarts.get(i);
      if (DEBUG_SERVICE)       Slog.v(TAG,"String_Node_Str" + r.name + "String_Node_Str"+ r.intent+ "String_Node_Str"+ si.intent);
      if (si.intent == null && N > 1) {
        i++;
        continue;
      }
      bumpServiceExecutingLocked(r);
      if (!oomAdjusted) {
        oomAdjusted=true;
        updateOomAdjLocked(r.app);
      }
      int flags=0;
      if (si.deliveryCount > 0) {
        flags|=Service.START_FLAG_RETRY;
      }
      if (si.doneExecutingCount > 0) {
        flags|=Service.START_FLAG_REDELIVERY;
      }
      r.app.thread.scheduleServiceArgs(r,si.id,flags,si.intent);
      si.deliveredTime=SystemClock.uptimeMillis();
      r.deliveredStarts.add(si);
      si.deliveryCount++;
      i++;
    }
 catch (    RemoteException e) {
      break;
    }
catch (    Exception e) {
      Slog.w(TAG,"String_Node_Str",e);
      break;
    }
  }
  if (i == N) {
    r.pendingStarts.clear();
  }
 else {
    while (i > 0) {
      i--;
      r.pendingStarts.remove(i);
    }
  }
}

Fixed version (ground truth):
private final void sendServiceArgsLocked(ServiceRecord r,boolean oomAdjusted){
  final int N=r.pendingStarts.size();
  if (N == 0) {
    return;
  }
  while (r.pendingStarts.size() > 0) {
    try {
      ServiceRecord.StartItem si=r.pendingStarts.remove(0);
      if (DEBUG_SERVICE)       Slog.v(TAG,"String_Node_Str" + r.name + "String_Node_Str"+ r.intent+ "String_Node_Str"+ si.intent);
      if (si.intent == null) {
        continue;
      }
      si.deliveredTime=SystemClock.uptimeMillis();
      r.deliveredStarts.add(si);
      si.deliveryCount++;
      if (si.targetPermissionUid >= 0) {
        grantUriPermissionUncheckedFromIntentLocked(si.targetPermissionUid,r.packageName,si.intent,si);
      }
      bumpServiceExecutingLocked(r);
      if (!oomAdjusted) {
        oomAdjusted=true;
        updateOomAdjLocked(r.app);
      }
      int flags=0;
      if (si.deliveryCount > 0) {
        flags|=Service.START_FLAG_RETRY;
      }
      if (si.doneExecutingCount > 0) {
        flags|=Service.START_FLAG_REDELIVERY;
      }
      r.app.thread.scheduleServiceArgs(r,si.id,flags,si.intent);
    }
 catch (    RemoteException e) {
      break;
    }
catch (    Exception e) {
      Slog.w(TAG,"String_Node_Str",e);
      break;
    }
  }
}
Program: 41400
Project: 41400
Buggy source:
private boolean getValueAt(int index,TypedValue outValue){
  final int[] data=mData;
  final int type=data[index + AssetManager.STYLE_TYPE];
  if (type == TypedValue.TYPE_NULL) {
    return false;
  }
  outValue.type=type;
  outValue.data=data[index + AssetManager.STYLE_DATA];
  outValue.assetCookie=data[index + AssetManager.STYLE_ASSET_COOKIE];
  outValue.resourceId=data[index + AssetManager.STYLE_RESOURCE_ID];
  outValue.changingConfigurations=data[index + AssetManager.STYLE_CHANGING_CONFIGURATIONS];
  outValue.density=data[index + AssetManager.STYLE_DENSITY];
  if (type == TypedValue.TYPE_STRING) {
    outValue.string=loadStringValueAt(index);
  }
  return true;
}

Fixed version (ground truth):
private boolean getValueAt(int index,TypedValue outValue){
  final int[] data=mData;
  final int type=data[index + AssetManager.STYLE_TYPE];
  if (type == TypedValue.TYPE_NULL) {
    return false;
  }
  outValue.type=type;
  outValue.data=data[index + AssetManager.STYLE_DATA];
  outValue.assetCookie=data[index + AssetManager.STYLE_ASSET_COOKIE];
  outValue.resourceId=data[index + AssetManager.STYLE_RESOURCE_ID];
  outValue.changingConfigurations=data[index + AssetManager.STYLE_CHANGING_CONFIGURATIONS];
  outValue.density=data[index + AssetManager.STYLE_DENSITY];
  outValue.string=(type == TypedValue.TYPE_STRING) ? loadStringValueAt(index) : null;
  return true;
}
Program: 41401
Project: 41401
Buggy source:
private boolean getValueAt(int index,TypedValue outValue){
  final int[] data=mData;
  final int type=data[index + AssetManager.STYLE_TYPE];
  if (type == TypedValue.TYPE_NULL) {
    return false;
  }
  outValue.type=type;
  outValue.data=data[index + AssetManager.STYLE_DATA];
  outValue.assetCookie=data[index + AssetManager.STYLE_ASSET_COOKIE];
  outValue.resourceId=data[index + AssetManager.STYLE_RESOURCE_ID];
  outValue.changingConfigurations=data[index + AssetManager.STYLE_CHANGING_CONFIGURATIONS];
  outValue.density=data[index + AssetManager.STYLE_DENSITY];
  if (type == TypedValue.TYPE_STRING) {
    outValue.string=loadStringValueAt(index);
  }
  return true;
}

Fixed version (ground truth):
private boolean getValueAt(int index,TypedValue outValue){
  final int[] data=mData;
  final int type=data[index + AssetManager.STYLE_TYPE];
  if (type == TypedValue.TYPE_NULL) {
    return false;
  }
  outValue.type=type;
  outValue.data=data[index + AssetManager.STYLE_DATA];
  outValue.assetCookie=data[index + AssetManager.STYLE_ASSET_COOKIE];
  outValue.resourceId=data[index + AssetManager.STYLE_RESOURCE_ID];
  outValue.changingConfigurations=data[index + AssetManager.STYLE_CHANGING_CONFIGURATIONS];
  outValue.density=data[index + AssetManager.STYLE_DENSITY];
  outValue.string=(type == TypedValue.TYPE_STRING) ? loadStringValueAt(index) : null;
  return true;
}
Program: 41402
Project: 41402
Buggy source:
private final IContentProvider getProvider(Context context,String name){
synchronized (mProviderMap) {
    final ProviderClientRecord pr=mProviderMap.get(name);
    if (pr != null) {
      return pr.mProvider;
    }
  }
  IActivityManager.ContentProviderHolder holder=null;
  try {
    holder=ActivityManagerNative.getDefault().getContentProvider(getApplicationThread(),name);
  }
 catch (  RemoteException ex) {
  }
  if (holder == null) {
    Slog.e(TAG,"String_Node_Str" + name);
    return null;
  }
  if (holder.permissionFailure != null) {
    throw new SecurityException("String_Node_Str" + holder.permissionFailure + "String_Node_Str"+ name);
  }
  IContentProvider prov=installProvider(context,holder.provider,holder.info,true);
  if (holder.noReleaseNeeded || holder.provider == null) {
synchronized (mProviderMap) {
      mProviderRefCountMap.put(prov.asBinder(),new ProviderRefCount(10000));
    }
  }
  return prov;
}

Fixed version (ground truth):
private final IContentProvider getProvider(Context context,String name){
synchronized (mProviderMap) {
    final ProviderClientRecord pr=mProviderMap.get(name);
    if (pr != null) {
      return pr.mProvider;
    }
  }
  IActivityManager.ContentProviderHolder holder=null;
  try {
    holder=ActivityManagerNative.getDefault().getContentProvider(getApplicationThread(),name);
  }
 catch (  RemoteException ex) {
  }
  if (holder == null) {
    Slog.e(TAG,"String_Node_Str" + name);
    return null;
  }
  IContentProvider prov=installProvider(context,holder.provider,holder.info,true);
  if (holder.noReleaseNeeded || holder.provider == null) {
synchronized (mProviderMap) {
      mProviderRefCountMap.put(prov.asBinder(),new ProviderRefCount(10000));
    }
  }
  return prov;
}
Program: 41403
Project: 41403
Buggy source:
private ContentProviderHolder(Parcel source){
  info=ProviderInfo.CREATOR.createFromParcel(source);
  permissionFailure=source.readString();
  provider=ContentProviderNative.asInterface(source.readStrongBinder());
  noReleaseNeeded=source.readInt() != 0;
}

Fixed version (ground truth):
private ContentProviderHolder(Parcel source){
  info=ProviderInfo.CREATOR.createFromParcel(source);
  provider=ContentProviderNative.asInterface(source.readStrongBinder());
  noReleaseNeeded=source.readInt() != 0;
}
Program: 41404
Project: 41404
Buggy source:
/** 
 * After being instantiated, this is called to tell the content provider about itself.
 * @param context The context this provider is running in
 * @param info Registered information about this content provider
 */
public void attachInfo(Context context,ProviderInfo info){
  if (mContext == null) {
    mContext=context;
    mMyUid=Process.myUid();
    if (info != null) {
      setReadPermission(info.readPermission);
      setWritePermission(info.writePermission);
      setPathPermissions(info.pathPermissions);
    }
    ContentProvider.this.onCreate();
  }
}

Fixed version (ground truth):
/** 
 * After being instantiated, this is called to tell the content provider about itself.
 * @param context The context this provider is running in
 * @param info Registered information about this content provider
 */
public void attachInfo(Context context,ProviderInfo info){
  if (mContext == null) {
    mContext=context;
    mMyUid=Process.myUid();
    if (info != null) {
      setReadPermission(info.readPermission);
      setWritePermission(info.writePermission);
      setPathPermissions(info.pathPermissions);
      mExported=info.exported;
    }
    ContentProvider.this.onCreate();
  }
}
Program: 41405
Project: 41405
Buggy source:
private void enforceReadPermission(Uri uri){
  final int uid=Binder.getCallingUid();
  if (uid == mMyUid) {
    return;
  }
  final Context context=getContext();
  final String rperm=getReadPermission();
  final int pid=Binder.getCallingPid();
  if (rperm == null || context.checkPermission(rperm,pid,uid) == PackageManager.PERMISSION_GRANTED) {
    return;
  }
  PathPermission[] pps=getPathPermissions();
  if (pps != null) {
    final String path=uri.getPath();
    int i=pps.length;
    while (i > 0) {
      i--;
      final PathPermission pp=pps[i];
      final String pprperm=pp.getReadPermission();
      if (pprperm != null && pp.match(path)) {
        if (context.checkPermission(pprperm,pid,uid) == PackageManager.PERMISSION_GRANTED) {
          return;
        }
      }
    }
  }
  if (context.checkUriPermission(uri,pid,uid,Intent.FLAG_GRANT_READ_URI_PERMISSION) == PackageManager.PERMISSION_GRANTED) {
    return;
  }
  String msg="String_Node_Str" + ContentProvider.this.getClass().getName() + "String_Node_Str"+ uri+ "String_Node_Str"+ Binder.getCallingPid()+ "String_Node_Str"+ Binder.getCallingUid()+ "String_Node_Str"+ rperm;
  throw new SecurityException(msg);
}

Fixed version (ground truth):
private void enforceReadPermission(Uri uri){
  final int uid=Binder.getCallingUid();
  if (uid == mMyUid) {
    return;
  }
  final Context context=getContext();
  final String rperm=getReadPermission();
  final int pid=Binder.getCallingPid();
  if (mExported && (rperm == null || context.checkPermission(rperm,pid,uid) == PackageManager.PERMISSION_GRANTED)) {
    return;
  }
  PathPermission[] pps=getPathPermissions();
  if (pps != null) {
    final String path=uri.getPath();
    int i=pps.length;
    while (i > 0) {
      i--;
      final PathPermission pp=pps[i];
      final String pprperm=pp.getReadPermission();
      if (pprperm != null && pp.match(path)) {
        if (context.checkPermission(pprperm,pid,uid) == PackageManager.PERMISSION_GRANTED) {
          return;
        }
      }
    }
  }
  if (context.checkUriPermission(uri,pid,uid,Intent.FLAG_GRANT_READ_URI_PERMISSION) == PackageManager.PERMISSION_GRANTED) {
    return;
  }
  String msg="String_Node_Str" + ContentProvider.this.getClass().getName() + "String_Node_Str"+ uri+ "String_Node_Str"+ Binder.getCallingPid()+ "String_Node_Str"+ Binder.getCallingUid()+ "String_Node_Str"+ rperm;
  throw new SecurityException(msg);
}
Program: 41406
Project: 41406
Buggy source:
private boolean hasWritePermission(Uri uri){
  final int uid=Binder.getCallingUid();
  if (uid == mMyUid) {
    return true;
  }
  final Context context=getContext();
  final String wperm=getWritePermission();
  final int pid=Binder.getCallingPid();
  if (wperm == null || context.checkPermission(wperm,pid,uid) == PackageManager.PERMISSION_GRANTED) {
    return true;
  }
  PathPermission[] pps=getPathPermissions();
  if (pps != null) {
    final String path=uri.getPath();
    int i=pps.length;
    while (i > 0) {
      i--;
      final PathPermission pp=pps[i];
      final String ppwperm=pp.getWritePermission();
      if (ppwperm != null && pp.match(path)) {
        if (context.checkPermission(ppwperm,pid,uid) == PackageManager.PERMISSION_GRANTED) {
          return true;
        }
      }
    }
  }
  if (context.checkUriPermission(uri,pid,uid,Intent.FLAG_GRANT_WRITE_URI_PERMISSION) == PackageManager.PERMISSION_GRANTED) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
private boolean hasWritePermission(Uri uri){
  final int uid=Binder.getCallingUid();
  if (uid == mMyUid) {
    return true;
  }
  final Context context=getContext();
  final String wperm=getWritePermission();
  final int pid=Binder.getCallingPid();
  if (mExported && (wperm == null || context.checkPermission(wperm,pid,uid) == PackageManager.PERMISSION_GRANTED)) {
    return true;
  }
  PathPermission[] pps=getPathPermissions();
  if (pps != null) {
    final String path=uri.getPath();
    int i=pps.length;
    while (i > 0) {
      i--;
      final PathPermission pp=pps[i];
      final String ppwperm=pp.getWritePermission();
      if (ppwperm != null && pp.match(path)) {
        if (context.checkPermission(ppwperm,pid,uid) == PackageManager.PERMISSION_GRANTED) {
          return true;
        }
      }
    }
  }
  if (context.checkUriPermission(uri,pid,uid,Intent.FLAG_GRANT_WRITE_URI_PERMISSION) == PackageManager.PERMISSION_GRANTED) {
    return true;
  }
  return false;
}
Program: 41407
Project: 41407
Buggy source:
void grantUriPermissionFromIntentLocked(int callingUid,String targetPkg,Intent intent,ActivityRecord activity){
  if (intent == null) {
    return;
  }
  Uri data=intent.getData();
  if (data == null) {
    return;
  }
  grantUriPermissionLocked(callingUid,targetPkg,data,intent.getFlags(),activity);
}

Fixed version (ground truth):
void grantUriPermissionFromIntentLocked(int callingUid,String targetPkg,Intent intent,ActivityRecord activity){
  if (DEBUG_URI_PERMISSION)   Slog.v(TAG,"String_Node_Str" + (intent != null ? intent.getData() : null) + "String_Node_Str"+ intent+ "String_Node_Str"+ Integer.toHexString(intent != null ? intent.getFlags() : 0));
  if (intent == null) {
    return;
  }
  Uri data=intent.getData();
  if (data == null) {
    return;
  }
  grantUriPermissionLocked(callingUid,targetPkg,data,intent.getFlags(),activity);
}
Program: 41408
Project: 41408
Buggy source:
public void handleApplicationStrictModeViolation(IBinder app,int violationMask,StrictMode.ViolationInfo info){
  ProcessRecord r=findAppProcess(app);
  if ((violationMask & StrictMode.PENALTY_DROPBOX) != 0) {
    Integer stackFingerprint=info.crashInfo.stackTrace.hashCode();
    boolean logIt=true;
synchronized (mAlreadyLoggedViolatedStacks) {
      if (mAlreadyLoggedViolatedStacks.contains(stackFingerprint)) {
        logIt=false;
      }
 else {
        if (mAlreadyLoggedViolatedStacks.size() >= MAX_DUP_SUPPRESSED_STACKS) {
          mAlreadyLoggedViolatedStacks.clear();
        }
        mAlreadyLoggedViolatedStacks.add(stackFingerprint);
      }
    }
    if (logIt) {
      logStrictModeViolationToDropBox(r,info);
    }
  }
  if ((violationMask & StrictMode.PENALTY_DIALOG) != 0) {
    AppErrorResult result=new AppErrorResult();
synchronized (this) {
      final long origId=Binder.clearCallingIdentity();
      Message msg=Message.obtain();
      msg.what=SHOW_STRICT_MODE_VIOLATION_MSG;
      HashMap<String,Object> data=new HashMap<String,Object>();
      data.put("String_Node_Str",result);
      data.put("String_Node_Str",r);
      data.put("String_Node_Str",violationMask);
      data.put("String_Node_Str",info);
      msg.obj=data;
      mHandler.sendMessage(msg);
      Binder.restoreCallingIdentity(origId);
    }
    int res=result.get();
    Log.w(TAG,"String_Node_Str" + res);
  }
}

Fixed version (ground truth):
public void handleApplicationStrictModeViolation(IBinder app,int violationMask,StrictMode.ViolationInfo info){
  ProcessRecord r=findAppProcess(app);
  if ((violationMask & StrictMode.PENALTY_DROPBOX) != 0) {
    Integer stackFingerprint=info.crashInfo.stackTrace.hashCode();
    boolean logIt=true;
synchronized (mAlreadyLoggedViolatedStacks) {
      if (mAlreadyLoggedViolatedStacks.contains(stackFingerprint)) {
        logIt=false;
      }
 else {
        if (mAlreadyLoggedViolatedStacks.size() >= MAX_DUP_SUPPRESSED_STACKS) {
          mAlreadyLoggedViolatedStacks.clear();
        }
        mAlreadyLoggedViolatedStacks.add(stackFingerprint);
      }
    }
    if (logIt) {
      logStrictModeViolationToDropBox(r,info);
    }
  }
  if ((violationMask & StrictMode.PENALTY_DIALOG) != 0) {
    AppErrorResult result=new AppErrorResult();
synchronized (this) {
      final long origId=Binder.clearCallingIdentity();
      Message msg=Message.obtain();
      msg.what=SHOW_STRICT_MODE_VIOLATION_MSG;
      HashMap<String,Object> data=new HashMap<String,Object>();
      data.put("String_Node_Str",result);
      data.put("String_Node_Str",r);
      data.put("String_Node_Str",violationMask);
      data.put("String_Node_Str",info);
      msg.obj=data;
      mHandler.sendMessage(msg);
      Binder.restoreCallingIdentity(origId);
    }
    int res=result.get();
    Slog.w(TAG,"String_Node_Str" + res);
  }
}
Program: 41409
Project: 41409
Buggy source:
private final boolean checkHoldingPermissionsLocked(IPackageManager pm,ProviderInfo pi,int uid,int modeFlags){
  try {
    if ((modeFlags & Intent.FLAG_GRANT_READ_URI_PERMISSION) != 0) {
      if ((pi.readPermission != null) && (pm.checkUidPermission(pi.readPermission,uid) != PackageManager.PERMISSION_GRANTED)) {
        return false;
      }
    }
    if ((modeFlags & Intent.FLAG_GRANT_WRITE_URI_PERMISSION) != 0) {
      if ((pi.writePermission != null) && (pm.checkUidPermission(pi.writePermission,uid) != PackageManager.PERMISSION_GRANTED)) {
        return false;
      }
    }
    return true;
  }
 catch (  RemoteException e) {
    return false;
  }
}

Fixed version (ground truth):
private final boolean checkHoldingPermissionsLocked(IPackageManager pm,ProviderInfo pi,int uid,int modeFlags){
  try {
    if ((modeFlags & Intent.FLAG_GRANT_READ_URI_PERMISSION) != 0) {
      if ((pi.readPermission != null) && (pm.checkUidPermission(pi.readPermission,uid) != PackageManager.PERMISSION_GRANTED)) {
        return false;
      }
    }
    if ((modeFlags & Intent.FLAG_GRANT_WRITE_URI_PERMISSION) != 0) {
      if ((pi.writePermission != null) && (pm.checkUidPermission(pi.writePermission,uid) != PackageManager.PERMISSION_GRANTED)) {
        return false;
      }
    }
    if (!pi.exported && pi.applicationInfo.uid != uid) {
      return false;
    }
    return true;
  }
 catch (  RemoteException e) {
    return false;
  }
}
Program: 41413
Project: 41413
Buggy source:
private final IContentProvider getProvider(Context context,String name){
synchronized (mProviderMap) {
    final ProviderClientRecord pr=mProviderMap.get(name);
    if (pr != null) {
      return pr.mProvider;
    }
  }
  IActivityManager.ContentProviderHolder holder=null;
  try {
    holder=ActivityManagerNative.getDefault().getContentProvider(getApplicationThread(),name);
  }
 catch (  RemoteException ex) {
  }
  if (holder == null) {
    Slog.e(TAG,"String_Node_Str" + name);
    return null;
  }
  if (holder.permissionFailure != null) {
    throw new SecurityException("String_Node_Str" + holder.permissionFailure + "String_Node_Str"+ name);
  }
  IContentProvider prov=installProvider(context,holder.provider,holder.info,true);
  if (holder.noReleaseNeeded || holder.provider == null) {
synchronized (mProviderMap) {
      mProviderRefCountMap.put(prov.asBinder(),new ProviderRefCount(10000));
    }
  }
  return prov;
}

Fixed version (ground truth):
private final IContentProvider getProvider(Context context,String name){
synchronized (mProviderMap) {
    final ProviderClientRecord pr=mProviderMap.get(name);
    if (pr != null) {
      return pr.mProvider;
    }
  }
  IActivityManager.ContentProviderHolder holder=null;
  try {
    holder=ActivityManagerNative.getDefault().getContentProvider(getApplicationThread(),name);
  }
 catch (  RemoteException ex) {
  }
  if (holder == null) {
    Slog.e(TAG,"String_Node_Str" + name);
    return null;
  }
  IContentProvider prov=installProvider(context,holder.provider,holder.info,true);
  if (holder.noReleaseNeeded || holder.provider == null) {
synchronized (mProviderMap) {
      mProviderRefCountMap.put(prov.asBinder(),new ProviderRefCount(10000));
    }
  }
  return prov;
}
Program: 41414
Project: 41414
Buggy source:
private ContentProviderHolder(Parcel source){
  info=ProviderInfo.CREATOR.createFromParcel(source);
  permissionFailure=source.readString();
  provider=ContentProviderNative.asInterface(source.readStrongBinder());
  noReleaseNeeded=source.readInt() != 0;
}

Fixed version (ground truth):
private ContentProviderHolder(Parcel source){
  info=ProviderInfo.CREATOR.createFromParcel(source);
  provider=ContentProviderNative.asInterface(source.readStrongBinder());
  noReleaseNeeded=source.readInt() != 0;
}
Program: 41415
Project: 41415
Buggy source:
/** 
 * After being instantiated, this is called to tell the content provider about itself.
 * @param context The context this provider is running in
 * @param info Registered information about this content provider
 */
public void attachInfo(Context context,ProviderInfo info){
  if (mContext == null) {
    mContext=context;
    mMyUid=Process.myUid();
    if (info != null) {
      setReadPermission(info.readPermission);
      setWritePermission(info.writePermission);
      setPathPermissions(info.pathPermissions);
    }
    ContentProvider.this.onCreate();
  }
}

Fixed version (ground truth):
/** 
 * After being instantiated, this is called to tell the content provider about itself.
 * @param context The context this provider is running in
 * @param info Registered information about this content provider
 */
public void attachInfo(Context context,ProviderInfo info){
  if (mContext == null) {
    mContext=context;
    mMyUid=Process.myUid();
    if (info != null) {
      setReadPermission(info.readPermission);
      setWritePermission(info.writePermission);
      setPathPermissions(info.pathPermissions);
      mExported=info.exported;
    }
    ContentProvider.this.onCreate();
  }
}
Program: 41416
Project: 41416
Buggy source:
private void enforceReadPermission(Uri uri){
  final int uid=Binder.getCallingUid();
  if (uid == mMyUid) {
    return;
  }
  final Context context=getContext();
  final String rperm=getReadPermission();
  final int pid=Binder.getCallingPid();
  if (rperm == null || context.checkPermission(rperm,pid,uid) == PackageManager.PERMISSION_GRANTED) {
    return;
  }
  PathPermission[] pps=getPathPermissions();
  if (pps != null) {
    final String path=uri.getPath();
    int i=pps.length;
    while (i > 0) {
      i--;
      final PathPermission pp=pps[i];
      final String pprperm=pp.getReadPermission();
      if (pprperm != null && pp.match(path)) {
        if (context.checkPermission(pprperm,pid,uid) == PackageManager.PERMISSION_GRANTED) {
          return;
        }
      }
    }
  }
  if (context.checkUriPermission(uri,pid,uid,Intent.FLAG_GRANT_READ_URI_PERMISSION) == PackageManager.PERMISSION_GRANTED) {
    return;
  }
  String msg="String_Node_Str" + ContentProvider.this.getClass().getName() + "String_Node_Str"+ uri+ "String_Node_Str"+ Binder.getCallingPid()+ "String_Node_Str"+ Binder.getCallingUid()+ "String_Node_Str"+ rperm;
  throw new SecurityException(msg);
}

Fixed version (ground truth):
private void enforceReadPermission(Uri uri){
  final int uid=Binder.getCallingUid();
  if (uid == mMyUid) {
    return;
  }
  final Context context=getContext();
  final String rperm=getReadPermission();
  final int pid=Binder.getCallingPid();
  if (mExported && (rperm == null || context.checkPermission(rperm,pid,uid) == PackageManager.PERMISSION_GRANTED)) {
    return;
  }
  PathPermission[] pps=getPathPermissions();
  if (pps != null) {
    final String path=uri.getPath();
    int i=pps.length;
    while (i > 0) {
      i--;
      final PathPermission pp=pps[i];
      final String pprperm=pp.getReadPermission();
      if (pprperm != null && pp.match(path)) {
        if (context.checkPermission(pprperm,pid,uid) == PackageManager.PERMISSION_GRANTED) {
          return;
        }
      }
    }
  }
  if (context.checkUriPermission(uri,pid,uid,Intent.FLAG_GRANT_READ_URI_PERMISSION) == PackageManager.PERMISSION_GRANTED) {
    return;
  }
  String msg="String_Node_Str" + ContentProvider.this.getClass().getName() + "String_Node_Str"+ uri+ "String_Node_Str"+ Binder.getCallingPid()+ "String_Node_Str"+ Binder.getCallingUid()+ "String_Node_Str"+ rperm;
  throw new SecurityException(msg);
}
Program: 41417
Project: 41417
Buggy source:
private boolean hasWritePermission(Uri uri){
  final int uid=Binder.getCallingUid();
  if (uid == mMyUid) {
    return true;
  }
  final Context context=getContext();
  final String wperm=getWritePermission();
  final int pid=Binder.getCallingPid();
  if (wperm == null || context.checkPermission(wperm,pid,uid) == PackageManager.PERMISSION_GRANTED) {
    return true;
  }
  PathPermission[] pps=getPathPermissions();
  if (pps != null) {
    final String path=uri.getPath();
    int i=pps.length;
    while (i > 0) {
      i--;
      final PathPermission pp=pps[i];
      final String ppwperm=pp.getWritePermission();
      if (ppwperm != null && pp.match(path)) {
        if (context.checkPermission(ppwperm,pid,uid) == PackageManager.PERMISSION_GRANTED) {
          return true;
        }
      }
    }
  }
  if (context.checkUriPermission(uri,pid,uid,Intent.FLAG_GRANT_WRITE_URI_PERMISSION) == PackageManager.PERMISSION_GRANTED) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
private boolean hasWritePermission(Uri uri){
  final int uid=Binder.getCallingUid();
  if (uid == mMyUid) {
    return true;
  }
  final Context context=getContext();
  final String wperm=getWritePermission();
  final int pid=Binder.getCallingPid();
  if (mExported && (wperm == null || context.checkPermission(wperm,pid,uid) == PackageManager.PERMISSION_GRANTED)) {
    return true;
  }
  PathPermission[] pps=getPathPermissions();
  if (pps != null) {
    final String path=uri.getPath();
    int i=pps.length;
    while (i > 0) {
      i--;
      final PathPermission pp=pps[i];
      final String ppwperm=pp.getWritePermission();
      if (ppwperm != null && pp.match(path)) {
        if (context.checkPermission(ppwperm,pid,uid) == PackageManager.PERMISSION_GRANTED) {
          return true;
        }
      }
    }
  }
  if (context.checkUriPermission(uri,pid,uid,Intent.FLAG_GRANT_WRITE_URI_PERMISSION) == PackageManager.PERMISSION_GRANTED) {
    return true;
  }
  return false;
}
Program: 41418
Project: 41418
Buggy source:
void grantUriPermissionFromIntentLocked(int callingUid,String targetPkg,Intent intent,ActivityRecord activity){
  if (intent == null) {
    return;
  }
  Uri data=intent.getData();
  if (data == null) {
    return;
  }
  grantUriPermissionLocked(callingUid,targetPkg,data,intent.getFlags(),activity);
}

Fixed version (ground truth):
void grantUriPermissionFromIntentLocked(int callingUid,String targetPkg,Intent intent,ActivityRecord activity){
  if (DEBUG_URI_PERMISSION)   Slog.v(TAG,"String_Node_Str" + (intent != null ? intent.getData() : null) + "String_Node_Str"+ intent+ "String_Node_Str"+ Integer.toHexString(intent != null ? intent.getFlags() : 0));
  if (intent == null) {
    return;
  }
  Uri data=intent.getData();
  if (data == null) {
    return;
  }
  grantUriPermissionLocked(callingUid,targetPkg,data,intent.getFlags(),activity);
}
Program: 41419
Project: 41419
Buggy source:
public void handleApplicationStrictModeViolation(IBinder app,int violationMask,StrictMode.ViolationInfo info){
  ProcessRecord r=findAppProcess(app);
  if ((violationMask & StrictMode.PENALTY_DROPBOX) != 0) {
    Integer stackFingerprint=info.crashInfo.stackTrace.hashCode();
    boolean logIt=true;
synchronized (mAlreadyLoggedViolatedStacks) {
      if (mAlreadyLoggedViolatedStacks.contains(stackFingerprint)) {
        logIt=false;
      }
 else {
        if (mAlreadyLoggedViolatedStacks.size() >= MAX_DUP_SUPPRESSED_STACKS) {
          mAlreadyLoggedViolatedStacks.clear();
        }
        mAlreadyLoggedViolatedStacks.add(stackFingerprint);
      }
    }
    if (logIt) {
      logStrictModeViolationToDropBox(r,info);
    }
  }
  if ((violationMask & StrictMode.PENALTY_DIALOG) != 0) {
    AppErrorResult result=new AppErrorResult();
synchronized (this) {
      final long origId=Binder.clearCallingIdentity();
      Message msg=Message.obtain();
      msg.what=SHOW_STRICT_MODE_VIOLATION_MSG;
      HashMap<String,Object> data=new HashMap<String,Object>();
      data.put("String_Node_Str",result);
      data.put("String_Node_Str",r);
      data.put("String_Node_Str",violationMask);
      data.put("String_Node_Str",info);
      msg.obj=data;
      mHandler.sendMessage(msg);
      Binder.restoreCallingIdentity(origId);
    }
    int res=result.get();
    Log.w(TAG,"String_Node_Str" + res);
  }
}

Fixed version (ground truth):
public void handleApplicationStrictModeViolation(IBinder app,int violationMask,StrictMode.ViolationInfo info){
  ProcessRecord r=findAppProcess(app);
  if ((violationMask & StrictMode.PENALTY_DROPBOX) != 0) {
    Integer stackFingerprint=info.crashInfo.stackTrace.hashCode();
    boolean logIt=true;
synchronized (mAlreadyLoggedViolatedStacks) {
      if (mAlreadyLoggedViolatedStacks.contains(stackFingerprint)) {
        logIt=false;
      }
 else {
        if (mAlreadyLoggedViolatedStacks.size() >= MAX_DUP_SUPPRESSED_STACKS) {
          mAlreadyLoggedViolatedStacks.clear();
        }
        mAlreadyLoggedViolatedStacks.add(stackFingerprint);
      }
    }
    if (logIt) {
      logStrictModeViolationToDropBox(r,info);
    }
  }
  if ((violationMask & StrictMode.PENALTY_DIALOG) != 0) {
    AppErrorResult result=new AppErrorResult();
synchronized (this) {
      final long origId=Binder.clearCallingIdentity();
      Message msg=Message.obtain();
      msg.what=SHOW_STRICT_MODE_VIOLATION_MSG;
      HashMap<String,Object> data=new HashMap<String,Object>();
      data.put("String_Node_Str",result);
      data.put("String_Node_Str",r);
      data.put("String_Node_Str",violationMask);
      data.put("String_Node_Str",info);
      msg.obj=data;
      mHandler.sendMessage(msg);
      Binder.restoreCallingIdentity(origId);
    }
    int res=result.get();
    Slog.w(TAG,"String_Node_Str" + res);
  }
}
Program: 41420
Project: 41420
Buggy source:
private final boolean checkHoldingPermissionsLocked(IPackageManager pm,ProviderInfo pi,int uid,int modeFlags){
  try {
    if ((modeFlags & Intent.FLAG_GRANT_READ_URI_PERMISSION) != 0) {
      if ((pi.readPermission != null) && (pm.checkUidPermission(pi.readPermission,uid) != PackageManager.PERMISSION_GRANTED)) {
        return false;
      }
    }
    if ((modeFlags & Intent.FLAG_GRANT_WRITE_URI_PERMISSION) != 0) {
      if ((pi.writePermission != null) && (pm.checkUidPermission(pi.writePermission,uid) != PackageManager.PERMISSION_GRANTED)) {
        return false;
      }
    }
    return true;
  }
 catch (  RemoteException e) {
    return false;
  }
}

Fixed version (ground truth):
private final boolean checkHoldingPermissionsLocked(IPackageManager pm,ProviderInfo pi,int uid,int modeFlags){
  try {
    if ((modeFlags & Intent.FLAG_GRANT_READ_URI_PERMISSION) != 0) {
      if ((pi.readPermission != null) && (pm.checkUidPermission(pi.readPermission,uid) != PackageManager.PERMISSION_GRANTED)) {
        return false;
      }
    }
    if ((modeFlags & Intent.FLAG_GRANT_WRITE_URI_PERMISSION) != 0) {
      if ((pi.writePermission != null) && (pm.checkUidPermission(pi.writePermission,uid) != PackageManager.PERMISSION_GRANTED)) {
        return false;
      }
    }
    if (!pi.exported && pi.applicationInfo.uid != uid) {
      return false;
    }
    return true;
  }
 catch (  RemoteException e) {
    return false;
  }
}
Program: 41424
Project: 41424
Buggy source:
/** 
 * Get an SMS-SUBMIT PDU for a data message to a destination address &amp; port
 * @param destAddr the address of the destination for the message
 * @param userDara the data for the message
 * @param statusReportRequested Indicates whether a report is requested for this message.
 * @return a <code>SubmitPdu</code> containing the encoded SCaddress, if applicable, and the encoded message. Returns null on encode error.
 */
public static SubmitPdu getSubmitPdu(String destAddr,UserData userData,boolean statusReportRequested){
  return privateGetSubmitPdu(destAddr,statusReportRequested,userData);
}

Fixed version (ground truth):
/** 
 * Get an SMS-SUBMIT PDU for a data message to a destination address &amp; port
 * @param destAddr the address of the destination for the message
 * @param userData the data for the message
 * @param statusReportRequested Indicates whether a report is requested for this message.
 * @return a <code>SubmitPdu</code> containing the encoded SCaddress, if applicable, and the encoded message. Returns null on encode error.
 */
public static SubmitPdu getSubmitPdu(String destAddr,UserData userData,boolean statusReportRequested){
  return privateGetSubmitPdu(destAddr,statusReportRequested,userData);
}
Program: 41425
Project: 41425
Buggy source:
/** 
 * Calculate the number of septets needed to encode the message.
 * @param messageBody the message to encode
 * @param use7bitOnly ignore (but still count) illegal characters if true
 * @return TextEncodingDetails
 */
public static TextEncodingDetails calculateLength(CharSequence messageBody,boolean use7bitOnly){
  return BearerData.calcTextEncodingDetails(messageBody.toString(),use7bitOnly);
}

Fixed version (ground truth):
/** 
 * Calculate the number of septets needed to encode the message.
 * @param messageBody the message to encode
 * @param use7bitOnly ignore (but still count) illegal characters if true
 * @return TextEncodingDetails
 */
public static TextEncodingDetails calculateLength(CharSequence messageBody,boolean use7bitOnly){
  return BearerData.calcTextEncodingDetails(messageBody,use7bitOnly);
}
Program: 41427
Project: 41427
Buggy source:
/** 
 * Calculate the message text encoding length, fragmentation, and other details.
 * @param force ignore (but still count) illegal characters if true
 * @return septet count, or -1 on failure
 */
public static TextEncodingDetails calcTextEncodingDetails(CharSequence msg,boolean force7BitEncoding){
  TextEncodingDetails ted;
  int septets=countAsciiSeptets(msg,force7BitEncoding);
  if (septets != -1 && septets <= SmsMessage.MAX_USER_DATA_SEPTETS) {
    ted=new TextEncodingDetails();
    ted.msgCount=1;
    ted.codeUnitCount=septets;
    ted.codeUnitsRemaining=SmsMessage.MAX_USER_DATA_SEPTETS - septets;
    ted.codeUnitSize=SmsMessage.ENCODING_7BIT;
  }
 else {
    ted=com.android.internal.telephony.gsm.SmsMessage.calculateLength(msg,force7BitEncoding);
    if (ted.msgCount == 1 && ted.codeUnitSize == SmsMessage.ENCODING_7BIT) {
      ted.codeUnitCount=msg.length();
      int octets=ted.codeUnitCount * 2;
      if (octets > MAX_USER_DATA_BYTES) {
        ted.msgCount=(octets / MAX_USER_DATA_BYTES_WITH_HEADER) + 1;
        ted.codeUnitsRemaining=(MAX_USER_DATA_BYTES_WITH_HEADER - (octets % MAX_USER_DATA_BYTES_WITH_HEADER)) / 2;
      }
 else {
        ted.msgCount=1;
        ted.codeUnitsRemaining=(MAX_USER_DATA_BYTES - octets) / 2;
      }
      ted.codeUnitSize=ENCODING_16BIT;
    }
  }
  return ted;
}

Fixed version (ground truth):
/** 
 * Calculate the message text encoding length, fragmentation, and other details.
 * @param msg message text
 * @param force7BitEncoding ignore (but still count) illegal characters if true
 * @return septet count, or -1 on failure
 */
public static TextEncodingDetails calcTextEncodingDetails(CharSequence msg,boolean force7BitEncoding){
  TextEncodingDetails ted;
  int septets=countAsciiSeptets(msg,force7BitEncoding);
  if (septets != -1 && septets <= SmsMessage.MAX_USER_DATA_SEPTETS) {
    ted=new TextEncodingDetails();
    ted.msgCount=1;
    ted.codeUnitCount=septets;
    ted.codeUnitsRemaining=SmsMessage.MAX_USER_DATA_SEPTETS - septets;
    ted.codeUnitSize=SmsMessage.ENCODING_7BIT;
  }
 else {
    ted=com.android.internal.telephony.gsm.SmsMessage.calculateLength(msg,force7BitEncoding);
    if (ted.msgCount == 1 && ted.codeUnitSize == SmsMessage.ENCODING_7BIT) {
      ted.codeUnitCount=msg.length();
      int octets=ted.codeUnitCount * 2;
      if (octets > MAX_USER_DATA_BYTES) {
        ted.msgCount=(octets + (MAX_USER_DATA_BYTES_WITH_HEADER - 1)) / MAX_USER_DATA_BYTES_WITH_HEADER;
        ted.codeUnitsRemaining=((ted.msgCount * MAX_USER_DATA_BYTES_WITH_HEADER) - octets) / 2;
      }
 else {
        ted.msgCount=1;
        ted.codeUnitsRemaining=(MAX_USER_DATA_BYTES - octets) / 2;
      }
      ted.codeUnitSize=ENCODING_16BIT;
    }
  }
  return ted;
}
Program: 41428
Project: 41428
Buggy source:
/** 
 * Calculate the number of septets needed to encode the message.
 * @param msgBody the message to encode
 * @param use7bitOnly ignore (but still count) illegal characters if true
 * @return TextEncodingDetails
 */
public static TextEncodingDetails calculateLength(CharSequence msgBody,boolean use7bitOnly){
  TextEncodingDetails ted=new TextEncodingDetails();
  try {
    int septets=GsmAlphabet.countGsmSeptets(msgBody,!use7bitOnly);
    ted.codeUnitCount=septets;
    if (septets > MAX_USER_DATA_SEPTETS) {
      ted.msgCount=(septets / MAX_USER_DATA_SEPTETS_WITH_HEADER) + 1;
      ted.codeUnitsRemaining=MAX_USER_DATA_SEPTETS_WITH_HEADER - (septets % MAX_USER_DATA_SEPTETS_WITH_HEADER);
    }
 else {
      ted.msgCount=1;
      ted.codeUnitsRemaining=MAX_USER_DATA_SEPTETS - septets;
    }
    ted.codeUnitSize=ENCODING_7BIT;
  }
 catch (  EncodeException ex) {
    int octets=msgBody.length() * 2;
    ted.codeUnitCount=msgBody.length();
    if (octets > MAX_USER_DATA_BYTES) {
      ted.msgCount=(octets / MAX_USER_DATA_BYTES_WITH_HEADER) + 1;
      ted.codeUnitsRemaining=(MAX_USER_DATA_BYTES_WITH_HEADER - (octets % MAX_USER_DATA_BYTES_WITH_HEADER)) / 2;
    }
 else {
      ted.msgCount=1;
      ted.codeUnitsRemaining=(MAX_USER_DATA_BYTES - octets) / 2;
    }
    ted.codeUnitSize=ENCODING_16BIT;
  }
  return ted;
}

Fixed version (ground truth):
/** 
 * Calculate the number of septets needed to encode the message.
 * @param msgBody the message to encode
 * @param use7bitOnly ignore (but still count) illegal characters if true
 * @return TextEncodingDetails
 */
public static TextEncodingDetails calculateLength(CharSequence msgBody,boolean use7bitOnly){
  TextEncodingDetails ted=new TextEncodingDetails();
  try {
    int septets=GsmAlphabet.countGsmSeptets(msgBody,!use7bitOnly);
    ted.codeUnitCount=septets;
    if (septets > MAX_USER_DATA_SEPTETS) {
      ted.msgCount=(septets + (MAX_USER_DATA_SEPTETS_WITH_HEADER - 1)) / MAX_USER_DATA_SEPTETS_WITH_HEADER;
      ted.codeUnitsRemaining=(ted.msgCount * MAX_USER_DATA_SEPTETS_WITH_HEADER) - septets;
    }
 else {
      ted.msgCount=1;
      ted.codeUnitsRemaining=MAX_USER_DATA_SEPTETS - septets;
    }
    ted.codeUnitSize=ENCODING_7BIT;
  }
 catch (  EncodeException ex) {
    int octets=msgBody.length() * 2;
    ted.codeUnitCount=msgBody.length();
    if (octets > MAX_USER_DATA_BYTES) {
      ted.msgCount=(octets + (MAX_USER_DATA_BYTES_WITH_HEADER - 1)) / MAX_USER_DATA_BYTES_WITH_HEADER;
      ted.codeUnitsRemaining=((ted.msgCount * MAX_USER_DATA_BYTES_WITH_HEADER) - octets) / 2;
    }
 else {
      ted.msgCount=1;
      ted.codeUnitsRemaining=(MAX_USER_DATA_BYTES - octets) / 2;
    }
    ted.codeUnitSize=ENCODING_16BIT;
  }
  return ted;
}
Program: 41429
Project: 41429
Buggy source:
public void dump(Printer pw,String prefix){
  pw.println(prefix + this);
  pw.println(prefix + "String_Node_Str" + mRun);
  pw.println(prefix + "String_Node_Str" + mThread);
  pw.println(prefix + "String_Node_Str" + ((mQueue != null) ? mQueue : "String_Node_Str"));
  if (mQueue != null) {
synchronized (mQueue) {
      Message msg=mQueue.mMessages;
      int n=0;
      while (msg != null) {
        pw.println(prefix + "String_Node_Str" + n+ "String_Node_Str"+ msg);
        n++;
        msg=msg.next;
      }
      pw.println(prefix + "String_Node_Str" + n+ "String_Node_Str");
    }
  }
}

Fixed version (ground truth):
public void dump(Printer pw,String prefix){
  pw.println(prefix + this);
  pw.println(prefix + "String_Node_Str" + mRun);
  pw.println(prefix + "String_Node_Str" + mThread);
  pw.println(prefix + "String_Node_Str" + ((mQueue != null) ? mQueue : "String_Node_Str"));
  if (mQueue != null) {
synchronized (mQueue) {
      long now=SystemClock.uptimeMillis();
      Message msg=mQueue.mMessages;
      int n=0;
      while (msg != null) {
        pw.println(prefix + "String_Node_Str" + n+ "String_Node_Str"+ msg.toString(now));
        n++;
        msg=msg.next;
      }
      pw.println(prefix + "String_Node_Str" + n+ "String_Node_Str");
    }
  }
}
Program: 41430
Project: 41430
Buggy source:
public String toString(){
  StringBuilder b=new StringBuilder();
  b.append("String_Node_Str");
  b.append(what);
  b.append("String_Node_Str");
  b.append(when);
  if (arg1 != 0) {
    b.append("String_Node_Str");
    b.append(arg1);
  }
  if (arg2 != 0) {
    b.append("String_Node_Str");
    b.append(arg2);
  }
  if (obj != null) {
    b.append("String_Node_Str");
    b.append(obj);
  }
  b.append("String_Node_Str");
  return b.toString();
}

Fixed version (ground truth):
String toString(long now){
  StringBuilder b=new StringBuilder();
  b.append("String_Node_Str");
  b.append(what);
  b.append("String_Node_Str");
  TimeUtils.formatDuration(when - now,b);
  if (arg1 != 0) {
    b.append("String_Node_Str");
    b.append(arg1);
  }
  if (arg2 != 0) {
    b.append("String_Node_Str");
    b.append(arg2);
  }
  if (obj != null) {
    b.append("String_Node_Str");
    b.append(obj);
  }
  b.append("String_Node_Str");
  return b.toString();
}
Program: 41431
Project: 41431
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  ImageView content=new ImageView(this);
  content.setImageResource(com.android.internal.R.drawable.platlogo);
  content.setScaleType(ImageView.ScaleType.FIT_CENTER);
  setContentView(content);
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  mToast=Toast.makeText(this,"String_Node_Str",Toast.LENGTH_SHORT);
  ImageView content=new ImageView(this);
  content.setImageResource(com.android.internal.R.drawable.platlogo);
  content.setScaleType(ImageView.ScaleType.FIT_CENTER);
  setContentView(content);
}
Program: 41432
Project: 41432
Buggy source:
public void noteScreenOnLocked(){
  if (!mScreenOn) {
    mHistoryCur.states|=HistoryItem.STATE_SCREEN_ON_FLAG;
    if (DEBUG_HISTORY)     Slog.v(TAG,"String_Node_Str" + Integer.toHexString(mHistoryCur.states));
    addHistoryRecordLocked(SystemClock.elapsedRealtime());
    mScreenOn=true;
    mScreenOnTimer.startRunningLocked(this);
    if (mScreenBrightnessBin >= 0) {
      mScreenBrightnessTimer[mScreenBrightnessBin].startRunningLocked(this);
    }
    noteStartWakeLocked(-1,-1,"String_Node_Str",0);
  }
}

Fixed version (ground truth):
public void noteScreenOnLocked(){
  if (!mScreenOn) {
    mHistoryCur.states|=HistoryItem.STATE_SCREEN_ON_FLAG;
    if (DEBUG_HISTORY)     Slog.v(TAG,"String_Node_Str" + Integer.toHexString(mHistoryCur.states));
    addHistoryRecordLocked(SystemClock.elapsedRealtime());
    mScreenOn=true;
    mScreenOnTimer.startRunningLocked(this);
    if (mScreenBrightnessBin >= 0) {
      mScreenBrightnessTimer[mScreenBrightnessBin].startRunningLocked(this);
    }
    noteStartWakeLocked(-1,-1,"String_Node_Str",WAKE_TYPE_PARTIAL);
  }
}
Program: 41433
Project: 41433
Buggy source:
public void noteStartWakeLocked(int pid,String name,int type){
  StopwatchTimer t=getWakeTimerLocked(name,type);
  if (t != null) {
    t.startRunningLocked(BatteryStatsImpl.this);
  }
  if (pid >= 0) {
    Pid p=getPidStatsLocked(pid);
    p.mWakeStart=SystemClock.elapsedRealtime();
  }
}

Fixed version (ground truth):
public void noteStartWakeLocked(int pid,String name,int type){
  StopwatchTimer t=getWakeTimerLocked(name,type);
  if (t != null) {
    t.startRunningLocked(BatteryStatsImpl.this);
  }
  if (pid >= 0 && type == WAKE_TYPE_PARTIAL) {
    Pid p=getPidStatsLocked(pid);
    p.mWakeStart=SystemClock.elapsedRealtime();
  }
}
Program: 41434
Project: 41434
Buggy source:
public void noteStopWakeLocked(int pid,String name,int type){
  StopwatchTimer t=getWakeTimerLocked(name,type);
  if (t != null) {
    t.stopRunningLocked(BatteryStatsImpl.this);
  }
  if (pid >= 0) {
    Pid p=mPids.get(pid);
    if (p != null) {
      p.mWakeSum+=SystemClock.elapsedRealtime() - p.mWakeStart;
      p.mWakeStart=0;
    }
  }
}

Fixed version (ground truth):
public void noteStopWakeLocked(int pid,String name,int type){
  StopwatchTimer t=getWakeTimerLocked(name,type);
  if (t != null) {
    t.stopRunningLocked(BatteryStatsImpl.this);
  }
  if (pid >= 0 && type == WAKE_TYPE_PARTIAL) {
    Pid p=mPids.get(pid);
    if (p != null) {
      p.mWakeSum+=SystemClock.elapsedRealtime() - p.mWakeStart;
      p.mWakeStart=0;
    }
  }
}
Program: 41435
Project: 41435
Buggy source:
public void noteScreenOffLocked(){
  if (mScreenOn) {
    mHistoryCur.states&=~HistoryItem.STATE_SCREEN_ON_FLAG;
    if (DEBUG_HISTORY)     Slog.v(TAG,"String_Node_Str" + Integer.toHexString(mHistoryCur.states));
    addHistoryRecordLocked(SystemClock.elapsedRealtime());
    mScreenOn=false;
    mScreenOnTimer.stopRunningLocked(this);
    if (mScreenBrightnessBin >= 0) {
      mScreenBrightnessTimer[mScreenBrightnessBin].stopRunningLocked(this);
    }
    noteStopWakeLocked(-1,-1,"String_Node_Str",0);
  }
}

Fixed version (ground truth):
public void noteScreenOffLocked(){
  if (mScreenOn) {
    mHistoryCur.states&=~HistoryItem.STATE_SCREEN_ON_FLAG;
    if (DEBUG_HISTORY)     Slog.v(TAG,"String_Node_Str" + Integer.toHexString(mHistoryCur.states));
    addHistoryRecordLocked(SystemClock.elapsedRealtime());
    mScreenOn=false;
    mScreenOnTimer.stopRunningLocked(this);
    if (mScreenBrightnessBin >= 0) {
      mScreenBrightnessTimer[mScreenBrightnessBin].stopRunningLocked(this);
    }
    noteStopWakeLocked(-1,-1,"String_Node_Str",WAKE_TYPE_PARTIAL);
  }
}
Program: 41436
Project: 41436
Buggy source:
/** 
 * Puts the device to speaker mode. 
 */
void setSpeakerMode();

Fixed version (ground truth):
/** 
 * Puts the device to speaker mode. 
 */
void setSpeakerMode(boolean speakerMode);
Program: 41437
Project: 41437
Buggy source:
private void stopCall(boolean releaseSocket){
  Log.d(TAG,"String_Node_Str");
  if (mRtpSession != null) {
    mRtpSession.join(null);
    if (releaseSocket) {
      mRtpSession.release();
      mRtpSession=null;
    }
  }
  setInCallMode();
}

Fixed version (ground truth):
private void stopCall(boolean releaseSocket){
  Log.d(TAG,"String_Node_Str");
  if (mRtpSession != null) {
    mRtpSession.join(null);
    if (releaseSocket) {
      mRtpSession.release();
      mRtpSession=null;
    }
  }
}
Program: 41438
Project: 41438
Buggy source:
public synchronized void setSpeakerMode(){
  ((AudioManager)mContext.getSystemService(Context.AUDIO_SERVICE)).setSpeakerphoneOn(true);
}

Fixed version (ground truth):
public synchronized void setSpeakerMode(boolean speakerMode){
  ((AudioManager)mContext.getSystemService(Context.AUDIO_SERVICE)).setSpeakerphoneOn(speakerMode);
}