summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--service/java/com/android/server/wifi/WifiConfigurationUtil.java7
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiConfigurationUtilTest.java25
2 files changed, 32 insertions, 0 deletions
diff --git a/service/java/com/android/server/wifi/WifiConfigurationUtil.java b/service/java/com/android/server/wifi/WifiConfigurationUtil.java
index f706c4e1f..fef78aade 100644
--- a/service/java/com/android/server/wifi/WifiConfigurationUtil.java
+++ b/service/java/com/android/server/wifi/WifiConfigurationUtil.java
@@ -23,6 +23,7 @@ import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiEnterpriseConfig;
import android.net.wifi.WifiScanner;
import android.os.UserHandle;
+import android.text.TextUtils;
import android.util.Log;
import com.android.internal.annotations.VisibleForTesting;
@@ -192,6 +193,12 @@ public class WifiConfigurationUtil {
!= newEnterpriseConfig.getPhase2Method()) {
return true;
}
+ if (!TextUtils.equals(existingEnterpriseConfig.getIdentity(),
+ newEnterpriseConfig.getIdentity())
+ || !TextUtils.equals(existingEnterpriseConfig.getAnonymousIdentity(),
+ newEnterpriseConfig.getAnonymousIdentity())) {
+ return true;
+ }
X509Certificate[] existingCaCerts = existingEnterpriseConfig.getCaCertificates();
X509Certificate[] newCaCerts = newEnterpriseConfig.getCaCertificates();
if (!Arrays.equals(existingCaCerts, newCaCerts)) {
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiConfigurationUtilTest.java b/tests/wifitests/src/com/android/server/wifi/WifiConfigurationUtilTest.java
index 376d686a4..2925273de 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiConfigurationUtilTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiConfigurationUtilTest.java
@@ -495,6 +495,31 @@ public class WifiConfigurationUtilTest {
assertFalse(WifiConfigurationUtil.isSameNetwork(network, network1));
}
+ /**
+ * Verify that WifiConfigurationUtil.isSameNetwork returns false when two WifiConfiguration
+ * objects have the different EAP identity.
+ */
+ @Test
+ public void testIsSameNetworkReturnsFalseOnDifferentEapIdentity() {
+ WifiConfiguration network1 = WifiConfigurationTestUtil.createEapNetwork(TEST_SSID);
+ WifiConfiguration network2 = WifiConfigurationTestUtil.createEapNetwork(TEST_SSID);
+ network1.enterpriseConfig.setIdentity("Identity1");
+ network2.enterpriseConfig.setIdentity("Identity2");
+ assertFalse(WifiConfigurationUtil.isSameNetwork(network1, network2));
+ }
+
+ /**
+ * Verify that WifiConfigurationUtil.isSameNetwork returns false when two WifiConfiguration
+ * objects have the different EAP anonymous identity.
+ */
+ @Test
+ public void testIsSameNetworkReturnsFalseOnDifferentEapAnonymousIdentity() {
+ WifiConfiguration network1 = WifiConfigurationTestUtil.createEapNetwork(TEST_SSID);
+ WifiConfiguration network2 = WifiConfigurationTestUtil.createEapNetwork(TEST_SSID);
+ network1.enterpriseConfig.setAnonymousIdentity("Identity1");
+ network2.enterpriseConfig.setAnonymousIdentity("Identity2");
+ assertFalse(WifiConfigurationUtil.isSameNetwork(network1, network2));
+ }
/**
* Verify the instance of {@link android.net.wifi.WifiScanner.PnoSettings.PnoNetwork} created