第一阶段:
对栈的处理。
具体流程:
1.ActivityStackSupervisor.startActivityMayWait
1.resolveActivity
2.getFocusedStack
3.Deal with heavy weight process.
4.startActivityLocked(并没有真正启动,而是异步的)
5.updateConfiguration.
2.ActvityStackSupervisor.startActivityLocked
1.resultTask&resultRecord&resultWho
2.voice compatible
3.check component permission(the activity is exported? android:permission's protect level?)
4.IntentFireWall
5.ActivityController
6.new ActivityRecord
7.getFocusStack
8.check can switch? 5 seconds delay start and add to pending start activity list. if yes, the following steps will not occur.(APP_SWITCH_DELAY_TIME)
9.mDidAppSwitch = true
10.doPendingActivityLaunches
11.startActivityUncheckedLocked.
3. ActivityStackSupervisor.startActivityUncheckedLocked.
1. deal with FLAG_ACTIVITY_MULTI_TASK and so on
2.deal with singgleTask, singleInstance and singleTop lauchMode and so on3.solve intentActivity.
if( (launchFlags & Intent.FLAG_ACTIVITY_NEW_TASK) != 0 &&
(launchFlags & Intent.FLAG_ACTIVITY_MULTIPLE_TASK) == 0)
|| launchSingleInstance || launchSingleTask)
so we want to reuse exited task, so find it as intentActivity.
4.if intentActivity is getted, so addingToTask? reuseTask is getted? or
addingToTask will add the activity to the task
reuseTask is the task that should be reused.
if(!addingToTask && reuseTask == null){
just bringcurrent task to front. END
}else{
go step 5
}
5.if Intent.FLAG_ACTIVITY_NEW_TASK and not addingToTask,so create a new task if reuseTask is null, and set newTask as true to indicate the activity is a new task's root.
6.if FLAG_ACTIVITY_CLEAR_TOP or FLAG_ACTIVITY_REORDER_TO_FRONT just
deliverNewIntentLocked else setTask as sourceTask. END, else go 7
7.targetStack is founded during step 4, 5, 6
8.ActivityStack.startActivityLocked is called.
第二阶段:对Activity的处理
4. ActivityStack.startActivityLocked
1.insertTaskAtTop
2.addActivityToTop
3.ActivityStackSupervisor.resumeTopActivityLocked
5.ActivityStackSupervisor.resumeTopActivityLocked
1.ActivityStack.resumeTopActivityLocked
2.ActivityStack.resumeTopActivityInnerLocked.
3.if mResumedActivity is not null, ActivityStack.startPausingLocked else just do resume(not happen this time)
4.ActivityThread.ApplicationThread.schedulePauseActivity
5.ActivityManagerService.activityPaused
6.ActivityManagerService.activityPaused
1.ActivityStack.completePaused.
2.ActivityStackSupervisor.resumeTopActivityLocked
7.ActivityStackSupervisor.resumeTopActivityLocked
1.ActivityStack.resumeTopActivityLocked
2.ActivityStack.resumeTopActivityInnerLocked.
3.mResumedActivity is null this time, so go to 4
4.if(next.app != null && next.app.thread != null) means activity is create alreally, just call ActivityThread.ApplicationThread.scheduleResumeActivity END else go 5
5.startSpecificActivityLocked if process not exit go 6 else
call ActivityStackSupervisor.realStartAcitivityLocked END
6.->startProcess->ActivivityThread.main->ActivityThread.attach->ActivityManagerService.attachApplication
->ActivityManagerService.attachApplicationLocked->ActivityStackSupervisor.realStartAcitivityLocked
密码管理请下载:
http://a.app.qq.com/o/simple.jsp?pkgname=com.wa505.kf.epassword
相关推荐
Activity启动流程是Android系统中一个非常核心的部分,它是应用程序组件之一,负责创建和管理应用的用户界面。当我们想要启动一个新的Activity时,背后有一系列复杂的交互过程,涉及多个组件和类。本文将通过代码...
Activity启动过程
Activity启动流程源码分析,使用eclipse代码跟踪,图片详解
Activity 的启动流程是一个复杂的过程,涉及到多个组件和对象之间的交互。在本文中,我们将详细介绍 Activity 启动流程的整个过程。 ActivityThread 的创建 在 Android 系统中,ActivityThread 是一个非常重要的...
1. **Activity启动流程概述** Activity的启动流程主要涉及`ActivityManagerService`(AMS)、`ApplicationThread`(Binder代理)和`Activity`自身。首先,应用通过调用`startActivity()`方法开启这一过程,然后该...
在本主题中,我们将深入探讨如何在Activity启动过程中利用Hook技术进行拦截,以及这种技术在Android插件化开发中的应用。 首先,理解Activity的启动过程是至关重要的。在Android中,当一个Activity被启动时,系统会...
activity启动流程
Android应用程序的Activity启动过程简要介绍和学习计划
Activity 启动流程时序图原件
7. **异常处理**:学习如何处理Activity启动过程中的异常,例如没有找到匹配的Activity或权限问题。 8. **实践项目**:通过编写小型应用或修改现有项目,实践Activity的启动和管理。 通过以上学习计划,你可以逐步...
Activity启动流程思维导图,详细整理了activity启动的逻辑,使人快速看清activity的启动逻辑。个人整理的东西,可能存在很多瑕疵,如有瑕疵,不是巧合。
Android_11_Activity 启动过程分析流程图原件
`Android Hook Activity 启动劫持`是一种高级技术,它允许开发者利用动态代理(Dynamic Proxy)技术来拦截并控制AMS的行为,从而在不修改系统源码的情况下,实现对Activity启动流程的监控或修改。 首先,我们需要...
【Android 插件化】Hook 插件化框架总结 ( 插件包管理 | Hook Activity 启动流程 | Hook 插件包资源加载 ) https://hanshuliang.blog.csdn.net/article/details/119647811
老罗Activity启动过程文章中,时序图比较模糊看不清,自己重新做了一个