diff options
author | Roshan Pius <rpius@google.com> | 2015-08-26 21:15:16 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-08-26 21:15:16 +0000 |
commit | 6ad123156e762a62616de63617ee11afb3cde334 (patch) | |
tree | 02af4e52fbf840de7eca9c3e8c73623301b2f3b3 /telephony | |
parent | 47ee2ecf82958f211c775a4125968fbf505fe594 (diff) | |
parent | 672b2cc05c26aa2a8fdb3def896367684b1b9920 (diff) | |
download | frameworks_base-6ad123156e762a62616de63617ee11afb3cde334.zip frameworks_base-6ad123156e762a62616de63617ee11afb3cde334.tar.gz frameworks_base-6ad123156e762a62616de63617ee11afb3cde334.tar.bz2 |
Merge "Reformat local Korean numbers in national format." into mnc-dr-dev
Diffstat (limited to 'telephony')
-rw-r--r-- | telephony/java/android/telephony/PhoneNumberUtils.java | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/telephony/java/android/telephony/PhoneNumberUtils.java b/telephony/java/android/telephony/PhoneNumberUtils.java index 79146f3..273cc93 100644 --- a/telephony/java/android/telephony/PhoneNumberUtils.java +++ b/telephony/java/android/telephony/PhoneNumberUtils.java @@ -1135,6 +1135,8 @@ public class PhoneNumberUtils "VI", // U.S. Virgin Islands }; + private static final String KOREA_ISO_COUNTRY_CODE = "KR"; + /** * Breaks the given number down and formats it according to the rules * for the country the number is from. @@ -1455,7 +1457,14 @@ public class PhoneNumberUtils String result = null; try { PhoneNumber pn = util.parseAndKeepRawInput(phoneNumber, defaultCountryIso); - result = util.formatInOriginalFormat(pn, defaultCountryIso); + 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. + result = util.format(pn, PhoneNumberUtil.PhoneNumberFormat.NATIONAL); + } else { + result = util.formatInOriginalFormat(pn, defaultCountryIso); + } } catch (NumberParseException e) { } return result; |