summaryrefslogtreecommitdiff
path: root/src/com/android/server/util/PermissionUtil.java
diff options
context:
space:
mode:
authorRemi NGUYEN VAN <reminv@google.com>2019-01-31 08:46:36 +0900
committerRemi NGUYEN VAN <reminv@google.com>2019-01-31 16:03:21 +0900
commitd9595902dabc494c9f1ca351b41d4825e4a2f586 (patch)
tree31141653cb64881bf119bba1c7b561158f5ab3f3 /src/com/android/server/util/PermissionUtil.java
parent5b3645191083aa26d95fe80a01f4fbf1f7a37d3c (diff)
Fix bluetooth tethering on multi-user
Bluetooth runs as UID 1001002 when on a secondary user. With this change the NetworkStack verifies that the calling UID matches the Bluetooth app regardless of the user. Test: flashed, BT reverse tethering still working as primary user (no option to turn on as secondary user on phones) Bug: 123655057 Change-Id: I23f9c5fa40f3bb676ac65dd8c15106c9d78309a4
Diffstat (limited to 'src/com/android/server/util/PermissionUtil.java')
-rw-r--r--src/com/android/server/util/PermissionUtil.java3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/com/android/server/util/PermissionUtil.java b/src/com/android/server/util/PermissionUtil.java
index 82bf038..f6eb900 100644
--- a/src/com/android/server/util/PermissionUtil.java
+++ b/src/com/android/server/util/PermissionUtil.java
@@ -19,6 +19,7 @@ package com.android.server.util;
import static android.os.Binder.getCallingUid;
import android.os.Process;
+import android.os.UserHandle;
/**
* Utility class to check calling permissions on the network stack.
@@ -32,7 +33,7 @@ public final class PermissionUtil {
public static void checkNetworkStackCallingPermission() {
// TODO: check that the calling PID is the system server.
final int caller = getCallingUid();
- if (caller != Process.SYSTEM_UID && caller != Process.BLUETOOTH_UID) {
+ if (caller != Process.SYSTEM_UID && UserHandle.getAppId(caller) != Process.BLUETOOTH_UID) {
throw new SecurityException("Invalid caller: " + caller);
}
}