summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoshan Pius <rpius@google.com>2017-07-17 16:31:59 +0000
committerandroid-build-merger <android-build-merger@google.com>2017-07-17 16:31:59 +0000
commit654ba3541b834d8e4d0516842dd0dc591b8344a7 (patch)
tree6519e8c0aaea1513fddd7709ed45d4d705f6e4fc
parent3ce12580c2b867253e5188595be254e4f840649e (diff)
parent23a870122497d94c83da9bdf7eee06f6eadb275f (diff)
WifiConfigManager: Remove transient networks from PNO list am: 77315558f3
am: 23a8701224 Change-Id: Icc3df851d6451c9aaddd4d0a767e9bd9bb2c81a9
-rw-r--r--service/java/com/android/server/wifi/WifiConfigManager.java3
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java29
2 files changed, 31 insertions, 1 deletions
diff --git a/service/java/com/android/server/wifi/WifiConfigManager.java b/service/java/com/android/server/wifi/WifiConfigManager.java
index 93cdfa64f..0a3a17d08 100644
--- a/service/java/com/android/server/wifi/WifiConfigManager.java
+++ b/service/java/com/android/server/wifi/WifiConfigManager.java
@@ -2310,7 +2310,8 @@ public class WifiConfigManager {
Iterator<WifiConfiguration> iter = networks.iterator();
while (iter.hasNext()) {
WifiConfiguration config = iter.next();
- if (config.getNetworkSelectionStatus().isNetworkPermanentlyDisabled()) {
+ if (config.ephemeral || config.isPasspoint()
+ || config.getNetworkSelectionStatus().isNetworkPermanentlyDisabled()) {
iter.remove();
}
}
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java b/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
index 6996a5825..961d9d676 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
@@ -1492,6 +1492,35 @@ public class WifiConfigManagerTest {
}
/**
+ * Verifies that the list of PNO networks does not contain ephemeral or passpoint networks
+ * {@link WifiConfigManager#retrievePnoNetworkList()}.
+ */
+ @Test
+ public void testRetrievePnoListDoesNotContainEphemeralOrPasspointNetworks() throws Exception {
+ WifiConfiguration savedOpenNetwork = WifiConfigurationTestUtil.createOpenNetwork();
+ WifiConfiguration ephemeralNetwork = WifiConfigurationTestUtil.createEphemeralNetwork();
+ WifiConfiguration passpointNetwork = WifiConfigurationTestUtil.createPasspointNetwork();
+
+ verifyAddNetworkToWifiConfigManager(savedOpenNetwork);
+ verifyAddEphemeralNetworkToWifiConfigManager(ephemeralNetwork);
+ verifyAddPasspointNetworkToWifiConfigManager(passpointNetwork);
+
+ // Enable all of them.
+ assertTrue(mWifiConfigManager.enableNetwork(
+ savedOpenNetwork.networkId, false, TEST_CREATOR_UID));
+ assertTrue(mWifiConfigManager.enableNetwork(
+ ephemeralNetwork.networkId, false, TEST_CREATOR_UID));
+ assertTrue(mWifiConfigManager.enableNetwork(
+ passpointNetwork.networkId, false, TEST_CREATOR_UID));
+
+ // Retrieve the Pno network list & verify the order of the networks returned.
+ List<WifiScanner.PnoSettings.PnoNetwork> pnoNetworks =
+ mWifiConfigManager.retrievePnoNetworkList();
+ assertEquals(1, pnoNetworks.size());
+ assertEquals(savedOpenNetwork.SSID, pnoNetworks.get(0).ssid);
+ }
+
+ /**
* Verifies the linking of networks when they have the same default GW Mac address in
* {@link WifiConfigManager#getOrCreateScanDetailCacheForNetwork(WifiConfiguration)}.
*/