最近碰到了一个要换YUNOS2.2 TV版桌面的的问题。将custom\full_gs703d\tmp\@system@app-platform-false下面的AliTvHomeshell.apk删掉,换成其他桌面,发现系统启动黑屏
从startHomeActivityLocked()中慢慢定位到是intent匹配的问题
在startHomeActivityLocked()--->resolveActivityInfo()--->resolveIntent()--->queryIntentActivities()--->queryIntent()--->super.queryIntent()--->buildResolveList()里老是提示
01-01 08:03:10.330 508 508 V IntentResolver: Matching against filter ActivityIntentInfo{4256ad40 com.dy.alilauncher/.LauncherActivity}
01-01 08:03:10.330 508 508 V IntentResolver: Filter did not match: category
什么鬼?我这桌面里的category明明是android.intent.category.HOME啊,不信看第三方桌面的manifest....
在代码中加过一堆log后logcat里的intent里的category成了
1-01 08:02:16.200 509 509 V IntentResolver: filter category matchingActivityIntentInfo{42c2cd70 com.kaiboer.gl.kiui7/.ui.WelcomeActivity}
01-01 08:02:16.200 509 509 V match mCategories: rm.android.intent.category.HOME
01-01 08:02:16.200 509 509 V match mCategories: android.intent.category.LAUNCHER
01-01 08:02:16.200 509 509 V match mCategories: android.intent.category.DEFAULT
01-01 08:02:16.200 509 509 V match mCategories: android.intent.category.MONKEY
01-01 08:02:16.200 509 509 V match categories: android.intent.category.HOME(这个是需要匹配的Intent)
我擦,多出来个rm,难怪匹配不上,什么情况?
发现系统启动时logcat里有这一行
01-01 08:03:02.660 518 518 D YUNOSSec231: mCategories is NOT @ android.content.pm.PackageParser.ActivityIntentInfo
01-01 08:03:02.660 518 518 D YUNOSSec231: mCategories is NOT @ android.content.pm.PackageParser.IntentInfo
01-01 08:03:02.660 518 518 W YUNOSSec231: Remove android.intent.category.HOME from com.dy.alilauncher
01-01 08:03:02.660 518 518 D YUNOSSec231: Get android.intent.category.DEFAULT from com.dy.alilauncher
01-01 08:03:02.660 518 518 D YUNOSSec231: Get android.intent.category.MONKEY from com.dy.alilauncher
01-01 08:03:02.660 518 518 D YUNOSSec231: mActions is NOT @ android.content.pm.PackageParser.ActivityIntentInfo
YUNOSSec231??估计是个阿里安全验证的机制,看到第三方的apk直接改了它的category了,晕,还带这样?
然后搜索源码树搜了半天也找不到YUNOSSec231,这玩意代码在什么地方?难道是二进制直接编进来的?求解。
找不到问题的根源就先用个笨办法
在IntentFilter.java的match()---->matchCategories()里加上
<span style="font-size:14px;"> public final String matchCategories(Set<String> categories) {
if (categories == null) {
return null;
}
Iterator<String> it = categories.iterator();
if (mCategories == null) {
return it.hasNext() ? it.next() : null;
}
/**add by ninteo**/
<span style="color:#ff0000;"> if(mCategories != null) {
for(int i=0;i < mCategories.size();i++) {
if(mCategories.get(i).equals("rm.android.intent.category.HOME"))
mCategories.set(i,"android.intent.category.HOME");
}
}</span>
while (it.hasNext()) {
final String category = it.next();
if (!mCategories.contains(category)) {
return category;
}
}
return null;
}</span>
=.=
好吧,问题解决。不过谁告诉我YUNOSSec231在哪??