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

Commit 8a25d0fa authored by Patrick Baumann's avatar Patrick Baumann Committed by Android (Google) Code Review
Browse files

Merge "Fixes wildcard intent filter matching logic" into rvc-dev

parents 215bb80b 28a68105
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -274,8 +274,13 @@ public class IntentFilter implements Parcelable {
     */
    public static final String SCHEME_HTTPS = "https";

    /** The value to indicate a wildcard for incoming match arguments. */
    private static final String WILDCARD = "*";
    /**
     * The value to indicate a wildcard for incoming match arguments.
     * @hide
     */
    public static final String WILDCARD = "*";
    /** @hide */
    public static final String WILDCARD_PATH = "/" + WILDCARD;

    private int mPriority;
    @UnsupportedAppUsage
@@ -1439,7 +1444,7 @@ public class IntentFilter implements Parcelable {
        if (mDataPaths == null) {
            return false;
        }
        if (wildcardSupported && WILDCARD.equals(data)) {
        if (wildcardSupported && WILDCARD_PATH.equals(data)) {
            return true;
        }
        final int numDataPaths = mDataPaths.size();
+14 −2
Original line number Diff line number Diff line
@@ -40,7 +40,6 @@ import android.content.pm.ConfigurationInfo;
import android.content.pm.FeatureGroupInfo;
import android.content.pm.FeatureInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageItemInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageParser;
import android.content.pm.PackageParser.PackageParserException;
@@ -1390,7 +1389,7 @@ public class ParsingPackageUtils {

                Uri data = null;
                String dataType = null;
                String host = "";
                String host = IntentFilter.WILDCARD;
                final int numActions = intentInfo.countActions();
                final int numSchemes = intentInfo.countDataSchemes();
                final int numTypes = intentInfo.countDataTypes();
@@ -1421,10 +1420,23 @@ public class ParsingPackageUtils {
                    data = new Uri.Builder()
                            .scheme(intentInfo.getDataScheme(0))
                            .authority(host)
                            .path(IntentFilter.WILDCARD_PATH)
                            .build();
                }
                if (numTypes == 1) {
                    dataType = intentInfo.getDataType(0);
                    // The dataType may have had the '/' removed for the dynamic mimeType feature.
                    // If we detect that case, we add the * back.
                    if (!dataType.contains("/")) {
                        dataType = dataType + "/*";
                    }
                    if (data == null) {
                        data = new Uri.Builder()
                                .scheme("content")
                                .authority(IntentFilter.WILDCARD)
                                .path(IntentFilter.WILDCARD_PATH)
                                .build();
                    }
                }
                intent.setDataAndType(data, dataType);
                if (numActions == 1) {