Snap for 5450365 from 129ad7feb8f0cb179e5befa5fb7245b9fc07c99d to pi-platform-release
Change-Id: I8e0b5b9c02d4200436c5125bb46b511962f9f2b3
diff --git a/src/com/android/mms/service/MmsHttpClient.java b/src/com/android/mms/service/MmsHttpClient.java
index 40e03cd..fc0d67e 100644
--- a/src/com/android/mms/service/MmsHttpClient.java
+++ b/src/com/android/mms/service/MmsHttpClient.java
@@ -456,7 +456,7 @@
* Example: "LINE1" returns the phone number, etc.
*
* @param macro The macro name
- * @param mmsConfig The MMS config which contains NAI suffix.
+ * @param mmsConfig The MMS config which contains NAI suffix and SIM country ISO to override.
* @param subId The subscription ID used to get line number, etc.
* @return The value of the defined macro
*/
@@ -465,7 +465,7 @@
if (MACRO_LINE1.equals(macro)) {
return getLine1(context, subId);
} else if (MACRO_LINE1NOCOUNTRYCODE.equals(macro)) {
- return getLine1NoCountryCode(context, subId);
+ return getLine1NoCountryCode(context, mmsConfig, subId);
} else if (MACRO_NAI.equals(macro)) {
return getNai(context, mmsConfig, subId);
}
@@ -485,13 +485,16 @@
/**
* Returns the phone number (without country code) for the given subscription ID.
*/
- private static String getLine1NoCountryCode(Context context, int subId) {
+ private static String getLine1NoCountryCode(Context context, Bundle mmsConfig, int subId) {
final TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(
Context.TELEPHONY_SERVICE);
+ String countryIsoOverride =
+ mmsConfig.getString(SmsManager.MMS_CONFIG_SIM_COUNTRY_ISO_OVERRIDE);
return PhoneUtils.getNationalNumber(
- telephonyManager,
- subId,
- telephonyManager.getLine1Number(subId));
+ telephonyManager,
+ subId,
+ telephonyManager.getLine1Number(subId),
+ countryIsoOverride);
}
/**
diff --git a/src/com/android/mms/service/PhoneUtils.java b/src/com/android/mms/service/PhoneUtils.java
index 54b7ba9..a736ee2 100644
--- a/src/com/android/mms/service/PhoneUtils.java
+++ b/src/com/android/mms/service/PhoneUtils.java
@@ -37,11 +37,17 @@
* @param telephonyManager
* @param subId The SIM ID associated with this number
* @param phoneText The input phone number text
+ * @param countryIsoOverride String to override sim country iso.
* @return The formatted number or the original phone number if failed to parse
*/
public static String getNationalNumber(TelephonyManager telephonyManager, int subId,
- String phoneText) {
- final String country = getSimOrDefaultLocaleCountry(telephonyManager, subId);
+ String phoneText, String countryIsoOverride) {
+ String country = getSimOrDefaultLocaleCountry(telephonyManager, subId);
+
+ if (!TextUtils.isEmpty(countryIsoOverride)) {
+ country = countryIsoOverride.toUpperCase();
+ }
+
final PhoneNumberUtil phoneNumberUtil = PhoneNumberUtil.getInstance();
final Phonenumber.PhoneNumber parsed = getParsedNumber(phoneNumberUtil, phoneText, country);
if (parsed == null) {