Android應(yīng)用程序進(jìn)程啟動(dòng)過程的源代碼分析(七)
從peers.get(index)得到的是一個(gè)ZygoteConnection對(duì)象,表示一個(gè)Socket連接,接下來就是調(diào)用ZygoteConnection.runOnce函數(shù)進(jìn)一步處理了。
上文調(diào)用了handleChildProc函數(shù)。
Step 7. ZygoteConnection.handleChildProc
這個(gè)函數(shù)定義在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"參數(shù),表示要為新創(chuàng)建的進(jìn)程初始化運(yùn)行時(shí)庫,因此,這里的parseArgs.runtimeInit值為true,于是就繼續(xù)執(zhí)行RuntimeInit.zygoteInit進(jìn)一步處理了。