summaryrefslogtreecommitdiffstats
path: root/telephony
diff options
context:
space:
mode:
authorRoshan Pius <rpius@google.com>2015-08-31 13:04:14 -0700
committerRoshan Pius <rpius@google.com>2015-09-01 09:24:32 -0700
commita9acb4c2b55fe1bf4f5eeb96971e46697eaeffe9 (patch)
tree3e19432e4c5f0ab6e9ff52038906d7a556cb5260 /telephony
parentda43a3aacaba069e79f1dbfa491f6bc0b6f7fa95 (diff)
downloadframeworks_base-a9acb4c2b55fe1bf4f5eeb96971e46697eaeffe9.zip
frameworks_base-a9acb4c2b55fe1bf4f5eeb96971e46697eaeffe9.tar.gz
frameworks_base-a9acb4c2b55fe1bf4f5eeb96971e46697eaeffe9.tar.bz2
Reformat only KR numbers with leading "+82".
Looks like the phonenumber util can figure out the country code of a phone number to format from the localization data even if it is not explicitly present in the phone number string. So, adding an explicit check to make sure that the country code(+82) was fetched from the original number string which was the intention of the fix for b/22862845. BUG: 23661668 Change-Id: I26ba03d759e0ec35a195ba51bf60d09eff8de090
Diffstat (limited to 'telephony')
-rw-r--r--telephony/java/android/telephony/PhoneNumberUtils.java11
1 files changed, 8 insertions, 3 deletions
diff --git a/telephony/java/android/telephony/PhoneNumberUtils.java b/telephony/java/android/telephony/PhoneNumberUtils.java
index 273cc93..b430340 100644
--- a/telephony/java/android/telephony/PhoneNumberUtils.java
+++ b/telephony/java/android/telephony/PhoneNumberUtils.java
@@ -1457,10 +1457,15 @@ public class PhoneNumberUtils
String result = null;
try {
PhoneNumber pn = util.parseAndKeepRawInput(phoneNumber, defaultCountryIso);
+ /**
+ * Need to reformat any local Korean phone numbers (when the user is in Korea) with
+ * country code to corresponding national format which would replace the leading
+ * +82 with 0.
+ */
if (KOREA_ISO_COUNTRY_CODE.equals(defaultCountryIso) &&
- (pn.getCountryCode() == util.getCountryCodeForRegion(KOREA_ISO_COUNTRY_CODE))) {
- // Format local Korean phone numbers with country code to corresponding national
- // format which would replace the leading +82 with 0.
+ (pn.getCountryCode() == util.getCountryCodeForRegion(KOREA_ISO_COUNTRY_CODE)) &&
+ (pn.getCountryCodeSource() ==
+ PhoneNumber.CountryCodeSource.FROM_NUMBER_WITH_PLUS_SIGN)) {
result = util.format(pn, PhoneNumberUtil.PhoneNumberFormat.NATIONAL);
} else {
result = util.formatInOriginalFormat(pn, defaultCountryIso);