main()--->new SystemServer.run()
run方法:
1、矫正时间
2、启动性能分析SamplingProfilerIntegration,开机后一小时执行一次
3、设置参数:获取更多内存,确保SystemServer一直有效,定义手势属性,设置UserRequired为true,确保binder的优先执行,准备Looper
4、加载android_servers库,并初始化nativeInit()
5、检查上次是否意外关机
6、初始化SystemContext
7、初始化类SystemServiceManager(用来启动服务),并将其对象加到LocalServices中
8、启动引导服务startBootstrapServices(),包括安装器、MessageMonitorService,ActivityManagerService,PowerManagerService,DisplayManagerService,RecoveryManagerService,PackageManagerService,UserManagerService,初始化AttributeCache(维护了一个Package的弱HashMap)
启动核心服务startCoreServices(),包括LightsService,BatteryService,UsageStatsService,WebViewUpdateService
启动其他服务startOtherServices(),包括启动SystemUIService,AccountManagerService,ContentService,VibratorService,MountService(USB挂载),NetworkManagementService,NetworkStatsService,NetworkPolicyManagerService,ConnectivityService,NetworkScoreService,NsdService,WindowManagerService,BluetoothManagerService,UsbService,SerialService,NetworkTimeUpdateService,CommonTimeManagementService,InputManagerService,TelephonyRegistry,ConsumerIrService,AudioService,MmsServiceBroker,StatusBarManagerService,INotificationManager,InputMethodManagerService,WallpaperManagerService,LocationManagerService,CountryDetectorService,TextServicesManagerService,LockSettingsService,PerfMgrStateNotifier,IPerfServiceManager,AssetAtlasService,MediaRouterService等,还有很多,通过SystemServiceManager.startService启动的都是。