Program: 195600
Project: 195600
Buggy source:
private final void startProcessLocked(ProcessRecord app,String hostingType,String hostingNameStr,String abiOverride,String entryPoint,String[] entryPointArgs){
  long startTime=SystemClock.elapsedRealtime();
  if (app.pid > 0 && app.pid != MY_PID) {
    checkTime(startTime,"String_Node_Str");
synchronized (mPidsSelfLocked) {
      mPidsSelfLocked.remove(app.pid);
      mHandler.removeMessages(PROC_START_TIMEOUT_MSG,app);
    }
    checkTime(startTime,"String_Node_Str");
    app.setPid(0);
  }
  if (DEBUG_PROCESSES && mProcessesOnHold.contains(app))   Slog.v(TAG,"String_Node_Str" + app);
  mProcessesOnHold.remove(app);
  checkTime(startTime,"String_Node_Str");
  updateCpuStats();
  checkTime(startTime,"String_Node_Str");
  try {
    int uid=app.uid;
    int[] gids=null;
    int mountExternal=Zygote.MOUNT_EXTERNAL_NONE;
    if (!app.isolated) {
      int[] permGids=null;
      try {
        checkTime(startTime,"String_Node_Str");
        final PackageManager pm=mContext.getPackageManager();
        permGids=pm.getPackageGids(app.info.packageName);
        if (Environment.isExternalStorageEmulated()) {
          checkTime(startTime,"String_Node_Str");
          if (pm.checkPermission(android.Manifest.permission.ACCESS_ALL_EXTERNAL_STORAGE,app.info.packageName) == PERMISSION_GRANTED) {
            mountExternal=Zygote.MOUNT_EXTERNAL_MULTIUSER_ALL;
          }
 else {
            mountExternal=Zygote.MOUNT_EXTERNAL_MULTIUSER;
          }
        }
      }
 catch (      PackageManager.NameNotFoundException e) {
        Slog.w(TAG,"String_Node_Str",e);
      }
      if (permGids == null) {
        gids=new int[2];
      }
 else {
        gids=new int[permGids.length + 2];
        System.arraycopy(permGids,0,gids,2,permGids.length);
      }
      gids[0]=UserHandle.getSharedAppGid(UserHandle.getAppId(uid));
      gids[1]=UserHandle.getUserGid(UserHandle.getUserId(uid));
    }
    checkTime(startTime,"String_Node_Str");
    if (mFactoryTest != FactoryTest.FACTORY_TEST_OFF) {
      if (mFactoryTest == FactoryTest.FACTORY_TEST_LOW_LEVEL && mTopComponent != null && app.processName.equals(mTopComponent.getPackageName())) {
        uid=0;
      }
      if (mFactoryTest == FactoryTest.FACTORY_TEST_HIGH_LEVEL && (app.info.flags & ApplicationInfo.FLAG_FACTORY_TEST) != 0) {
        uid=0;
      }
    }
    int debugFlags=0;
    if ((app.info.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) {
      debugFlags|=Zygote.DEBUG_ENABLE_DEBUGGER;
      debugFlags|=Zygote.DEBUG_ENABLE_CHECKJNI;
    }
    if ((app.info.flags & ApplicationInfo.FLAG_VM_SAFE_MODE) != 0 || mSafeMode == true) {
      debugFlags|=Zygote.DEBUG_ENABLE_SAFEMODE;
    }
    if ("String_Node_Str".equals(SystemProperties.get("String_Node_Str"))) {
      debugFlags|=Zygote.DEBUG_ENABLE_CHECKJNI;
    }
    if ("String_Node_Str".equals(SystemProperties.get("String_Node_Str"))) {
      debugFlags|=Zygote.DEBUG_ENABLE_JNI_LOGGING;
    }
    if ("String_Node_Str".equals(SystemProperties.get("String_Node_Str"))) {
      debugFlags|=Zygote.DEBUG_ENABLE_ASSERT;
    }
    String requiredAbi=(abiOverride != null) ? abiOverride : app.info.primaryCpuAbi;
    if (requiredAbi == null) {
      requiredAbi=Build.SUPPORTED_ABIS[0];
    }
    String instructionSet=null;
    if (app.info.primaryCpuAbi != null) {
      instructionSet=VMRuntime.getInstructionSet(app.info.primaryCpuAbi);
    }
    boolean isActivityProcess=(entryPoint == null);
    if (entryPoint == null)     entryPoint="String_Node_Str";
    checkTime(startTime,"String_Node_Str");
    Process.ProcessStartResult startResult=Process.start(entryPoint,app.processName,uid,uid,gids,debugFlags,mountExternal,app.info.targetSdkVersion,app.info.seinfo,requiredAbi,instructionSet,app.info.dataDir,entryPointArgs);
    checkTime(startTime,"String_Node_Str");
    if (app.isolated) {
      mBatteryStatsService.addIsolatedUid(app.uid,app.info.uid);
    }
    mBatteryStatsService.noteProcessStart(app.processName,app.info.uid);
    checkTime(startTime,"String_Node_Str");
    EventLog.writeEvent(EventLogTags.AM_PROC_START,UserHandle.getUserId(uid),startResult.pid,uid,app.processName,hostingType,hostingNameStr != null ? hostingNameStr : "String_Node_Str");
    if (app.persistent) {
      Watchdog.getInstance().processStarted(app.processName,startResult.pid);
    }
    checkTime(startTime,"String_Node_Str");
    StringBuilder buf=mStringBuilder;
    buf.setLength(0);
    buf.append("String_Node_Str");
    buf.append(app.processName);
    if (!isActivityProcess) {
      buf.append("String_Node_Str");
      buf.append(entryPoint);
      buf.append("String_Node_Str");
    }
    buf.append("String_Node_Str");
    buf.append(hostingType);
    if (hostingNameStr != null) {
      buf.append("String_Node_Str");
      buf.append(hostingNameStr);
    }
    buf.append("String_Node_Str");
    buf.append(startResult.pid);
    buf.append("String_Node_Str");
    buf.append(uid);
    buf.append("String_Node_Str");
    if (gids != null) {
      for (int gi=0; gi < gids.length; gi++) {
        if (gi != 0)         buf.append("String_Node_Str");
        buf.append(gids[gi]);
      }
    }
    buf.append("String_Node_Str");
    if (requiredAbi != null) {
      buf.append("String_Node_Str");
      buf.append(requiredAbi);
    }
    Slog.i(TAG,buf.toString());
    app.setPid(startResult.pid);
    app.usingWrapper=startResult.usingWrapper;
    app.removed=false;
    app.killed=false;
    app.killedByAm=false;
    checkTime(startTime,"String_Node_Str");
synchronized (mPidsSelfLocked) {
      this.mPidsSelfLocked.put(startResult.pid,app);
      if (isActivityProcess) {
        Message msg=mHandler.obtainMessage(PROC_START_TIMEOUT_MSG);
        msg.obj=app;
        mHandler.sendMessageDelayed(msg,startResult.usingWrapper ? PROC_START_TIMEOUT_WITH_WRAPPER : PROC_START_TIMEOUT);
      }
    }
    checkTime(startTime,"String_Node_Str");
  }
 catch (  RuntimeException e) {
    app.setPid(0);
    mBatteryStatsService.noteProcessFinish(app.processName,app.info.uid);
    if (app.isolated) {
      mBatteryStatsService.removeIsolatedUid(app.uid,app.info.uid);
    }
    Slog.e(TAG,"String_Node_Str" + app.processName,e);
  }
}

Fixed version (ground truth):
private final void startProcessLocked(ProcessRecord app,String hostingType,String hostingNameStr,String abiOverride,String entryPoint,String[] entryPointArgs){
  long startTime=SystemClock.elapsedRealtime();
  if (app.pid > 0 && app.pid != MY_PID) {
    checkTime(startTime,"String_Node_Str");
synchronized (mPidsSelfLocked) {
      mPidsSelfLocked.remove(app.pid);
      mHandler.removeMessages(PROC_START_TIMEOUT_MSG,app);
    }
    checkTime(startTime,"String_Node_Str");
    app.setPid(0);
  }
  if (DEBUG_PROCESSES && mProcessesOnHold.contains(app))   Slog.v(TAG,"String_Node_Str" + app);
  mProcessesOnHold.remove(app);
  checkTime(startTime,"String_Node_Str");
  updateCpuStats();
  checkTime(startTime,"String_Node_Str");
  try {
    int uid=app.uid;
    int[] gids=null;
    int mountExternal=Zygote.MOUNT_EXTERNAL_NONE;
    if (!app.isolated) {
      int[] permGids=null;
      try {
        checkTime(startTime,"String_Node_Str");
        final PackageManager pm=mContext.getPackageManager();
        permGids=pm.getPackageGids(app.info.packageName);
        if (Environment.isExternalStorageEmulated()) {
          checkTime(startTime,"String_Node_Str");
          if (pm.checkPermission(android.Manifest.permission.ACCESS_ALL_EXTERNAL_STORAGE,app.info.packageName) == PERMISSION_GRANTED) {
            mountExternal=Zygote.MOUNT_EXTERNAL_MULTIUSER_ALL;
          }
 else {
            mountExternal=Zygote.MOUNT_EXTERNAL_MULTIUSER;
          }
        }
      }
 catch (      PackageManager.NameNotFoundException e) {
        Slog.w(TAG,"String_Node_Str",e);
      }
      if (permGids == null) {
        gids=new int[2];
      }
 else {
        gids=new int[permGids.length + 2];
        System.arraycopy(permGids,0,gids,2,permGids.length);
      }
      gids[0]=UserHandle.getSharedAppGid(UserHandle.getAppId(uid));
      gids[1]=UserHandle.getUserGid(UserHandle.getUserId(uid));
    }
    checkTime(startTime,"String_Node_Str");
    if (mFactoryTest != FactoryTest.FACTORY_TEST_OFF) {
      if (mFactoryTest == FactoryTest.FACTORY_TEST_LOW_LEVEL && mTopComponent != null && app.processName.equals(mTopComponent.getPackageName())) {
        uid=0;
      }
      if (mFactoryTest == FactoryTest.FACTORY_TEST_HIGH_LEVEL && (app.info.flags & ApplicationInfo.FLAG_FACTORY_TEST) != 0) {
        uid=0;
      }
    }
    int debugFlags=0;
    if ((app.info.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) {
      debugFlags|=Zygote.DEBUG_ENABLE_DEBUGGER;
      debugFlags|=Zygote.DEBUG_ENABLE_CHECKJNI;
    }
    if ((app.info.flags & ApplicationInfo.FLAG_VM_SAFE_MODE) != 0 || mSafeMode == true) {
      debugFlags|=Zygote.DEBUG_ENABLE_SAFEMODE;
    }
    if ("String_Node_Str".equals(SystemProperties.get("String_Node_Str"))) {
      debugFlags|=Zygote.DEBUG_ENABLE_CHECKJNI;
    }
    if ("String_Node_Str".equals(SystemProperties.get("String_Node_Str"))) {
      debugFlags|=Zygote.DEBUG_ENABLE_JNI_LOGGING;
    }
    if ("String_Node_Str".equals(SystemProperties.get("String_Node_Str"))) {
      debugFlags|=Zygote.DEBUG_ENABLE_ASSERT;
    }
    String requiredAbi=(abiOverride != null) ? abiOverride : app.info.primaryCpuAbi;
    if (requiredAbi == null) {
      requiredAbi=Build.SUPPORTED_ABIS[0];
    }
    String instructionSet=null;
    if (app.info.primaryCpuAbi != null) {
      instructionSet=VMRuntime.getInstructionSet(app.info.primaryCpuAbi);
    }
    app.gids=gids;
    app.requiredAbi=requiredAbi;
    app.instructionSet=instructionSet;
    boolean isActivityProcess=(entryPoint == null);
    if (entryPoint == null)     entryPoint="String_Node_Str";
    checkTime(startTime,"String_Node_Str");
    Process.ProcessStartResult startResult=Process.start(entryPoint,app.processName,uid,uid,gids,debugFlags,mountExternal,app.info.targetSdkVersion,app.info.seinfo,requiredAbi,instructionSet,app.info.dataDir,entryPointArgs);
    checkTime(startTime,"String_Node_Str");
    if (app.isolated) {
      mBatteryStatsService.addIsolatedUid(app.uid,app.info.uid);
    }
    mBatteryStatsService.noteProcessStart(app.processName,app.info.uid);
    checkTime(startTime,"String_Node_Str");
    EventLog.writeEvent(EventLogTags.AM_PROC_START,UserHandle.getUserId(uid),startResult.pid,uid,app.processName,hostingType,hostingNameStr != null ? hostingNameStr : "String_Node_Str");
    if (app.persistent) {
      Watchdog.getInstance().processStarted(app.processName,startResult.pid);
    }
    checkTime(startTime,"String_Node_Str");
    StringBuilder buf=mStringBuilder;
    buf.setLength(0);
    buf.append("String_Node_Str");
    buf.append(startResult.pid);
    buf.append(':');
    buf.append(app.processName);
    buf.append('/');
    UserHandle.formatUid(buf,uid);
    if (!isActivityProcess) {
      buf.append("String_Node_Str");
      buf.append(entryPoint);
      buf.append("String_Node_Str");
    }
    buf.append("String_Node_Str");
    buf.append(hostingType);
    if (hostingNameStr != null) {
      buf.append("String_Node_Str");
      buf.append(hostingNameStr);
    }
    Slog.i(TAG,buf.toString());
    app.setPid(startResult.pid);
    app.usingWrapper=startResult.usingWrapper;
    app.removed=false;
    app.killed=false;
    app.killedByAm=false;
    checkTime(startTime,"String_Node_Str");
synchronized (mPidsSelfLocked) {
      this.mPidsSelfLocked.put(startResult.pid,app);
      if (isActivityProcess) {
        Message msg=mHandler.obtainMessage(PROC_START_TIMEOUT_MSG);
        msg.obj=app;
        mHandler.sendMessageDelayed(msg,startResult.usingWrapper ? PROC_START_TIMEOUT_WITH_WRAPPER : PROC_START_TIMEOUT);
      }
    }
    checkTime(startTime,"String_Node_Str");
  }
 catch (  RuntimeException e) {
    app.setPid(0);
    mBatteryStatsService.noteProcessFinish(app.processName,app.info.uid);
    if (app.isolated) {
      mBatteryStatsService.removeIsolatedUid(app.uid,app.info.uid);
    }
    Slog.e(TAG,"String_Node_Str" + app.processName,e);
  }
}