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

Commit e263f7fe authored by Adnan Begovic's avatar Adnan Begovic Committed by Gerrit Code Review
Browse files

pm: Avoid filtering out protected components in implicit queries.

  Implicity queries resolve the target component for an intent, the
  intent (if fired) will be gated by the protected apps feature
  implementation within the activity stack supervisor.

Change-Id: Ib079cfa6093f472d4b85f6b4a986440a764affa3
TICKET: FEIJ-1449
parent 12fdd7fd
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -9448,12 +9448,15 @@ public class PackageManagerService extends IPackageManager.Stub {
            mFlags = flags;
            List<ResolveInfo> list = super.queryIntent(intent, resolvedType,
                    (flags & PackageManager.MATCH_DEFAULT_ONLY) != 0, userId);
            // Remove protected Application components
            // Remove protected Application components if they're explicitly queried for.
            // Implicit intent queries will be gated when the returned component is acted upon.
            int callingUid = Binder.getCallingUid();
            String[] pkgs = getPackagesForUid(callingUid);
            List<String> packages = (pkgs != null) ? Arrays.asList(pkgs) : Collections.EMPTY_LIST;
            if (callingUid != Process.SYSTEM_UID &&
                    (getFlagsForUid(callingUid) & ApplicationInfo.FLAG_SYSTEM) == 0) {
            final boolean isNotSystem = callingUid != Process.SYSTEM_UID &&
                    (getFlagsForUid(callingUid) & ApplicationInfo.FLAG_SYSTEM) == 0;
            if (isNotSystem && intent.getComponent() != null) {
               Iterator<ResolveInfo> itr = list.iterator();
                while (itr.hasNext()) {
                    ActivityInfo activityInfo = itr.next().activityInfo;