summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorChris Tate <ctate@android.com>2015-08-14 17:15:37 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-08-14 17:15:37 +0000
commitb47890c4e7a7fc119e74da2b50bf94c2cf172916 (patch)
treed022824b4e80e1ed88a58d66f11dc86135f5d70a /services
parent9e398eb51497dbcd2347cb1315933fa4e7cfcd9e (diff)
parent7e7d79ef2f4aa6a8da86af459d419bd24c47b440 (diff)
downloadframeworks_base-b47890c4e7a7fc119e74da2b50bf94c2cf172916.zip
frameworks_base-b47890c4e7a7fc119e74da2b50bf94c2cf172916.tar.gz
frameworks_base-b47890c4e7a7fc119e74da2b50bf94c2cf172916.tar.bz2
am 7e7d79ef: Merge "Make "Ask every time" actually work that way" into mnc-dev
* commit '7e7d79ef2f4aa6a8da86af459d419bd24c47b440': Make "Ask every time" actually work that way
Diffstat (limited to 'services')
-rw-r--r--services/core/java/com/android/server/pm/PackageManagerService.java33
1 files changed, 31 insertions, 2 deletions
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index 656e35b..4bb3c1a 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -56,6 +56,7 @@ import static android.content.pm.PackageManager.INTENT_FILTER_DOMAIN_VERIFICATIO
import static android.content.pm.PackageManager.INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ASK;
import static android.content.pm.PackageManager.INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER;
import static android.content.pm.PackageManager.INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_UNDEFINED;
+import static android.content.pm.PackageManager.INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS_ASK;
import static android.content.pm.PackageManager.MATCH_ALL;
import static android.content.pm.PackageManager.MOVE_FAILED_DOESNT_EXIST;
import static android.content.pm.PackageManager.MOVE_FAILED_INTERNAL_ERROR;
@@ -4706,6 +4707,7 @@ public class PackageManagerService extends IPackageManager.Stub {
ArrayList<ResolveInfo> result = new ArrayList<ResolveInfo>();
ArrayList<ResolveInfo> alwaysList = new ArrayList<ResolveInfo>();
ArrayList<ResolveInfo> undefinedList = new ArrayList<ResolveInfo>();
+ ArrayList<ResolveInfo> alwaysAskList = new ArrayList<ResolveInfo>();
ArrayList<ResolveInfo> neverList = new ArrayList<ResolveInfo>();
ArrayList<ResolveInfo> matchAllList = new ArrayList<ResolveInfo>();
@@ -4742,6 +4744,11 @@ public class PackageManagerService extends IPackageManager.Stub {
Slog.i(TAG, " + never: " + info.activityInfo.packageName);
}
neverList.add(info);
+ } else if (status == INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS_ASK) {
+ if (DEBUG_DOMAIN_VERIFICATION) {
+ Slog.i(TAG, " + always-ask: " + info.activityInfo.packageName);
+ }
+ alwaysAskList.add(info);
} else if (status == INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_UNDEFINED ||
status == INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ASK) {
if (DEBUG_DOMAIN_VERIFICATION) {
@@ -4751,6 +4758,10 @@ public class PackageManagerService extends IPackageManager.Stub {
}
}
}
+
+ // We'll want to include browser possibilities in a few cases
+ boolean includeBrowser = false;
+
// First try to add the "always" resolution(s) for the current user, if any
if (alwaysList.size() > 0) {
result.addAll(alwaysList);
@@ -4759,7 +4770,7 @@ public class PackageManagerService extends IPackageManager.Stub {
== INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS) {
result.add(xpDomainInfo.resolveInfo);
} else {
- // Add all undefined Apps as we want them to appear in the Disambiguation dialog.
+ // Add all undefined apps as we want them to appear in the disambiguation dialog.
result.addAll(undefinedList);
if (xpDomainInfo != null && (
xpDomainInfo.bestDomainVerificationStatus
@@ -4768,7 +4779,25 @@ public class PackageManagerService extends IPackageManager.Stub {
== INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ASK)) {
result.add(xpDomainInfo.resolveInfo);
}
- // Also add Browsers (all of them or only the default one)
+ includeBrowser = true;
+ }
+
+ // The presence of any 'always ask' alternatives means we'll also offer browsers.
+ // If there were 'always' entries their preferred order has been set, so we also
+ // back that off to make the alternatives equivalent
+ if (alwaysAskList.size() > 0) {
+ for (ResolveInfo i : result) {
+ i.preferredOrder = 0;
+ }
+ result.addAll(alwaysAskList);
+ includeBrowser = true;
+ }
+
+ if (includeBrowser) {
+ // Also add browsers (all of them or only the default one)
+ if (DEBUG_DOMAIN_VERIFICATION) {
+ Slog.v(TAG, " ...including browsers in candidate set");
+ }
if ((matchFlags & MATCH_ALL) != 0) {
result.addAll(matchAllList);
} else {