代码路径: frameworks/base/servicesjava/com/android/server/SystemServer.java 1、SystemServer.java文件中的main方法是在通过zygote中调用该方法
public static void main(String[] args) {
new SystemServer().run();
}
2、在SystemServer.java文件中.run()方法中调用startOtherServices()
private void run() {
try {
traceBeginAndSlog("StartServices");
startBootstrapServices();
startCoreServices();
startOtherServices();
SystemServerInitThreadPool.shutdown();
} catch (Throwable ex) {
Slog.e("System", "******************************************");
Slog.e("System", "************ Failure starting system services", ex);
throw ex;
} finally {
traceEnd();
}
}
3、在SystemServer.java文件中startSystemUi()方法就是拉起SystemUI中SystemUIService服务
private void startOtherServices() {
traceBeginAndSlog("StartSystemUI");
try {
startSystemUi(context, windowManagerF);
} catch (Throwable e) {
reportWtf("starting System UI", e);
}
traceEnd();
}
private static void startSystemUi(Context context, WindowManagerService windowManager) {
Intent intent = new Intent();
intent.setComponent(new ComponentName("com.android.systemui",
"com.android.systemui.SystemUIService"));
intent.addFlags(Intent.FLAG_DEBUG_TRIAGED_MISSING);
context.startServiceAsUser(intent, UserHandle.SYSTEM);
windowManager.onSystemUiStarted();
}
|