Allow ROOT_UID to execute privileged shell cmds
When adb runs as root, Binder.getCallingUid returns ROOT_UID for shell
commands. Add that to the allow list.
Test: manual
Change-Id: I8457500e2272110496ae7054347490863a446dce
diff --git a/src/com/android/phone/TelephonyShellCommand.java b/src/com/android/phone/TelephonyShellCommand.java
index dc1e7d1..dac797d 100644
--- a/src/com/android/phone/TelephonyShellCommand.java
+++ b/src/com/android/phone/TelephonyShellCommand.java
@@ -439,6 +439,8 @@
}
private boolean checkShellUid() {
- return Binder.getCallingUid() == Process.SHELL_UID;
+ // adb can run as root or as shell, depending on whether the device is rooted.
+ return Binder.getCallingUid() == Process.SHELL_UID
+ || Binder.getCallingUid() == Process.ROOT_UID;
}
}