defaultServiceManager()与apk

1. 启动apk后,会自动调用defaultServiceManager(), 所以显式调用defaultServiceManager()前, gDefaultServiceManager != NULL

代码位置:

frameworks/base/cmds/runtime/Main_runtime.cpp

static int run(sp<ProcessState>& proc)
{
    LOGE("run of Main_runtime.cpp E/n.");
    // Temporary hack to call startRunning() on the activity manager.
    sp<IServiceManager> sm = defaultServiceManager();

 

2. 验证:如果,写一个二进制可执行文件,放入system/bin目录下,第一次defaultServiceManager()前, gDefaultServiceManager是NULL.

你可能感兴趣的:(null)