Initializing Native Bridge

After the state is changed to kPreInitialized, the creation of the new Android application will continue in the ForkAndSpecializeCommon function. At the end of this function, it calls a callPostForkChildHooks registered function through a global variable, gCallPostForkChildHooks. The call stack will eventually go to a ZygoteHooks_nativePostForkChild function, which is the JNI implementation of the postForkChild Java method. The postForkChild function is called by Zygote in the child process after every fork. The following table is a summary of the call stack:

Function

Class

Language

ForkAndSpecializeCommon

C++

gCallPostForkChildHooks

C++

callPostForkChildHooks

Zygote

Java

postForkChild ...

Get Android System Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.