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

Commit cdb901b5 authored by Bryce Lee's avatar Bryce Lee
Browse files

Clear calling UID before resolving intent types.

By not clearing the uid, the intent type is not resolved and the
activity fails to launch. This change adds the resolve call to the
cleared UID scope, which previously encapsulated the invocation.

Fixes: 73297146
Test: Open images shortcut from secondary user's Downloads launcher
      icon.

Change-Id: I656a4dcab962ff716bdd2b39441c07a10d5b8c8a
parent a46e4d10
Loading
Loading
Loading
Loading
+6 −3
Original line number Original line Diff line number Diff line
@@ -25925,16 +25925,19 @@ public class ActivityManagerService extends IActivityManager.Stub
                Bundle bOptions) {
                Bundle bOptions) {
            Preconditions.checkNotNull(intents, "intents");
            Preconditions.checkNotNull(intents, "intents");
            final String[] resolvedTypes = new String[intents.length];
            final String[] resolvedTypes = new String[intents.length];
            for (int i = 0; i < intents.length; i++) {
                resolvedTypes[i] = intents[i].resolveTypeIfNeeded(mContext.getContentResolver());
            }
            // UID of the package on user userId.
            // UID of the package on user userId.
            // "= 0" is needed because otherwise catch(RemoteException) would make it look like
            // "= 0" is needed because otherwise catch(RemoteException) would make it look like
            // packageUid may not be initialized.
            // packageUid may not be initialized.
            int packageUid = 0;
            int packageUid = 0;
            final long ident = Binder.clearCallingIdentity();
            final long ident = Binder.clearCallingIdentity();
            try {
            try {
                for (int i = 0; i < intents.length; i++) {
                    resolvedTypes[i] =
                            intents[i].resolveTypeIfNeeded(mContext.getContentResolver());
                }
                packageUid = AppGlobals.getPackageManager().getPackageUid(
                packageUid = AppGlobals.getPackageManager().getPackageUid(
                        packageName, PackageManager.MATCH_DEBUG_TRIAGED_MISSING, userId);
                        packageName, PackageManager.MATCH_DEBUG_TRIAGED_MISSING, userId);
            } catch (RemoteException e) {
            } catch (RemoteException e) {