SystemServer中启动DMS后,并保留了DMS对象引用,因此除了执行正常启动方法之外,还进行了以下操作:
// frameworks/base/services/java/com/android/server/SystemServer.java
private void startBootstrapServices() {
…
mDisplayManagerService.setupSchedulerPolicies();
}
private void startOtherServices() {
…
mDisplayManagerService.windowManagerAndInputReady();
mDisplayManagerService.systemReady(safeMode, mOnlyCore);
}
下面依次看这些方法。
2.1.执行DisplayManagerService()
启动过程中,首先会执行其构造方法:
@VisibleForTesting
DisplayManagerService(Context context, Injector injector) {
super(context);
mInjector = injector;
mContext = context;
// android.display线程handler
mHandler = new DisplayManagerHandler(DisplayThread.get().getLooper());
// android.ui线程Handler
mUiHandler = UiThread.getHandler()