从peers.get(index)得到的是一个ZygoteConnection对象,表示一个Socket连接,接下来就是调用ZygoteConnection.runOnce函数进一步处理了。
上文调用了handleChildProc函数。
Step 7. ZygoteConnection.handleChildProc
这个函数定义在frameworks/base/core/java/com/android/internal/os/ZygoteConnection.java文件中:
- [java] view plaincopyclass ZygoteConnection {
- ......
- private void handleChildProc(Arguments parsedArgs,
- FileDescriptor[] descriptors, PrintStream newStderr)
- throws ZygoteInit.MethodAndArgsCaller {
- ......
- if (parsedArgs.runtimeInit) {
- RuntimeInit.zygoteInit(parsedArgs.remainingArgs);
- } else {
- ......
- }
- }
- ......
- }
由于在前面的Step 3中,指定了"--runtime-init"参数,表示要为新创建的进程初始化运行时库,因此,这里的parseArgs.runtimeInit值为true,于是就继续执行RuntimeInit.zygoteInit进一步处理了。