diff options
-rw-r--r-- | service/java/com/android/server/wifi/WifiConfigManager.java | 2 | ||||
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java | 20 |
2 files changed, 20 insertions, 2 deletions
diff --git a/service/java/com/android/server/wifi/WifiConfigManager.java b/service/java/com/android/server/wifi/WifiConfigManager.java index 79dfb8716..c403387df 100644 --- a/service/java/com/android/server/wifi/WifiConfigManager.java +++ b/service/java/com/android/server/wifi/WifiConfigManager.java @@ -561,7 +561,7 @@ public class WifiConfigManager { boolean savedOnly, boolean maskPasswords, int targetUid) { List<WifiConfiguration> networks = new ArrayList<>(); for (WifiConfiguration config : getInternalConfiguredNetworks()) { - if (savedOnly && config.ephemeral) { + if (savedOnly && (config.ephemeral || config.isPasspoint())) { continue; } networks.add(createExternalWifiConfiguration(config, maskPasswords, targetUid)); diff --git a/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java b/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java index e4da770ee..9d3ea9f9c 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java @@ -542,7 +542,7 @@ public class WifiConfigManagerTest { /** * Verifies the addition of a single ephemeral network using * {@link WifiConfigManager#addOrUpdateNetwork(WifiConfiguration, int)} and verifies that - * the {@link WifiConfigManager#getSavedNetworks()} does not return this network. + * the {@link WifiConfigManager#getSavedNetworks(int)} does not return this network. */ @Test public void testAddSingleEphemeralNetwork() throws Exception { @@ -564,6 +564,24 @@ public class WifiConfigManagerTest { } /** + * Verifies the addition of a single passpoint network using + * {@link WifiConfigManager#addOrUpdateNetwork(WifiConfiguration, int)} and verifies that + * the {@link WifiConfigManager#getSavedNetworks(int)} ()} does not return this network. + */ + @Test + public void testAddSinglePasspointNetwork() throws Exception { + WifiConfiguration passpointNetwork = WifiConfigurationTestUtil.createPasspointNetwork(); + + verifyAddPasspointNetworkToWifiConfigManager(passpointNetwork); + // Ensure that configured network list is not empty. + assertFalse(mWifiConfigManager.getConfiguredNetworks().isEmpty()); + + // Ensure that this is not returned in the saved network list. + assertTrue(mWifiConfigManager.getSavedNetworks(Process.WIFI_UID).isEmpty()); + verify(mWcmListener, never()).onSavedNetworkAdded(passpointNetwork.networkId); + } + + /** * Verifies the addition of 2 networks (1 normal and 1 ephemeral) using * {@link WifiConfigManager#addOrUpdateNetwork(WifiConfiguration, int)} and ensures that * the ephemeral network configuration is not persisted in config store. |