From a6850061f043da5cc827ea805eb750c6d416fc60 Mon Sep 17 00:00:00 2001 From: Vinit Nayak Date: Wed, 11 Dec 2019 16:24:20 -0800 Subject: [PATCH] Permit Recents component to access multiple users data After switching users, Recents maintains task state listeners for all users and as such needs to request tasks from all users instead of just the current one. There's a separate task in which we need to audit the callbacks and associate userIds with them or only send callbacks to potentially active users. See b/146080174 However, some components around sysUi still need access to multiple users data so this removal of this check is still necessary. Fixes: 144702576 Test: Setup work profile under primary user using Test DPC app. Opened both work and non-work profile apps, switch profile to guest, observed no crash. Also did test steps in ag/3469837 for which the checks were originally introduced. Change-Id: I9b30a0287246594200fba7a3af075d0051b5fac2 --- .../core/java/com/android/server/am/UserController.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/services/core/java/com/android/server/am/UserController.java b/services/core/java/com/android/server/am/UserController.java index 2b207827a5ef1..8ae18ff68b66e 100644 --- a/services/core/java/com/android/server/am/UserController.java +++ b/services/core/java/com/android/server/am/UserController.java @@ -1645,10 +1645,9 @@ class UserController implements Handler.Callback { final boolean allow; final boolean isSameProfileGroup = isSameProfileGroup(callingUserId, targetUserId); if (mInjector.isCallerRecents(callingUid) - && callingUserId == getCurrentUserId() - && isSameProfileGroup) { - // If the caller is Recents and it is running in the current user, we then allow it - // to access its profiles. + && isSameProfileGroup(callingUserId, targetUserId)) { + // If the caller is Recents and the caller has ownership of the profile group, + // we then allow it to access its profiles. allow = true; } else if (mInjector.checkComponentPermission(INTERACT_ACROSS_USERS_FULL, callingPid, callingUid, -1, true) == PackageManager.PERMISSION_GRANTED) {