parentDir = arg;
} else if (strcmp(arg, "--zygote") == 0) {
zygote = true;
niceName = "zygote";
} else if (strcmp(arg, "--start-system-server") == 0) {
startSystemServer = true;
} else if (strcmp(arg, "--application") == 0) {
application = true;
} else if (strncmp(arg, "--nice-name=", 12)) {
niceName = arg + 12;
} else {
className = arg;
break;
}
}
if (niceName && *niceName) {
setArgv0(argv0, niceName);
set_process_name(niceName);
}
runtime.mParentDir = parentDir;
if (zygote) {
// 进入到AppRuntime的start函数
runtime.start("com.android.internal.os.ZygoteInit",
startSystemServer? "start-system-server" : "");
} else if (className) {
runtime.mClassName = className;
runtime.mArgc = argc - i;
runtime.mArgv = argv + i;
runtime.start("com.android.internal.os.RuntimeInit", application ? "application" : "tool");
} else {
fprintf("stderr", "Error: no class name or --zygote supplied.n");
app_usage();
LOG_ALWAYS_FATAL("app_process: no class name or --zygote supplied");
return 10;
}
}