2 WMS服务启动流程
wms(WindowManagerService)属于一种系统服务,类似的服务为AMS,PMS,IMS等,是在SystemServer中被启动。
启动wms服务的流程如下:
2.1 Zygote启动systemserver
由结构图的得知,在ZygoteInit.java的forkSystemServer函数中启动了SyetemServer进程,代码如下:
2.2 systemserver进程启动过程
handleSystemServerProcess的代码如下:
handleSystemServerProcess的代码如下:
ZygoteInit的zygoteInit主要的工作如下:
- 调用了Native的代码,启动了线程池
- 调用了findStaticMain方法来找到systemserver的main方法
代码如下: