summaryrefslogtreecommitdiffstats
path: root/telephony/java
diff options
context:
space:
mode:
authorRoshan Pius <rpius@google.com>2015-08-25 11:23:49 -0700
committerRoshan Pius <rpius@google.com>2015-08-26 10:00:49 -0700
commit672b2cc05c26aa2a8fdb3def896367684b1b9920 (patch)
treea1838c212c5db2b2a8d25d95e0ac865fe7e8b1c6 /telephony/java
parentb460cc88865bbdafe3f343e43bd08382c6745fe0 (diff)
downloadframeworks_base-672b2cc05c26aa2a8fdb3def896367684b1b9920.zip
frameworks_base-672b2cc05c26aa2a8fdb3def896367684b1b9920.tar.gz
frameworks_base-672b2cc05c26aa2a8fdb3def896367684b1b9920.tar.bz2
Reformat local Korean numbers in national format.
Korean carriers don't want the country codes displayed for local calls. However the network returns the entire phone number including the country code for Volte calls. According to the Koean phone numbering scheme (https://en.wikipedia.org/wiki/Telephone_numbers_in_South_Korea), we need to replace the country code +82 with a 0 prepended to the carrier code to format it as a national number. BUG: 22862845 Change-Id: Ifbb9eb8d5379608b4ea9d95ae7744779340b188e
Diffstat (limited to 'telephony/java')
-rw-r--r--telephony/java/android/telephony/PhoneNumberUtils.java11
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;