void scheduleAppCrashLocked(int uid, int initialPid, String packageName, String message) {
    ProcessRecord proc = null;

    // Figure out which process to kill.  We don't trust that initialPid
    // still has any relation to current pids, so must scan through the
    // list.

    synchronized (mService.mPidsSelfLocked) {
      for (int i = 0; i < mService.mPidsSelfLocked.size(); i++) {
        ProcessRecord p = mService.mPidsSelfLocked.valueAt(i);
        if (p.uid != uid) {
          continue;
        }
        if (p.pid == initialPid) {
          proc = p;
          break;
        }
        if (p.pkgList.containsKey(packageName)) {
          proc = p;
        }
      }
    }

    if (proc == null) {
      Slog.w(
          TAG,
          "crashApplication: nothing for uid="
              + uid
              + " initialPid="
              + initialPid
              + " packageName="
              + packageName);
      return;
    }

    proc.scheduleCrash(message);
  }