在SystemUIApplication创建完成后,SystemUIService的onCreate()方法会被调用,进而启动config.xml中定义的一些子模块。下面我们来看一下SystemUIService启动流程。
第零步:Zygote调用SystemServer的main方法启动SystemServer
参考:Android系统启动——5 zyogte进程(Java篇) - 简书
第一步:SystemServer的main()方法中调用SystemServer.run(),run()中调用startOtherServices()
/**
* The main entry point from zygote.
*/
public static void main(String[] args) {
new SystemServer().run();
}
private void run() {
... ...
// Start services.
try {
startBootstrapServices(t);
startCoreServices(t);
startOtherServices(t); //run()中调用了startOtherServices()
}
... ...
}
第二步:startOtherServices()中通过AMS的回调方法ready(),调用startSystemUI()
// We now tell the activity manager it is okay to run third party
// code. It will call back into us once it has gotten to the state
// where third party code can really run (but before it has actually
// started launching the initial applications), for us to complete our
// initialization.
mActivityManagerService.systemReady(() -> {
... ...
try {
startSyste

最低0.47元/天 解锁文章
971

被折叠的 条评论
为什么被折叠?



