diff options
author | Pawit Pornkitprasan <p.pawit@gmail.com> | 2012-04-05 13:58:50 +0700 |
---|---|---|
committer | Pawit Pornkitprasan <p.pawit@gmail.com> | 2012-04-05 13:58:50 +0700 |
commit | 62bdf8b764832d1e01019e7f67ce535bfe507267 (patch) | |
tree | 7decee94a73fcb857086f8d5c68f5f08c809b6c3 | |
parent | d470984844c388d6766c3de6ac64e93e00480fc9 (diff) | |
download | libphonenumber-62bdf8b764832d1e01019e7f67ce535bfe507267.tar.gz |
libphonenumber: Fix inability to dial 0001
When entering "0001" in to the dialer, AsYouTypeFormatter will
errornously reformat it as "001". Fix lifted from r348 of
libphonenumber.
Change-Id: I5f4d64694d9f9bced135cfd9a3e483fbe1ed1612
-rw-r--r-- | java/src/com/android/i18n/phonenumbers/PhoneNumberUtil.java | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/java/src/com/android/i18n/phonenumbers/PhoneNumberUtil.java b/java/src/com/android/i18n/phonenumbers/PhoneNumberUtil.java index 16a975e9..d65de331 100644 --- a/java/src/com/android/i18n/phonenumbers/PhoneNumberUtil.java +++ b/java/src/com/android/i18n/phonenumbers/PhoneNumberUtil.java @@ -2027,6 +2027,10 @@ public class PhoneNumberUtil { // 0 if fullNumber doesn't start with a valid country calling code, and leaves nationalNumber // unmodified. int extractCountryCode(StringBuilder fullNumber, StringBuilder nationalNumber) { + if ((fullNumber.length() == 0) || (fullNumber.charAt(0) == '0')) { + // Country codes do not begin with a '0'. + return 0; + } int potentialCountryCode; int numberLength = fullNumber.length(); for (int i = 1; i <= MAX_LENGTH_COUNTRY_CODE && i <= numberLength; i++) { |