diff options
author | Roshan Pius <rpius@google.com> | 2019-04-18 12:59:37 -0700 |
---|---|---|
committer | Roshan Pius <rpius@google.com> | 2019-04-18 13:22:23 -0700 |
commit | f9ce345318244e26b173dd2fc54038bccf2388cf (patch) | |
tree | 305965bf71ccf6ab3ce3b00b2f1351a3f477c966 /tests | |
parent | be70cc2e5eb921f4c49ad2ca118211335df8a5dd (diff) |
WifiConfigManager: Remove user choice on disableEphemeralNetwork
For ephemeral networks, disableEpehemeralNetwork() call is equivalent to
the user forgetting the network (albeit for 24 hours). So, remove user
choice set by that network on any other networks.
Also, a minor refactor of disableEphemeralNetwork(return early on null).
Bug: 130816398
Test: Manual verification
Test: atest com.android.server.wifi.WifiConfigManagerTest
Change-Id: I92c01b71ecad4bff3da77bc0cdaf3aa979037bd8
Diffstat (limited to 'tests')
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java b/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java index 2f73ca7f0..4808dd789 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java @@ -4450,6 +4450,37 @@ public class WifiConfigManagerTest { verifyExpiryOfTimeout(passpointNetwork); } + /** + * Verifies the disconnection of Passpoint network using + * {@link WifiConfigManager#disableEphemeralNetwork(String)} and ensures that any user choice + * set over other networks is removed. + */ + @Test + public void testDisablePasspointNetworkRemovesUserChoice() throws Exception { + WifiConfiguration passpointNetwork = WifiConfigurationTestUtil.createPasspointNetwork(); + WifiConfiguration savedNetwork = WifiConfigurationTestUtil.createOpenNetwork(); + + verifyAddNetworkToWifiConfigManager(savedNetwork); + verifyAddPasspointNetworkToWifiConfigManager(passpointNetwork); + + // Set connect choice of passpoint network over saved network. + assertTrue( + mWifiConfigManager.setNetworkConnectChoice( + savedNetwork.networkId, passpointNetwork.configKey(), 78L)); + + WifiConfiguration retrievedSavedNetwork = + mWifiConfigManager.getConfiguredNetwork(savedNetwork.networkId); + assertEquals( + passpointNetwork.configKey(), + retrievedSavedNetwork.getNetworkSelectionStatus().getConnectChoice()); + + // Disable the passpoint network & ensure the user choice is now removed from saved network. + mWifiConfigManager.disableEphemeralNetwork(passpointNetwork.SSID); + + retrievedSavedNetwork = mWifiConfigManager.getConfiguredNetwork(savedNetwork.networkId); + assertNull(retrievedSavedNetwork.getNetworkSelectionStatus().getConnectChoice()); + } + private void verifyExpiryOfTimeout(WifiConfiguration config) { // Disable the ephemeral network. long disableTimeMs = 546643L; |