ResolverActivity 流程

版本 aosp-5.1.1_r6

1
2
3
4
5
6
7
8
9
10
11
ResolverActivity.java ResolveListAdapter.ctor()
-> ResolveListAdapter.rebuildList()
--binder--> PackageManagerService.queryIntentActivities() {
if intent有component, 直接返回component指定的;
if intent有packageName, ActivityIntentResolver.queryIntentForPackage()
else ActivityIntentResolver.queryIntent()
}
->1. (ActivityIntentResolver父类 IntentResolver).queryIntent()
->2. (ActivityIntentResolver父类 IntentResolver).queryIntentForPackage()

-> IntentResolver.buildResolveList()
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
PMS.findPreferredActivity()
1. <- PMS.setLastChosenActivity()
<- ResolverActivity.onIntentSelected()

2. <- PMS.getLastChosenActivity()
<- ResolverActivity.rebuildList()

3. <- PMS.chooseBestActivity() {findPreferredActivity(intent,resolvedType,flags,query,r0.priority,true==always,false==removeMatches,debug,userId)}
<- PMS.resolveIntent()

4. <- PMS.getHomeActivities() {
list=queryIntentActivities(); return findPreferredActivity(list) 返回NULL表示没有preferred }
<--binder-- PM.getHomeActivities()
4.1 <- SystemUI SystemServicesProxy.getHomeActivityPackageName()
<- SystemUI AlternateRecentsComponent.startRecentsActivity() 最近应用页面
4.2 <- ApplicationPackageManager.getHomeActivities() ContextImpl.mPackageManager==ApplicationPackageManager, 实际client端的PackageManager, api公开接口
4.3 <- PackageManagerBackupAgent.getPreferredHomeComponent()
<- PMBA.onBackup()