diff options
| author | 2023-11-06 21:41:24 +0000 | |
|---|---|---|
| committer | 2023-11-06 21:41:24 +0000 | |
| commit | 2bc772d33690b458ea277e15cf0524f0c54e86d6 (patch) | |
| tree | cf566e017dbe5a200df77e5dc986a4a69037d54c | |
| parent | 9a24157c26a2f55c60a7eb8808c25dcc9d8b2fb8 (diff) | |
| parent | 9a14267036edef6224a7418f92b9d3f88f2ac5b7 (diff) | |
Merge "DO NOT MERGE: Fix ActivityManager#killBackgroundProcesses permissions" into sc-v2-dev
| -rw-r--r-- | services/core/java/com/android/server/am/ActivityManagerService.java | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index ffa290649580..a71be69c2860 100644 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -3690,6 +3690,22 @@ public class ActivityManagerService extends IActivityManager.Stub throw new SecurityException(msg); } + final int callingUid = Binder.getCallingUid(); + final int callingPid = Binder.getCallingPid(); + + ProcessRecord proc; + synchronized (mPidsSelfLocked) { + proc = mPidsSelfLocked.get(callingPid); + } + if (callingUid >= FIRST_APPLICATION_UID + && (proc == null || !proc.info.isSystemApp())) { + final String msg = "Permission Denial: killAllBackgroundProcesses() from pid=" + + callingPid + ", uid=" + callingUid + " is not allowed"; + Slog.w(TAG, msg); + // Silently return to avoid existing apps from crashing. + return; + } + final long callingId = Binder.clearCallingIdentity(); try { synchronized (this) { @@ -3730,22 +3746,6 @@ public class ActivityManagerService extends IActivityManager.Stub throw new SecurityException(msg); } - final int callingUid = Binder.getCallingUid(); - final int callingPid = Binder.getCallingPid(); - - ProcessRecord proc; - synchronized (mPidsSelfLocked) { - proc = mPidsSelfLocked.get(callingPid); - } - if (callingUid >= FIRST_APPLICATION_UID - && (proc == null || !proc.info.isSystemApp())) { - final String msg = "Permission Denial: killAllBackgroundProcesses() from pid=" - + callingPid + ", uid=" + callingUid + " is not allowed"; - Slog.w(TAG, msg); - // Silently return to avoid existing apps from crashing. - return; - } - final long callingId = Binder.clearCallingIdentity(); try { synchronized (this) { |