summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Chiachang Wang <chiachangwang@google.com> 2020-02-21 17:50:18 +0800
committer Chiachang Wang <chiachangwang@google.com> 2020-02-21 17:50:18 +0800
commit96ca8e9fff61bdbc2da9ca34c82d8f7fed106d94 (patch)
tree36bda31291a65b7b9dc9545fa995dd62e8094f03
parent269d32a0fabbfea02b1dbe543f8490878b0af15b (diff)
Use exposed permission defintion in Tethering
The permissions are checked by Tethering; mainline modules should be able to do permission checks based on these permissions. Bug: 135411507 Test: m Change-Id: Ib7f2aedfaaa909bbc356196114c62af9345f2593
-rw-r--r--packages/Tethering/src/com/android/server/connectivity/tethering/Tethering.java10
1 files changed, 4 insertions, 6 deletions
diff --git a/packages/Tethering/src/com/android/server/connectivity/tethering/Tethering.java b/packages/Tethering/src/com/android/server/connectivity/tethering/Tethering.java
index 33335633f61d..84ca656d64ba 100644
--- a/packages/Tethering/src/com/android/server/connectivity/tethering/Tethering.java
+++ b/packages/Tethering/src/com/android/server/connectivity/tethering/Tethering.java
@@ -16,6 +16,8 @@
package com.android.server.connectivity.tethering;
+import static android.Manifest.permission.NETWORK_SETTINGS;
+import static android.Manifest.permission.NETWORK_STACK;
import static android.content.pm.PackageManager.PERMISSION_GRANTED;
import static android.hardware.usb.UsbManager.USB_CONFIGURED;
import static android.hardware.usb.UsbManager.USB_CONNECTED;
@@ -150,10 +152,6 @@ public class Tethering {
private static final boolean DBG = false;
private static final boolean VDBG = false;
- // TODO: add the below permissions to @SystemApi
- private static final String PERMISSION_NETWORK_SETTINGS = "android.permission.NETWORK_SETTINGS";
- private static final String PERMISSION_NETWORK_STACK = "android.permission.NETWORK_STACK";
-
private static final Class[] sMessageClasses = {
Tethering.class, TetherMasterSM.class, IpServer.class
};
@@ -1987,9 +1985,9 @@ public class Tethering {
/** Register tethering event callback */
void registerTetheringEventCallback(ITetheringEventCallback callback) {
final boolean hasListPermission =
- hasCallingPermission(PERMISSION_NETWORK_SETTINGS)
+ hasCallingPermission(NETWORK_SETTINGS)
|| hasCallingPermission(PERMISSION_MAINLINE_NETWORK_STACK)
- || hasCallingPermission(PERMISSION_NETWORK_STACK);
+ || hasCallingPermission(NETWORK_STACK);
mHandler.post(() -> {
mTetheringEventCallbacks.register(callback, new CallbackCookie(hasListPermission));
final TetheringCallbackStartedParcel parcel = new TetheringCallbackStartedParcel();