summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--service/java/com/android/server/wifi/WifiConnectivityManager.java10
-rw-r--r--service/java/com/android/server/wifi/WifiServiceImpl.java23
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);
}