summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorDavid Su <dysu@google.com>2019-10-11 19:02:07 +0000
committerDavid Su <dysu@google.com>2019-11-01 20:25:15 -0700
commitccffa4a350fb26d7e1a5ff96ca3825db97f5c4c9 (patch)
tree8fa8a866ce41acbd18cedbbff90eeb7d7114808d /service
parent26e83c9a0ebd8466285451cbd258249b149aa064 (diff)
Accept either MAINLINE_NETWORK_STACK or NETWORK_STACK permission.
Accept both permissions until tethering has been moved to the MAINLINE_NETWORK_STACK permission, then stop checking for NETWORK_STACK permission. Bug: 142372871 Test: compiles Change-Id: I0c431e27ea6f5d46ebf9e32c283040889bd48056 Merged-In: I0c431e27ea6f5d46ebf9e32c283040889bd48056
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/WifiServiceImpl.java12
1 files changed, 10 insertions, 2 deletions
diff --git a/service/java/com/android/server/wifi/WifiServiceImpl.java b/service/java/com/android/server/wifi/WifiServiceImpl.java
index cf5dcea97..685bb479e 100644
--- a/service/java/com/android/server/wifi/WifiServiceImpl.java
+++ b/service/java/com/android/server/wifi/WifiServiceImpl.java
@@ -58,6 +58,7 @@ import android.database.ContentObserver;
import android.net.DhcpInfo;
import android.net.DhcpResults;
import android.net.Network;
+import android.net.NetworkStack;
import android.net.NetworkUtils;
import android.net.Uri;
import android.net.ip.IpClientUtil;
@@ -785,8 +786,15 @@ public class WifiServiceImpl extends BaseWifiService {
}
private void enforceNetworkStackPermission() {
- mContext.enforceCallingOrSelfPermission(android.Manifest.permission.NETWORK_STACK,
- "WifiService");
+ // TODO(b/142554155): Only check for MAINLINE_NETWORK_STACK permission
+ boolean granted = mContext.checkCallingOrSelfPermission(
+ android.Manifest.permission.NETWORK_STACK)
+ == PackageManager.PERMISSION_GRANTED;
+ if (granted) {
+ return;
+ }
+ mContext.enforceCallingOrSelfPermission(
+ NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK, "WifiService");
}
private void enforceAccessPermission() {