Program: 197012
Project: 197012
Buggy source:
private void runStart() throws Exception {
  Intent intent=makeIntent(UserHandle.USER_CURRENT);
  if (mUserId == UserHandle.USER_ALL) {
    System.err.println("String_Node_Str");
    return;
  }
  String mimeType=intent.getType();
  if (mimeType == null && intent.getData() != null && "String_Node_Str".equals(intent.getData().getScheme())) {
    mimeType=mAm.getProviderMimeType(intent.getData(),mUserId);
  }
  do {
    if (mStopOption) {
      String packageName;
      if (intent.getComponent() != null) {
        packageName=intent.getComponent().getPackageName();
      }
 else {
        IPackageManager pm=IPackageManager.Stub.asInterface(ServiceManager.getService("String_Node_Str"));
        if (pm == null) {
          System.err.println("String_Node_Str");
          return;
        }
        List<ResolveInfo> activities=pm.queryIntentActivities(intent,mimeType,0,mUserId);
        if (activities == null || activities.size() <= 0) {
          System.err.println("String_Node_Str" + intent);
          return;
        }
 else         if (activities.size() > 1) {
          System.err.println("String_Node_Str" + intent);
          return;
        }
        packageName=activities.get(0).activityInfo.packageName;
      }
      System.out.println("String_Node_Str" + packageName);
      mAm.forceStopPackage(packageName,mUserId);
      Thread.sleep(250);
    }
    System.out.println("String_Node_Str" + intent);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    ParcelFileDescriptor fd=null;
    ProfilerInfo profilerInfo=null;
    if (mProfileFile != null) {
      try {
        fd=ParcelFileDescriptor.open(new File(mProfileFile),ParcelFileDescriptor.MODE_CREATE | ParcelFileDescriptor.MODE_TRUNCATE | ParcelFileDescriptor.MODE_READ_WRITE);
      }
 catch (      FileNotFoundException e) {
        System.err.println("String_Node_Str" + mProfileFile);
        return;
      }
      profilerInfo=new ProfilerInfo(mProfileFile,fd,mSamplingInterval,mAutoStop);
    }
    IActivityManager.WaitResult result=null;
    int res;
    if (mWaitOption) {
      result=mAm.startActivityAndWait(null,null,intent,mimeType,null,null,0,mStartFlags,profilerInfo,null,mUserId);
      res=result.result;
    }
 else {
      res=mAm.startActivityAsUser(null,null,intent,mimeType,null,null,0,mStartFlags,profilerInfo,null,mUserId);
    }
    PrintStream out=mWaitOption ? System.out : System.err;
    boolean launched=false;
switch (res) {
case ActivityManager.START_SUCCESS:
      launched=true;
    break;
case ActivityManager.START_SWITCHES_CANCELED:
  launched=true;
out.println("String_Node_Str" + "String_Node_Str");
break;
case ActivityManager.START_DELIVERED_TO_TOP:
launched=true;
out.println("String_Node_Str" + "String_Node_Str" + "String_Node_Str");
break;
case ActivityManager.START_RETURN_INTENT_TO_CALLER:
launched=true;
out.println("String_Node_Str" + "String_Node_Str");
break;
case ActivityManager.START_TASK_TO_FRONT:
launched=true;
out.println("String_Node_Str" + "String_Node_Str");
break;
case ActivityManager.START_INTENT_NOT_RESOLVED:
out.println("String_Node_Str" + "String_Node_Str" + intent.toString());
break;
case ActivityManager.START_CLASS_NOT_FOUND:
out.println(NO_CLASS_ERROR_CODE);
out.println("String_Node_Str" + intent.getComponent().toShortString() + "String_Node_Str");
break;
case ActivityManager.START_FORWARD_AND_REQUEST_CONFLICT:
out.println("String_Node_Str" + "String_Node_Str");
break;
case ActivityManager.START_PERMISSION_DENIED:
out.println("String_Node_Str" + "String_Node_Str");
break;
case ActivityManager.START_NOT_VOICE_COMPATIBLE:
out.println("String_Node_Str" + intent);
break;
default :
out.println("String_Node_Str" + res);
break;
}
if (mWaitOption && launched) {
if (result == null) {
result=new IActivityManager.WaitResult();
result.who=intent.getComponent();
}
System.out.println("String_Node_Str" + (result.timeout ? "String_Node_Str" : "String_Node_Str"));
if (result.who != null) {
System.out.println("String_Node_Str" + result.who.flattenToShortString());
}
if (result.thisTime >= 0) {
System.out.println("String_Node_Str" + result.thisTime);
}
if (result.totalTime >= 0) {
System.out.println("String_Node_Str" + result.totalTime);
}
System.out.println("String_Node_Str");
}
mRepeat--;
if (mRepeat > 1) {
mAm.unhandledBack();
}
}
 while (mRepeat > 1);
}

