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

Commit 79f141c2 authored by Ivan Chiang's avatar Ivan Chiang Committed by Android (Google) Code Review
Browse files

Merge "[PM] Fix the NPE" into main

parents b918d671 683e4fa4
Loading
Loading
Loading
Loading
+18 −9
Original line number Diff line number Diff line
@@ -760,13 +760,18 @@ public class ComputerEngine implements Computer {
        if (pkgName == null) {
            if (!mCrossProfileIntentResolverEngine.shouldSkipCurrentProfile(this, intent,
                    resolvedType, userId)) {

                final List<ResolveInfo> queryResult = mComponentResolver.queryActivities(this,
                        intent, resolvedType, flags, userId);
                // If the user doesn't exist, the queryResult is null
                if (queryResult != null) {
                    /*
                     Check for results in the current profile only if there is no
                     {@link CrossProfileIntentFilter} for user with flag
                     {@link PackageManager.SKIP_CURRENT_PROFILE} set.
                     */
                result.addAll(filterIfNotSystemUser(mComponentResolver.queryActivities(this,
                        intent, resolvedType, flags, userId), userId));
                    result.addAll(filterIfNotSystemUser(queryResult, userId));
                }
            }
            addInstant = isInstantAppResolutionAllowed(intent, result, userId,
                    false /*skipPackageCheck*/, flags);
@@ -788,9 +793,13 @@ public class ComputerEngine implements Computer {

            if (setting != null && setting.getAndroidPackage() != null && (resolveForStart
                    || !shouldFilterApplication(setting, filterCallingUid, userId))) {
                result.addAll(filterIfNotSystemUser(mComponentResolver.queryActivities(this,
                final List<ResolveInfo> queryResult = mComponentResolver.queryActivities(this,
                        intent, resolvedType, flags, setting.getAndroidPackage().getActivities(),
                        userId), userId));
                        userId);
                // If the user doesn't exist, the queryResult is null
                if (queryResult != null) {
                    result.addAll(filterIfNotSystemUser(queryResult, userId));
                }
            }
            if (result == null || result.size() == 0) {
                // the caller wants to resolve for a particular package; however, there