diff options
author | Peter Qiu <zqiu@google.com> | 2017-03-20 10:25:22 -0700 |
---|---|---|
committer | Peter Qiu <zqiu@google.com> | 2017-03-23 11:01:09 -0700 |
commit | 9af7a553d86c910a14410ddecea6fb9422c41cdb (patch) | |
tree | bf257e34c0873433b7570dcd31c5f89c316bb131 /service | |
parent | e5909d266e65deae7612486cf2cc7570449b8514 (diff) |
hotspot2: add support for the build config flag "config_wifi_hotspot2_enabled"
This flag specifies if the Passpoint is enabled or not. Currently,
this flag is set to false for the default overlay.
So do not register PasspointNetworkEvaluator if Passpoint support
is not enabled to avoid any Passpoint related traffics (e.g. ANQP).
Also throw UnsupportedOperationException for any Passpoint related API
calls.
Bug: 32671424
Test: manual test
Change-Id: Icefa9b990d6d989750e5a7f00b4f3f5d83a82960
Diffstat (limited to 'service')
-rw-r--r-- | service/java/com/android/server/wifi/WifiConnectivityManager.java | 10 | ||||
-rw-r--r-- | service/java/com/android/server/wifi/WifiServiceImpl.java | 23 |
2 files changed, 30 insertions, 3 deletions
diff --git a/service/java/com/android/server/wifi/WifiConnectivityManager.java b/service/java/com/android/server/wifi/WifiConnectivityManager.java index 86b9782a4..b41e2d33a 100644 --- a/service/java/com/android/server/wifi/WifiConnectivityManager.java +++ b/service/java/com/android/server/wifi/WifiConnectivityManager.java @@ -542,11 +542,17 @@ public class WifiConnectivityManager { + " secureNetworkBonus " + mSecureBonus + " initialScoreMax " + mInitialScoreMax); + boolean hs2Enabled = context.getResources().getBoolean( + R.bool.config_wifi_hotspot2_enabled); + localLog("Passpoint is: " + (hs2Enabled ? "enabled" : "disabled")); + // Register the network evaluators mNetworkSelector.registerNetworkEvaluator(savedNetworkEvaluator, SAVED_NETWORK_EVALUATOR_PRIORITY); - mNetworkSelector.registerNetworkEvaluator(passpointNetworkEvaluator, - PASSPOINT_NETWORK_EVALUATOR_PRIORITY); + if (hs2Enabled) { + mNetworkSelector.registerNetworkEvaluator(passpointNetworkEvaluator, + PASSPOINT_NETWORK_EVALUATOR_PRIORITY); + } mNetworkSelector.registerNetworkEvaluator(recommendedNetworkEvaluator, RECOMMENDED_NETWORK_EVALUATOR_PRIORITY); diff --git a/service/java/com/android/server/wifi/WifiServiceImpl.java b/service/java/com/android/server/wifi/WifiServiceImpl.java index ee97eb498..dd8405dce 100644 --- a/service/java/com/android/server/wifi/WifiServiceImpl.java +++ b/service/java/com/android/server/wifi/WifiServiceImpl.java @@ -907,7 +907,8 @@ public class WifiServiceImpl extends IWifiManager.Stub { } /** - * Returns a WifiConfiguration matching this ScanResult + * Returns a WifiConfiguration for a Passpoint network matching this ScanResult. + * * @param scanResult scanResult that represents the BSSID * @return {@link WifiConfiguration} that matches this BSSID or null */ @@ -915,6 +916,10 @@ public class WifiServiceImpl extends IWifiManager.Stub { public WifiConfiguration getMatchingWifiConfig(ScanResult scanResult) { enforceAccessPermission(); mLog.trace("getMatchingWifiConfig uid=%").c(Binder.getCallingUid()).flush(); + if (!mContext.getResources().getBoolean( + com.android.internal.R.bool.config_wifi_hotspot2_enabled)) { + throw new UnsupportedOperationException("Passpoint not enabled"); + } return mWifiStateMachine.syncGetMatchingWifiConfig(scanResult, mWifiStateMachineChannel); } @@ -1101,6 +1106,10 @@ public class WifiServiceImpl extends IWifiManager.Stub { public boolean addOrUpdatePasspointConfiguration(PasspointConfiguration config) { enforceChangePermission(); mLog.trace("addorUpdatePasspointConfiguration uid=%").c(Binder.getCallingUid()).flush(); + if (!mContext.getResources().getBoolean( + com.android.internal.R.bool.config_wifi_hotspot2_enabled)) { + throw new UnsupportedOperationException("Passpoint not enabled"); + } return mWifiStateMachine.syncAddOrUpdatePasspointConfig(mWifiStateMachineChannel, config); } @@ -1114,6 +1123,10 @@ public class WifiServiceImpl extends IWifiManager.Stub { public boolean removePasspointConfiguration(String fqdn) { enforceChangePermission(); mLog.trace("removePasspointConfiguration uid=%").c(Binder.getCallingUid()).flush(); + if (!mContext.getResources().getBoolean( + com.android.internal.R.bool.config_wifi_hotspot2_enabled)) { + throw new UnsupportedOperationException("Passpoint not enabled"); + } return mWifiStateMachine.syncRemovePasspointConfig(mWifiStateMachineChannel, fqdn); } @@ -1128,6 +1141,10 @@ public class WifiServiceImpl extends IWifiManager.Stub { public List<PasspointConfiguration> getPasspointConfigurations() { enforceAccessPermission(); mLog.trace("getPasspointConfigurations uid=%").c(Binder.getCallingUid()).flush(); + if (!mContext.getResources().getBoolean( + com.android.internal.R.bool.config_wifi_hotspot2_enabled)) { + throw new UnsupportedOperationException("Passpoint not enabled"); + } return mWifiStateMachine.syncGetPasspointConfigs(mWifiStateMachineChannel); } @@ -1140,6 +1157,10 @@ public class WifiServiceImpl extends IWifiManager.Stub { public void queryPasspointIcon(long bssid, String fileName) { enforceAccessPermission(); mLog.trace("queryPasspointIcon uid=%").c(Binder.getCallingUid()).flush(); + if (!mContext.getResources().getBoolean( + com.android.internal.R.bool.config_wifi_hotspot2_enabled)) { + throw new UnsupportedOperationException("Passpoint not enabled"); + } mWifiStateMachine.syncQueryPasspointIcon(mWifiStateMachineChannel, bssid, fileName); } |