From a464a9fce8d160d2bbac3aeea3b23ecc7bb179a0 Mon Sep 17 00:00:00 2001 From: Mitchell Wills Date: Thu, 16 Jun 2016 16:51:26 -0700 Subject: [PATCH] Don't save the anonymous identity for EAP-SIM/AKA/AKA-Prime wpa_supplicant can update this value when authenticating so if the framework writes it back the new value can be overwritten. TEST: Patch was validated by original reporter Enterprise tests pass (b/29608435) Change-Id: If359b4ca625371fbdb68177c7cdb6498c3a519a1 Fixes: 28161335 --- wifi/java/android/net/wifi/WifiEnterpriseConfig.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/wifi/java/android/net/wifi/WifiEnterpriseConfig.java b/wifi/java/android/net/wifi/WifiEnterpriseConfig.java index b614a86605098..08ad35ed28088 100644 --- a/wifi/java/android/net/wifi/WifiEnterpriseConfig.java +++ b/wifi/java/android/net/wifi/WifiEnterpriseConfig.java @@ -375,7 +375,15 @@ public class WifiEnterpriseConfig implements Parcelable { return false; } + // wpa_supplicant can update the anonymous identity for these kinds of networks after + // framework reads them, so make sure the framework doesn't try to overwrite them. + boolean shouldNotWriteAnonIdentity = mEapMethod == WifiEnterpriseConfig.Eap.SIM + || mEapMethod == WifiEnterpriseConfig.Eap.AKA + || mEapMethod == WifiEnterpriseConfig.Eap.AKA_PRIME; for (String key : mFields.keySet()) { + if (shouldNotWriteAnonIdentity && ANON_IDENTITY_KEY.equals(key)) { + continue; + } if (!saver.saveValue(key, mFields.get(key))) { return false; }