Android之framework开发 - SystemUI启动流程
本人还是初入坑的小白,目前只是做简单的记录,多谢支持
首先分享一个源码库 AospXref
本次基于Android10.0.0-r47
先找到下面路径 /frameworks/base/services/java/com/android/server/SystemServer.java
SystemUI由SystemServer启动
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();
}
}
SystemUI被放在startOtherServices();中,接着我们看向startOtherServices代码
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();
}
综上可以看到最后将com.android.systemui中的SystemUIService给启动了
|