Add IntentFilter auto verification - part 5

- optimize IntentFilter verification: dont do stuff we dont want
if we dont need to do them.

- improve IntentFilter candidates filtering and also improve
at the same time fix for bug #20128771: we can return the candidates
list rigth the way if the Intent is not related to a Web data URI and
include the "undefined verification state" ones if the first filtering
pass does not leave any.

Change-Id: I19f5c060f58b93530e37b4425d19ed23d2a0f4c0
diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java
index 6b9d3f8..7523675 100644
--- a/core/java/android/content/pm/PackageParser.java
+++ b/core/java/android/content/pm/PackageParser.java
@@ -2778,7 +2778,7 @@
     }
 
     /**
-     * Check if one of the IntentFilter as an action VIEW and a HTTP/HTTPS data URI
+     * Check if one of the IntentFilter as both actions DEFAULT / VIEW and a HTTP/HTTPS data URI
      */
     private static boolean hasDomainURLs(Package pkg) {
         if (pkg == null || pkg.activities == null) return false;
@@ -2792,6 +2792,7 @@
             for (int m=0; m<countFilters; m++) {
                 ActivityIntentInfo aii = filters.get(m);
                 if (!aii.hasAction(Intent.ACTION_VIEW)) continue;
+                if (!aii.hasAction(Intent.ACTION_DEFAULT)) continue;
                 if (aii.hasDataScheme(IntentFilter.SCHEME_HTTP) ||
                         aii.hasDataScheme(IntentFilter.SCHEME_HTTPS)) {
                     Slog.d(TAG, "hasDomainURLs:true for package:" + pkg.packageName);