I have a question involving the Android framework.
Every boot sequence shown on the Internet or in books shows the flow starting from zygote to dalvik as follows.
However, according to my code research, init processor runs app_process(app_main.cpp)
before loading zygote like this :
[init.rc] :
service zygote **/system/bin/app_process** -Xzygote /system/bin --zygote --start-system-server
Because zygote(ZygoteInit.java)
is java file(a kind of class), it needs the dalvik virtual machine to be executed so app_process(app_main.cpp)
initializes dalvik machine and makes it ready for start.
And then loads ZygoteInit.java
via dalvik.
Thus, zygote actually run.
It seems to me that the process which initializes and loads dalvik is not zygote but app_process and zygote is under dalvik because it is composed of java code.
The only thing that makes me doubt this is some code in app_main.cpp.
Watching main
function in app_main.cpp
file, you can find some lines as below :
[app_main.cpp] :
if (niceName && *niceName) {
setArgv0(argv0, niceName);
**set_process_name(niceName);**
}
niceName
is pointing to the string "zygote"
.
That means app_process
is changed to zygote process using the set_process_name()
function. If it is true, everything is OK. But I don't know what the fact is.
Anyone make me sure of what is first.
Try to browse android code in :