SystemServer相关

SystemServer分析

由Zygote通过Zygote.forkSystemServer函数fork出来的。此函数是一个JNI函数,实现在dalvik_system_Zygote.c中。

1.SystemServer调用zygoteinitNative后,将与binder建立联系。

2.SystemServer调用handleSystemServerProcess完成自己的使命。

3.HandleSystemServerProcess抛出异常,最终调用SystemServer的mian函数。

4.Main函数加载libandroid_server.so并调用native的init1函数

5.Init1通过JNI调用SystemServer的init2函数

6.Init2创建ServerThread线程,用来加载service。

7.Init1函数最终加入Binder通信系统

8.WatchDog 是用来监视Server的有问题他会杀死service。

RefBase分析

    Class A:public RefBase (A继承RefBase)

    Mian函数中创建sp,wp。

原文地址:https://www.cnblogs.com/hongguang-kim/p/4884814.html