From b08116e96162040adb35133cd46c0440ce81215c Mon Sep 17 00:00:00 2001 From: Patrick Baumann Date: Thu, 19 Mar 2020 14:19:57 -0700 Subject: [PATCH] Fixes query logic when not instant What should have been the final branch of an if / else if sequence was broken from it and so VISIBLE_TO_INSTANT activities were being made visible to normal packages targetting R. This change fixes that. Fixes: 151696596 Test: atest AppEnumerationTests Change-Id: I8e60c52a1e917d56d2714fed049788439bd2acc6 --- .../com/android/server/pm/PackageManagerService.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java index 24ebd32f2e2d5..874853b2f25cc 100644 --- a/services/core/java/com/android/server/pm/PackageManagerService.java +++ b/services/core/java/com/android/server/pm/PackageManagerService.java @@ -7240,8 +7240,8 @@ public class PackageManagerService extends IPackageManager.Stub resolveInfos.set(i, installerInfo); continue; } - // caller is a full app if (ephemeralPkgName == null) { + // caller is a full app SettingBase callingSetting = mSettings.getSettingLPr(UserHandle.getAppId(filterCallingUid)); PackageSetting resolvedSetting = @@ -7261,11 +7261,9 @@ public class PackageManagerService extends IPackageManager.Stub && intent.getComponent() == null) { // ephemeral apps can launch other ephemeral apps indirectly continue; - } - // allow activities that have been explicitly exposed to ephemeral apps - final boolean isEphemeralApp = info.activityInfo.applicationInfo.isInstantApp(); - if (!isEphemeralApp - && ((info.activityInfo.flags & ActivityInfo.FLAG_VISIBLE_TO_INSTANT_APP) != 0)) { + } else if (((info.activityInfo.flags & ActivityInfo.FLAG_VISIBLE_TO_INSTANT_APP) != 0) + && !info.activityInfo.applicationInfo.isInstantApp()) { + // allow activities that have been explicitly exposed to ephemeral apps continue; } resolveInfos.remove(i);