nus-yam/ex-repair huggingface dataset:
Program: 198467
Project: 198467
Buggy source:
void readArrayMapInternal(ArrayMap outVal,int N,ClassLoader loader){
  if (DEBUG_ARRAY_MAP) {
    RuntimeException here=new RuntimeException("String_Node_Str");
    here.fillInStackTrace();
    Log.d(TAG,"String_Node_Str" + N + "String_Node_Str",here);
  }
  int startPos;
  while (N > 0) {
    if (DEBUG_ARRAY_MAP)     startPos=dataPosition();
    Object key=readValue(loader);
    Object value=readValue(loader);
    if (DEBUG_ARRAY_MAP)     Log.d(TAG,"String_Node_Str" + (N - 1) + "String_Node_Str"+ (dataPosition() - startPos)+ "String_Node_Str"+ Integer.toHexString((key != null ? key.hashCode() : 0))+ "String_Node_Str"+ key);
    outVal.append(key,value);
    N--;
  }
}

Fixed version (ground truth):
void readArrayMapInternal(ArrayMap outVal,int N,ClassLoader loader){
  if (DEBUG_ARRAY_MAP) {
    RuntimeException here=new RuntimeException("String_Node_Str");
    here.fillInStackTrace();
    Log.d(TAG,"String_Node_Str" + N + "String_Node_Str",here);
  }
  int startPos;
  while (N > 0) {
    if (DEBUG_ARRAY_MAP)     startPos=dataPosition();
    String key=readString();
    Object value=readValue(loader);
    if (DEBUG_ARRAY_MAP)     Log.d(TAG,"String_Node_Str" + (N - 1) + "String_Node_Str"+ (dataPosition() - startPos)+ "String_Node_Str"+ Integer.toHexString((key != null ? key.hashCode() : 0))+ "String_Node_Str"+ key);
    outVal.append(key,value);
    N--;
  }
  outVal.validate();
}
Program: 198468
Project: 198468
Buggy source:
/** 
 * Flatten an ArrayMap into the parcel at the current dataPosition(), growing dataCapacity() if needed.  The Map keys must be String objects.
 */
void writeArrayMapInternal(ArrayMap<String,Object> val){
  if (val == null) {
    writeInt(-1);
    return;
  }
  final int N=val.size();
  writeInt(N);
  if (DEBUG_ARRAY_MAP) {
    RuntimeException here=new RuntimeException("String_Node_Str");
    here.fillInStackTrace();
    Log.d(TAG,"String_Node_Str" + N + "String_Node_Str",here);
  }
  int startPos;
  for (int i=0; i < N; i++) {
    if (DEBUG_ARRAY_MAP)     startPos=dataPosition();
    writeValue(val.keyAt(i));
    writeValue(val.valueAt(i));
    if (DEBUG_ARRAY_MAP)     Log.d(TAG,"String_Node_Str" + i + "String_Node_Str"+ (dataPosition() - startPos)+ "String_Node_Str"+ Integer.toHexString(val.keyAt(i) != null ? val.keyAt(i).hashCode() : 0)+ "String_Node_Str"+ val.keyAt(i));
  }
}

Fixed version (ground truth):
/** 
 * Flatten an ArrayMap into the parcel at the current dataPosition(), growing dataCapacity() if needed.  The Map keys must be String objects.
 */
