PackageManager.getPreferredActivities

public abstract int getPreferredActivities(@NonNull ListoutFilters,            @NonNull ListoutActivities, String packageName);

packageName必须不为空,否则返回的数据是错误的。


if (packageName == null 

|| (pa.mPref.mComponent.getPackageName().equals(packageName)

&& pa.mPref.mAlways)) {

if (outFilters != null) {

outFilters.add(new IntentFilter(pa));

}

问题出现在如果packageName ==null,没有判断pa.mPref.mAlways

你可能感兴趣的:(PackageManager.getPreferredActivities)