Loading cmds/pm/src/com/android/commands/pm/Pm.java +6 −1 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.commands.pm; import static android.content.pm.PackageManager.INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_UNDEFINED; import static android.content.pm.PackageManager.INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ASK; import static android.content.pm.PackageManager.INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS; import static android.content.pm.PackageManager.INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS_ASK; import static android.content.pm.PackageManager.INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER; import android.app.ActivityManager; Loading Loading @@ -840,7 +841,7 @@ public final class Pm { return Integer.toString(result); } // pm set-app-link [--user USER_ID] PACKAGE {always|ask|never|undefined} // pm set-app-link [--user USER_ID] PACKAGE {always|ask|always-ask|never|undefined} private int runSetAppLink() { int userId = UserHandle.USER_OWNER; Loading Loading @@ -889,6 +890,10 @@ public final class Pm { newMode = INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ASK; break; case "always-ask": newMode = INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS_ASK; break; case "never": newMode = INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER; break; Loading core/java/android/content/pm/IntentFilterVerificationInfo.java +5 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package android.content.pm; import static android.content.pm.PackageManager.INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_UNDEFINED; import static android.content.pm.PackageManager.INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ASK; import static android.content.pm.PackageManager.INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS; import static android.content.pm.PackageManager.INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS_ASK; import static android.content.pm.PackageManager.INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER; import android.os.Parcel; Loading Loading @@ -199,6 +200,10 @@ public final class IntentFilterVerificationInfo implements Parcelable { sb.append("never"); break; case INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS_ASK: sb.append("always-ask"); break; case INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_UNDEFINED: default: sb.append("undefined"); Loading core/java/android/content/pm/PackageManager.java +12 −0 Original line number Diff line number Diff line Loading @@ -1072,6 +1072,18 @@ public abstract class PackageManager { */ public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER = 3; /** * Used as the {@code status} argument for {@link PackageManager#updateIntentVerificationStatus} * to indicate that this app should always be considered as an ambiguous candidate for * handling the matching Intent even if there are other candidate apps in the "always" * state. Put another way: if there are any 'always ask' apps in a set of more than * one candidate app, then a disambiguation is *always* presented even if there is * another candidate app with the 'always' state. * * @hide */ public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS_ASK = 4; /** * Can be used as the {@code millisecondsToDelay} argument for * {@link PackageManager#extendVerificationTimeout}. This is the Loading services/core/java/com/android/server/pm/PackageManagerService.java +31 −2 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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>(); Loading Loading @@ -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) { Loading @@ -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); Loading @@ -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 Loading @@ -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 { Loading Loading
cmds/pm/src/com/android/commands/pm/Pm.java +6 −1 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.commands.pm; import static android.content.pm.PackageManager.INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_UNDEFINED; import static android.content.pm.PackageManager.INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ASK; import static android.content.pm.PackageManager.INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS; import static android.content.pm.PackageManager.INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS_ASK; import static android.content.pm.PackageManager.INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER; import android.app.ActivityManager; Loading Loading @@ -840,7 +841,7 @@ public final class Pm { return Integer.toString(result); } // pm set-app-link [--user USER_ID] PACKAGE {always|ask|never|undefined} // pm set-app-link [--user USER_ID] PACKAGE {always|ask|always-ask|never|undefined} private int runSetAppLink() { int userId = UserHandle.USER_OWNER; Loading Loading @@ -889,6 +890,10 @@ public final class Pm { newMode = INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ASK; break; case "always-ask": newMode = INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS_ASK; break; case "never": newMode = INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER; break; Loading
core/java/android/content/pm/IntentFilterVerificationInfo.java +5 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package android.content.pm; import static android.content.pm.PackageManager.INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_UNDEFINED; import static android.content.pm.PackageManager.INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ASK; import static android.content.pm.PackageManager.INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS; import static android.content.pm.PackageManager.INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS_ASK; import static android.content.pm.PackageManager.INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER; import android.os.Parcel; Loading Loading @@ -199,6 +200,10 @@ public final class IntentFilterVerificationInfo implements Parcelable { sb.append("never"); break; case INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS_ASK: sb.append("always-ask"); break; case INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_UNDEFINED: default: sb.append("undefined"); Loading
core/java/android/content/pm/PackageManager.java +12 −0 Original line number Diff line number Diff line Loading @@ -1072,6 +1072,18 @@ public abstract class PackageManager { */ public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER = 3; /** * Used as the {@code status} argument for {@link PackageManager#updateIntentVerificationStatus} * to indicate that this app should always be considered as an ambiguous candidate for * handling the matching Intent even if there are other candidate apps in the "always" * state. Put another way: if there are any 'always ask' apps in a set of more than * one candidate app, then a disambiguation is *always* presented even if there is * another candidate app with the 'always' state. * * @hide */ public static final int INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS_ASK = 4; /** * Can be used as the {@code millisecondsToDelay} argument for * {@link PackageManager#extendVerificationTimeout}. This is the Loading
services/core/java/com/android/server/pm/PackageManagerService.java +31 −2 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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>(); Loading Loading @@ -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) { Loading @@ -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); Loading @@ -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 Loading @@ -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 { Loading