diff options
-rw-r--r-- | src/com/android/contacts/common/util/PhoneNumberHelper.java | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/com/android/contacts/common/util/PhoneNumberHelper.java b/src/com/android/contacts/common/util/PhoneNumberHelper.java index 9d676689..11f2153b 100644 --- a/src/com/android/contacts/common/util/PhoneNumberHelper.java +++ b/src/com/android/contacts/common/util/PhoneNumberHelper.java @@ -36,6 +36,7 @@ public class PhoneNumberHelper { private static final String LOG_TAG = PhoneNumberHelper.class.getSimpleName(); + private static final String KOREA_ISO_COUNTRY_CODE = "KR"; /** * Determines if the specified number is actually a URI (i.e. a SIP address) rather than a * regular PSTN phone number, based on whether or not the number contains an "@" character. @@ -124,7 +125,14 @@ public class PhoneNumberHelper { 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) { Log.w(LOG_TAG, "Number could not be parsed with the given country code!"); } |