Fixes wildcard intent filter matching logic am: 28a68105e1 am: 6acd3edcbc
Change-Id: Id2ab110cad52ca589ca23f3d79a8584b81fc5a1d
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user