Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 22d8bb2c authored by Todd Kennedy's avatar Todd Kennedy
Browse files

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
parent 34bc4af8
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -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<ResolveInfo>();
                    if (result == null) {
                        result = new ArrayList<>();
                    }
                }
            }
        }