From 84249ed31e4d6af7bfa9335ff0879893e300b46f Mon Sep 17 00:00:00 2001 From: Patrick Baumann Date: Thu, 14 May 2020 15:56:52 -0700 Subject: Treat mimegroup as wildcard for app enumeration This change treats any filter with a mimegroup as if it matches all or no mime types when matching for the purpose of app enumeration. Fixes: 155379839 Test: atest IntentFilterTest Change-Id: I358872082524a4001179bb145053d006622898a7 --- core/java/android/content/IntentFilter.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/core/java/android/content/IntentFilter.java b/core/java/android/content/IntentFilter.java index 11d3f529b0fa..79da1f6ab282 100644 --- a/core/java/android/content/IntentFilter.java +++ b/core/java/android/content/IntentFilter.java @@ -1581,12 +1581,13 @@ public class IntentFilter implements Parcelable { * @param wildcardSupported if true, will allow parameters to use wildcards */ private int matchData(String type, String scheme, Uri data, boolean wildcardSupported) { - final ArrayList types = mDataTypes; + final boolean wildcardWithMimegroups = wildcardSupported && countMimeGroups() != 0; + final List types = mDataTypes; final ArrayList schemes = mDataSchemes; int match = MATCH_CATEGORY_EMPTY; - if (types == null && schemes == null) { + if (!wildcardWithMimegroups && types == null && schemes == null) { return ((type == null && data == null) ? (MATCH_CATEGORY_EMPTY+MATCH_ADJUSTMENT_NORMAL) : NO_MATCH_DATA); } @@ -1641,7 +1642,9 @@ public class IntentFilter implements Parcelable { } } - if (types != null) { + if (wildcardWithMimegroups) { + return MATCH_CATEGORY_TYPE; + } else if (types != null) { if (findMimeType(type)) { match = MATCH_CATEGORY_TYPE; } else { -- cgit v1.2.3-59-g8ed1b