Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7ca03665 authored by Jing Ji's avatar Jing Ji Committed by Android (Google) Code Review
Browse files

Merge "DO NOT MERGE: Fix ActivityManager#killBackgroundProcesses permissions" into sc-dev

parents 641f8674 140fce86
Loading
Loading
Loading
Loading
+16 −16
Original line number Diff line number Diff line
@@ -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) {