diff options
author | Peter Qiu <zqiu@google.com> | 2017-03-23 20:43:55 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-03-23 20:43:55 +0000 |
commit | 9e63c7d71a090fc58617fd3899c34a60458df629 (patch) | |
tree | a3beb910da6415f77a7f959f27ab2c3d17e2a516 | |
parent | 70c6644fa335c33117affbbac3cdcdd957990ad6 (diff) | |
parent | de3a7c0e948c41d7663aae426606889d72b5e9f1 (diff) |
Merge "hotspot2: add support for the build config flag "config_wifi_hotspot2_enabled""
am: de3a7c0e94
Change-Id: Ia310bbb69e176aaf42e7c4bede19067d1d1fb454
-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); } |