Program: 43526
Project: 43526
Buggy source:
/** 
 * Start a new activity and wait for it to begin running before returning. In addition to being synchronous, this method as some semantic differences from the standard   {@link Context#startActivity} call: theactivity component is resolved before talking with the activity manager (its class name is specified in the Intent that this method ultimately starts), and it does not allow you to start activities that run in a different process.  In addition, if the given Intent resolves to multiple activities, instead of displaying a dialog for the user to select an activity, an exception will be thrown. <p>The function returns as soon as the activity goes idle following the call to its  {@link Activity#onCreate}.  Generally this means it has gone through the full initialization including   {@link Activity#onResume} anddrawn and displayed its initial window.
 * @param intent Description of the activity to start.
 * @see Context#startActivity
 */
public Activity startActivitySync(Intent intent){
  validateNotAppThread();
synchronized (mSync) {
    intent=new Intent(intent);
    ActivityInfo ai=intent.resolveActivityInfo(getTargetContext().getPackageManager(),0);
    if (ai == null) {
      throw new RuntimeException("String_Node_Str" + intent);
    }
    if (!ai.applicationInfo.processName.equals(getTargetContext().getPackageName())) {
      throw new RuntimeException("String_Node_Str" + ai.applicationInfo.packageName + "String_Node_Str"+ intent);
    }
    intent.setComponent(new ComponentName(ai.applicationInfo.packageName,ai.name));
    final ActivityWaiter aw=new ActivityWaiter(intent);
    if (mWaitingActivities == null) {
      mWaitingActivities=new ArrayList();
    }
    mWaitingActivities.add(aw);
    getTargetContext().startActivity(intent);
    do {
      try {
        mSync.wait();
      }
 catch (      InterruptedException e) {
      }
    }
 while (mWaitingActivities.contains(aw));
    return aw.activity;
  }
}

Fixed version (ground truth):
/** 
 * Start a new activity and wait for it to begin running before returning. In addition to being synchronous, this method as some semantic differences from the standard   {@link Context#startActivity} call: theactivity component is resolved before talking with the activity manager (its class name is specified in the Intent that this method ultimately starts), and it does not allow you to start activities that run in a different process.  In addition, if the given Intent resolves to multiple activities, instead of displaying a dialog for the user to select an activity, an exception will be thrown. <p>The function returns as soon as the activity goes idle following the call to its  {@link Activity#onCreate}.  Generally this means it has gone through the full initialization including   {@link Activity#onResume} anddrawn and displayed its initial window.
 * @param intent Description of the activity to start.
 * @see Context#startActivity
 */
public Activity startActivitySync(Intent intent){
  validateNotAppThread();
synchronized (mSync) {
    intent=new Intent(intent);
    ActivityInfo ai=intent.resolveActivityInfo(getTargetContext().getPackageManager(),0);
    if (ai == null) {
      throw new RuntimeException("String_Node_Str" + intent);
    }
    String myProc=mThread.getProcessName();
    if (!ai.processName.equals(myProc)) {
      throw new RuntimeException("String_Node_Str" + myProc + "String_Node_Str"+ ai.processName+ "String_Node_Str"+ intent);
    }
    intent.setComponent(new ComponentName(ai.applicationInfo.packageName,ai.name));
    final ActivityWaiter aw=new ActivityWaiter(intent);
    if (mWaitingActivities == null) {
      mWaitingActivities=new ArrayList();
    }
    mWaitingActivities.add(aw);
    getTargetContext().startActivity(intent);
    do {
      try {
        mSync.wait();
      }
 catch (      InterruptedException e) {
      }
    }
 while (mWaitingActivities.contains(aw));
    return aw.activity;
  }
}