Add private flag PRIVATE_FLAG_HAS_DOMAIN_URLS to ApplicationInfo
This is for supporting Settings UX and Domain URLs
- the new PRIVATE_FLAG_HAS_DOMAIN_URLS flag will be set by
generateApplicationInfo() when the Activity is said to have some
IntentFilter with a VIEW action and a http / https data URI
- code cleaning for args passing
- also add a new constant for the MetricsLogger
Change-Id: I5c9762fc2c4a9b46c0e255b9a23bffd70fae40c7
diff --git a/core/java/android/content/pm/ApplicationInfo.java b/core/java/android/content/pm/ApplicationInfo.java
index 2496e45..d6a068c4 100644
--- a/core/java/android/content/pm/ApplicationInfo.java
+++ b/core/java/android/content/pm/ApplicationInfo.java
@@ -421,6 +421,14 @@
public static final int PRIVATE_FLAG_PRIVILEGED = 1<<3;
/**
+ * Value for {@link #flags}: {@code true} if the application has any IntentFiler with some
+ * data URI using HTTP or HTTPS with an associated VIEW action.
+ *
+ * {@hide}
+ */
+ public static final int PRIVATE_FLAG_HAS_DOMAIN_URLS = 1<<4;
+
+ /**
* Private/hidden flags. See {@code PRIVATE_FLAG_...} constants.
* {@hide}
*/
diff --git a/core/java/android/content/pm/IPackageManager.aidl b/core/java/android/content/pm/IPackageManager.aidl
index 66b0d1a..fb7c96d 100644
--- a/core/java/android/content/pm/IPackageManager.aidl
+++ b/core/java/android/content/pm/IPackageManager.aidl
@@ -437,7 +437,7 @@
void verifyPendingInstall(int id, int verificationCode);
void extendVerificationTimeout(int id, int verificationCodeAtTimeout, long millisecondsToDelay);
- void verifyIntentFilter(int id, int verificationCode, in List<String> outFailedDomains);
+ void verifyIntentFilter(int id, int verificationCode, in List<String> failedDomains);
int getIntentVerificationStatus(String packageName, int userId);
boolean updateIntentVerificationStatus(String packageName, int status, int userId);
List<IntentFilterVerificationInfo> getIntentFilterVerifications(String packageName);
diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java
index 4b81fd4..a6d9289 100644
--- a/core/java/android/content/pm/PackageParser.java
+++ b/core/java/android/content/pm/PackageParser.java
@@ -2752,6 +2752,12 @@
modifySharedLibrariesForBackwardCompatibility(owner);
+ if (hasDomainURLs(owner)) {
+ owner.applicationInfo.privateFlags |= ApplicationInfo.PRIVATE_FLAG_HAS_DOMAIN_URLS;
+ } else {
+ owner.applicationInfo.privateFlags &= ~ApplicationInfo.PRIVATE_FLAG_HAS_DOMAIN_URLS;
+ }
+
return true;
}
@@ -2768,6 +2774,30 @@
}
/**
+ * Check if one of the IntentFilter as an action VIEW and a HTTP/HTTPS data URI
+ */
+ private static boolean hasDomainURLs(Package pkg) {
+ if (pkg == null || pkg.activities == null) return false;
+ final ArrayList<Activity> activities = pkg.activities;
+ final int countActivities = activities.size();
+ for (int n=0; n<countActivities; n++) {
+ Activity activity = activities.get(n);
+ ArrayList<ActivityIntentInfo> filters = activity.intents;
+ if (filters == null) continue;
+ final int countFilters = filters.size();
+ for (int m=0; m<countFilters; m++) {
+ ActivityIntentInfo aii = filters.get(m);
+ if (!aii.hasAction(Intent.ACTION_VIEW)) continue;
+ if (aii.hasDataScheme(IntentFilter.SCHEME_HTTP) ||
+ aii.hasDataScheme(IntentFilter.SCHEME_HTTPS)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
* Parse the {@code application} XML tree at the current parse location in a
* <em>split APK</em> manifest.
* <p>
diff --git a/core/java/com/android/internal/logging/MetricsLogger.java b/core/java/com/android/internal/logging/MetricsLogger.java
index 9b45e34..a2f6461 100644
--- a/core/java/com/android/internal/logging/MetricsLogger.java
+++ b/core/java/com/android/internal/logging/MetricsLogger.java
@@ -40,6 +40,8 @@
public static final int MANAGE_PERMISSIONS = 142;
+ public static final int MANAGE_DOMAIN_URLS = 143;
+
public static void visible(Context context, int category) throws IllegalArgumentException {
if (Build.IS_DEBUGGABLE && category == VIEW_UNKNOWN) {
throw new IllegalArgumentException("Must define metric category");