summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRicardo Cerqueira <ricardo@cyngn.com>2016-05-09 19:54:32 +0100
committerRicardo Cerqueira <ricardo@cyngn.com>2016-05-09 20:04:50 +0100
commit3c8e304e5243233375f8d2c97989a071f8bd9452 (patch)
treeec3d9649e1cb85a89846e02e5e593d99314889b8
parent440b933667a2822ff88588664d2ee1c7d90f8e1d (diff)
downloadandroid_frameworks_opt_net_wifi-3c8e304e5243233375f8d2c97989a071f8bd9452.tar.gz
android_frameworks_opt_net_wifi-3c8e304e5243233375f8d2c97989a071f8bd9452.tar.bz2
android_frameworks_opt_net_wifi-3c8e304e5243233375f8d2c97989a071f8bd9452.zip
Fix EAP-SIM fallback identity generation outside of North America
There are only a few MCCs in which the MNC is expected to be 3-digit long. However, the fallback path for REQ-IDENTITY was assuming that length all the time, which resulted in us getting the wrong realm for the fallback path (which is kicked in when, for example, wifi starts up faster than mobile) Also, SIM states are indexed by slot, not subId Ref CYNGNOS-2768 Change-Id: I3ea01d45e62689075b62df7a169f8734d0c9f5e6 (cherry picked from commit b354a61d44d2ff79c922ac96bbf662825f909dcd)
-rw-r--r--service/java/com/android/server/wifi/WifiStateMachine.java14
1 files changed, 12 insertions, 2 deletions
diff --git a/service/java/com/android/server/wifi/WifiStateMachine.java b/service/java/com/android/server/wifi/WifiStateMachine.java
index f6a7e69d2..d2de558ad 100644
--- a/service/java/com/android/server/wifi/WifiStateMachine.java
+++ b/service/java/com/android/server/wifi/WifiStateMachine.java
@@ -7728,19 +7728,21 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiPno
mContext.getSystemService(Context.TELEPHONY_SERVICE);
if (tm != null) {
int subId = SubscriptionManager.getDefaultSubId();
+ int slotId = tm.getDefaultSim();
if (targetWificonfiguration != null && targetWificonfiguration.SIMNum > 0 &&
tm.getDefault().getPhoneCount() >= 2) {
int[] subIds = SubscriptionManager.getSubId(targetWificonfiguration.SIMNum - 1);
if (subIds != null) {
subId = subIds[0];
+ slotId = SubscriptionManager.getSlotId(subId);
}
}
String imsi = tm.getSubscriberId(subId);
String mccMnc = "";
- if (tm.getSimState(subId) == TelephonyManager.SIM_STATE_READY)
+ if (tm.getSimState(slotId) == TelephonyManager.SIM_STATE_READY)
mccMnc = tm.getSimOperator(subId);
String identity = buildIdentity(eapMethod, imsi, mccMnc);
@@ -8411,9 +8413,17 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiPno
if (mnc.length() == 2)
mnc = "0" + mnc;
} else {
- // extract mcc & mnc from IMSI, assume mnc size is 3
+ // extract mcc & mnc from IMSI, assume mnc size is 3 if in this list, 2 otherwise
+ String ThreeDigitMnc[] = {"302", "310", "311", "312", "313", "314", "315", "316", "334", "348"};
+
mcc = imsi.substring(0, 3);
mnc = imsi.substring(3, 6);
+
+ if (!Arrays.asList(ThreeDigitMnc).contains(mcc))
+ mnc = mnc.substring(0, 2);
+
+ if (mnc.length() == 2)
+ mnc = "0" + mnc;
}
return prefix + imsi + "@wlan.mnc" + mnc + ".mcc" + mcc + ".3gppnetwork.org";