summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--service/java/com/android/server/wifi/SavedNetworkEvaluator.java28
-rw-r--r--service/java/com/android/server/wifi/hotspot2/PasspointNetworkEvaluator.java1
-rw-r--r--tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointNetworkEvaluatorTest.java16
3 files changed, 36 insertions, 9 deletions
diff --git a/service/java/com/android/server/wifi/SavedNetworkEvaluator.java b/service/java/com/android/server/wifi/SavedNetworkEvaluator.java
index 25591f59e..98cecf170 100644
--- a/service/java/com/android/server/wifi/SavedNetworkEvaluator.java
+++ b/service/java/com/android/server/wifi/SavedNetworkEvaluator.java
@@ -47,7 +47,6 @@ public class SavedNetworkEvaluator implements WifiNetworkSelector.NetworkEvaluat
private final int mSameNetworkAward;
private final int mBand5GHzAward;
private final int mLastSelectionAward;
- private final int mPasspointSecurityAward;
private final int mSecurityAward;
private final int mNoInternetPenalty;
private final int mThresholdSaturatedRssi24;
@@ -70,8 +69,6 @@ public class SavedNetworkEvaluator implements WifiNetworkSelector.NetworkEvaluat
R.integer.config_wifi_framework_current_network_boost);
mLastSelectionAward = context.getResources().getInteger(
R.integer.config_wifi_framework_LAST_SELECTION_AWARD);
- mPasspointSecurityAward = context.getResources().getInteger(
- R.integer.config_wifi_framework_PASSPOINT_SECURITY_AWARD);
mSecurityAward = context.getResources().getInteger(
R.integer.config_wifi_framework_SECURITY_AWARD);
mBand5GHzAward = context.getResources().getInteger(
@@ -125,6 +122,15 @@ public class SavedNetworkEvaluator implements WifiNetworkSelector.NetworkEvaluat
StringBuffer sbuf = new StringBuffer("Saved Networks List: \n");
for (WifiConfiguration network : savedNetworks) {
+ /**
+ * Ignore Passpoint networks. Passpoint networks are also considered as "saved"
+ * network, but without being persisted to the storage. They are managed
+ * by {@link PasspointNetworkEvaluator}.
+ */
+ if (network.isPasspoint()) {
+ continue;
+ }
+
WifiConfiguration.NetworkSelectionStatus status =
network.getNetworkSelectionStatus();
@@ -211,10 +217,7 @@ public class SavedNetworkEvaluator implements WifiNetworkSelector.NetworkEvaluat
}
// Security award.
- if (network.isPasspoint()) {
- score += mPasspointSecurityAward;
- sbuf.append(" Passpoint bonus: ").append(mPasspointSecurityAward).append(",");
- } else if (!WifiConfigurationUtil.isConfigForOpenNetwork(network)) {
+ if (!WifiConfigurationUtil.isConfigForOpenNetwork(network)) {
score += mSecurityAward;
sbuf.append(" Secure network bonus: ").append(mSecurityAward).append(",");
}
@@ -253,8 +256,6 @@ public class SavedNetworkEvaluator implements WifiNetworkSelector.NetworkEvaluat
// One ScanResult can be associated with more than one networks, hence we calculate all
// the scores and use the highest one as the ScanResult's score.
- // TODO(b/31065385): WifiConfigManager does not support passpoint networks currently.
- // So this list has just one entry always.
List<WifiConfiguration> associatedConfigurations = null;
WifiConfiguration associatedConfiguration =
mWifiConfigManager.getSavedNetworkForScanDetailAndCache(scanDetail);
@@ -267,6 +268,15 @@ public class SavedNetworkEvaluator implements WifiNetworkSelector.NetworkEvaluat
}
for (WifiConfiguration network : associatedConfigurations) {
+ /**
+ * Ignore Passpoint networks. Passpoint networks are also considered as "saved"
+ * network, but without being persisted to the storage. They are being evaluated
+ * by {@link PasspointNetworkEvaluator}.
+ */
+ if (network.isPasspoint()) {
+ continue;
+ }
+
WifiConfiguration.NetworkSelectionStatus status =
network.getNetworkSelectionStatus();
status.setSeenInLastQualifiedNetworkSelection(true);
diff --git a/service/java/com/android/server/wifi/hotspot2/PasspointNetworkEvaluator.java b/service/java/com/android/server/wifi/hotspot2/PasspointNetworkEvaluator.java
index 5eafc1759..f08b5de32 100644
--- a/service/java/com/android/server/wifi/hotspot2/PasspointNetworkEvaluator.java
+++ b/service/java/com/android/server/wifi/hotspot2/PasspointNetworkEvaluator.java
@@ -124,6 +124,7 @@ public class PasspointNetworkEvaluator implements WifiNetworkSelector.NetworkEva
localLog("Failed to add passpoint network");
return null;
}
+ mWifiConfigManager.enableNetwork(result.getNetworkId(), false, Process.WIFI_UID);
mWifiConfigManager.setNetworkCandidateScanResult(result.getNetworkId(),
scanDetail.getScanResult(), 0);
mWifiConfigManager.updateScanDetailForNetwork(result.getNetworkId(), scanDetail);
diff --git a/tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointNetworkEvaluatorTest.java b/tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointNetworkEvaluatorTest.java
index 7312b3334..616e2161a 100644
--- a/tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointNetworkEvaluatorTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointNetworkEvaluatorTest.java
@@ -21,6 +21,7 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.any;
import static org.mockito.Mockito.anyInt;
+import static org.mockito.Mockito.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
@@ -195,6 +196,11 @@ public class PasspointNetworkEvaluatorTest {
verify(mWifiConfigManager).addOrUpdateNetwork(addedConfig.capture(), anyInt());
assertEquals(ScanResultUtil.createQuotedSSID(TEST_SSID1), addedConfig.getValue().SSID);
assertEquals(TEST_FQDN1, addedConfig.getValue().FQDN);
+ verify(mWifiConfigManager).enableNetwork(eq(TEST_NETWORK_ID), eq(false), anyInt());
+ verify(mWifiConfigManager).setNetworkCandidateScanResult(
+ eq(TEST_NETWORK_ID), any(ScanResult.class), anyInt());
+ verify(mWifiConfigManager).updateScanDetailForNetwork(
+ eq(TEST_NETWORK_ID), any(ScanDetail.class));
}
/**
@@ -233,6 +239,11 @@ public class PasspointNetworkEvaluatorTest {
verify(mWifiConfigManager).addOrUpdateNetwork(addedConfig.capture(), anyInt());
assertEquals(ScanResultUtil.createQuotedSSID(TEST_SSID1), addedConfig.getValue().SSID);
assertEquals(TEST_FQDN1, addedConfig.getValue().FQDN);
+ verify(mWifiConfigManager).enableNetwork(eq(TEST_NETWORK_ID), eq(false), anyInt());
+ verify(mWifiConfigManager).setNetworkCandidateScanResult(
+ eq(TEST_NETWORK_ID), any(ScanResult.class), anyInt());
+ verify(mWifiConfigManager).updateScanDetailForNetwork(
+ eq(TEST_NETWORK_ID), any(ScanDetail.class));
}
/**
@@ -275,6 +286,11 @@ public class PasspointNetworkEvaluatorTest {
verify(mWifiConfigManager).addOrUpdateNetwork(addedConfig.capture(), anyInt());
assertEquals(ScanResultUtil.createQuotedSSID(TEST_SSID1), addedConfig.getValue().SSID);
assertEquals(TEST_FQDN1, addedConfig.getValue().FQDN);
+ verify(mWifiConfigManager).enableNetwork(eq(TEST_NETWORK_ID), eq(false), anyInt());
+ verify(mWifiConfigManager).setNetworkCandidateScanResult(
+ eq(TEST_NETWORK_ID), any(ScanResult.class), anyInt());
+ verify(mWifiConfigManager).updateScanDetailForNetwork(
+ eq(TEST_NETWORK_ID), any(ScanDetail.class));
}
/**