当前位置: 首页 > news >正文

Android14 SystemUI 启动流程(1)

1.从SystemServer启动

  private void run() {......// Start services.try {t.traceBegin("StartServices");startBootstrapServices(t);startCoreServices(t);startOtherServices(t);//从这里走startApexServices(t);// Only update the timeout after starting all the services so that we use// the default timeout to start system server.updateWatchdogTimeout(t);} catch (Throwable ex) {Slog.e("System", "******************************************");Slog.e("System", "************ Failure starting system services", ex);throw ex;} finally {t.traceEnd(); // StartServices}......

2.走startOtherServices()

/*** Starts a miscellaneous grab bag of stuff that has yet to be refactored and organized.*/private void startOtherServices(@NonNull TimingsTraceAndSlog t) {......t.traceBegin("StartSystemUI");try {startSystemUi(context, windowManagerF);} catch (Throwable e) {reportWtf("starting System UI", e);}......}

3.启动SystemUi

    private static void startSystemUi(Context context, WindowManagerService windowManager) {PackageManagerInternal pm = LocalServices.getService(PackageManagerInternal.class);Intent intent = new Intent();intent.setComponent(pm.getSystemUiServiceComponent());intent.addFlags(Intent.FLAG_DEBUG_TRIAGED_MISSING);//Slog.d(TAG, "Starting service: " + intent);context.startServiceAsUser(intent, UserHandle.SYSTEM);windowManager.onSystemUiStarted();}
//frameworks/base/services/core/java/com/android/server/pm/PackageManagerInternalBase.java@Override@Deprecatedpublic final ComponentName getSystemUiServiceComponent() {return ComponentName.unflattenFromString(getContext().getResources().getString(com.android.internal.R.string.config_systemUIServiceComponent));}
    <!-- SystemUi service component --><string name="config_systemUIServiceComponent" translatable="false">com.android.systemui/com.android.systemui.SystemUIService</string>

4.启动SystemUIService服务(SystemUI中)

public class SystemUIService extends Service {@Overridepublic void onCreate() {super.onCreate();// Start all of SystemUI((SystemUIApplication) getApplication()).startServicesIfNeeded();}
}
    启动实现了CoreStartable的实体类:如CentralSurfacesImpl等等,去start,去onBootCompleted/*** Makes sure that all the SystemUI services are running. If they are already running, this is a* no-op. This is needed to conditinally start all the services, as we only need to have it in* the main process.* <p>This method must only be called from the main thread.</p>*/public void startServicesIfNeeded() {final String vendorComponent = mInitializer.getVendorComponent(getResources());// Sort the startables so that we get a deterministic ordering.// TODO: make #start idempotent and require users of CoreStartable to call it.Map<Class<?>, Provider<CoreStartable>> sortedStartables = new TreeMap<>(Comparator.comparing(Class::getName));sortedStartables.putAll(mSysUIComponent.getStartables());sortedStartables.putAll(mSysUIComponent.getPerUserStartables());startServicesIfNeeded(sortedStartables, "StartServices", vendorComponent);}

http://www.mrgr.cn/news/50632.html

相关文章:

  • Ubuntu里彻底卸载UHD
  • SHA256算法学习
  • MATLAB代码解析:利用DCGAN实现图像数据的生成 全网最细DCGAN设计-训练入门
  • [供应链] 让步接收
  • 安科瑞ARB5弧光保护在船舶中压配电板中的应用-安科瑞黄安南
  • Vue3创建
  • Flutter框架学习计划
  • 一份Python自动化测试学习秘籍,请查收!
  • 真空牛肉滚揉机的优点:
  • 三勾软件/ java+springboot+vue3玖玖云电商ERP多平台源码
  • 如何将AI大模型部署到本地电脑
  • Deeppaas 3.6版本发布,推动零代码开发新纪元
  • 怎样用python获取浏览器的背景颜色?怎样用python把浏览器背景颜色设置为dark?
  • 【jQuery】jQuery基本操作(样式操作 内容操作 节点操作 属性操作 节点遍历)
  • 关于Oracle透明数据加密(TDE)的两个概念
  • RLC串联谐振
  • 多元线性回归模型
  • 光伏电站的安装方式有哪些类型
  • 国际盲人节,看华为智能眼镜2是如何为视障用户开启便捷新体验的
  • 【工具推荐】Hikvision - 一款海康威视综合漏洞利用工具,适用于漏洞挖掘、SRC漏洞挖掘、护网红队、渗透测试,支持一键获取 shell。