diff options
author | Roshan Pius <rpius@google.com> | 2018-09-11 14:27:33 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2018-09-11 14:27:33 +0000 |
commit | 8affe3f8197801bd5dc805eefbf75d63d2431432 (patch) | |
tree | be83e6fcb10e010443c04cc78c6b3743b7e4fee7 | |
parent | 86e858c699629e44f268bdc7295d1e2e1c66a16e (diff) | |
parent | bb2676abb394c9b4c236df5c3420140bbd8320f4 (diff) |
Merge "Skip Anonymous Identity check in SIM/AKA/AKA' networks"
-rw-r--r-- | service/java/com/android/server/wifi/WifiConfigurationUtil.java | 10 | ||||
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/WifiConfigurationUtilTest.java | 15 |
2 files changed, 22 insertions, 3 deletions
diff --git a/service/java/com/android/server/wifi/WifiConfigurationUtil.java b/service/java/com/android/server/wifi/WifiConfigurationUtil.java index 8d94862e2..0258834ea 100644 --- a/service/java/com/android/server/wifi/WifiConfigurationUtil.java +++ b/service/java/com/android/server/wifi/WifiConfigurationUtil.java @@ -28,6 +28,7 @@ import android.util.Log; import com.android.internal.annotations.VisibleForTesting; import com.android.server.wifi.util.NativeUtil; +import com.android.server.wifi.util.TelephonyUtil; import java.nio.charset.StandardCharsets; import java.security.cert.X509Certificate; @@ -195,9 +196,12 @@ public class WifiConfigurationUtil { return true; } if (!TextUtils.equals(existingEnterpriseConfig.getIdentity(), - newEnterpriseConfig.getIdentity()) - || !TextUtils.equals(existingEnterpriseConfig.getAnonymousIdentity(), - newEnterpriseConfig.getAnonymousIdentity())) { + newEnterpriseConfig.getIdentity())) { + return true; + } + if (!TelephonyUtil.isSimEapMethod(existingEnterpriseConfig.getEapMethod()) + && !TextUtils.equals(existingEnterpriseConfig.getAnonymousIdentity(), + newEnterpriseConfig.getAnonymousIdentity())) { return true; } if (!TextUtils.equals(existingEnterpriseConfig.getPassword(), diff --git a/tests/wifitests/src/com/android/server/wifi/WifiConfigurationUtilTest.java b/tests/wifitests/src/com/android/server/wifi/WifiConfigurationUtilTest.java index 7bb24371a..3774feca3 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiConfigurationUtilTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiConfigurationUtilTest.java @@ -614,6 +614,21 @@ public class WifiConfigurationUtilTest { } /** + * Verify that WifiConfigurationUtil.isSameNetwork returns true when two WifiConfiguration + * objects have the different EAP anonymous(pseudonym) identity in EAP-SIM. + */ + @Test + public void testIsSameNetworkReturnsTrueOnDifferentEapAnonymousIdentityInEapSim() { + WifiConfiguration network1 = WifiConfigurationTestUtil.createEapNetwork(TEST_SSID); + WifiConfiguration network2 = WifiConfigurationTestUtil.createEapNetwork(TEST_SSID); + network1.enterpriseConfig.setEapMethod(WifiEnterpriseConfig.Eap.SIM); + network2.enterpriseConfig.setEapMethod(WifiEnterpriseConfig.Eap.SIM); + network1.enterpriseConfig.setAnonymousIdentity("Identity1"); + network2.enterpriseConfig.setAnonymousIdentity("Identity2"); + assertTrue(WifiConfigurationUtil.isSameNetwork(network1, network2)); + } + + /** * Verify the instance of {@link android.net.wifi.WifiScanner.PnoSettings.PnoNetwork} created * for a EAP network using {@link WifiConfigurationUtil#createPnoNetwork(WifiConfiguration) * }. |