Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0da8537c authored by Patrick Baumann's avatar Patrick Baumann
Browse files

Require only ACTION_VIEW for web instant apps

When generic intent resolution support was added to instant apps, it
added the requirement that web instant app resolution also require the
BROWSABLE category. This change relaxes that requirement.

Test: manual - sent intent without browsable and observed resolution
Change-Id: I7d4d891484f538b46d37f2c8e7c040b370b46b9e
Fixes: 72835413
parent d205cde5
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -88,7 +88,7 @@ public abstract class InstantAppResolverService extends Service {
    public void onGetInstantAppResolveInfo(Intent sanitizedIntent, int[] hostDigestPrefix,
            String token, InstantAppResolutionCallback callback) {
        // if not overridden, forward to old methods and filter out non-web intents
        if (sanitizedIntent.isBrowsableWebIntent()) {
        if (sanitizedIntent.isWebIntent()) {
            onGetInstantAppResolveInfo(hostDigestPrefix, token, callback);
        } else {
            callback.onInstantAppResolveInfo(Collections.emptyList());
@@ -107,7 +107,7 @@ public abstract class InstantAppResolverService extends Service {
            String token, InstantAppResolutionCallback callback) {
        Log.e(TAG, "New onGetInstantAppIntentFilter is not overridden");
        // if not overridden, forward to old methods and filter out non-web intents
        if (sanitizedIntent.isBrowsableWebIntent()) {
        if (sanitizedIntent.isWebIntent()) {
            onGetInstantAppIntentFilter(hostDigestPrefix, token, callback);
        } else {
            callback.onInstantAppResolveInfo(Collections.emptyList());
+1 −2
Original line number Diff line number Diff line
@@ -10089,9 +10089,8 @@ public class Intent implements Parcelable, Cloneable {
    }

    /** @hide */
    public boolean isBrowsableWebIntent() {
    public boolean isWebIntent() {
        return ACTION_VIEW.equals(mAction)
                && hasCategory(CATEGORY_BROWSABLE)
                && hasWebURI();
    }

+1 −1
Original line number Diff line number Diff line
@@ -106,7 +106,7 @@ public class ResolverListController {
            int flags = PackageManager.MATCH_DEFAULT_ONLY
                    | (shouldGetResolvedFilter ? PackageManager.GET_RESOLVED_FILTER : 0)
                    | (shouldGetActivityMetadata ? PackageManager.GET_META_DATA : 0);
            if (intent.isBrowsableWebIntent()
            if (intent.isWebIntent()
                        || (intent.getFlags() & Intent.FLAG_ACTIVITY_MATCH_EXTERNAL) != 0) {
                flags |= PackageManager.MATCH_INSTANT;
            }
+1 −1
Original line number Diff line number Diff line
@@ -1266,7 +1266,7 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D
                Trace.traceBegin(TRACE_TAG_ACTIVITY_MANAGER, "resolveIntent");
                int modifiedFlags = flags
                        | PackageManager.MATCH_DEFAULT_ONLY | ActivityManagerService.STOCK_PM_FLAGS;
                if (intent.isBrowsableWebIntent()
                if (intent.isWebIntent()
                            || (intent.getFlags() & Intent.FLAG_ACTIVITY_MATCH_EXTERNAL) != 0) {
                    modifiedFlags |= PackageManager.MATCH_INSTANT;
                }
+2 −2
Original line number Diff line number Diff line
@@ -377,7 +377,7 @@ public abstract class InstantAppResolver {
        failureIntent.setFlags(failureIntent.getFlags() | Intent.FLAG_IGNORE_EPHEMERAL);
        failureIntent.setLaunchToken(token);
        ArrayList<AuxiliaryResolveInfo.AuxiliaryFilter> filters = null;
        boolean isWebIntent = origIntent.isBrowsableWebIntent();
        boolean isWebIntent = origIntent.isWebIntent();
        for (InstantAppResolveInfo instantAppResolveInfo : instantAppResolveInfoList) {
            if (shaPrefix.length > 0 && instantAppResolveInfo.shouldLetInstallerDecide()) {
                Slog.e(TAG, "InstantAppResolveInfo with mShouldLetInstallerDecide=true when digest"
@@ -448,7 +448,7 @@ public abstract class InstantAppResolver {
                instantAppInfo.getIntentFilters();
        if (instantAppFilters == null || instantAppFilters.isEmpty()) {
            // No filters on web intent; no matches, 2nd phase unnecessary.
            if (origIntent.isBrowsableWebIntent()) {
            if (origIntent.isWebIntent()) {
                return null;
            }
            // No filters; we need to start phase two
Loading