summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorEtan Cohen <etancohen@google.com>2016-08-18 16:52:43 -0700
committerEtan Cohen <etancohen@google.com>2016-08-19 12:31:37 -0700
commitf46c53450a5706846fe4dbc1acc35c15eec17018 (patch)
tree553ed2ab185974280744b29721178d0902767fa3 /service
parent65e89d2063f6ee50d00a2579b809deb0a98b5d8b (diff)
[NAN] Enforce SystemApi checks using CONNECTIVITY_INTERNAL
Enforce for API: - Enabling/disabling NAN usage - Creating a non-default configuration Bug: 27696149 Change-Id: I402577a92f5adfe0ba57f2e567b64e0d068552eb
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/nan/WifiNanServiceImpl.java20
1 files changed, 10 insertions, 10 deletions
diff --git a/service/java/com/android/server/wifi/nan/WifiNanServiceImpl.java b/service/java/com/android/server/wifi/nan/WifiNanServiceImpl.java
index ec5df3b0c..4600318e0 100644
--- a/service/java/com/android/server/wifi/nan/WifiNanServiceImpl.java
+++ b/service/java/com/android/server/wifi/nan/WifiNanServiceImpl.java
@@ -100,9 +100,7 @@ public class WifiNanServiceImpl extends IWifiNanManager.Stub {
public void enableUsage() {
enforceAccessPermission();
enforceChangePermission();
- /*
- * TODO: enforce additional permissions b/27696149.
- */
+ enforceConnectivityInternalPermission();
mStateManager.enableUsage();
}
@@ -111,9 +109,7 @@ public class WifiNanServiceImpl extends IWifiNanManager.Stub {
public void disableUsage() {
enforceAccessPermission();
enforceChangePermission();
- /*
- * TODO: enforce additional permissions b/27696149.
- */
+ enforceConnectivityInternalPermission();
mStateManager.disableUsage();
@@ -146,10 +142,9 @@ public class WifiNanServiceImpl extends IWifiNanManager.Stub {
}
if (configRequest != null) {
- /*
- * TODO: enforce additional permissions if configuration is
- * non-standard (i.e. the system API). (b/27696149)
- */
+ if (configRequest.isNonDefaultOnTheAir()) {
+ enforceConnectivityInternalPermission();
+ }
} else {
configRequest = new ConfigRequest.Builder().build();
}
@@ -419,4 +414,9 @@ public class WifiNanServiceImpl extends IWifiNanManager.Stub {
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.ACCESS_FINE_LOCATION,
TAG);
}
+
+ private void enforceConnectivityInternalPermission() {
+ mContext.enforceCallingOrSelfPermission(android.Manifest.permission.CONNECTIVITY_INTERNAL,
+ TAG);
+ }
}