summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorHai Shalom <haishalom@google.com>2020-01-06 21:14:06 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2020-01-06 21:14:06 +0000
commit6632bbc1fb548fa613fdeaef3bf18ae08a8e8a47 (patch)
tree3d380d2190903b8d7041ccd01bf3b4c39fff5433 /service
parenta855d2dd2a07926d8c82e57ba6f1ef634f0cb3f1 (diff)
parentecd58085c1e1c53560144d0c8232fb23c1561371 (diff)
Merge "[Encrypted IMSI] Add support for EAP Method prefix"
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/util/TelephonyUtil.java24
1 files changed, 21 insertions, 3 deletions
diff --git a/service/java/com/android/server/wifi/util/TelephonyUtil.java b/service/java/com/android/server/wifi/util/TelephonyUtil.java
index 3f4f22466..f2761d555 100644
--- a/service/java/com/android/server/wifi/util/TelephonyUtil.java
+++ b/service/java/com/android/server/wifi/util/TelephonyUtil.java
@@ -102,6 +102,7 @@ public class TelephonyUtil {
private boolean mVerboseLogEnabled = false;
private SparseBooleanArray mImsiEncryptionRequired = new SparseBooleanArray();
private SparseBooleanArray mImsiEncryptionInfoAvailable = new SparseBooleanArray();
+ private SparseBooleanArray mEapMethodPrefixEnable = new SparseBooleanArray();
/**
* Gets the instance of TelephonyUtil.
@@ -160,6 +161,7 @@ public class TelephonyUtil {
mImsiEncryptionRequired.clear();
mImsiEncryptionInfoAvailable.clear();
+ mEapMethodPrefixEnable.clear();
List<SubscriptionInfo> activeSubInfos =
mSubscriptionManager.getActiveSubscriptionInfoList();
if (activeSubInfos == null) {
@@ -174,6 +176,12 @@ public class TelephonyUtil {
mImsiEncryptionRequired.put(subId, true);
}
+ if ((carrierConfigManager.getConfigForSubId(subId)
+ .getBoolean(CarrierConfigManager.ENABLE_EAP_METHOD_PREFIX_BOOL))) {
+ vlogd("EAP Prefix is required for " + subId);
+ mEapMethodPrefixEnable.put(subId, true);
+ }
+
try {
if (mImsiEncryptionRequired.get(subId)
&& mTelephonyManager.createForSubscriptionId(subId)
@@ -352,7 +360,15 @@ public class TelephonyUtil {
}
String realm = String.format(THREE_GPP_NAI_REALM_FORMAT, mnc, mcc);
- return ANONYMOUS_IDENTITY + "@" + realm;
+ StringBuilder sb = new StringBuilder();
+ if (mEapMethodPrefixEnable.get(subId)) {
+ // Set the EAP method as a prefix
+ String eapMethod = EAP_METHOD_PREFIX.get(config.enterpriseConfig.getEapMethod());
+ if (!TextUtils.isEmpty(eapMethod)) {
+ sb.append(eapMethod);
+ }
+ }
+ return sb.append(ANONYMOUS_IDENTITY).append("@").append(realm).toString();
}
/**
@@ -512,8 +528,10 @@ public class TelephonyUtil {
* Returns true if {@code identity} contains an anonymous@realm identity, false otherwise.
*/
public static boolean isAnonymousAtRealmIdentity(String identity) {
- if (identity == null) return false;
- return identity.startsWith(TelephonyUtil.ANONYMOUS_IDENTITY + "@");
+ if (TextUtils.isEmpty(identity)) return false;
+ final String anonymousId = TelephonyUtil.ANONYMOUS_IDENTITY + "@";
+ return identity.startsWith(anonymousId)
+ || identity.substring(1).startsWith(anonymousId);
}
// TODO replace some of this code with Byte.parseByte