Index: net/android/java/src/org/chromium/net/AndroidNetworkLibrary.java |
diff --git a/net/android/java/src/org/chromium/net/AndroidNetworkLibrary.java b/net/android/java/src/org/chromium/net/AndroidNetworkLibrary.java |
index e4caee50583f6b0ccb24452529666261b456f1c9..839a4953604a158ce4ccd714c312c5755ffb7e75 100644 |
--- a/net/android/java/src/org/chromium/net/AndroidNetworkLibrary.java |
+++ b/net/android/java/src/org/chromium/net/AndroidNetworkLibrary.java |
@@ -8,6 +8,7 @@ import android.content.ActivityNotFoundException; |
import android.content.Context; |
import android.content.Intent; |
import android.security.KeyChain; |
+import android.telephony.TelephonyManager; |
import android.util.Log; |
import org.chromium.base.CalledByNative; |
@@ -238,4 +239,32 @@ class AndroidNetworkLibrary { |
CertificateException, KeyStoreException { |
X509Util.clearTestRootCertificates(); |
} |
+ |
+ /** |
+ * Returns the ISO country code equivalent of the current MCC. |
+ */ |
+ @CalledByNative |
+ private static String getNetworkCountryIso(Context context) { |
+ TelephonyManager telephonyManager = |
+ (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); |
+ if (telephonyManager != null) { |
+ return telephonyManager.getNetworkCountryIso(); |
+ } |
+ return ""; |
+ } |
+ |
+ /** |
+ * Returns the MCC+MNC (mobile country code + mobile network code) as |
+ * the numeric name of the current registered operator. |
+ */ |
+ @CalledByNative |
+ private static String getNetworkOperator(Context context) { |
+ TelephonyManager telephonyManager = |
+ (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); |
+ if (telephonyManager != null) { |
+ return telephonyManager.getNetworkOperator(); |
+ } |
+ return ""; |
+ } |
+ |
} |