From 2ac7bbd85d016d5baf582cd6f04dda6f434a3c9f Mon Sep 17 00:00:00 2001 From: Hai Shalom Date: Wed, 26 Aug 2020 15:04:21 -0700 Subject: [Enterprise] Fix hasEnterpriseConfigChanged method Updated the hasEnterpriseConfigChanged method to look at additional fields related to the credential: CA and Client certificate aliases, Subject alternate match and OCSP setting. Bug: 162985598 Test: atest WifiConfigurationUtilTest Change-Id: I6fe2ccf27b71072b06de92128e5c1bf429efe251 Merged-In: I6fe2ccf27b71072b06de92128e5c1bf429efe251 (cherry picked from commit 2828d29df8f91a98cd24cfb2e6f226ac402f330c) --- .../android/server/wifi/WifiConfigurationUtil.java | 23 ++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'service') diff --git a/service/java/com/android/server/wifi/WifiConfigurationUtil.java b/service/java/com/android/server/wifi/WifiConfigurationUtil.java index f37472ead..336d97810 100644 --- a/service/java/com/android/server/wifi/WifiConfigurationUtil.java +++ b/service/java/com/android/server/wifi/WifiConfigurationUtil.java @@ -224,6 +224,11 @@ public class WifiConfigurationUtil { if (existingEnterpriseConfig.getEapMethod() != newEnterpriseConfig.getEapMethod()) { return true; } + if (existingEnterpriseConfig.isAuthenticationSimBased()) { + // No other credential changes for SIM based methods. + // The SIM card is the credential. + return false; + } if (existingEnterpriseConfig.getPhase2Method() != newEnterpriseConfig.getPhase2Method()) { return true; @@ -232,8 +237,7 @@ public class WifiConfigurationUtil { newEnterpriseConfig.getIdentity())) { return true; } - if (!existingEnterpriseConfig.isAuthenticationSimBased() - && !TextUtils.equals(existingEnterpriseConfig.getAnonymousIdentity(), + if (!TextUtils.equals(existingEnterpriseConfig.getAnonymousIdentity(), newEnterpriseConfig.getAnonymousIdentity())) { return true; } @@ -246,6 +250,21 @@ public class WifiConfigurationUtil { if (!Arrays.equals(existingCaCerts, newCaCerts)) { return true; } + if (!Arrays.equals(newEnterpriseConfig.getCaCertificateAliases(), + existingEnterpriseConfig.getCaCertificateAliases())) { + return true; + } + if (!TextUtils.equals(newEnterpriseConfig.getClientCertificateAlias(), + existingEnterpriseConfig.getClientCertificateAlias())) { + return true; + } + if (!TextUtils.equals(newEnterpriseConfig.getAltSubjectMatch(), + existingEnterpriseConfig.getAltSubjectMatch())) { + return true; + } + if (newEnterpriseConfig.getOcsp() != existingEnterpriseConfig.getOcsp()) { + return true; + } } else { // One of the configs may have an enterpriseConfig if (existingEnterpriseConfig != null || newEnterpriseConfig != null) { -- cgit v1.2.3