Check for invalid simOperator.
The simOperator can either be null or empty string. Make sure the string
is long enough to split into MCC and MNC. Technically, a valid
simOperator can only be 5 or 6 digits, but we don't check explicitly for
those lengths to leave some flexibility in the code.
Bug: 20420802
Change-Id: Id8ac7f1e0d6866c5016f6b250d705ceb90626974
diff --git a/src/com/android/phone/CarrierConfigLoader.java b/src/com/android/phone/CarrierConfigLoader.java
index 185aea0..c6a1921 100644
--- a/src/com/android/phone/CarrierConfigLoader.java
+++ b/src/com/android/phone/CarrierConfigLoader.java
@@ -270,7 +270,8 @@
String gid2 = "";
String spn = TelephonyManager.from(mContext).getSimOperatorNameForPhone(phoneId);
String simOperator = TelephonyManager.from(mContext).getSimOperatorNumericForPhone(phoneId);
- if (simOperator != null) {
+ // A valid simOperator should be 5 or 6 digits, depending on the length of the MNC.
+ if (simOperator != null && simOperator.length() >= 3) {
mcc = simOperator.substring(0, 3);
mnc = simOperator.substring(3);
}