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

Commit f1a3a1e7 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Add missing isShellUser check" into oc-mr1-dev am: 0fb5377e

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12172257

Change-Id: I20b599818c78955b120a68a5823948db46e96014
parents 095a00f2 0fb5377e
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -4827,9 +4827,18 @@ public class ActivityManagerService extends IActivityManager.Stub
        return procState;
    }
    private boolean isCallerShell() {
        final int callingUid = Binder.getCallingUid();
        return callingUid == SHELL_UID || callingUid == ROOT_UID;
    }
    @Override
    public boolean setProcessMemoryTrimLevel(String process, int userId, int level)
            throws RemoteException {
        if (!isCallerShell()) {
            EventLog.writeEvent(0x534e4554, 160390416, Binder.getCallingUid(), "");
            throw new SecurityException("Only shell can call it");
        }
        synchronized (this) {
            final ProcessRecord app = findProcessLocked(process, userId, "setProcessMemoryTrimLevel");
            if (app == null) {