intent.getCategories().contains(intent.CATEGORY_HOME))) { //MTK ADD
Slog.i(TAG, "Result set changed, dropping preferred activity for "
+ intent + " type " + resolvedType);
if (DEBUG_PREFERRED) {
Slog.v(TAG, "Removing preferred activity since set changed "
+ pa.mPref.mComponent);
}
pir.removeFilter(pa);
// Re-add the filter as a "last chosen" entry (!always)
PreferredActivity lastChosen = new PreferredActivity(
pa, pa.mPref.mMatch, null, pa.mPref.mComponent, false);
pir.addFilter(lastChosen);
mSettings.writePackageRestrictionsLPr(userId);
return null;
}
}
Slog.i(TAG,"Result set not change, not drop preferred activity for special intent: "+intent);//MTK ADD
// Yay! Either the set matched or we‘re looking for the last chosen
特别说明:
JB系列findPreferredActivity略有调整,见下面:
修改 packageManagerService.java (framework/base/services/java/com/android/server/pm/)的findPreferredActivity方法,将此方法比较靠后的一段代码:
if (!pa.mPref.sameSet(query, priority)) {
Slog.i(TAG, "Result set changed, dropping preferred activity for " + intent + " type " + resolvedType);
pir.removeFilter(pa);
return null;
}
修改为:
if (!pa.mPref.sameSet(query, priority)) {
if(!(intent.getAction() != null && intent.getAction().equals(intent.ACTION_MAIN) && intent.getCategories()!=null &&
intent.getCategories().contains(intent.CATEGORY_HOME))) { //MTK ADD
Slog.i(TAG, "Result set changed, dropping preferred activity for "+ intent + " type " + resolvedType);
pir.removeFilter(pa);
return null;
} //MTK ADD
Slog.i(TAG,"Result set not change, not drop preferred activity for special intent: "+intent);//MTK ADD
}