Adds instant app visibility to instumentation
This change grants visibility to instant apps of instrumentation
components that are targetting their package name. This allows
instrumentation tests to run just as installed apps do.
Change-Id: I3786390986cf9a65472da888257833f5b294a937
Fixes: 73078297
Test: manual - connected test passes as instant app
Test: atest EphemeralTest passes
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index 6513683..06d3533 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -4096,8 +4096,15 @@
return false;
}
if (callerIsInstantApp) {
- // request for a specific component; if it hasn't been explicitly exposed, filter
+ // request for a specific component; if it hasn't been explicitly exposed through
+ // property or instrumentation target, filter
if (component != null) {
+ final PackageParser.Instrumentation instrumentation =
+ mInstrumentation.get(component);
+ if (instrumentation != null
+ && isCallerSameApp(instrumentation.info.targetPackage, callingUid)) {
+ return false;
+ }
return !isComponentVisibleToInstantApp(component, componentType);
}
// request for application; if no components have been explicitly exposed, filter