Allow the launcher to get all instant apps
Change-Id: Ie0381d01fe8cd5293a0a3671c1bdf497ca5c5783
Fixes: 63814920
Test: Manual
Test: Make and install a launcher that calls the protected APIs
Test: Run launcher, see that it gets a security exception
Test: Make the launcher the default, see that it gets a security exception
Test: Install the launcher as a system app
Test: Run the launcher, see that it gets a security exception
Test: Make the launcher the default, see that the API works
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index 98b6949..3ac7384 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -8282,8 +8282,10 @@
if (HIDE_EPHEMERAL_APIS || isEphemeralDisabled()) {
return null;
}
- mContext.enforceCallingOrSelfPermission(Manifest.permission.ACCESS_INSTANT_APPS,
- "getEphemeralApplications");
+ if (!canViewInstantApps(Binder.getCallingUid(), userId)) {
+ mContext.enforceCallingOrSelfPermission(Manifest.permission.ACCESS_INSTANT_APPS,
+ "getEphemeralApplications");
+ }
enforceCrossUserPermission(Binder.getCallingUid(), userId,
true /* requireFullPermission */, false /* checkShell */,
"getEphemeralApplications");
@@ -8368,9 +8370,10 @@
return null;
}
- mContext.enforceCallingOrSelfPermission(Manifest.permission.ACCESS_INSTANT_APPS,
- "getInstantAppIcon");
-
+ if (!canViewInstantApps(Binder.getCallingUid(), userId)) {
+ mContext.enforceCallingOrSelfPermission(Manifest.permission.ACCESS_INSTANT_APPS,
+ "getInstantAppIcon");
+ }
enforceCrossUserPermission(Binder.getCallingUid(), userId,
true /* requireFullPermission */, false /* checkShell */,
"getInstantAppIcon");