summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRoshan Pius <rpius@google.com>2015-08-31 13:54:06 -0700
committerRoshan Pius <rpius@google.com>2015-09-01 09:22:38 -0700
commitd5488b65ee5b266097fc69272888462ee4934c09 (patch)
tree2ae9b297644904f1beaabfb8095dcb53700c5b55 /src
parentb75762d4efe72e92221ba4b5ef5db121393647c1 (diff)
downloadandroid_packages_apps_ContactsCommon-d5488b65ee5b266097fc69272888462ee4934c09.tar.gz
android_packages_apps_ContactsCommon-d5488b65ee5b266097fc69272888462ee4934c09.tar.bz2
android_packages_apps_ContactsCommon-d5488b65ee5b266097fc69272888462ee4934c09.zip
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: I24244ec3979c0c9e277e14f9f48959129b3f67ee
Diffstat (limited to 'src')
-rw-r--r--src/com/android/contacts/common/util/PhoneNumberHelper.java11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/com/android/contacts/common/util/PhoneNumberHelper.java b/src/com/android/contacts/common/util/PhoneNumberHelper.java
index 11f2153b..34514024 100644
--- a/src/com/android/contacts/common/util/PhoneNumberHelper.java
+++ b/src/com/android/contacts/common/util/PhoneNumberHelper.java
@@ -125,10 +125,15 @@ public class PhoneNumberHelper {
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);