diff options
-rw-r--r-- | service/java/com/android/server/wifi/SavedNetworkEvaluator.java | 9 | ||||
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/SavedNetworkEvaluatorTest.java | 27 |
2 files changed, 32 insertions, 4 deletions
diff --git a/service/java/com/android/server/wifi/SavedNetworkEvaluator.java b/service/java/com/android/server/wifi/SavedNetworkEvaluator.java index bf79edaf8..720afd5a7 100644 --- a/service/java/com/android/server/wifi/SavedNetworkEvaluator.java +++ b/service/java/com/android/server/wifi/SavedNetworkEvaluator.java @@ -264,11 +264,12 @@ 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}. + * Ignore Passpoint and Ephemeral networks. They are configured networks, + * but without being persisted to the storage. They are evaluated by + * {@link PasspointNetworkEvaluator} and {@link ScoredNetworkEvaluator} + * respectively. */ - if (network.isPasspoint()) { + if (network.isPasspoint() || network.isEphemeral()) { continue; } diff --git a/tests/wifitests/src/com/android/server/wifi/SavedNetworkEvaluatorTest.java b/tests/wifitests/src/com/android/server/wifi/SavedNetworkEvaluatorTest.java index 78a3a3d0f..7f6360408 100644 --- a/tests/wifitests/src/com/android/server/wifi/SavedNetworkEvaluatorTest.java +++ b/tests/wifitests/src/com/android/server/wifi/SavedNetworkEvaluatorTest.java @@ -172,6 +172,33 @@ public class SavedNetworkEvaluatorTest { } /** + * Do not evaluate networks that {@link WifiConfiguration#isEphemeral}. + */ + @Test + public void ignoreEphemeralNetworks() { + String[] ssids = {"\"test1\"", "\"test2\""}; + String[] bssids = {"6c:f3:7f:ae:8c:f3", "6c:f3:7f:ae:8c:f4"}; + int[] freqs = {2470, 2437}; + String[] caps = {"[ESS]", "[ESS]"}; + int[] levels = {mThresholdQualifiedRssi2G + 8, mThresholdQualifiedRssi2G + 10}; + int[] securities = {SECURITY_NONE, SECURITY_NONE}; + + ScanDetailsAndWifiConfigs scanDetailsAndConfigs = + WifiNetworkSelectorTestUtil.setupScanDetailsAndConfigStore(ssids, bssids, + freqs, caps, levels, securities, mWifiConfigManager, mClock); + List<ScanDetail> scanDetails = scanDetailsAndConfigs.getScanDetails(); + WifiConfiguration[] savedConfigs = scanDetailsAndConfigs.getWifiConfigs(); + for (WifiConfiguration wifiConfiguration : savedConfigs) { + wifiConfiguration.ephemeral = true; + } + + WifiConfiguration candidate = mSavedNetworkEvaluator.evaluateNetworks(scanDetails, + null, null, true, false, null); + + assertNull(candidate); + } + + /** * Set the candidate {@link ScanResult} for all {@link WifiConfiguration}s regardless of * whether they are secure saved, open saved, or {@link WifiConfiguration#useExternalScores}. */ |