diff options
author | Etan Cohen <etancohen@google.com> | 2016-08-18 16:52:43 -0700 |
---|---|---|
committer | Etan Cohen <etancohen@google.com> | 2016-08-19 12:31:37 -0700 |
commit | f46c53450a5706846fe4dbc1acc35c15eec17018 (patch) | |
tree | 553ed2ab185974280744b29721178d0902767fa3 /service | |
parent | 65e89d2063f6ee50d00a2579b809deb0a98b5d8b (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.java | 20 |
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); + } } |