From cdb901b584f5042a781dd0512f79f405e1ce8080 Mon Sep 17 00:00:00 2001 From: Bryce Lee Date: Thu, 15 Mar 2018 15:00:01 -0700 Subject: 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 --- .../core/java/com/android/server/am/ActivityManagerService.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index 96633da16508..dba10bd8aff8 100644 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -25925,16 +25925,19 @@ public class ActivityManagerService extends IActivityManager.Stub Bundle bOptions) { Preconditions.checkNotNull(intents, "intents"); 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. // "= 0" is needed because otherwise catch(RemoteException) would make it look like // packageUid may not be initialized. int packageUid = 0; final long ident = Binder.clearCallingIdentity(); + try { + for (int i = 0; i < intents.length; i++) { + resolvedTypes[i] = + intents[i].resolveTypeIfNeeded(mContext.getContentResolver()); + } + packageUid = AppGlobals.getPackageManager().getPackageUid( packageName, PackageManager.MATCH_DEBUG_TRIAGED_MISSING, userId); } catch (RemoteException e) { -- cgit v1.2.3-59-g8ed1b