diff options
| author | 2023-11-08 16:07:22 +0000 | |
|---|---|---|
| committer | 2023-11-08 16:07:22 +0000 | |
| commit | 7ca03665c4bbb253cb639342351001dc668ea06f (patch) | |
| tree | 159e5579d252cbea9214ed614e61f66cd62dd6f1 | |
| parent | 641f8674731f8f6a6f310ee856ca4f1bc92772de (diff) | |
| parent | 140fce861944419a375c669010c6c47cd7ff5b37 (diff) | |
Merge "DO NOT MERGE: Fix ActivityManager#killBackgroundProcesses permissions" into sc-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 ee255b4223d0..43423e25376a 100644 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -3663,6 +3663,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) { @@ -3703,22 +3719,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) { |