summaryrefslogtreecommitdiff
path: root/src/com/android/server/util/PermissionUtil.java
diff options
context:
space:
mode:
authorRemi NGUYEN VAN <reminv@google.com>2019-01-13 03:10:49 +0900
committerRemi NGUYEN VAN <reminv@google.com>2019-01-21 18:25:01 +0900
commitec9a352d011ea2891ee3aae2d338409c6239e4e8 (patch)
tree21035198cc095438401e86c3e73886446026a88f /src/com/android/server/util/PermissionUtil.java
parent79d05c934fa8a325e7fd9d311541465ab7ff2b74 (diff)
Allow Bluetooth to bind to NetworkStack
Test: flashed, verified bluetooth tethering gets IP address Bug: b/112869080 Change-Id: Idfbfdf54754fea46eb0099b9b9a3bdc29dd241e0
Diffstat (limited to 'src/com/android/server/util/PermissionUtil.java')
-rw-r--r--src/com/android/server/util/PermissionUtil.java17
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);
}
}