Implement service filtering

Instant apps can no longer see services that haven't been
exposed to them via the visibleToInstantApps attribute.

Change-Id: I6fd78067d1253825668d67b9e17dd3a0703f5d57
Fixes: 35871716
Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.EphemeralTest
diff --git a/core/java/android/content/pm/PackageManagerInternal.java b/core/java/android/content/pm/PackageManagerInternal.java
index 16d582ef..7bfde75 100644
--- a/core/java/android/content/pm/PackageManagerInternal.java
+++ b/core/java/android/content/pm/PackageManagerInternal.java
@@ -310,12 +310,18 @@
             List<String> overlayPackageNames);
 
     /**
-     * Resolves an intent, allowing instant apps to be resolved.
+     * Resolves an activity intent, allowing instant apps to be resolved.
      */
     public abstract ResolveInfo resolveIntent(Intent intent, String resolvedType,
             int flags, int userId);
 
     /**
+    * Resolves a service intent, allowing instant apps to be resolved.
+    */
+   public abstract ResolveInfo resolveService(Intent intent, String resolvedType,
+           int flags, int userId, int callingUid);
+
+    /**
      * Track the creator of a new isolated uid.
      * @param isolatedUid The newly created isolated uid.
      * @param ownerUid The uid of the app that created the isolated process.