Last active
May 5, 2019 13:42
-
-
Save penn5/549b54bc44809c11187104eab7aac759 to your computer and use it in GitHub Desktop.
patch telephony mcc mnc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -ur a/src/com/android/phone/NetworkQueryService.java b/src/com/android/phone/NetworkQueryService.java | |
--- a/src/com/android/phone/NetworkQueryService.java 2019-05-04 07:44:45.525858527 +0100 | |
+++ b/src/com/android/phone/NetworkQueryService.java 2019-05-04 07:49:03.385063857 +0100 | |
@@ -334,9 +334,10 @@ | |
String mcc = null; | |
String mnc = null; | |
log("operatorNumeric: " + operatorNumeric); | |
- if (operatorNumeric != null && operatorNumeric.matches("^[0-9]{5,6}$")) { | |
+ if (operatorNumeric != null && operatorNumeric.matches("^[0-9]{5,6}")) { | |
mcc = operatorNumeric.substring(0, 3); | |
- mnc = operatorNumeric.substring(3); | |
+ // Some devices (love you Huawei) hate us and want to break Android. To do that, they add extra info after the MCC/MNC, which we find by the comma located just before it. As we don't care about it, we disard it. | |
+ mnc = operatorNumeric.substring(3).split("[^0-9]", 2)[0]; | |
} | |
CellIdentityGsm cig = new CellIdentityGsm( | |
Integer.MAX_VALUE /* lac */, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment