summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2020-03-18 23:03:31 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2020-03-18 23:03:31 +0000
commit807336bf4ac1f47408360ca3d36e0a51b6510af0 (patch)
tree456d25c2bba1d2b0877146307fd803970099bdf4
parentac798f2ce039778139e24966af87e391d451ac6d (diff)
parent3239bf0036fc81d2b8a9da3ff31647915e1fc02d (diff)
Merge "Fix user saved passpoint network user disable issue" into rvc-dev
-rw-r--r--service/java/com/android/server/wifi/WifiConfigManager.java6
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java27
2 files changed, 31 insertions, 2 deletions
diff --git a/service/java/com/android/server/wifi/WifiConfigManager.java b/service/java/com/android/server/wifi/WifiConfigManager.java
index db7e4c091..1fd3c5124 100644
--- a/service/java/com/android/server/wifi/WifiConfigManager.java
+++ b/service/java/com/android/server/wifi/WifiConfigManager.java
@@ -1269,8 +1269,10 @@ public class WifiConfigManager {
Log.e(TAG, "Failed to add network to config map", e);
return new NetworkUpdateResult(WifiConfiguration.INVALID_NETWORK_ID);
}
- // Add or update user saved network or saved passpoint network will re-enable network.
- if (!newInternalConfig.fromWifiNetworkSuggestion) {
+ // Only re-enable network: 1. add or update user saved network; 2. add or update a user
+ // saved passpoint network framework consider it is a new network.
+ if (!newInternalConfig.fromWifiNetworkSuggestion
+ && (!newInternalConfig.isPasspoint() || newNetwork)) {
userEnabledNetwork(newInternalConfig.networkId);
}
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java b/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
index 98c82b88e..244cad499 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
@@ -4736,6 +4736,33 @@ public class WifiConfigManagerTest extends WifiBaseTest {
assertFalse(mWifiConfigManager.isNetworkTemporarilyDisabledByUser(openNetwork.SSID));
}
+ @Test
+ public void testUserAddPasspointNetworkEnableNetwork() {
+ WifiConfiguration passpointNetwork = WifiConfigurationTestUtil.createPasspointNetwork();
+ List<WifiConfiguration> networks = new ArrayList<>();
+ networks.add(passpointNetwork);
+ mWifiConfigManager.userTemporarilyDisabledNetwork(passpointNetwork.FQDN);
+ assertTrue(mWifiConfigManager.isNetworkTemporarilyDisabledByUser(passpointNetwork.FQDN));
+ // Add new passpoint network will enable the network.
+ NetworkUpdateResult result = addNetworkToWifiConfigManager(passpointNetwork);
+ assertTrue(result.getNetworkId() != WifiConfiguration.INVALID_NETWORK_ID);
+ assertTrue(result.isNewNetwork());
+
+ List<WifiConfiguration> retrievedNetworks =
+ mWifiConfigManager.getConfiguredNetworksWithPasswords();
+ WifiConfigurationTestUtil.assertConfigurationsEqualForConfigManagerAddOrUpdate(
+ networks, retrievedNetworks);
+ assertFalse(mWifiConfigManager.isNetworkTemporarilyDisabledByUser(passpointNetwork.FQDN));
+
+ mWifiConfigManager.userTemporarilyDisabledNetwork(passpointNetwork.FQDN);
+ assertTrue(mWifiConfigManager.isNetworkTemporarilyDisabledByUser(passpointNetwork.FQDN));
+ // Update a existing passpoint network will not enable network.
+ result = addNetworkToWifiConfigManager(passpointNetwork);
+ assertTrue(result.getNetworkId() != WifiConfiguration.INVALID_NETWORK_ID);
+ assertFalse(result.isNewNetwork());
+ assertTrue(mWifiConfigManager.isNetworkTemporarilyDisabledByUser(passpointNetwork.FQDN));
+ }
+
private void verifyExpiryOfTimeout(WifiConfiguration config) {
// Disable the ephemeral network.
long disableTimeMs = 546643L;