summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoshan Pius <rpius@google.com>2015-08-26 21:26:36 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-08-26 21:26:36 +0000
commit870b8a67390dd28872005953578727a240c6c877 (patch)
tree41332ca3c14b3c3c489daece9b70e3ddad82d008
parent3522659621cd16693a7b3017ef6779f15a9334e5 (diff)
parent8fdf7d99124c8747e6632d6adf39c2314fcd2ad2 (diff)
downloadandroid_packages_apps_ContactsCommon-870b8a67390dd28872005953578727a240c6c877.tar.gz
android_packages_apps_ContactsCommon-870b8a67390dd28872005953578727a240c6c877.tar.bz2
android_packages_apps_ContactsCommon-870b8a67390dd28872005953578727a240c6c877.zip
am 8fdf7d99: am b75762d4: Replace country code with 0 for Korean carriers.
* commit '8fdf7d99124c8747e6632d6adf39c2314fcd2ad2': Replace country code with 0 for Korean carriers.
-rw-r--r--src/com/android/contacts/common/util/PhoneNumberHelper.java10
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!");
}