Merge "App linking: permit overlapping link handling" into mnc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
15bb16fb48
@@ -4568,8 +4568,8 @@ public class PackageManagerService extends IPackageManager.Stub {
|
|||||||
|
|
||||||
private List<ResolveInfo> filterCandidatesWithDomainPreferredActivitiesLPr(
|
private List<ResolveInfo> filterCandidatesWithDomainPreferredActivitiesLPr(
|
||||||
int flags, List<ResolveInfo> candidates, CrossProfileDomainInfo xpDomainInfo) {
|
int flags, List<ResolveInfo> candidates, CrossProfileDomainInfo xpDomainInfo) {
|
||||||
if (DEBUG_PREFERRED) {
|
if (DEBUG_PREFERRED || DEBUG_DOMAIN_VERIFICATION) {
|
||||||
Slog.v("TAG", "Filtering results with prefered activities. Candidates count: " +
|
Slog.v("TAG", "Filtering results with preferred activities. Candidates count: " +
|
||||||
candidates.size());
|
candidates.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4582,9 +4582,9 @@ public class PackageManagerService extends IPackageManager.Stub {
|
|||||||
|
|
||||||
synchronized (mPackages) {
|
synchronized (mPackages) {
|
||||||
final int count = candidates.size();
|
final int count = candidates.size();
|
||||||
// First, try to use the domain preferred app. Partition the candidates into four lists:
|
// First, try to use linked apps. Partition the candidates into four lists:
|
||||||
// one for the final results, one for the "do not use ever", one for "undefined status"
|
// one for the final results, one for the "do not use ever", one for "undefined status"
|
||||||
// and finally one for "Browser App type".
|
// and finally one for "browser app type".
|
||||||
for (int n=0; n<count; n++) {
|
for (int n=0; n<count; n++) {
|
||||||
ResolveInfo info = candidates.get(n);
|
ResolveInfo info = candidates.get(n);
|
||||||
String packageName = info.activityInfo.packageName;
|
String packageName = info.activityInfo.packageName;
|
||||||
@@ -4598,11 +4598,20 @@ public class PackageManagerService extends IPackageManager.Stub {
|
|||||||
// Try to get the status from User settings first
|
// Try to get the status from User settings first
|
||||||
int status = getDomainVerificationStatusLPr(ps, userId);
|
int status = getDomainVerificationStatusLPr(ps, userId);
|
||||||
if (status == INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS) {
|
if (status == INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS) {
|
||||||
|
if (DEBUG_DOMAIN_VERIFICATION) {
|
||||||
|
Slog.i(TAG, " + always: " + info.activityInfo.packageName);
|
||||||
|
}
|
||||||
alwaysList.add(info);
|
alwaysList.add(info);
|
||||||
} else if (status == INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER) {
|
} else if (status == INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER) {
|
||||||
|
if (DEBUG_DOMAIN_VERIFICATION) {
|
||||||
|
Slog.i(TAG, " + never: " + info.activityInfo.packageName);
|
||||||
|
}
|
||||||
neverList.add(info);
|
neverList.add(info);
|
||||||
} else if (status == INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_UNDEFINED ||
|
} else if (status == INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_UNDEFINED ||
|
||||||
status == INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ASK) {
|
status == INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ASK) {
|
||||||
|
if (DEBUG_DOMAIN_VERIFICATION) {
|
||||||
|
Slog.i(TAG, " + ask: " + info.activityInfo.packageName);
|
||||||
|
}
|
||||||
undefinedList.add(info);
|
undefinedList.add(info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4650,17 +4659,20 @@ public class PackageManagerService extends IPackageManager.Stub {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If there is nothing selected, add all candidates and remove the ones that the User
|
// If there is nothing selected, add all candidates and remove the ones that the user
|
||||||
// has explicitely put into the INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER state
|
// has explicitly put into the INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER state
|
||||||
if (result.size() == 0) {
|
if (result.size() == 0) {
|
||||||
result.addAll(candidates);
|
result.addAll(candidates);
|
||||||
result.removeAll(neverList);
|
result.removeAll(neverList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (DEBUG_PREFERRED) {
|
if (DEBUG_PREFERRED || DEBUG_DOMAIN_VERIFICATION) {
|
||||||
Slog.v("TAG", "Filtered results with prefered activities. New candidates count: " +
|
Slog.v(TAG, "Filtered results with preferred activities. New candidates count: " +
|
||||||
result.size());
|
result.size());
|
||||||
|
for (ResolveInfo info : result) {
|
||||||
|
Slog.v(TAG, " + " + info.activityInfo);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1058,36 +1058,8 @@ final class Settings {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
current.setDomainVerificationStatusForUser(status, userId);
|
current.setDomainVerificationStatusForUser(status, userId);
|
||||||
|
|
||||||
if (current.getIntentFilterVerificationInfo() == null) {
|
|
||||||
if (DEBUG_DOMAIN_VERIFICATION) {
|
|
||||||
Slog.w(PackageManagerService.TAG,
|
|
||||||
"No IntentFilterVerificationInfo known: " + packageName);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Then, if we set a ALWAYS status, then put NEVER status for Apps whose IntentFilter
|
|
||||||
// domains overlap the domains of the current package
|
|
||||||
ArraySet<String> currentDomains = current.getIntentFilterVerificationInfo().getDomains();
|
|
||||||
if (status == INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS) {
|
|
||||||
for (PackageSetting ps : mPackages.values()) {
|
|
||||||
if (ps == null || ps.pkg == null || packageName.equals(ps.pkg.packageName)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
IntentFilterVerificationInfo ivi = ps.getIntentFilterVerificationInfo();
|
|
||||||
if (ivi == null) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
ArraySet<String> set = ivi.getDomains();
|
|
||||||
set.retainAll(currentDomains);
|
|
||||||
if (set.size() > 0) {
|
|
||||||
ps.setDomainVerificationStatusForUser(
|
|
||||||
INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER, userId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user