SystemServer::init2 将会启动一个新的线程来启动下面的所有JAVA服务:
Core 服务:
1. Starting Power Manager(电源管理)
2. Creating Activity Manager(活动服务)
3. Starting Telephony Registry(电话注册服务)
4. Starting Package Manager(包管理器)
5. Set Activity Manager Service as System Process
6. Starting Context Manager
7. Starting System Context Providers
8. Starting Battery Service(电池服务)
9. Starting Alarm Manager(闹钟服务)
10. Starting Sensor Service
11. Starting Window Manager(启动窗口管理器)
12. Starting Bluetooth Service(蓝牙服务)
13. Starting Mount Service
其他services:
1. Starting Status Bar Service(状态服务)
2. Starting Hardware Service(硬件服务)
3. Starting NetStat Service(网络状态服务)
4. Starting Connectivity Service
5. Starting Notification Manager
6. Starting DeviceStorageMonitor Service
7. Starting Location Manager
8. Starting Search Service(查询服务)
9. Starting Clipboard Service
10. Starting Checkin Service
11. Starting Wallpaper Service
12. Starting Audio Service
13. Starting HeadsetObserver
14. Starting AdbSettingsObserver
最后SystemServer::init2 将会调用 ActivityManagerService.systemReady 通过发送
Intent.CATEGORY_HOME intent来启动第一个 activity.还有另外一种启动system server的方法是:
通过名为 system_server的程序(源代码:device/servers/system/system_main.cpp)它也是通过
调用 system_init 来启动 system services,这时候就有个问题:为什么android 有两种方式启动system services?
我的猜想是:
My guess is that directly start system_server may have synchronous problem with zygote because system_server will call JNI to start SystemServer::init2, while at that time zygote may not start JAVA VM yet. So Android uses another method. After zynote is initialized, fork a new process to start system services.
SystemServier.java分析
最新推荐文章于 2024-04-05 23:54:44 发布