diff options
Diffstat (limited to 'src/com/android/server/util/PermissionUtil.java')
-rw-r--r-- | src/com/android/server/util/PermissionUtil.java | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/com/android/server/util/PermissionUtil.java b/src/com/android/server/util/PermissionUtil.java index 733f873..82bf038 100644 --- a/src/com/android/server/util/PermissionUtil.java +++ b/src/com/android/server/util/PermissionUtil.java @@ -31,8 +31,21 @@ public final class PermissionUtil { */ public static void checkNetworkStackCallingPermission() { // TODO: check that the calling PID is the system server. - if (getCallingUid() != Process.SYSTEM_UID && getCallingUid() != Process.ROOT_UID) { - throw new SecurityException("Invalid caller: " + getCallingUid()); + final int caller = getCallingUid(); + if (caller != Process.SYSTEM_UID && caller != Process.BLUETOOTH_UID) { + throw new SecurityException("Invalid caller: " + caller); + } + } + + /** + * Check that the caller is allowed to dump the network stack, e.g. dumpsys. + * @throws SecurityException The caller is not allowed to dump the network stack. + */ + public static void checkDumpPermission() { + final int caller = getCallingUid(); + if (caller != Process.SYSTEM_UID && caller != Process.ROOT_UID + && caller != Process.SHELL_UID) { + throw new SecurityException("No dump permissions for caller: " + caller); } } |