diff options
author | Wale Ogunwale <ogunwale@google.com> | 2015-05-27 06:06:51 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2015-05-27 06:06:51 +0000 |
commit | 21531bce0e8848311c7f8caceeee3b988c7396f4 (patch) | |
tree | 5bf9768d3d9d4df6171bfa730eaf382515b39401 /services | |
parent | 54856cc75f5dbbfa18aa0f84b69fbcaad7c25cc4 (diff) | |
parent | 5714170091065bb51f33c8f3ce272db07f69a21b (diff) | |
download | frameworks_base-21531bce0e8848311c7f8caceeee3b988c7396f4.zip frameworks_base-21531bce0e8848311c7f8caceeee3b988c7396f4.tar.gz frameworks_base-21531bce0e8848311c7f8caceeee3b988c7396f4.tar.bz2 |
am 57141700: am 0f771240: am bf0439a7: am 02f3cf79: am 523a19bf: am c9a0c0b9: Lockdown AM.getRunningAppProcesses API with permission.REAL_GET_TASKS
* commit '5714170091065bb51f33c8f3ce272db07f69a21b':
Lockdown AM.getRunningAppProcesses API with permission.REAL_GET_TASKS
Diffstat (limited to 'services')
-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); } |