Android 8.0 Activity启动流程

1.com.android.launcher3.
1.1luncher.java ------startActivitySafely()方法调用

2.frameworks/base/core/java/android/app/
2.1 Activity.java ------ startActivityForResult(@RequiresPermission Intent intent, int
requestCode, @Nullable Bundle options)
2.2Instrumentation.java ----execStartActivity();

2.2.1 ActivityManager.getService()
通过ServiceManager管理ActivityManagerService
ServiceManager.getService(Context.ACTIVITY_SERVICE)
获取到ActivityManager
IActivityManager am = IActivityManager.Stub.asInterface(b)

2.2.2 ActivityManagerService.startActivty() -->startActivityAsUser()

2.2.3 ActivityManagerService.startActivityAsUser()

2.2.4 ActivityStarter.startActivityMayWait()

2.2.5 ActivityStarter.startActivityLocked()--ActivityStarter.startActivity() -->startActivityUnChecked()

2.3 ActivityStackSupervisor.java resumeFocusedStackTopActivityLocked()
-->startSpecificActivityLocked() --->realStartActivityLocked()

2.4 ActivityThread.java --->ApplicationThread.scheduleLaunchActivity()

-->ActivityThread.sendMessage()--->ActivityThread.performLaunchActivity()

2.5 Instrumentation.callActivityOnCreate()

2.6 Activity.performCreate()

你可能感兴趣的:(Android 8.0 Activity启动流程)