summaryrefslogtreecommitdiffstats
path: root/core/java/android/content
diff options
context:
space:
mode:
authorFabrice Di Meglio <fdimeglio@google.com>2015-04-08 16:17:46 -0700
committerFabrice Di Meglio <fdimeglio@google.com>2015-04-08 19:24:15 -0700
commit7d014cec63939f7aca2a8014f45cd4c9a3e1aa0c (patch)
tree085a43dd907c8106194c6856dd1505c587196203 /core/java/android/content
parent88fa96c7589a076898ac5514925d09a9058df715 (diff)
downloadframeworks_base-7d014cec63939f7aca2a8014f45cd4c9a3e1aa0c.zip
frameworks_base-7d014cec63939f7aca2a8014f45cd4c9a3e1aa0c.tar.gz
frameworks_base-7d014cec63939f7aca2a8014f45cd4c9a3e1aa0c.tar.bz2
Add IntentFilter auto verification - part 4
- add domain verification priming at boot when the PackageManagerService singleton is created. This will mainly set the domain verification status to INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS for all Apps that have an IntentFilter with action VIEW and data scheme HTTP or HTTPS. - also optimize Intent resolution by taking into account Browser Apps Change-Id: Id8e66c9759a99e79b07051595ca89a168dc5ae0e
Diffstat (limited to 'core/java/android/content')
-rw-r--r--core/java/android/content/IntentFilter.java37
-rw-r--r--core/java/android/content/pm/IntentFilterVerificationInfo.java2
-rw-r--r--core/java/android/content/pm/PackageParser.java1
-rw-r--r--core/java/android/content/pm/ResolveInfo.java10
4 files changed, 40 insertions, 10 deletions
diff --git a/core/java/android/content/IntentFilter.java b/core/java/android/content/IntentFilter.java
index 590d791..044e3e3 100644
--- a/core/java/android/content/IntentFilter.java
+++ b/core/java/android/content/IntentFilter.java
@@ -517,6 +517,38 @@ public class IntentFilter implements Parcelable {
}
/**
+ * Return if this filter handle all HTTP or HTTPS data URI or not.
+ *
+ * @return True if the filter handle all HTTP or HTTPS data URI. False otherwise.
+ *
+ * This will check if if the Intent action is {@link android.content.Intent#ACTION_VIEW} and
+ * the Intent category is {@link android.content.Intent#CATEGORY_BROWSABLE} and the Intent
+ * data scheme is "http" or "https" and that there is no specific host defined.
+ *
+ * @hide
+ */
+ public final boolean handleAllWebDataURI() {
+ return hasWebDataURI() && (countDataAuthorities() == 0);
+ }
+
+ /**
+ * Return if this filter has any HTTP or HTTPS data URI or not.
+ *
+ * @return True if the filter has any HTTP or HTTPS data URI. False otherwise.
+ *
+ * This will check if if the Intent action is {@link android.content.Intent#ACTION_VIEW} and
+ * the Intent category is {@link android.content.Intent#CATEGORY_BROWSABLE} and the Intent
+ * data scheme is "http" or "https".
+ *
+ * @hide
+ */
+ public final boolean hasWebDataURI() {
+ return hasAction(Intent.ACTION_VIEW) &&
+ hasCategory(Intent.CATEGORY_BROWSABLE) &&
+ (hasDataScheme(SCHEME_HTTP) || hasDataScheme(SCHEME_HTTPS));
+ }
+
+ /**
* Return if this filter needs to be automatically verified again its data URIs or not.
*
* @return True if the filter needs to be automatically verified. False otherwise.
@@ -530,10 +562,7 @@ public class IntentFilter implements Parcelable {
* @hide
*/
public final boolean needsVerification() {
- return hasAction(Intent.ACTION_VIEW) &&
- hasCategory(Intent.CATEGORY_BROWSABLE) &&
- (hasDataScheme(SCHEME_HTTP) || hasDataScheme(SCHEME_HTTPS)) &&
- getAutoVerify();
+ return hasWebDataURI() && getAutoVerify();
}
/**
diff --git a/core/java/android/content/pm/IntentFilterVerificationInfo.java b/core/java/android/content/pm/IntentFilterVerificationInfo.java
index 28cbaa8..e50b0ff 100644
--- a/core/java/android/content/pm/IntentFilterVerificationInfo.java
+++ b/core/java/android/content/pm/IntentFilterVerificationInfo.java
@@ -36,7 +36,7 @@ import java.util.ArrayList;
/**
* The {@link com.android.server.pm.PackageManagerService} maintains some
- * {@link IntentFilterVerificationInfo}s for each domain / package / class name per user.
+ * {@link IntentFilterVerificationInfo}s for each domain / package name.
*
* @hide
*/
diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java
index bdbed75..6b9d3f8 100644
--- a/core/java/android/content/pm/PackageParser.java
+++ b/core/java/android/content/pm/PackageParser.java
@@ -2794,6 +2794,7 @@ public class PackageParser {
if (!aii.hasAction(Intent.ACTION_VIEW)) continue;
if (aii.hasDataScheme(IntentFilter.SCHEME_HTTP) ||
aii.hasDataScheme(IntentFilter.SCHEME_HTTPS)) {
+ Slog.d(TAG, "hasDomainURLs:true for package:" + pkg.packageName);
return true;
}
}
diff --git a/core/java/android/content/pm/ResolveInfo.java b/core/java/android/content/pm/ResolveInfo.java
index 7b141f0..05f5e90 100644
--- a/core/java/android/content/pm/ResolveInfo.java
+++ b/core/java/android/content/pm/ResolveInfo.java
@@ -144,9 +144,9 @@ public class ResolveInfo implements Parcelable {
public boolean system;
/**
- * @hide Does the associated IntentFilter needs verification ?
+ * @hide Does the associated IntentFilter comes from a Browser ?
*/
- public boolean filterNeedsVerification;
+ public boolean handleAllWebDataURI;
private ComponentInfo getComponentInfo() {
if (activityInfo != null) return activityInfo;
@@ -288,7 +288,7 @@ public class ResolveInfo implements Parcelable {
resolvePackageName = orig.resolvePackageName;
system = orig.system;
targetUserId = orig.targetUserId;
- filterNeedsVerification = orig.filterNeedsVerification;
+ handleAllWebDataURI = orig.handleAllWebDataURI;
}
public String toString() {
@@ -350,7 +350,7 @@ public class ResolveInfo implements Parcelable {
dest.writeInt(targetUserId);
dest.writeInt(system ? 1 : 0);
dest.writeInt(noResourceId ? 1 : 0);
- dest.writeInt(filterNeedsVerification ? 1 : 0);
+ dest.writeInt(handleAllWebDataURI ? 1 : 0);
}
public static final Creator<ResolveInfo> CREATOR
@@ -396,7 +396,7 @@ public class ResolveInfo implements Parcelable {
targetUserId = source.readInt();
system = source.readInt() != 0;
noResourceId = source.readInt() != 0;
- filterNeedsVerification = source.readInt() != 0;
+ handleAllWebDataURI = source.readInt() != 0;
}
public static class DisplayNameComparator