Fixed version (ground truth):
private void runStart() throws Exception {
  Intent intent=makeIntent(UserHandle.USER_CURRENT);
  if (mUserId == UserHandle.USER_ALL) {
    System.err.println("String_Node_Str");
    return;
  }
  String mimeType=intent.getType();
  if (mimeType == null && intent.getData() != null && "String_Node_Str".equals(intent.getData().getScheme())) {
    mimeType=mAm.getProviderMimeType(intent.getData(),mUserId);
  }
  do {
    if (mStopOption) {
      String packageName;
      if (intent.getComponent() != null) {
        packageName=intent.getComponent().getPackageName();
      }
 else {
        IPackageManager pm=IPackageManager.Stub.asInterface(ServiceManager.getService("String_Node_Str"));
        if (pm == null) {
          System.err.println("String_Node_Str");
          return;
        }
        List<ResolveInfo> activities=pm.queryIntentActivities(intent,mimeType,0,mUserId);
        if (activities == null || activities.size() <= 0) {
          System.err.println("String_Node_Str" + intent);
          return;
        }
 else         if (activities.size() > 1) {
          System.err.println("String_Node_Str" + intent);
          return;
        }
        packageName=activities.get(0).activityInfo.packageName;
      }
      System.out.println("String_Node_Str" + packageName);
      mAm.forceStopPackage(packageName,mUserId);
      Thread.sleep(250);
    }
    System.out.println("String_Node_Str" + intent);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    ParcelFileDescriptor fd=null;
    ProfilerInfo profilerInfo=null;
    if (mProfileFile != null) {
      try {
        fd=ParcelFileDescriptor.open(new File(mProfileFile),ParcelFileDescriptor.MODE_CREATE | ParcelFileDescriptor.MODE_TRUNCATE | ParcelFileDescriptor.MODE_READ_WRITE);
      }
 catch (      FileNotFoundException e) {
        System.err.println("String_Node_Str" + mProfileFile);
        return;
      }
      profilerInfo=new ProfilerInfo(mProfileFile,fd,mSamplingInterval,mAutoStop);
    }
    IActivityManager.WaitResult result=null;
    int res;
    final long startTime=SystemClock.uptimeMillis();
    if (mWaitOption) {
      result=mAm.startActivityAndWait(null,null,intent,mimeType,null,null,0,mStartFlags,profilerInfo,null,mUserId);
      res=result.result;
    }
 else {
      res=mAm.startActivityAsUser(null,null,intent,mimeType,null,null,0,mStartFlags,profilerInfo,null,mUserId);
    }
    final long endTime=SystemClock.uptimeMillis();
    PrintStream out=mWaitOption ? System.out : System.err;
    boolean launched=false;
switch (res) {
case ActivityManager.START_SUCCESS:
      launched=true;
    break;
case ActivityManager.START_SWITCHES_CANCELED:
  launched=true;
out.println("String_Node_Str" + "String_Node_Str");
break;
case ActivityManager.START_DELIVERED_TO_TOP:
launched=true;
out.println("String_Node_Str" + "String_Node_Str" + "String_Node_Str");
break;
case ActivityManager.START_RETURN_INTENT_TO_CALLER:
launched=true;
out.println("String_Node_Str" + "String_Node_Str");
break;
case ActivityManager.START_TASK_TO_FRONT:
launched=true;
out.println("String_Node_Str" + "String_Node_Str");
break;
case ActivityManager.START_INTENT_NOT_RESOLVED:
out.println("String_Node_Str" + "String_Node_Str" + intent.toString());
break;
case ActivityManager.START_CLASS_NOT_FOUND:
out.println(NO_CLASS_ERROR_CODE);
out.println("String_Node_Str" + intent.getComponent().toShortString() + "String_Node_Str");
break;
case ActivityManager.START_FORWARD_AND_REQUEST_CONFLICT:
out.println("String_Node_Str" + "String_Node_Str");
break;
case ActivityManager.START_PERMISSION_DENIED:
out.println("String_Node_Str" + "String_Node_Str");
break;
case ActivityManager.START_NOT_VOICE_COMPATIBLE:
out.println("String_Node_Str" + intent);
break;
default :
out.println("String_Node_Str" + res);
break;
}
if (mWaitOption && launched) {
if (result == null) {
result=new IActivityManager.WaitResult();
result.who=intent.getComponent();
}
System.out.println("String_Node_Str" + (result.timeout ? "String_Node_Str" : "String_Node_Str"));
if (result.who != null) {
System.out.println("String_Node_Str" + result.who.flattenToShortString());
}
if (result.thisTime >= 0) {
System.out.println("String_Node_Str" + result.thisTime);
}
if (result.totalTime >= 0) {
System.out.println("String_Node_Str" + result.totalTime);
}
System.out.println("String_Node_Str" + (endTime - startTime));
System.out.println("String_Node_Str");
}
mRepeat--;
if (mRepeat > 1) {
mAm.unhandledBack();
}
}
 while (mRepeat > 1);
}