乐趣区

关于android:AndroidActivity的工作过程

「Android」Activity 的工作过程

流程图

graph TD
android.app.Activity#startActivity
--> android.app.Activity#startActivityForResult
--> android.app.Instrumentation#execStartActivity
--> com.android.server.wm.ActivityTaskManagerService#startActivity
--> com.android.server.wm.ActivityTaskManagerService#startActivityAsUser
--> com.android.server.wm.ActivityStarter#execute
--> com.android.server.wm.ActivityStarter#executeRequest
--> com.android.server.wm.ActivityStarter#startActivityUnchecked
--> com.android.server.wm.ActivityStarter#startActivityInner
--> com.android.server.wm.RootWindowContainer#resumeFocusedStacksTopActivities
--> com.android.server.wm.ActivityStack#resumeTopActivityUncheckedLocked
--> com.android.server.wm.ActivityStack#resumeTopActivityInnerLocked
com.android.server.wm.ActivityStack#resumeTopActivityInnerLocked --> com.android.server.wm.ActivityStack#startPausingLocked
--> com.android.server.wm.ClientLifecycleManager#scheduleTransaction
com.android.server.wm.ActivityStack#resumeTopActivityInnerLocked --> com.android.server.wm.ActivityStackSupervisor#startSpecificActivity
--> com.android.server.wm.ActivityStackSupervisor#realStartActivityLocked
--> com.android.server.wm.ClientLifecycleManager#scheduleTransaction
--> android.app.servertransaction.ClientTransaction#schedule
--> android.app.ClientTransactionHandler#scheduleTransaction
--> android.app.ActivityThread#sendMessage
--> android.app.ActivityThread.H#handleMessage
--> android.app.servertransaction.TransactionExecutor#execute
android.app.servertransaction.TransactionExecutor#execute --> android.app.servertransaction.TransactionExecutor#executeCallbacks
--> android.app.servertransaction.LaunchActivityItem#execute
--> android.app.ActivityThread#handleLaunchActivity
--> android.app.ActivityThread#performLaunchActivity
--> android.app.Instrumentation#callActivityOnCreate
--> android.app.Activity#performCreate
--> android.app.Activity#onCreate
android.app.servertransaction.TransactionExecutor#execute --> android.app.servertransaction.TransactionExecutor#executeLifecycleState
--> android.app.servertransaction.PauseActivityItem#execute
--> android.app.ActivityThread#handlePauseActivity
--> android.app.ActivityThread#performPauseActivity
--> android.app.ActivityThread#performPauseActivityIfNeeded
--> android.app.Instrumentation#callActivityOnPause
--> android.app.Activity#performPause
--> android.app.Activity#onPause

参考

https://zhuanlan.zhihu.com/p/…

退出移动版