android setupwizard launcher app启动优先级(未验证)
来源:互联网 发布:sql server 分组排序 编辑:程序博客网 时间:2024/06/05 16:16
记录mainfest priority优先级决定app启动流程
<activity android:name="com.android.setupwizard.activity.DefaultMainActivity"> <intent-filter android:priority="1"> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.HOME" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter></activity>
app 启动为:
ActivityManagerService.java
>>startHomeActivityLocked();
决定启动哪个app
Intent getHomeIntent() { Intent intent = new Intent(mTopAction, mTopData != null ? Uri.parse(mTopData) : null); intent.setComponent(mTopComponent); intent.addFlags(Intent.FLAG_DEBUG_TRIAGED_MISSING); if (mFactoryTest != FactoryTest.FACTORY_TEST_LOW_LEVEL) { intent.addCategory(Intent.CATEGORY_HOME); } return intent;}
>>> systemReady
if (mFactoryTest == FactoryTest.FACTORY_TEST_LOW_LEVEL) { ResolveInfo ri = mContext.getPackageManager() .resolveActivity(new Intent(Intent.ACTION_FACTORY_TEST), STOCK_PM_FLAGS); CharSequence errorMsg = null; if (ri != null) { ActivityInfo ai = ri.activityInfo; ApplicationInfo app = ai.applicationInfo; if ((app.flags&ApplicationInfo.FLAG_SYSTEM) != 0) { mTopAction = Intent.ACTION_FACTORY_TEST; mTopData = null; mTopComponent = new ComponentName(app.packageName, ai.name); } else { errorMsg = mContext.getResources().getText( com.android.internal.R.string.factorytest_not_system); } }>>>>> resolveActivitymTopComponent >>mContext.getPackageManager() .resolveActivity
>>>ContextImpl.java
>>> mPM.resolveIntent
PackageManagerService.java resolveIntent
>>>chooseBestActivity 可以看到选择优先级的问题
private ResolveInfo chooseBestActivity(Intent intent, String resolvedType, int flags, List<ResolveInfo> query, int userId) { if (query != null) { final int N = query.size(); if (N == 1) { return query.get(0); } else if (N > 1) { final boolean debug = ((intent.getFlags() & Intent.FLAG_DEBUG_LOG_RESOLUTION) != 0); // If there is more than one activity with the same priority, // then let the user decide between them. ResolveInfo r0 = query.get(0); ResolveInfo r1 = query.get(1); if (DEBUG_INTENT_MATCHING || debug) { Slog.v(TAG, r0.activityInfo.name + "=" + r0.priority + " vs " + r1.activityInfo.name + "=" + r1.priority); } // If the first activity has a higher priority, or a different // default, then it is always desirable to pick it. if (r0.priority != r1.priority || r0.preferredOrder != r1.preferredOrder || r0.isDefault != r1.isDefault) { return query.get(0); } // If we have saved a preference for a preferred activity for // this Intent, use that. ResolveInfo ri = findPreferredActivity(intent, resolvedType, flags, query, r0.priority, true, false, debug, userId); if (ri != null) { return ri; } ri = new ResolveInfo(mResolveInfo); ri.activityInfo = new ActivityInfo(ri.activityInfo); ri.activityInfo.labelRes = ResolverActivity.getLabelRes(intent.getAction()); // If all of the options come from the same package, show the application's // label and icon instead of the generic resolver's. // Some calls like Intent.resolveActivityInfo query the ResolveInfo from here // and then throw away the ResolveInfo itself, meaning that the caller loses // the resolvePackageName. Therefore the activityInfo.labelRes above provides // a fallback for this case; we only set the target package's resources on // the ResolveInfo, not the ActivityInfo. final String intentPackage = intent.getPackage(); if (!TextUtils.isEmpty(intentPackage) && allHavePackage(query, intentPackage)) { final ApplicationInfo appi = query.get(0).activityInfo.applicationInfo; ri.resolvePackageName = intentPackage; if (userNeedsBadging(userId)) { ri.noResourceId = true; } else { ri.icon = appi.icon; } ri.iconResourceId = appi.icon; ri.labelRes = appi.labelRes; } ri.activityInfo.applicationInfo = new ApplicationInfo( ri.activityInfo.applicationInfo); if (userId != 0) { ri.activityInfo.applicationInfo.uid = UserHandle.getUid(userId, UserHandle.getAppId(ri.activityInfo.applicationInfo.uid)); } // Make sure that the resolver is displayable in car mode if (ri.activityInfo.metaData == null) ri.activityInfo.metaData = new Bundle(); ri.activityInfo.metaData.putBoolean(Intent.METADATA_DOCK_HOME, true); return ri; } } return null;}
阅读全文
0 0
- android setupwizard launcher app启动优先级(未验证)
- Android launcher 源码 app 的启动方式
- Android launcher 初体验--app开机启动
- Android APP设置为Launcher时onCreate启动两次
- [Android]从Launcher开始启动App流程源码分析
- Android Launcher解析和批改9——Launcher启动APP流程
- Android Launcher分析和修改9——Launcher启动APP流程
- Android 启动Launcher
- Android启动Launcher过程
- 【Android】launcher启动参数
- android 启动launcher流程
- Android 通过广播调用未启动过的App
- android APP如何实现launcher
- android APP如何实现launcher
- Android 跳过 屏蔽 google Setupwizard
- Google App Engine Launcher无法启动问题解决
- APP Launcher 之桌面Application启动篇
- Android 获取Launcher 启动列表
- FastDFS实战(三)- 配置和运行
- Maven报错Please ensure you are using JDK 1.4 or above and not a JRE解决方法
- ios 视图center的一个坑
- JS_正则表达式
- Java并发编程之Lock
- android setupwizard launcher app启动优先级(未验证)
- 神经网络入门
- H.264(H264)解码SPS获取分辨率和帧率
- POJ1251_简单的Prim的应用,使用的是优先队列prim
- Android APP测试流程
- 什么是 solr
- 按照带不带返回值来划分方法
- jvm 静态类及非静态类的变量,方法加载顺序
- 插值算法分类