From: Todd Kennedy Date: Mon, 15 May 2017 17:25:02 +0000 (-0700) Subject: Always add the instant app installer X-Git-Tag: android-x86-9.0-r1~1044^2~682^2 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=22d8bb2ca310a929803be4c4ab99c44bc43d1a93;p=android-x86%2Fframeworks-base.git Always add the instant app installer Even if we filter out an instant app because the caller doesn't have access to it, always make sure to add the installer when we have the possibility of an instant app. NOTE: This does not have CTS tests since it's impossible to test without involving the resolver. CTS tests will be added in MR1+ when we can make changes to the APIs and add the necessary methods to mock out the resolver service. Change-Id: I92c88eb04520c0c5e0c58db6d668ed0a0e552a35 Fixes: 38268052 Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.EphemeralTest --- diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java index 093cdbc58019..cb8ae49d61fa 100644 --- a/services/core/java/com/android/server/pm/PackageManagerService.java +++ b/services/core/java/com/android/server/pm/PackageManagerService.java @@ -6474,18 +6474,22 @@ public class PackageManagerService extends IPackageManager.Stub } } else { final PackageParser.Package pkg = mPackages.get(pkgName); + result = null; if (pkg != null) { - return applyPostResolutionFilter(filterIfNotSystemUser( + result = filterIfNotSystemUser( mActivities.queryIntentForPackage( intent, resolvedType, flags, pkg.activities, userId), - userId), instantAppPkgName); - } else { + userId); + } + if (result == null || result.size() == 0) { // the caller wants to resolve for a particular package; however, there // were no installed results, so, try to find an ephemeral result addEphemeral = !ephemeralDisabled && isInstantAppAllowed( intent, null /*result*/, userId, true /*skipPackageCheck*/); - result = new ArrayList(); + if (result == null) { + result = new ArrayList<>(); + } } } }