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

Unverified Commit ab172a14 authored by Jing Ji's avatar Jing Ji Committed by Kevin F. Haggerty
Browse files

DO NOT MERGE: Fix ActivityManager#killBackgroundProcesses permissions

In the pevious CL, we incorrectly added the permission check in the
killBackgroundProcessesExcept. Now fix this issue.

Bug: 239423414
Bug: 223376078
Test: atest CtsAppTestCases:ActivityManagerTest
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:140fce861944419a375c669010c6c47cd7ff5b37)
Merged-In: I9471a77188ee63ec32cd0c81569193e4ccad885b
AOSP-Change-Id: I9471a77188ee63ec32cd0c81569193e4ccad885b

Change-Id: I1b1e683b6a92b0fa2a844a99bedcccac8c980e58
parent ba7e9fa7
Loading
Loading
Loading
Loading
+0 −16
Original line number Diff line number Diff line
@@ -3746,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) {