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

Commit 8f6b8d31 authored by Kunal Malhotra's avatar Kunal Malhotra Committed by Automerger Merge Worker
Browse files

Merge "Adding in verification of calling UID in onShellCommand" into rvc-dev...

Merge "Adding in verification of calling UID in onShellCommand" into rvc-dev am: 7c905e10 am: ca34073d

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



Change-Id: If1714cbfb29550144f9bd663baf2504290a2c71b
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents af9de2e6 ca34073d
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -8663,6 +8663,13 @@ public class ActivityManagerService extends IActivityManager.Stub
    public void onShellCommand(FileDescriptor in, FileDescriptor out,
            FileDescriptor err, String[] args, ShellCallback callback,
            ResultReceiver resultReceiver) {
        final int callingUid = Binder.getCallingUid();
        if (callingUid != ROOT_UID && callingUid != Process.SHELL_UID) {
            if (resultReceiver != null) {
                resultReceiver.send(-1, null);
            }
            throw new SecurityException("Shell commands are only callable by root or shell");
        }
        (new ActivityManagerShellCommand(this, false)).exec(
                this, in, out, err, args, callback, resultReceiver);
    }