void writeArrayMapInternal(ArrayMap<String,Object> val){
  if (val == null) {
    writeInt(-1);
    return;
  }
  final int N=val.size();
  writeInt(N);
  if (DEBUG_ARRAY_MAP) {
    RuntimeException here=new RuntimeException("String_Node_Str");
    here.fillInStackTrace();
    Log.d(TAG,"String_Node_Str" + N + "String_Node_Str",here);
  }
  int startPos;
  for (int i=0; i < N; i++) {
    if (DEBUG_ARRAY_MAP)     startPos=dataPosition();
    writeString(val.keyAt(i));
    writeValue(val.valueAt(i));
    if (DEBUG_ARRAY_MAP)     Log.d(TAG,"String_Node_Str" + i + "String_Node_Str"+ (dataPosition() - startPos)+ "String_Node_Str"+ Integer.toHexString(val.keyAt(i) != null ? val.keyAt(i).hashCode() : 0)+ "String_Node_Str"+ val.keyAt(i));
  }
}
Program: 198469
Project: 198469
Buggy source:
@Override public boolean canForwardTo(Intent intent,String resolvedType,int sourceUserId,int targetUserId){
  mContext.enforceCallingOrSelfPermission(android.Manifest.permission.INTERACT_ACROSS_USERS_FULL,null);
  List<CrossProfileIntentFilter> matches=getMatchingCrossProfileIntentFilters(intent,resolvedType,sourceUserId);
  if (matches != null) {
    int size=matches.size();
    for (int i=0; i < size; i++) {
      if (matches.get(i).getTargetUserId() == targetUserId)       return true;
    }
  }
  ArrayList<String> packageNames=null;
  SparseArray<ArrayList<String>> fromSource=mSettings.mCrossProfilePackageInfo.get(sourceUserId);
  if (fromSource != null) {
    packageNames=fromSource.get(targetUserId);
  }
  if (packageNames.contains(intent.getPackage())) {
    return true;
  }
  List<ResolveInfo> resolveInfos=mActivities.queryIntent(intent,resolvedType,PackageManager.GET_UNINSTALLED_PACKAGES,targetUserId);
  int count=resolveInfos.size();
  for (int i=0; i < count; i++) {
    ResolveInfo resolveInfo=resolveInfos.get(i);
    if (packageNames.contains(resolveInfo.activityInfo.packageName)) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean canForwardTo(Intent intent,String resolvedType,int sourceUserId,int targetUserId){
  mContext.enforceCallingOrSelfPermission(android.Manifest.permission.INTERACT_ACROSS_USERS_FULL,null);
  List<CrossProfileIntentFilter> matches=getMatchingCrossProfileIntentFilters(intent,resolvedType,sourceUserId);
  if (matches != null) {
    int size=matches.size();
    for (int i=0; i < size; i++) {
      if (matches.get(i).getTargetUserId() == targetUserId)       return true;
    }
  }
  ArrayList<String> packageNames=null;
  SparseArray<ArrayList<String>> fromSource=mSettings.mCrossProfilePackageInfo.get(sourceUserId);
  if (fromSource != null) {
    packageNames=fromSource.get(targetUserId);
  }
  if (packageNames != null && packageNames.contains(intent.getPackage())) {
    return true;
  }
  List<ResolveInfo> resolveInfos=mActivities.queryIntent(intent,resolvedType,PackageManager.GET_UNINSTALLED_PACKAGES,targetUserId);
  int count=resolveInfos.size();
  for (int i=0; i < count; i++) {
    ResolveInfo resolveInfo=resolveInfos.get(i);
    if (packageNames.contains(resolveInfo.activityInfo.packageName)) {
      return true;
    }
  }
  return false;
}
Program: 198470
Project: 198470
Buggy source:
@Override public boolean canForwardTo(Intent intent,String resolvedType,int sourceUserId,int targetUserId){
  mContext.enforceCallingOrSelfPermission(android.Manifest.permission.INTERACT_ACROSS_USERS_FULL,null);
  List<CrossProfileIntentFilter> matches=getMatchingCrossProfileIntentFilters(intent,resolvedType,sourceUserId);
  if (matches != null) {
    int size=matches.size();
    for (int i=0; i < size; i++) {
      if (matches.get(i).getTargetUserId() == targetUserId)       return true;
    }
  }
  ArrayList<String> packageNames=null;
  SparseArray<ArrayList<String>> fromSource=mSettings.mCrossProfilePackageInfo.get(sourceUserId);
  if (fromSource != null) {
    packageNames=fromSource.get(targetUserId);
  }
  if (packageNames.contains(intent.getPackage())) {
    return true;
  }
  List<ResolveInfo> resolveInfos=mActivities.queryIntent(intent,resolvedType,PackageManager.GET_UNINSTALLED_PACKAGES,targetUserId);
  int count=resolveInfos.size();
  for (int i=0; i < count; i++) {
    ResolveInfo resolveInfo=resolveInfos.get(i);
    if (packageNames.contains(resolveInfo.activityInfo.packageName)) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean canForwardTo(Intent intent,String resolvedType,int sourceUserId,int targetUserId){
  mContext.enforceCallingOrSelfPermission(android.Manifest.permission.INTERACT_ACROSS_USERS_FULL,null);
  List<CrossProfileIntentFilter> matches=getMatchingCrossProfileIntentFilters(intent,resolvedType,sourceUserId);
  if (matches != null) {
    int size=matches.size();
    for (int i=0; i < size; i++) {
      if (matches.get(i).getTargetUserId() == targetUserId)       return true;
    }
  }
  ArrayList<String> packageNames=null;
  SparseArray<ArrayList<String>> fromSource=mSettings.mCrossProfilePackageInfo.get(sourceUserId);
  if (fromSource != null) {
    packageNames=fromSource.get(targetUserId);
  }
  if (packageNames != null && packageNames.contains(intent.getPackage())) {
    return true;
  }
  List<ResolveInfo> resolveInfos=mActivities.queryIntent(intent,resolvedType,PackageManager.GET_UNINSTALLED_PACKAGES,targetUserId);
  int count=resolveInfos.size();
  for (int i=0; i < count; i++) {
    ResolveInfo resolveInfo=resolveInfos.get(i);
    if (packageNames.contains(resolveInfo.activityInfo.packageName)) {
      return true;
    }
  }
  return false;
}
Program: 198471
Project: 198471
Buggy source:
@Override public boolean canForwardTo(Intent intent,String resolvedType,int sourceUserId,int targetUserId){
  mContext.enforceCallingOrSelfPermission(android.Manifest.permission.INTERACT_ACROSS_USERS_FULL,null);
  List<CrossProfileIntentFilter> matches=getMatchingCrossProfileIntentFilters(intent,resolvedType,sourceUserId);
  if (matches != null) {
    int size=matches.size();
    for (int i=0; i < size; i++) {
      if (matches.get(i).getTargetUserId() == targetUserId)       return true;
    }
  }
  ArrayList<String> packageNames=null;
  SparseArray<ArrayList<String>> fromSource=mSettings.mCrossProfilePackageInfo.get(sourceUserId);
  if (fromSource != null) {
    packageNames=fromSource.get(targetUserId);
  }
  if (packageNames.contains(intent.getPackage())) {
    return true;
  }
  List<ResolveInfo> resolveInfos=mActivities.queryIntent(intent,resolvedType,PackageManager.GET_UNINSTALLED_PACKAGES,targetUserId);
  int count=resolveInfos.size();
  for (int i=0; i < count; i++) {
    ResolveInfo resolveInfo=resolveInfos.get(i);
    if (packageNames.contains(resolveInfo.activityInfo.packageName)) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean canForwardTo(Intent intent,String resolvedType,int sourceUserId,int targetUserId){
  mContext.enforceCallingOrSelfPermission(android.Manifest.permission.INTERACT_ACROSS_USERS_FULL,null);
  List<CrossProfileIntentFilter> matches=getMatchingCrossProfileIntentFilters(intent,resolvedType,sourceUserId);
  if (matches != null) {
    int size=matches.size();
    for (int i=0; i < size; i++) {
      if (matches.get(i).getTargetUserId() == targetUserId)       return true;
    }
  }
  ArrayList<String> packageNames=null;
  SparseArray<ArrayList<String>> fromSource=mSettings.mCrossProfilePackageInfo.get(sourceUserId);
  if (fromSource != null) {
    packageNames=fromSource.get(targetUserId);
  }
  if (packageNames != null && packageNames.contains(intent.getPackage())) {
    return true;
  }
  List<ResolveInfo> resolveInfos=mActivities.queryIntent(intent,resolvedType,PackageManager.GET_UNINSTALLED_PACKAGES,targetUserId);
  int count=resolveInfos.size();
  for (int i=0; i < count; i++) {
    ResolveInfo resolveInfo=resolveInfos.get(i);
    if (packageNames.contains(resolveInfo.activityInfo.packageName)) {
      return true;
    }
  }
  return false;
}
Program: 198472
Project: 198472
Buggy source:
public static void removeGhost(View view){
  GhostView ghostView=view.mGhostView;
  if (ghostView != null) {
    ViewGroup parent=(ViewGroup)ghostView.getParent();
    parent.removeView(ghostView);
  }
}

Fixed version (ground truth):
public static void removeGhost(View view){
  GhostView ghostView=view.mGhostView;
  if (ghostView != null) {
    ghostView.mReferences--;
    if (ghostView.mReferences == 0) {
      ViewGroup parent=(ViewGroup)ghostView.getParent();
      ViewGroup grandParent=(ViewGroup)parent.getParent();
      grandParent.removeView(parent);
    }
  }
}
Program: 198473
Project: 198473
Buggy source:
private GhostView(View view,ViewGroup host,Matrix matrix){
  super(view.getContext());
  mView=view;
  mView.mGhostView=this;
  mRenderNode.setAnimationMatrix(matrix);
  final ViewGroup parent=(ViewGroup)mView.getParent();
  setLeft(0);
  setTop(0);
  setRight(host.getWidth());
  setBottom(host.getHeight());
  setGhostedVisibility(View.INVISIBLE);
  parent.mRecreateDisplayList=true;
  parent.getDisplayList();
}

Fixed version (ground truth):
private GhostView(View view){
  super(view.getContext());
  mView=view;
  mView.mGhostView=this;
  final ViewGroup parent=(ViewGroup)mView.getParent();
  setGhostedVisibility(View.INVISIBLE);
  parent.mRecreateDisplayList=true;
  parent.getDisplayList();
}
Program: 198474
Project: 198474
Buggy source:
public static void removeGhost(View view){
  GhostView ghostView=view.mGhostView;
  if (ghostView != null) {
    ViewGroup parent=(ViewGroup)ghostView.getParent();
    parent.removeView(ghostView);
  }
}

Fixed version (ground truth):
public static void removeGhost(View view){
  GhostView ghostView=view.mGhostView;
  if (ghostView != null) {
    ghostView.mReferences--;
    if (ghostView.mReferences == 0) {
      ViewGroup parent=(ViewGroup)ghostView.getParent();
      ViewGroup grandParent=(ViewGroup)parent.getParent();
      grandParent.removeView(parent);
    }
  }
}
Program: 198475
Project: 198475
Buggy source:
private GhostView(View view,ViewGroup host,Matrix matrix){
  super(view.getContext());
  mView=view;
  mView.mGhostView=this;
  mRenderNode.setAnimationMatrix(matrix);
  final ViewGroup parent=(ViewGroup)mView.getParent();
  setLeft(0);
  setTop(0);
  setRight(host.getWidth());
  setBottom(host.getHeight());
  setGhostedVisibility(View.INVISIBLE);
  parent.mRecreateDisplayList=true;
  parent.getDisplayList();
}

Fixed version (ground truth):
private GhostView(View view){
  super(view.getContext());
  mView=view;
  mView.mGhostView=this;
  final ViewGroup parent=(ViewGroup)mView.getParent();
  setGhostedVisibility(View.INVISIBLE);
  parent.mRecreateDisplayList=true;
  parent.getDisplayList();
}
Program: 198476
Project: 198476
Buggy source:
@Override public boolean canForwardTo(Intent intent,String resolvedType,int sourceUserId,int targetUserId){
  mContext.enforceCallingOrSelfPermission(android.Manifest.permission.INTERACT_ACROSS_USERS_FULL,null);
  List<CrossProfileIntentFilter> matches=getMatchingCrossProfileIntentFilters(intent,resolvedType,sourceUserId);
  if (matches != null) {
    int size=matches.size();
    for (int i=0; i < size; i++) {
      if (matches.get(i).getTargetUserId() == targetUserId)       return true;
    }
  }
  ArrayList<String> packageNames=null;
  SparseArray<ArrayList<String>> fromSource=mSettings.mCrossProfilePackageInfo.get(sourceUserId);
  if (fromSource != null) {
    packageNames=fromSource.get(targetUserId);
  }
  if (packageNames.contains(intent.getPackage())) {
    return true;
  }
  List<ResolveInfo> resolveInfos=mActivities.queryIntent(intent,resolvedType,PackageManager.GET_UNINSTALLED_PACKAGES,targetUserId);
  int count=resolveInfos.size();
  for (int i=0; i < count; i++) {
    ResolveInfo resolveInfo=resolveInfos.get(i);
    if (packageNames.contains(resolveInfo.activityInfo.packageName)) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean canForwardTo(Intent intent,String resolvedType,int sourceUserId,int targetUserId){
  mContext.enforceCallingOrSelfPermission(android.Manifest.permission.INTERACT_ACROSS_USERS_FULL,null);
  List<CrossProfileIntentFilter> matches=getMatchingCrossProfileIntentFilters(intent,resolvedType,sourceUserId);
  if (matches != null) {
    int size=matches.size();
    for (int i=0; i < size; i++) {
      if (matches.get(i).getTargetUserId() == targetUserId)       return true;
    }
  }
  ArrayList<String> packageNames=null;
  SparseArray<ArrayList<String>> fromSource=mSettings.mCrossProfilePackageInfo.get(sourceUserId);
  if (fromSource != null) {
    packageNames=fromSource.get(targetUserId);
  }
  if (packageNames != null && packageNames.contains(intent.getPackage())) {
    return true;
  }
  List<ResolveInfo> resolveInfos=mActivities.queryIntent(intent,resolvedType,PackageManager.GET_UNINSTALLED_PACKAGES,targetUserId);
  int count=resolveInfos.size();
  for (int i=0; i < count; i++) {
    ResolveInfo resolveInfo=resolveInfos.get(i);
    if (packageNames.contains(resolveInfo.activityInfo.packageName)) {
      return true;
    }
  }
  return false;
}
Program: 198477
Project: 198477
Buggy source:
public static void removeGhost(View view){
  GhostView ghostView=view.mGhostView;
  if (ghostView != null) {
    ViewGroup parent=(ViewGroup)ghostView.getParent();
    parent.removeView(ghostView);
  }
}

Fixed version (ground truth):
public static void removeGhost(View view){
  GhostView ghostView=view.mGhostView;
  if (ghostView != null) {
    ghostView.mReferences--;
    if (ghostView.mReferences == 0) {
      ViewGroup parent=(ViewGroup)ghostView.getParent();
      ViewGroup grandParent=(ViewGroup)parent.getParent();
      grandParent.removeView(parent);
    }
  }
}
Program: 198478
Project: 198478
Buggy source:
private GhostView(View view,ViewGroup host,Matrix matrix){
  super(view.getContext());
  mView=view;
  mView.mGhostView=this;
  mRenderNode.setAnimationMatrix(matrix);
  final ViewGroup parent=(ViewGroup)mView.getParent();
  setLeft(0);
  setTop(0);
  setRight(host.getWidth());
  setBottom(host.getHeight());
  setGhostedVisibility(View.INVISIBLE);
  parent.mRecreateDisplayList=true;
  parent.getDisplayList();
}

Fixed version (ground truth):
private GhostView(View view){
  super(view.getContext());
  mView=view;
  mView.mGhostView=this;
  final ViewGroup parent=(ViewGroup)mView.getParent();
  setGhostedVisibility(View.INVISIBLE);
  parent.mRecreateDisplayList=true;
  parent.getDisplayList();
}
Program: 198479
Project: 198479
Buggy source:
public static void removeGhost(View view){
  GhostView ghostView=view.mGhostView;
  if (ghostView != null) {
    ViewGroup parent=(ViewGroup)ghostView.getParent();
    parent.removeView(ghostView);
  }
}

Fixed version (ground truth):
public static void removeGhost(View view){
  GhostView ghostView=view.mGhostView;
  if (ghostView != null) {
    ghostView.mReferences--;
    if (ghostView.mReferences == 0) {
      ViewGroup parent=(ViewGroup)ghostView.getParent();
      ViewGroup grandParent=(ViewGroup)parent.getParent();
      grandParent.removeView(parent);
    }
  }
}
Program: 198480
Project: 198480
Buggy source:
private GhostView(View view,ViewGroup host,Matrix matrix){
  super(view.getContext());
  mView=view;
  mView.mGhostView=this;
  mRenderNode.setAnimationMatrix(matrix);
  final ViewGroup parent=(ViewGroup)mView.getParent();
  setLeft(0);
  setTop(0);
  setRight(host.getWidth());
  setBottom(host.getHeight());
  setGhostedVisibility(View.INVISIBLE);
  parent.mRecreateDisplayList=true;
  parent.getDisplayList();
}

Fixed version (ground truth):
private GhostView(View view){
  super(view.getContext());
  mView=view;
  mView.mGhostView=this;
  final ViewGroup parent=(ViewGroup)mView.getParent();
  setGhostedVisibility(View.INVISIBLE);
  parent.mRecreateDisplayList=true;
  parent.getDisplayList();
}
Program: 198481
Project: 198481
Buggy source:
void startSpecificActivityLocked(ActivityRecord r,boolean andResume,boolean checkConfig){
  ProcessRecord app=mService.getProcessRecordLocked(r.processName,r.info.applicationInfo.uid,true);
  r.task.stack.setLaunchTime(r);
  if (app != null && app.thread != null && !app.killedByAm) {
    try {
      if ((r.info.flags & ActivityInfo.FLAG_MULTIPROCESS) == 0 || !"String_Node_Str".equals(r.info.packageName)) {
        app.addPackage(r.info.packageName,mService.mProcessStats);
      }
      realStartActivityLocked(r,app,andResume,checkConfig);
      return;
    }
 catch (    RemoteException e) {
      Slog.w(TAG,"String_Node_Str" + r.intent.getComponent().flattenToShortString(),e);
    }
  }
  mService.startProcessLocked(r.processName,r.info.applicationInfo,true,0,"String_Node_Str",r.intent.getComponent(),false,false,true);
}

Fixed version (ground truth):
void startSpecificActivityLocked(ActivityRecord r,boolean andResume,boolean checkConfig){
  ProcessRecord app=mService.getProcessRecordLocked(r.processName,r.info.applicationInfo.uid,true);
  r.task.stack.setLaunchTime(r);
  if (app != null && app.thread != null) {
    try {
      if ((r.info.flags & ActivityInfo.FLAG_MULTIPROCESS) == 0 || !"String_Node_Str".equals(r.info.packageName)) {
        app.addPackage(r.info.packageName,mService.mProcessStats);
      }
      realStartActivityLocked(r,app,andResume,checkConfig);
      return;
    }
 catch (    RemoteException e) {
      Slog.w(TAG,"String_Node_Str" + r.intent.getComponent().flattenToShortString(),e);
    }
  }
  mService.startProcessLocked(r.processName,r.info.applicationInfo,true,0,"String_Node_Str",r.intent.getComponent(),false,false,true);
}
Program: 198482
Project: 198482
Buggy source:
void startSpecificActivityLocked(ActivityRecord r,boolean andResume,boolean checkConfig){
  ProcessRecord app=mService.getProcessRecordLocked(r.processName,r.info.applicationInfo.uid,true);
  r.task.stack.setLaunchTime(r);
  if (app != null && app.thread != null && !app.killedByAm) {
    try {
      if ((r.info.flags & ActivityInfo.FLAG_MULTIPROCESS) == 0 || !"String_Node_Str".equals(r.info.packageName)) {
        app.addPackage(r.info.packageName,r.info.applicationInfo.versionCode,mService.mProcessStats);
      }
      realStartActivityLocked(r,app,andResume,checkConfig);
      return;
    }
 catch (    RemoteException e) {
      Slog.w(TAG,"String_Node_Str" + r.intent.getComponent().flattenToShortString(),e);
    }
  }
  mService.startProcessLocked(r.processName,r.info.applicationInfo,true,0,"String_Node_Str",r.intent.getComponent(),false,false,true);
}

Fixed version (ground truth):
void startSpecificActivityLocked(ActivityRecord r,boolean andResume,boolean checkConfig){
  ProcessRecord app=mService.getProcessRecordLocked(r.processName,r.info.applicationInfo.uid,true);
  r.task.stack.setLaunchTime(r);
  if (app != null && app.thread != null) {
    try {
      if ((r.info.flags & ActivityInfo.FLAG_MULTIPROCESS) == 0 || !"String_Node_Str".equals(r.info.packageName)) {
        app.addPackage(r.info.packageName,r.info.applicationInfo.versionCode,mService.mProcessStats);
      }
      realStartActivityLocked(r,app,andResume,checkConfig);
      return;
    }
 catch (    RemoteException e) {
      Slog.w(TAG,"String_Node_Str" + r.intent.getComponent().flattenToShortString(),e);
    }
  }
  mService.startProcessLocked(r.processName,r.info.applicationInfo,true,0,"String_Node_Str",r.intent.getComponent(),false,false,true);
}
Program: 198483
Project: 198483
Buggy source:
void startSpecificActivityLocked(ActivityRecord r,boolean andResume,boolean checkConfig){
  ProcessRecord app=mService.getProcessRecordLocked(r.processName,r.info.applicationInfo.uid,true);
  r.task.stack.setLaunchTime(r);
  if (app != null && app.thread != null && !app.killedByAm) {
    try {
      if ((r.info.flags & ActivityInfo.FLAG_MULTIPROCESS) == 0 || !"String_Node_Str".equals(r.info.packageName)) {
        app.addPackage(r.info.packageName,r.info.applicationInfo.versionCode,mService.mProcessStats);
      }
      realStartActivityLocked(r,app,andResume,checkConfig);
      return;
    }
 catch (    RemoteException e) {
      Slog.w(TAG,"String_Node_Str" + r.intent.getComponent().flattenToShortString(),e);
    }
  }
  mService.startProcessLocked(r.processName,r.info.applicationInfo,true,0,"String_Node_Str",r.intent.getComponent(),false,false,true);
}

Fixed version (ground truth):
void startSpecificActivityLocked(ActivityRecord r,boolean andResume,boolean checkConfig){
  ProcessRecord app=mService.getProcessRecordLocked(r.processName,r.info.applicationInfo.uid,true);
  r.task.stack.setLaunchTime(r);
  if (app != null && app.thread != null) {
    try {
      if ((r.info.flags & ActivityInfo.FLAG_MULTIPROCESS) == 0 || !"String_Node_Str".equals(r.info.packageName)) {
        app.addPackage(r.info.packageName,r.info.applicationInfo.versionCode,mService.mProcessStats);
      }
      realStartActivityLocked(r,app,andResume,checkConfig);
      return;
    }
 catch (    RemoteException e) {
      Slog.w(TAG,"String_Node_Str" + r.intent.getComponent().flattenToShortString(),e);
    }
  }
  mService.startProcessLocked(r.processName,r.info.applicationInfo,true,0,"String_Node_Str",r.intent.getComponent(),false,false,true);
}
Program: 198484
Project: 198484
Buggy source:
void startSpecificActivityLocked(ActivityRecord r,boolean andResume,boolean checkConfig){
  ProcessRecord app=mService.getProcessRecordLocked(r.processName,r.info.applicationInfo.uid,true);
  r.task.stack.setLaunchTime(r);
  if (app != null && app.thread != null && !app.killedByAm) {
    try {
      if ((r.info.flags & ActivityInfo.FLAG_MULTIPROCESS) == 0 || !"String_Node_Str".equals(r.info.packageName)) {
        app.addPackage(r.info.packageName,mService.mProcessStats);
      }
      realStartActivityLocked(r,app,andResume,checkConfig);
      return;
    }
 catch (    RemoteException e) {
      Slog.w(TAG,"String_Node_Str" + r.intent.getComponent().flattenToShortString(),e);
    }
  }
  mService.startProcessLocked(r.processName,r.info.applicationInfo,true,0,"String_Node_Str",r.intent.getComponent(),false,false,true);
}

Fixed version (ground truth):
void startSpecificActivityLocked(ActivityRecord r,boolean andResume,boolean checkConfig){
  ProcessRecord app=mService.getProcessRecordLocked(r.processName,r.info.applicationInfo.uid,true);
  r.task.stack.setLaunchTime(r);
  if (app != null && app.thread != null) {
    try {
      if ((r.info.flags & ActivityInfo.FLAG_MULTIPROCESS) == 0 || !"String_Node_Str".equals(r.info.packageName)) {
        app.addPackage(r.info.packageName,mService.mProcessStats);
      }
      realStartActivityLocked(r,app,andResume,checkConfig);
      return;
    }
 catch (    RemoteException e) {
      Slog.w(TAG,"String_Node_Str" + r.intent.getComponent().flattenToShortString(),e);
    }
  }
  mService.startProcessLocked(r.processName,r.info.applicationInfo,true,0,"String_Node_Str",r.intent.getComponent(),false,false,true);
}
Program: 198485
Project: 198485
Buggy source:
void startSpecificActivityLocked(ActivityRecord r,boolean andResume,boolean checkConfig){
  ProcessRecord app=mService.getProcessRecordLocked(r.processName,r.info.applicationInfo.uid,true);
  r.task.stack.setLaunchTime(r);
  if (app != null && app.thread != null && !app.killedByAm) {
    try {
      if ((r.info.flags & ActivityInfo.FLAG_MULTIPROCESS) == 0 || !"String_Node_Str".equals(r.info.packageName)) {
        app.addPackage(r.info.packageName,mService.mProcessStats);
      }
      realStartActivityLocked(r,app,andResume,checkConfig);
      return;
    }
 catch (    RemoteException e) {
      Slog.w(TAG,"String_Node_Str" + r.intent.getComponent().flattenToShortString(),e);
    }
  }
  mService.startProcessLocked(r.processName,r.info.applicationInfo,true,0,"String_Node_Str",r.intent.getComponent(),false,false,true);
}

Fixed version (ground truth):
void startSpecificActivityLocked(ActivityRecord r,boolean andResume,boolean checkConfig){
  ProcessRecord app=mService.getProcessRecordLocked(r.processName,r.info.applicationInfo.uid,true);
  r.task.stack.setLaunchTime(r);
  if (app != null && app.thread != null) {
    try {
      if ((r.info.flags & ActivityInfo.FLAG_MULTIPROCESS) == 0 || !"String_Node_Str".equals(r.info.packageName)) {
        app.addPackage(r.info.packageName,mService.mProcessStats);
      }
      realStartActivityLocked(r,app,andResume,checkConfig);
      return;
    }
 catch (    RemoteException e) {
      Slog.w(TAG,"String_Node_Str" + r.intent.getComponent().flattenToShortString(),e);
    }
  }
  mService.startProcessLocked(r.processName,r.info.applicationInfo,true,0,"String_Node_Str",r.intent.getComponent(),false,false,true);
}
Program: 198486
Project: 198486
Buggy source:
@Override public boolean canForwardTo(Intent intent,String resolvedType,int sourceUserId,int targetUserId){
  mContext.enforceCallingOrSelfPermission(android.Manifest.permission.INTERACT_ACROSS_USERS_FULL,null);
  List<CrossProfileIntentFilter> matches=getMatchingCrossProfileIntentFilters(intent,resolvedType,sourceUserId);
  if (matches != null) {
    int size=matches.size();
    for (int i=0; i < size; i++) {
      if (matches.get(i).getTargetUserId() == targetUserId)       return true;
    }
  }
  ArrayList<String> packageNames=null;
  SparseArray<ArrayList<String>> fromSource=mSettings.mCrossProfilePackageInfo.get(sourceUserId);
  if (fromSource != null) {
    packageNames=fromSource.get(targetUserId);
  }
  if (packageNames.contains(intent.getPackage())) {
    return true;
  }
  List<ResolveInfo> resolveInfos=mActivities.queryIntent(intent,resolvedType,PackageManager.GET_UNINSTALLED_PACKAGES,targetUserId);
  int count=resolveInfos.size();
  for (int i=0; i < count; i++) {
    ResolveInfo resolveInfo=resolveInfos.get(i);
    if (packageNames.contains(resolveInfo.activityInfo.packageName)) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean canForwardTo(Intent intent,String resolvedType,int sourceUserId,int targetUserId){
  mContext.enforceCallingOrSelfPermission(android.Manifest.permission.INTERACT_ACROSS_USERS_FULL,null);
  List<CrossProfileIntentFilter> matches=getMatchingCrossProfileIntentFilters(intent,resolvedType,sourceUserId);
  if (matches != null) {
    int size=matches.size();
    for (int i=0; i < size; i++) {
      if (matches.get(i).getTargetUserId() == targetUserId)       return true;
    }
  }
  ArrayList<String> packageNames=null;
  SparseArray<ArrayList<String>> fromSource=mSettings.mCrossProfilePackageInfo.get(sourceUserId);
  if (fromSource != null) {
    packageNames=fromSource.get(targetUserId);
  }
  if (packageNames != null && packageNames.contains(intent.getPackage())) {
    return true;
  }
  List<ResolveInfo> resolveInfos=mActivities.queryIntent(intent,resolvedType,PackageManager.GET_UNINSTALLED_PACKAGES,targetUserId);
  int count=resolveInfos.size();
  for (int i=0; i < count; i++) {
    ResolveInfo resolveInfo=resolveInfos.get(i);
    if (packageNames.contains(resolveInfo.activityInfo.packageName)) {
      return true;
    }
  }
  return false;
}
Program: 198487
Project: 198487
Buggy source:
void startSpecificActivityLocked(ActivityRecord r,boolean andResume,boolean checkConfig){
  ProcessRecord app=mService.getProcessRecordLocked(r.processName,r.info.applicationInfo.uid,true);
  r.task.stack.setLaunchTime(r);
  if (app != null && app.thread != null) {
    try {
      if ((r.info.flags & ActivityInfo.FLAG_MULTIPROCESS) == 0 || !"String_Node_Str".equals(r.info.packageName)) {
        app.addPackage(r.info.packageName,mService.mProcessStats);
      }
      realStartActivityLocked(r,app,andResume,checkConfig);
      return;
    }
 catch (    RemoteException e) {
      Slog.w(TAG,"String_Node_Str" + r.intent.getComponent().flattenToShortString(),e);
    }
  }
  mService.startProcessLocked(r.processName,r.info.applicationInfo,true,0,"String_Node_Str",r.intent.getComponent(),false,false,true);
}

Fixed version (ground truth):
void startSpecificActivityLocked(ActivityRecord r,boolean andResume,boolean checkConfig){
  ProcessRecord app=mService.getProcessRecordLocked(r.processName,r.info.applicationInfo.uid,true);
  r.task.stack.setLaunchTime(r);
  if (app != null && app.thread != null && !app.killedByAm) {
    try {
      if ((r.info.flags & ActivityInfo.FLAG_MULTIPROCESS) == 0 || !"String_Node_Str".equals(r.info.packageName)) {
        app.addPackage(r.info.packageName,mService.mProcessStats);
      }
      realStartActivityLocked(r,app,andResume,checkConfig);
      return;
    }
 catch (    RemoteException e) {
      Slog.w(TAG,"String_Node_Str" + r.intent.getComponent().flattenToShortString(),e);
    }
  }
  mService.startProcessLocked(r.processName,r.info.applicationInfo,true,0,"String_Node_Str",r.intent.getComponent(),false,false,true);
}
Program: 198488
Project: 198488
Buggy source:
void startSpecificActivityLocked(ActivityRecord r,boolean andResume,boolean checkConfig){
  ProcessRecord app=mService.getProcessRecordLocked(r.processName,r.info.applicationInfo.uid,true);
  r.task.stack.setLaunchTime(r);
  if (app != null && app.thread != null) {
    try {
      if ((r.info.flags & ActivityInfo.FLAG_MULTIPROCESS) == 0 || !"String_Node_Str".equals(r.info.packageName)) {
        app.addPackage(r.info.packageName,r.info.applicationInfo.versionCode,mService.mProcessStats);
      }
      realStartActivityLocked(r,app,andResume,checkConfig);
      return;
    }
 catch (    RemoteException e) {
      Slog.w(TAG,"String_Node_Str" + r.intent.getComponent().flattenToShortString(),e);
    }
  }
  mService.startProcessLocked(r.processName,r.info.applicationInfo,true,0,"String_Node_Str",r.intent.getComponent(),false,false,true);
}

Fixed version (ground truth):
void startSpecificActivityLocked(ActivityRecord r,boolean andResume,boolean checkConfig){
  ProcessRecord app=mService.getProcessRecordLocked(r.processName,r.info.applicationInfo.uid,true);
  r.task.stack.setLaunchTime(r);
  if (app != null && app.thread != null && !app.killedByAm) {
    try {
      if ((r.info.flags & ActivityInfo.FLAG_MULTIPROCESS) == 0 || !"String_Node_Str".equals(r.info.packageName)) {
        app.addPackage(r.info.packageName,r.info.applicationInfo.versionCode,mService.mProcessStats);
      }
      realStartActivityLocked(r,app,andResume,checkConfig);
      return;
    }
 catch (    RemoteException e) {
      Slog.w(TAG,"String_Node_Str" + r.intent.getComponent().flattenToShortString(),e);
    }
  }
  mService.startProcessLocked(r.processName,r.info.applicationInfo,true,0,"String_Node_Str",r.intent.getComponent(),false,false,true);
}
Program: 198492
Project: 198492
Buggy source:
private void startActivateAnimation(boolean reverse){
  int widthHalf=mBackgroundNormal.getWidth() / 2;
  int heightHalf=mBackgroundNormal.getActualHeight() / 2;
  float radius=(float)Math.sqrt(widthHalf * widthHalf + heightHalf * heightHalf);
  Animator animator=ViewAnimationUtils.createCircularReveal(mBackgroundNormal,widthHalf,heightHalf,0,radius);
  mBackgroundNormal.setVisibility(View.VISIBLE);
  Interpolator interpolator;
  Interpolator alphaInterpolator;
  if (!reverse) {
    interpolator=mLinearOutSlowInInterpolator;
    alphaInterpolator=mLinearOutSlowInInterpolator;
  }
 else {
    interpolator=ACTIVATE_INVERSE_INTERPOLATOR;
    alphaInterpolator=ACTIVATE_INVERSE_ALPHA_INTERPOLATOR;
  }
  animator.setInterpolator(interpolator);
  animator.setDuration(ACTIVATE_ANIMATION_LENGTH);
  if (reverse) {
    mBackgroundNormal.setAlpha(1f);
    animator.addListener(new AnimatorListenerAdapter(){
      @Override public void onAnimationEnd(      Animator animation){
        mBackgroundNormal.setVisibility(View.INVISIBLE);
      }
    }
);
    animator.reverse();
  }
 else {
    mBackgroundNormal.setAlpha(0.4f);
    animator.start();
  }
  mBackgroundNormal.animate().alpha(reverse ? 0f : 1f).setInterpolator(alphaInterpolator).setDuration(ACTIVATE_ANIMATION_LENGTH);
}

Fixed version (ground truth):
private void startActivateAnimation(boolean reverse){
  int widthHalf=mBackgroundNormal.getWidth() / 2;
  int heightHalf=mBackgroundNormal.getActualHeight() / 2;
  float radius=(float)Math.sqrt(widthHalf * widthHalf + heightHalf * heightHalf);
  Animator animator=ViewAnimationUtils.createCircularReveal(mBackgroundNormal,widthHalf,heightHalf,0,radius);
  mBackgroundNormal.setVisibility(View.VISIBLE);
  Interpolator interpolator;
  Interpolator alphaInterpolator;
  if (!reverse) {
    interpolator=mLinearOutSlowInInterpolator;
    alphaInterpolator=mLinearOutSlowInInterpolator;
  }
 else {
    interpolator=ACTIVATE_INVERSE_INTERPOLATOR;
    alphaInterpolator=ACTIVATE_INVERSE_ALPHA_INTERPOLATOR;
  }
  animator.setInterpolator(interpolator);
  animator.setDuration(ACTIVATE_ANIMATION_LENGTH);
  if (reverse) {
    mBackgroundNormal.setAlpha(1f);
    animator.addListener(new AnimatorListenerAdapter(){
      @Override public void onAnimationEnd(      Animator animation){
        if (mDimmed) {
          mBackgroundNormal.setVisibility(View.INVISIBLE);
        }
      }
    }
);
    animator.reverse();
  }
 else {
    mBackgroundNormal.setAlpha(0.4f);
    animator.start();
  }
  mBackgroundNormal.animate().alpha(reverse ? 0f : 1f).setInterpolator(alphaInterpolator).setDuration(ACTIVATE_ANIMATION_LENGTH);
}
Program: 198493
Project: 198493
Buggy source:
private void startActivateAnimation(boolean reverse){
  int widthHalf=mBackgroundNormal.getWidth() / 2;
  int heightHalf=mBackgroundNormal.getActualHeight() / 2;
  float radius=(float)Math.sqrt(widthHalf * widthHalf + heightHalf * heightHalf);
  Animator animator=ViewAnimationUtils.createCircularReveal(mBackgroundNormal,widthHalf,heightHalf,0,radius);
  mBackgroundNormal.setVisibility(View.VISIBLE);
  Interpolator interpolator;
  Interpolator alphaInterpolator;
  if (!reverse) {
    interpolator=mLinearOutSlowInInterpolator;
    alphaInterpolator=mLinearOutSlowInInterpolator;
  }
 else {
    interpolator=ACTIVATE_INVERSE_INTERPOLATOR;
    alphaInterpolator=ACTIVATE_INVERSE_ALPHA_INTERPOLATOR;
  }
  animator.setInterpolator(interpolator);
  animator.setDuration(ACTIVATE_ANIMATION_LENGTH);
  if (reverse) {
    mBackgroundNormal.setAlpha(1f);
    animator.addListener(new AnimatorListenerAdapter(){
      @Override public void onAnimationEnd(      Animator animation){
        mBackgroundNormal.setVisibility(View.INVISIBLE);
      }
    }
);
    animator.reverse();
  }
 else {
    mBackgroundNormal.setAlpha(0.4f);
    animator.start();
  }
  mBackgroundNormal.animate().alpha(reverse ? 0f : 1f).setInterpolator(alphaInterpolator).setDuration(ACTIVATE_ANIMATION_LENGTH);
}

Fixed version (ground truth):
private void startActivateAnimation(boolean reverse){
  int widthHalf=mBackgroundNormal.getWidth() / 2;
  int heightHalf=mBackgroundNormal.getActualHeight() / 2;
  float radius=(float)Math.sqrt(widthHalf * widthHalf + heightHalf * heightHalf);
  Animator animator=ViewAnimationUtils.createCircularReveal(mBackgroundNormal,widthHalf,heightHalf,0,radius);
  mBackgroundNormal.setVisibility(View.VISIBLE);
  Interpolator interpolator;
  Interpolator alphaInterpolator;
  if (!reverse) {
    interpolator=mLinearOutSlowInInterpolator;
    alphaInterpolator=mLinearOutSlowInInterpolator;
  }
 else {
    interpolator=ACTIVATE_INVERSE_INTERPOLATOR;
    alphaInterpolator=ACTIVATE_INVERSE_ALPHA_INTERPOLATOR;
  }
  animator.setInterpolator(interpolator);
  animator.setDuration(ACTIVATE_ANIMATION_LENGTH);
  if (reverse) {
    mBackgroundNormal.setAlpha(1f);
    animator.addListener(new AnimatorListenerAdapter(){
      @Override public void onAnimationEnd(      Animator animation){
        if (mDimmed) {
          mBackgroundNormal.setVisibility(View.INVISIBLE);
        }
      }
    }
);
    animator.reverse();
  }
 else {
    mBackgroundNormal.setAlpha(0.4f);
    animator.start();
  }
  mBackgroundNormal.animate().alpha(reverse ? 0f : 1f).setInterpolator(alphaInterpolator).setDuration(ACTIVATE_ANIMATION_LENGTH);
}
Program: 198495
Project: 198495
Buggy source:
void startSpecificActivityLocked(ActivityRecord r,boolean andResume,boolean checkConfig){
  ProcessRecord app=mService.getProcessRecordLocked(r.processName,r.info.applicationInfo.uid,true);
  r.task.stack.setLaunchTime(r);
  if (app != null && app.thread != null) {
    try {
      if ((r.info.flags & ActivityInfo.FLAG_MULTIPROCESS) == 0 || !"String_Node_Str".equals(r.info.packageName)) {
        app.addPackage(r.info.packageName,r.info.applicationInfo.versionCode,mService.mProcessStats);
      }
      realStartActivityLocked(r,app,andResume,checkConfig);
      return;
    }
 catch (    RemoteException e) {
      Slog.w(TAG,"String_Node_Str" + r.intent.getComponent().flattenToShortString(),e);
    }
  }
  mService.startProcessLocked(r.processName,r.info.applicationInfo,true,0,"String_Node_Str",r.intent.getComponent(),false,false,true);
}

Fixed version (ground truth):
void startSpecificActivityLocked(ActivityRecord r,boolean andResume,boolean checkConfig){
  ProcessRecord app=mService.getProcessRecordLocked(r.processName,r.info.applicationInfo.uid,true);
  r.task.stack.setLaunchTime(r);
  if (app != null && app.thread != null && !app.killedByAm) {
    try {
      if ((r.info.flags & ActivityInfo.FLAG_MULTIPROCESS) == 0 || !"String_Node_Str".equals(r.info.packageName)) {
        app.addPackage(r.info.packageName,r.info.applicationInfo.versionCode,mService.mProcessStats);
      }
      realStartActivityLocked(r,app,andResume,checkConfig);
      return;
    }
 catch (    RemoteException e) {
      Slog.w(TAG,"String_Node_Str" + r.intent.getComponent().flattenToShortString(),e);
    }
  }
  mService.startProcessLocked(r.processName,r.info.applicationInfo,true,0,"String_Node_Str",r.intent.getComponent(),false,false,true);
}
Program: 198498
Project: 198498
Buggy source:
@ServiceThreadOnly void doManualPortSwitching(int portId,IHdmiControlCallback callback){
  assertRunOnServiceThread();
  if (!mService.isValidPortId(portId)) {
    invokeCallback(callback,HdmiControlManager.RESULT_INCORRECT_MODE);
    return;
  }
  if (portId == getActivePortId()) {
    invokeCallback(callback,HdmiControlManager.RESULT_SUCCESS);
    return;
  }
  mActiveSource.invalidate();
  if (!mService.isControlEnabled()) {
    setActivePortId(portId);
    invokeCallback(callback,HdmiControlManager.RESULT_INCORRECT_MODE);
    return;
  }
  int oldPath=mService.portIdToPath(getActivePortId());
  int newPath=mService.portIdToPath(portId);
  HdmiCecMessage routingChange=HdmiCecMessageBuilder.buildRoutingChange(mAddress,oldPath,newPath);
  mService.sendCecCommand(routingChange);
  removeAction(RoutingControlAction.class);
  addAndStartAction(new RoutingControlAction(this,newPath,false,callback));
}

Fixed version (ground truth):
@ServiceThreadOnly void doManualPortSwitching(int portId,IHdmiControlCallback callback){
  assertRunOnServiceThread();
  if (!mService.isValidPortId(portId)) {
    invokeCallback(callback,HdmiControlManager.RESULT_INCORRECT_MODE);
    return;
  }
  if (portId == getActivePortId()) {
    invokeCallback(callback,HdmiControlManager.RESULT_SUCCESS);
    return;
  }
  mActiveSource.invalidate();
  if (!mService.isControlEnabled()) {
    setActivePortId(portId);
    invokeCallback(callback,HdmiControlManager.RESULT_INCORRECT_MODE);
    return;
  }
  int oldPath=getActivePortId() != Constants.INVALID_PORT_ID ? mService.portIdToPath(getActivePortId()) : getDeviceInfo().getPhysicalAddress();
  int newPath=mService.portIdToPath(portId);
  HdmiCecMessage routingChange=HdmiCecMessageBuilder.buildRoutingChange(mAddress,oldPath,newPath);
  mService.sendCecCommand(routingChange);
  removeAction(RoutingControlAction.class);
  addAndStartAction(new RoutingControlAction(this,newPath,false,callback));
}
Program: 198499
Project: 198499
Buggy source:
/** 
 * Sends key to a target CEC device.
 * @param keyCode key code to send. Defined in {@link android.view.KeyEvent}.
 * @param isPressed true if this is key press event
 */
@Override @ServiceThreadOnly protected void sendKeyEvent(int keyCode,boolean isPressed){
  assertRunOnServiceThread();
  List<SendKeyAction> action=getActions(SendKeyAction.class);
  if (!action.isEmpty()) {
    action.get(0).processKeyEvent(keyCode,isPressed);
  }
 else {
    if (isPressed) {
      int logicalAddress=getActiveSource().logicalAddress;
      addAndStartAction(new SendKeyAction(this,logicalAddress,keyCode));
    }
 else {
      Slog.w(TAG,"String_Node_Str");
    }
  }
}

Fixed version (ground truth):
/** 
 * Sends key to a target CEC device.
 * @param keyCode key code to send. Defined in {@link android.view.KeyEvent}.
 * @param isPressed true if this is key press event
 */
@Override @ServiceThreadOnly protected void sendKeyEvent(int keyCode,boolean isPressed){
  assertRunOnServiceThread();
  List<SendKeyAction> action=getActions(SendKeyAction.class);
  if (!action.isEmpty()) {
    action.get(0).processKeyEvent(keyCode,isPressed);
  }
 else {
    if (isPressed && getActiveSource().isValid()) {
      int logicalAddress=getActiveSource().logicalAddress;
      addAndStartAction(new SendKeyAction(this,logicalAddress,keyCode));
    }
 else {
      Slog.w(TAG,"String_Node_Str" + keyCode + "String_Node_Str"+ isPressed);
    }
  }
}
Program: 198500
Project: 198500
Buggy source:
void startSpecificActivityLocked(ActivityRecord r,boolean andResume,boolean checkConfig){
  ProcessRecord app=mService.getProcessRecordLocked(r.processName,r.info.applicationInfo.uid,true);
  r.task.stack.setLaunchTime(r);
  if (app != null && app.thread != null) {
    try {
      if ((r.info.flags & ActivityInfo.FLAG_MULTIPROCESS) == 0 || !"String_Node_Str".equals(r.info.packageName)) {
        app.addPackage(r.info.packageName,mService.mProcessStats);
      }
      realStartActivityLocked(r,app,andResume,checkConfig);
      return;
    }
 catch (    RemoteException e) {
      Slog.w(TAG,"String_Node_Str" + r.intent.getComponent().flattenToShortString(),e);
    }
  }
  mService.startProcessLocked(r.processName,r.info.applicationInfo,true,0,"String_Node_Str",r.intent.getComponent(),false,false,true);
}

Fixed version (ground truth):
void startSpecificActivityLocked(ActivityRecord r,boolean andResume,boolean checkConfig){
  ProcessRecord app=mService.getProcessRecordLocked(r.processName,r.info.applicationInfo.uid,true);
  r.task.stack.setLaunchTime(r);
  if (app != null && app.thread != null && !app.killedByAm) {
    try {
      if ((r.info.flags & ActivityInfo.FLAG_MULTIPROCESS) == 0 || !"String_Node_Str".equals(r.info.packageName)) {
        app.addPackage(r.info.packageName,mService.mProcessStats);
      }
      realStartActivityLocked(r,app,andResume,checkConfig);
      return;
    }
 catch (    RemoteException e) {
      Slog.w(TAG,"String_Node_Str" + r.intent.getComponent().flattenToShortString(),e);
    }
  }
  mService.startProcessLocked(r.processName,r.info.applicationInfo,true,0,"String_Node_Str",r.intent.getComponent(),false,false,true);
}
Program: 198501
Project: 198501
Buggy source:
@ServiceThreadOnly void doManualPortSwitching(int portId,IHdmiControlCallback callback){
  assertRunOnServiceThread();
  if (!mService.isValidPortId(portId)) {
    invokeCallback(callback,HdmiControlManager.RESULT_INCORRECT_MODE);
    return;
  }
  if (portId == getActivePortId()) {
    invokeCallback(callback,HdmiControlManager.RESULT_SUCCESS);
    return;
  }
  mActiveSource.invalidate();
  if (!mService.isControlEnabled()) {
    setActivePortId(portId);
    invokeCallback(callback,HdmiControlManager.RESULT_INCORRECT_MODE);
    return;
  }
  int oldPath=mService.portIdToPath(getActivePortId());
  int newPath=mService.portIdToPath(portId);
  HdmiCecMessage routingChange=HdmiCecMessageBuilder.buildRoutingChange(mAddress,oldPath,newPath);
  mService.sendCecCommand(routingChange);
  removeAction(RoutingControlAction.class);
  addAndStartAction(new RoutingControlAction(this,newPath,false,callback));
}

Fixed version (ground truth):
@ServiceThreadOnly void doManualPortSwitching(int portId,IHdmiControlCallback callback){
  assertRunOnServiceThread();
  if (!mService.isValidPortId(portId)) {
    invokeCallback(callback,HdmiControlManager.RESULT_INCORRECT_MODE);
    return;
  }
  if (portId == getActivePortId()) {
    invokeCallback(callback,HdmiControlManager.RESULT_SUCCESS);
    return;
  }
  mActiveSource.invalidate();
  if (!mService.isControlEnabled()) {
    setActivePortId(portId);
    invokeCallback(callback,HdmiControlManager.RESULT_INCORRECT_MODE);
    return;
  }
  int oldPath=getActivePortId() != Constants.INVALID_PORT_ID ? mService.portIdToPath(getActivePortId()) : getDeviceInfo().getPhysicalAddress();
  int newPath=mService.portIdToPath(portId);
  HdmiCecMessage routingChange=HdmiCecMessageBuilder.buildRoutingChange(mAddress,oldPath,newPath);
  mService.sendCecCommand(routingChange);
  removeAction(RoutingControlAction.class);
  addAndStartAction(new RoutingControlAction(this,newPath,false,callback));
}
Program: 198502
Project: 198502
Buggy source:
/** 
 * Sends key to a target CEC device.
 * @param keyCode key code to send. Defined in {@link android.view.KeyEvent}.
 * @param isPressed true if this is key press event
 */
@Override @ServiceThreadOnly protected void sendKeyEvent(int keyCode,boolean isPressed){
  assertRunOnServiceThread();
  List<SendKeyAction> action=getActions(SendKeyAction.class);
  if (!action.isEmpty()) {
    action.get(0).processKeyEvent(keyCode,isPressed);
  }
 else {
    if (isPressed) {
      int logicalAddress=getActiveSource().logicalAddress;
      addAndStartAction(new SendKeyAction(this,logicalAddress,keyCode));
    }
 else {
      Slog.w(TAG,"String_Node_Str");
    }
  }
}

Fixed version (ground truth):
/** 
 * Sends key to a target CEC device.
 * @param keyCode key code to send. Defined in {@link android.view.KeyEvent}.
 * @param isPressed true if this is key press event
 */
@Override @ServiceThreadOnly protected void sendKeyEvent(int keyCode,boolean isPressed){
  assertRunOnServiceThread();
  List<SendKeyAction> action=getActions(SendKeyAction.class);
  if (!action.isEmpty()) {
    action.get(0).processKeyEvent(keyCode,isPressed);
  }
 else {
    if (isPressed && getActiveSource().isValid()) {
      int logicalAddress=getActiveSource().logicalAddress;
      addAndStartAction(new SendKeyAction(this,logicalAddress,keyCode));
    }
 else {
      Slog.w(TAG,"String_Node_Str" + keyCode + "String_Node_Str"+ isPressed);
    }
  }
}