From 57a0fad19e7ea4cb59675fd6ead148321428cfd0 Mon Sep 17 00:00:00 2001 From: Rhed Jao Date: Mon, 25 Jan 2021 20:15:25 +0800 Subject: [PATCH] Do not adding ResolveInfo if no ephemeral installer For the components such as Provider and Service declared in the base apk but defined in the non-installed split. Do not adding it to the ResolveInfo List in the query intent resolve functions if the ephemeral installer could not be found. Bug: 177638069 Test: atest SplitTests Change-Id: Ibf4f4fc5b594326da88edbb2d12f9f6399df38c6 --- .../android/server/pm/PackageManagerService.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java index e7a04ef2b449d..c730ca2fa7fa8 100644 --- a/services/core/java/com/android/server/pm/PackageManagerService.java +++ b/services/core/java/com/android/server/pm/PackageManagerService.java @@ -3138,6 +3138,14 @@ public class PackageManagerService extends IPackageManager.Stub if (info.serviceInfo.splitName != null && !ArrayUtils.contains(info.serviceInfo.applicationInfo.splitNames, info.serviceInfo.splitName)) { + if (instantAppInstallerActivity() == null) { + if (DEBUG_INSTANT) { + Slog.v(TAG, "No installer - not adding it to the ResolveInfo" + + "list"); + } + resolveInfos.remove(i); + continue; + } // requested service is defined in a split that hasn't been installed yet. // add the installer to the resolve list if (DEBUG_INSTANT) { @@ -10551,6 +10559,13 @@ public class PackageManagerService extends IPackageManager.Stub if (info.providerInfo.splitName != null && !ArrayUtils.contains(info.providerInfo.applicationInfo.splitNames, info.providerInfo.splitName)) { + if (mInstantAppInstallerActivity == null) { + if (DEBUG_INSTANT) { + Slog.v(TAG, "No installer - not adding it to the ResolveInfo list"); + } + resolveInfos.remove(i); + continue; + } // requested provider is defined in a split that hasn't been installed yet. // add the installer to the resolve list if (DEBUG_INSTANT) {