summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/java/android/content/IntentFilter.java23
-rw-r--r--core/java/android/content/pm/PackageParser.java40
2 files changed, 50 insertions, 13 deletions
diff --git a/core/java/android/content/IntentFilter.java b/core/java/android/content/IntentFilter.java
index 36b1abc..5760a5d 100644
--- a/core/java/android/content/IntentFilter.java
+++ b/core/java/android/content/IntentFilter.java
@@ -733,10 +733,15 @@ public class IntentFilter implements Parcelable {
* @see #addDataScheme
*/
public final void addDataSchemeSpecificPart(String ssp, int type) {
+ addDataSchemeSpecificPart(new PatternMatcher(ssp, type));
+ }
+
+ /** @hide */
+ public final void addDataSchemeSpecificPart(PatternMatcher ssp) {
if (mDataSchemeSpecificParts == null) {
mDataSchemeSpecificParts = new ArrayList<PatternMatcher>();
}
- mDataSchemeSpecificParts.add(new PatternMatcher(ssp, type));
+ mDataSchemeSpecificParts.add(ssp);
}
/**
@@ -806,10 +811,15 @@ public class IntentFilter implements Parcelable {
* @see #addDataScheme
*/
public final void addDataAuthority(String host, String port) {
+ if (port != null) port = port.intern();
+ addDataAuthority(new AuthorityEntry(host.intern(), port));
+ }
+
+ /** @hide */
+ public final void addDataAuthority(AuthorityEntry ent) {
if (mDataAuthorities == null) mDataAuthorities =
new ArrayList<AuthorityEntry>();
- if (port != null) port = port.intern();
- mDataAuthorities.add(new AuthorityEntry(host.intern(), port));
+ mDataAuthorities.add(ent);
}
/**
@@ -874,8 +884,13 @@ public class IntentFilter implements Parcelable {
* @see #addDataAuthority
*/
public final void addDataPath(String path, int type) {
+ addDataPath(new PatternMatcher(path.intern(), type));
+ }
+
+ /** @hide */
+ public final void addDataPath(PatternMatcher path) {
if (mDataPaths == null) mDataPaths = new ArrayList<PatternMatcher>();
- mDataPaths.add(new PatternMatcher(path.intern(), type));
+ mDataPaths.add(path);
}
/**
diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java
index ce7addc..aaa2640 100644
--- a/core/java/android/content/pm/PackageParser.java
+++ b/core/java/android/content/pm/PackageParser.java
@@ -45,9 +45,6 @@ import java.security.NoSuchAlgorithmException;
import java.security.PublicKey;
import java.security.cert.Certificate;
import java.security.cert.CertificateEncodingException;
-import java.security.cert.CertificateFactory;
-import java.security.cert.CertPath;
-import java.security.cert.X509Certificate;
import java.security.spec.EncodedKeySpec;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.X509EncodedKeySpec;
@@ -2440,7 +2437,7 @@ public class PackageParser {
if (parser.getName().equals("intent-filter")) {
ActivityIntentInfo intent = new ActivityIntentInfo(a);
- if (!parseIntent(res, parser, attrs, flags, intent, outError, !receiver)) {
+ if (!parseIntent(res, parser, attrs, true, intent, outError)) {
return null;
}
if (intent.countActions() == 0) {
@@ -2450,6 +2447,21 @@ public class PackageParser {
} else {
a.intents.add(intent);
}
+ } else if (!receiver && parser.getName().equals("preferred")) {
+ ActivityIntentInfo intent = new ActivityIntentInfo(a);
+ if (!parseIntent(res, parser, attrs, false, intent, outError)) {
+ return null;
+ }
+ if (intent.countActions() == 0) {
+ Slog.w(TAG, "No actions in preferred at "
+ + mArchiveSourcePath + " "
+ + parser.getPositionDescription());
+ } else {
+ if (owner.preferredActivityFilters == null) {
+ owner.preferredActivityFilters = new ArrayList<ActivityIntentInfo>();
+ }
+ owner.preferredActivityFilters.add(intent);
+ }
} else if (parser.getName().equals("meta-data")) {
if ((a.metaData=parseMetaData(res, parser, attrs, a.metaData,
outError)) == null) {
@@ -2613,7 +2625,7 @@ public class PackageParser {
if (parser.getName().equals("intent-filter")) {
ActivityIntentInfo intent = new ActivityIntentInfo(a);
- if (!parseIntent(res, parser, attrs, flags, intent, outError, true)) {
+ if (!parseIntent(res, parser, attrs, true, intent, outError)) {
return null;
}
if (intent.countActions() == 0) {
@@ -3037,7 +3049,7 @@ public class PackageParser {
if (parser.getName().equals("intent-filter")) {
ServiceIntentInfo intent = new ServiceIntentInfo(s);
- if (!parseIntent(res, parser, attrs, flags, intent, outError, false)) {
+ if (!parseIntent(res, parser, attrs, true, intent, outError)) {
return null;
}
@@ -3234,9 +3246,8 @@ public class PackageParser {
private static final String ANDROID_RESOURCES
= "http://schemas.android.com/apk/res/android";
- private boolean parseIntent(Resources res,
- XmlPullParser parser, AttributeSet attrs, int flags,
- IntentInfo outInfo, String[] outError, boolean isActivity)
+ private boolean parseIntent(Resources res, XmlPullParser parser, AttributeSet attrs,
+ boolean allowGlobs, IntentInfo outInfo, String[] outError)
throws XmlPullParserException, IOException {
TypedArray sa = res.obtainAttributes(attrs,
@@ -3327,6 +3338,10 @@ public class PackageParser {
str = sa.getNonConfigurationString(
com.android.internal.R.styleable.AndroidManifestData_sspPattern, 0);
if (str != null) {
+ if (!allowGlobs) {
+ outError[0] = "sspPattern not allowed here; ssp must be literal";
+ return false;
+ }
outInfo.addDataSchemeSpecificPart(str, PatternMatcher.PATTERN_SIMPLE_GLOB);
}
@@ -3353,6 +3368,10 @@ public class PackageParser {
str = sa.getNonConfigurationString(
com.android.internal.R.styleable.AndroidManifestData_pathPattern, 0);
if (str != null) {
+ if (!allowGlobs) {
+ outError[0] = "pathPattern not allowed here; path must be literal";
+ return false;
+ }
outInfo.addDataPath(str, PatternMatcher.PATTERN_SIMPLE_GLOB);
}
@@ -3414,6 +3433,8 @@ public class PackageParser {
public ArrayList<String> usesOptionalLibraries = null;
public String[] usesLibraryFiles = null;
+ public ArrayList<ActivityIntentInfo> preferredActivityFilters = null;
+
public ArrayList<String> mOriginalPackages = null;
public String mRealPackage = null;
public ArrayList<String> mAdoptPermissions = null;
@@ -4020,6 +4041,7 @@ public class PackageParser {
public CharSequence nonLocalizedLabel;
public int icon;
public int logo;
+ public int preferred;
}
public final static class ActivityIntentInfo extends IntentInfo {