startActivity流程分析

 分类:Android, Java 阅读 (1,047)  Add comments
2月 212017
 

首先调用Activity.java中的startActivity

调用了另外一startActivity函数,增加了options参数,为避免过于复杂,我们使用options为null

实际上又调用到了startActivityForResult函数

同样,带options参数的startActivityForResult

我们这里假设mParent为null

然后调用Instrumentation的executeStartActivity

然后调用ActivityManagerService里的startActivity和startActivityAsUser

mStackSupervisor.startActivityMayWait函数

mStackSupervisor.startActivityLocked函数

调用函数mStackSupervisor.startActivityUncheckedLocked

调用函数ActiviyManagerService.checkGrantUriPermissionFromIntentLocked

调用函数ActivityStack.startActivityLocked

调用WindowManagerService.prepareAppTransition

调用函数ActivityStack.resumeTopActivityLocked

调用函数ActivityStack.startPausingLocked 开始pause当前Activity

调用函数ActivityManagerService.updateUsageStats 更新电池电量统计

调用函数mStackSupervisor.setFocusedStack

调用WindowManagerService.findFocusedWindowLocked 

调用函数WindowManagerService.updateFocusedWindowLocked

调用函数:mStackSupervisor.allPausedActivitiesComplete

打赏
 Posted by on 2017-02-21