Program: 182056
Project: 182056
Buggy source:
private final int startActivityMayWait(IApplicationThread caller,Intent intent,String resolvedType,Uri[] grantedUriPermissions,int grantedMode,IBinder resultTo,String resultWho,int requestCode,boolean onlyIfNeeded,boolean debug,WaitResult outResult,Configuration config){
  if (intent != null && intent.hasFileDescriptors()) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  final boolean componentSpecified=intent.getComponent() != null;
  intent=new Intent(intent);
  ActivityInfo aInfo;
  try {
    ResolveInfo rInfo=ActivityThread.getPackageManager().resolveIntent(intent,resolvedType,PackageManager.MATCH_DEFAULT_ONLY | STOCK_PM_FLAGS);
    aInfo=rInfo != null ? rInfo.activityInfo : null;
  }
 catch (  RemoteException e) {
    aInfo=null;
  }
  if (aInfo != null) {
    intent.setComponent(new ComponentName(aInfo.applicationInfo.packageName,aInfo.name));
    if (debug) {
      if (!aInfo.processName.equals("String_Node_Str")) {
        setDebugApp(aInfo.processName,true,false);
      }
    }
  }
synchronized (this) {
    int callingPid;
    int callingUid;
    if (caller == null) {
      callingPid=Binder.getCallingPid();
      callingUid=Binder.getCallingUid();
    }
 else {
      callingPid=callingUid=-1;
    }
    mConfigWillChange=config != null && mConfiguration.diff(config) != 0;
    final long origId=Binder.clearCallingIdentity();
    int res=startActivityLocked(caller,intent,resolvedType,grantedUriPermissions,grantedMode,aInfo,resultTo,resultWho,requestCode,callingPid,callingUid,onlyIfNeeded,componentSpecified);
    if (config != null && mConfigWillChange) {
      enforceCallingPermission(android.Manifest.permission.CHANGE_CONFIGURATION,"String_Node_Str");
      updateConfigurationLocked(config,null);
    }
    Binder.restoreCallingIdentity(origId);
    if (outResult != null) {
      outResult.result=res;
      if (res == IActivityManager.START_SUCCESS) {
        mWaitingActivityLaunched.add(outResult);
        do {
          try {
            wait();
          }
 catch (          InterruptedException e) {
          }
        }
 while (!outResult.timeout && outResult.who == null);
      }
 else       if (res == IActivityManager.START_TASK_TO_FRONT) {
        HistoryRecord r=this.topRunningActivityLocked(null);
        if (r.nowVisible) {
          outResult.timeout=false;
          outResult.who=new ComponentName(r.info.packageName,r.info.name);
          outResult.totalTime=0;
          outResult.thisTime=0;
        }
 else {
          outResult.thisTime=SystemClock.uptimeMillis();
          mWaitingActivityVisible.add(outResult);
          do {
            try {
              wait();
            }
 catch (            InterruptedException e) {
            }
          }
 while (!outResult.timeout && outResult.who == null);
        }
      }
    }
    return res;
  }
}

Fixed version (ground truth):
private final int startActivityMayWait(IApplicationThread caller,Intent intent,String resolvedType,Uri[] grantedUriPermissions,int grantedMode,IBinder resultTo,String resultWho,int requestCode,boolean onlyIfNeeded,boolean debug,WaitResult outResult,Configuration config){
  if (intent != null && intent.hasFileDescriptors()) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  final boolean componentSpecified=intent.getComponent() != null;
  intent=new Intent(intent);
  ActivityInfo aInfo;
  try {
    ResolveInfo rInfo=ActivityThread.getPackageManager().resolveIntent(intent,resolvedType,PackageManager.MATCH_DEFAULT_ONLY | STOCK_PM_FLAGS);
    aInfo=rInfo != null ? rInfo.activityInfo : null;
  }
 catch (  RemoteException e) {
    aInfo=null;
  }
  if (aInfo != null) {
    intent.setComponent(new ComponentName(aInfo.applicationInfo.packageName,aInfo.name));
    if (debug) {
      if (!aInfo.processName.equals("String_Node_Str")) {
        setDebugApp(aInfo.processName,true,false);
      }
    }
  }
synchronized (this) {
    int callingPid;
    int callingUid;
    if (caller == null) {
      callingPid=Binder.getCallingPid();
      callingUid=Binder.getCallingUid();
    }
 else {
      callingPid=callingUid=-1;
    }
    mConfigWillChange=config != null && mConfiguration.diff(config) != 0;
    if (DEBUG_CONFIGURATION)     Slog.v(TAG,"String_Node_Str" + mConfigWillChange);
    final long origId=Binder.clearCallingIdentity();
    int res=startActivityLocked(caller,intent,resolvedType,grantedUriPermissions,grantedMode,aInfo,resultTo,resultWho,requestCode,callingPid,callingUid,onlyIfNeeded,componentSpecified);
    if (mConfigWillChange) {
      enforceCallingPermission(android.Manifest.permission.CHANGE_CONFIGURATION,"String_Node_Str");
      mConfigWillChange=false;
      if (DEBUG_CONFIGURATION)       Slog.v(TAG,"String_Node_Str");
      updateConfigurationLocked(config,null);
    }
    Binder.restoreCallingIdentity(origId);
    if (outResult != null) {
      outResult.result=res;
      if (res == IActivityManager.START_SUCCESS) {
        mWaitingActivityLaunched.add(outResult);
        do {
          try {
            wait();
          }
 catch (          InterruptedException e) {
          }
        }
 while (!outResult.timeout && outResult.who == null);
      }
 else       if (res == IActivityManager.START_TASK_TO_FRONT) {
        HistoryRecord r=this.topRunningActivityLocked(null);
        if (r.nowVisible) {
          outResult.timeout=false;
          outResult.who=new ComponentName(r.info.packageName,r.info.name);
          outResult.totalTime=0;
          outResult.thisTime=0;
        }
 else {
          outResult.thisTime=SystemClock.uptimeMillis();
          mWaitingActivityVisible.add(outResult);
          do {
            try {
              wait();
            }
 catch (            InterruptedException e) {
            }
          }
 while (!outResult.timeout && outResult.who == null);
        }
      }
    }
    return res;
  }
}