android display 杂谈(三)WMS
最佳答案 问答题库658位专家为你答疑解惑
用来记录学习wms,后续会一点一点更新。。。。。。
代码:android14
WMS是在SystemServer进程中启动的
在SystemServer中的main方法中,调用run方法。
private void run() {
// Initialize native services.初始化服务,加载android_servers so库
870 System.loadLibrary("android_servers");
// Create the system service manager.创建SystemServiceManager
895 mSystemServiceManager = new SystemServiceManager(mSystemContext);942 startOtherServices(t);//android14在startOtherServices中启动WindowManagerService
android14中,在startOtherServices中启动WindowManagerService
1606 wm = WindowManagerService.main(context, inputManager, !mFirstBoot,
1607 new PhoneWindowManager(), mActivityManagerService.mActivityTaskManager);
该代码执行了WMS的main方法,会在内部创建一个WMS。其中有一个参数inputManager也是在startOtherServices中创建的,如下。
1589 t.traceBegin("StartInputManagerService");
1590 inputManager = new InputManagerService(context);
总结,WMS的main方法在startOtherServices中,而startOtherServices在SystemServer的run方法中,运行在system_server线程中。
1608 ServiceManager.addService(Context.WINDOW_SERVICE, wm, /* allowIsolated= */ false,
1609 DUMP_FLAG_PRIORITY_CRITICAL | DUMP_FLAG_PROTO);
1610 ServiceManager.addService(Context.INPUT_SERVICE, inputManager,
1611 /* allowIsolated= */ false, DUMP_FLAG_PRIORITY_CRITICAL);
上述代码将WMS和IMS注册到ServerManager中。
回到上述的WindowManagerService main中。
/frameworks/base/services/core/java/com/android/server/wm/WindowManagerService.java
1137 public static WindowManagerService main(final Context context, final InputManagerService im,
1138 final boolean showBootMsgs, WindowManagerPolicy policy, ActivityTaskManagerService atm,
1139 DisplayWindowSettingsProvider displayWindowSettingsProvider,
1140 Supplier<SurfaceControl.Transaction> transactionFactory,
1141 Function<SurfaceSession, SurfaceControl.Builder> surfaceControlFactory) {
1142 final WindowManagerService[] wms = new WindowManagerService[1];
1143 DisplayThread.getHandler().runWithScissors(() ->
1144 wms[0] = new WindowManagerService(context, im, showBootMsgs, policy, atm,
1145 displayWindowSettingsProvider, transactionFactory,
1146 surfaceControlFactory), 0);
1147 return wms[0];
1148 }
DisplayThread.getHandler().runWithScissors调用DisplayThread的getHandler方法,获得DisplayThread的handler实例。
可以用来处理需要低延时显示的相关操作。
这张图可以清晰的了解到,不管是applicationWindow,还是SystemWindow都是由WindowManager和WMS处理。
99%的人还看了
相似问题
- Kotlin学习——kt里的集合,Map的各种方法之String篇
- Office文件在线预览大全-Word文档在线预览的实现方法-OFD文档在线预览-WPS文件在线预览
- composer切换全局镜像源的方法
- Python通过selenium调用IE11浏览器报错解决方法
- 测试用例的设计方法(全):正交实验设计方法|功能图分析方法|场景设计方发
- Java8新特性 ----- Lambda表达式和方法引用/构造器引用详解
- C#中抽象类、抽象方法和接口暨内联临时变量的精彩表达
- ChatGLM2 大模型微调过程中遇到的一些坑及解决方法(更新中)
- 类方法,静态方法和实例方法的区别及应用场景
- 【链表的说明、方法---顺序表与链表的区别】
猜你感兴趣
版权申明
本文"android display 杂谈(三)WMS":http://eshow365.cn/6-32148-0.html 内容来自互联网,请自行判断内容的正确性。如有侵权请联系我们,立即删除!
- 上一篇: JVM字节码文件浅谈
- 下一篇: 以太网实验1.mdio接口读写实验