现在的网站开发方式,wordpress 弹出登录页,网站定做公司,海外网站有哪些用来记录学习wms#xff0c;后续会一点一点更新。。。。。。 代码#xff1a;android14
WMS是在SystemServer进程中启动的
在SystemServer中的main方法中#xff0c;调用run方法。
private void run() {
// Initialize native services.初始化服务#xff0c;加载andro…用来记录学习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 SupplierSurfaceControl.Transaction transactionFactory,
1141 FunctionSurfaceSession, 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处理。