diff options
-rw-r--r-- | services/core/java/com/android/server/am/ActivityManagerService.java | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index 092e232..b1fea1c 100644 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -8201,7 +8201,7 @@ public final class ActivityManagerService extends ActivityManagerNative } if (!allowed) { Slog.w(TAG, caller + ": caller " + callingUid - + " does not hold GET_TASKS; limiting output"); + + " does not hold REAL_GET_TASKS; limiting output"); } return allowed; } @@ -12335,16 +12335,23 @@ public final class ActivityManagerService extends ActivityManagerNative public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses() { enforceNotIsolatedCaller("getRunningAppProcesses"); + + final int callingUid = Binder.getCallingUid(); + // Lazy instantiation of list List<ActivityManager.RunningAppProcessInfo> runList = null; final boolean allUsers = ActivityManager.checkUidPermission(INTERACT_ACROSS_USERS_FULL, - Binder.getCallingUid()) == PackageManager.PERMISSION_GRANTED; - int userId = UserHandle.getUserId(Binder.getCallingUid()); + callingUid) == PackageManager.PERMISSION_GRANTED; + final int userId = UserHandle.getUserId(callingUid); + final boolean allUids = isGetTasksAllowed( + "getRunningAppProcesses", Binder.getCallingPid(), callingUid); + synchronized (this) { // Iterate across all processes - for (int i=mLruProcesses.size()-1; i>=0; i--) { + for (int i = mLruProcesses.size() - 1; i >= 0; i--) { ProcessRecord app = mLruProcesses.get(i); - if (!allUsers && app.userId != userId) { + if ((!allUsers && app.userId != userId) + || (!allUids && app.uid != callingUid)) { continue; } if ((app.thread != null) && (!app.crashing && !app.notResponding)) { @@ -12368,7 +12375,7 @@ public final class ActivityManagerService extends ActivityManagerNative //Slog.v(TAG, "Proc " + app.processName + ": imp=" + currApp.importance // + " lru=" + currApp.lru); if (runList == null) { - runList = new ArrayList<ActivityManager.RunningAppProcessInfo>(); + runList = new ArrayList<>(); } runList.add(currApp); } |