// line 796-797privatevoidrun(){TimingsTraceAndSlogt=newTimingsTraceAndSlog();//...// line 984-994 调用 startOtherServices 方法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);CriticalEventLog.getInstance().logSystemServerStarted();}catch(Throwableex){
// line 1513-1518/** * Starts a miscellaneous grab bag of stuff that has yet to be refactored and organized. */privatevoidstartOtherServices(@NonNullTimingsTraceAndSlogt){t.traceBegin("startOtherServices");mSystemServiceManager.updateOtherServicesStartIndex();//...// line 3217-3223 调用 mActivityManagerService.systemReady// We now tell the activity manager it is okay to run third party// code. It will call back into us once it has gotten to the state// where third party code can really run (but before it has actually// started launching the initial applications), for us to complete our// initialization.mActivityManagerService.systemReady(()->{Slog.i(TAG,"Making services ready");
// line 8970-8975/** * Ready. Set. Go! */publicvoidsystemReady(finalRunnablegoingCallback,@NonNullTimingsTraceAndSlogt){t.traceBegin("PhaseActivityManagerReady");mSystemServiceManager.preSystemReady();//...// line 9129-9139 调用 mAtmInternal.startHomeOnAllDisplaysbooleanisBootingSystemUser=currentUserId==UserHandle.USER_SYSTEM;// Some systems - like automotive - will explicitly unlock system user then switch// to a secondary user.// TODO(b/266158156): this workaround shouldn't be necessary once we move// the headless-user start logic to UserManager-land.if(isBootingSystemUser&&!UserManager.isHeadlessSystemUserMode()){t.traceBegin("startHomeOnAllDisplays");mAtmInternal.startHomeOnAllDisplays(currentUserId,"systemReady");t.traceEnd();}
// line 6038finalclassLocalServiceextendsActivityTaskManagerInternal{// line 6636-6641@OverridepublicbooleanstartHomeOnAllDisplays(intuserId,Stringreason){synchronized(mGlobalLock){returnmRootWindowContainer.startHomeOnAllDisplays(userId,reason);}}