[CSDN]Android应用程序启动过程源代码分析

http://blog.csdn.net/luoshengyang/article/details/6689748

简要整理:

context.startActivity()
|
Activity.java.startActivity()
|
Instrumentation.java.execStartActivity()
|
{当前应用程序主线程(context)—>binder,RemountBinder}
|
-------------通过binder,流程进入activityManagerService--------------------------
|binder
ActivityManagerNative.java
|
ActivityManagerService.java.startActivityMayWait()
|
{通过packageManger获得目标Activity的package,classnane}
|
ActivityStack.java.startActivityLocked()
|
ActivityStack.java.startUncheckedLocked()
|
{检查是否需要返回(即是否startActivityForResult()?),检查task是否存在(LauncherMode==Single_instance?)}
|
{新建TaskRecord.java}
|
{检查目标activity是否已经Resumed}
|
否,将当前Resumed界面标记为pause
|
ActivyThreadNative.java.ApplicationThreadProxy.schedulePaused()
|
ActivityThread.java.schedulePauseActivity()
|
ActivityThread.java.performPauseActivity()-->Activity.onPause()
|
ActivityManagerNative.activityPause()(通知am暂停界面)
|binder
ActivityManagerService.java.activityPause()
|
ActivityStack.java.activityPause()
|
ActivityStack.java.startSpecificActivitylocked()
|
{查询进程信息}
|
AcivityManagerService.startProcessLocked()-->fork()新进程
|
ActivityThread.java.main()
|
ActivityStack.realstartActivitylocked()
|
ApplicationThreadNative.java
|
ApplicationThread.java
|
ActivityThread.java.handleLaunchActivity()
|
ActivityThread.java.performLaunchActivity()
|
Activity.onCreate()

你可能感兴趣的:(android)