summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShaopeng Jia <shaopengjia@google.com>2012-07-13 13:46:11 +0200
committerShaopeng Jia <shaopengjia@google.com>2012-07-13 13:46:11 +0200
commitbf5d9756fe9b13f5b2e0696c62949cea77396687 (patch)
tree51daac195bcb29aed09b3316d76e38fdea7fb4c6
parent32cbb58e961e6576fd8bf52b75b04a1027a22648 (diff)
downloadlibphonenumber-tools_r22.tar.gz
Change-Id: I0c4b01931dc7d97b0e1c2ea432199db0ed5a67ab
-rw-r--r--README.android2
-rw-r--r--java/release_notes.txt43
-rw-r--r--java/src/com/android/i18n/phonenumbers/CountryCodeToRegionCodeMap.java20
-rw-r--r--java/src/com/android/i18n/phonenumbers/PhoneNumberUtil.java87
-rw-r--r--java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_870bin0 -> 310 bytes
-rw-r--r--java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_878bin0 -> 316 bytes
-rw-r--r--java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_881bin0 -> 297 bytes
-rw-r--r--java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_882bin0 -> 764 bytes
-rw-r--r--java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_ACbin256 -> 255 bytes
-rw-r--r--java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_AEbin609 -> 611 bytes
-rw-r--r--java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_ANbin293 -> 297 bytes
-rw-r--r--java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_BFbin429 -> 436 bytes
-rw-r--r--java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_BHbin526 -> 532 bytes
-rw-r--r--java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_CAbin726 -> 736 bytes
-rw-r--r--java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_CIbin436 -> 438 bytes
-rw-r--r--java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_CRbin612 -> 627 bytes
-rw-r--r--java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_CZbin536 -> 744 bytes
-rw-r--r--java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_DEbin1923 -> 1928 bytes
-rw-r--r--java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_DKbin394 -> 396 bytes
-rw-r--r--java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_EEbin845 -> 953 bytes
-rw-r--r--java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_EGbin763 -> 746 bytes
-rw-r--r--java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_ESbin542 -> 708 bytes
-rw-r--r--java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_ETbin985 -> 998 bytes
-rw-r--r--java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_HKbin540 -> 649 bytes
-rw-r--r--java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_ILbin988 -> 989 bytes
-rw-r--r--java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_INbin4035 -> 4020 bytes
-rw-r--r--java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_IRbin1122 -> 1123 bytes
-rw-r--r--java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_ISbin766 -> 755 bytes
-rw-r--r--java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_JObin1025 -> 1022 bytes
-rw-r--r--java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_KHbin616 -> 618 bytes
-rw-r--r--java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_KWbin613 -> 517 bytes
-rw-r--r--java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_LAbin453 -> 454 bytes
-rw-r--r--java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_LBbin546 -> 564 bytes
-rw-r--r--java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_LIbin804 -> 952 bytes
-rw-r--r--java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_LRbin593 -> 595 bytes
-rw-r--r--java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_MAbin775 -> 778 bytes
-rw-r--r--java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_MDbin660 -> 685 bytes
-rw-r--r--java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_MEbin695 -> 692 bytes
-rw-r--r--java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_MKbin635 -> 644 bytes
-rw-r--r--java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_MMbin696 -> 788 bytes
-rw-r--r--java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_MNbin733 -> 727 bytes
-rw-r--r--java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_PAbin875 -> 882 bytes
-rw-r--r--java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_QAbin405 -> 408 bytes
-rw-r--r--java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_RObin508 -> 647 bytes
-rw-r--r--java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_SAbin659 -> 644 bytes
-rw-r--r--java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_SGbin600 -> 600 bytes
-rw-r--r--java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_SIbin698 -> 698 bytes
-rw-r--r--java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_SSbin376 -> 311 bytes
-rw-r--r--java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_SXbin451 -> 459 bytes
-rw-r--r--java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_TCbin506 -> 507 bytes
-rw-r--r--java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_THbin638 -> 586 bytes
-rw-r--r--java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_TLbin366 -> 367 bytes
-rw-r--r--java/src/com/android/i18n/phonenumbers/geocoding/data/1431_enbin0 -> 33 bytes
-rw-r--r--java/src/com/android/i18n/phonenumbers/geocoding/data/1669_enbin0 -> 35 bytes
-rw-r--r--java/src/com/android/i18n/phonenumbers/geocoding/data/1873_enbin0 -> 31 bytes
-rw-r--r--java/src/com/android/i18n/phonenumbers/geocoding/data/221_enbin49 -> 49 bytes
-rw-r--r--java/src/com/android/i18n/phonenumbers/geocoding/data/224_enbin303 -> 303 bytes
-rw-r--r--java/src/com/android/i18n/phonenumbers/geocoding/data/226_enbin280 -> 471 bytes
-rw-r--r--java/src/com/android/i18n/phonenumbers/geocoding/data/242_enbin140 -> 140 bytes
-rw-r--r--java/src/com/android/i18n/phonenumbers/geocoding/data/244_enbin488 -> 537 bytes
-rw-r--r--java/src/com/android/i18n/phonenumbers/geocoding/data/244_ptbin95 -> 238 bytes
-rw-r--r--java/src/com/android/i18n/phonenumbers/geocoding/data/245_enbin325 -> 280 bytes
-rw-r--r--java/src/com/android/i18n/phonenumbers/geocoding/data/245_ptbin325 -> 67 bytes
-rw-r--r--java/src/com/android/i18n/phonenumbers/geocoding/data/886_enbin241 -> 235 bytes
-rw-r--r--java/src/com/android/i18n/phonenumbers/geocoding/data/configbin4907 -> 4943 bytes
-rw-r--r--java/test/com/android/i18n/phonenumbers/CountryCodeToRegionCodeMapForTesting.java8
-rw-r--r--java/test/com/android/i18n/phonenumbers/ExampleNumbersTest.java5
-rw-r--r--java/test/com/android/i18n/phonenumbers/PhoneNumberUtilTest.java88
-rw-r--r--java/test/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_979bin0 -> 294 bytes
69 files changed, 200 insertions, 53 deletions
diff --git a/README.android b/README.android
index 62099c5a..797c6402 100644
--- a/README.android
+++ b/README.android
@@ -1,5 +1,5 @@
URL: http://code.google.com/p/libphonenumber/
-Version: 4.8 (r444)
+Version: 4.9 (r473)
License: Apache 2
Description: Google Phone Number Library.
Local Modification:
diff --git a/java/release_notes.txt b/java/release_notes.txt
index 87b6c094..f7aae057 100644
--- a/java/release_notes.txt
+++ b/java/release_notes.txt
@@ -1,3 +1,46 @@
+June 21st, 2012: libphonenumber-4.9
+* Bug fix
+ - formatInOriginalFormat fixed not to add a star sign if it was not present
+ originally.
+* Metadata changes
+ - BF, CZ, ES, KW
+ - Non-geographical entities with calling code 882 (BebbiCell, Maritime
+ Communications, Oration Technologies, Telespazio and Thuraya)
+ - Geocoding data updates for country calling codes 221, 224, 226, 242, 244, 245
+* Functionality changes:
+ - Minimum allowed length for a national significant number (NSN) when parsing
+ changed from 3 to 2.
+ - Support parsing of RFC3966-formatted strings with an isdn-subaddress or extra
+ parameters specified.
+ - Allow soft hyphen to appear in phone numbers (\u00AD)
+* Testing changes:
+ - Add extra unit tests for non-geographical phone number entities
+ - ExampleNumbersTest testEmergency tests now uses ShortNumberUtil
+
+June 14th, 2012: libphonenumber-4.8.5
+* Metadata update only:
+ - AC, CR, DE, DK, IL, IN, IS, KH, LI, LR, MA, MD, MK, PA, SA, SG, SS
+
+June 6th, 2012: libphonenumber-4.8.4
+* Metadata update only:
+ - AE, RO
+ - Non-geographical entity with calling code 881 (Iridium)
+
+May 30th, 2012: libphonenumber-4.8.3
+* Metadata update only:
+ - AN, ET, KW, MN, SX, TC, TL
+
+May 16th, 2012: libphonenumber-4.8.2
+* Metadata update only:
+ - BH, CR, EE, JO, KW, LA, QA, SI, TH
+ - Non-geographical entity with calling code 878 (VISIONng)
+
+May 8th, 2012: libphonenumber-4.8.1
+* Metadata update only:
+ - CA, CI, EG, HK, IN, IR, LB, MA, ME, MM
+ - Non-geographical entity with calling code 870 (Inmarsat)
+ - Geocoding updates for country calling codes 1 for new area codes
+
April 24th, 2012: libphonenumber-4.8
* Functionality changes
- RFC format now outputs a number starting with "tel:"
diff --git a/java/src/com/android/i18n/phonenumbers/CountryCodeToRegionCodeMap.java b/java/src/com/android/i18n/phonenumbers/CountryCodeToRegionCodeMap.java
index 69bb3519..7e885bf6 100644
--- a/java/src/com/android/i18n/phonenumbers/CountryCodeToRegionCodeMap.java
+++ b/java/src/com/android/i18n/phonenumbers/CountryCodeToRegionCodeMap.java
@@ -31,10 +31,10 @@ public class CountryCodeToRegionCodeMap {
// countries sharing a calling code, such as the NANPA countries, the one
// indicated with "isMainCountryForCode" in the metadata should be first.
static Map<Integer, List<String>> getCountryCodeToRegionCodeMap() {
- // The capacity is set to 281 as there are 211 different country codes,
+ // The capacity is set to 286 as there are 215 different country codes,
// and this offers a load factor of roughly 0.75.
Map<Integer, List<String>> countryCodeToRegionCodeMap =
- new HashMap<Integer, List<String>>(281);
+ new HashMap<Integer, List<String>>(286);
ArrayList<String> listWithRegionCode;
@@ -808,11 +808,27 @@ public class CountryCodeToRegionCodeMap {
countryCodeToRegionCodeMap.put(856, listWithRegionCode);
listWithRegionCode = new ArrayList<String>(1);
+ listWithRegionCode.add("001");
+ countryCodeToRegionCodeMap.put(870, listWithRegionCode);
+
+ listWithRegionCode = new ArrayList<String>(1);
+ listWithRegionCode.add("001");
+ countryCodeToRegionCodeMap.put(878, listWithRegionCode);
+
+ listWithRegionCode = new ArrayList<String>(1);
listWithRegionCode.add("BD");
countryCodeToRegionCodeMap.put(880, listWithRegionCode);
listWithRegionCode = new ArrayList<String>(1);
listWithRegionCode.add("001");
+ countryCodeToRegionCodeMap.put(881, listWithRegionCode);
+
+ listWithRegionCode = new ArrayList<String>(1);
+ listWithRegionCode.add("001");
+ countryCodeToRegionCodeMap.put(882, listWithRegionCode);
+
+ listWithRegionCode = new ArrayList<String>(1);
+ listWithRegionCode.add("001");
countryCodeToRegionCodeMap.put(883, listWithRegionCode);
listWithRegionCode = new ArrayList<String>(1);
diff --git a/java/src/com/android/i18n/phonenumbers/PhoneNumberUtil.java b/java/src/com/android/i18n/phonenumbers/PhoneNumberUtil.java
index a05c8326..581dee37 100644
--- a/java/src/com/android/i18n/phonenumbers/PhoneNumberUtil.java
+++ b/java/src/com/android/i18n/phonenumbers/PhoneNumberUtil.java
@@ -49,7 +49,8 @@ import java.util.regex.Pattern;
*
* NOTE: A lot of methods in this class require Region Code strings. These must be provided using
* ISO 3166-1 two-letter country-code format. These should be in upper-case. The list of the codes
- * can be found here: http://www.iso.org/iso/english_country_names_and_code_elements
+ * can be found here:
+ * http://www.iso.org/iso/country_codes/iso_3166_code_lists/country_names_and_code_elements.htm
*
* @author Shaopeng Jia
* @author Lara Rennie
@@ -58,7 +59,7 @@ public class PhoneNumberUtil {
/** Flags to use when compiling regular expressions for phone numbers. */
static final int REGEX_FLAGS = Pattern.UNICODE_CASE | Pattern.CASE_INSENSITIVE;
// The minimum and maximum length of the national significant number.
- private static final int MIN_LENGTH_FOR_NSN = 3;
+ private static final int MIN_LENGTH_FOR_NSN = 2;
// The ITU says the maximum length should be 15, but we have found longer numbers in Germany.
static final int MAX_LENGTH_FOR_NSN = 16;
// The maximum length of the country calling code.
@@ -102,9 +103,8 @@ public class PhoneNumberUtil {
private static final String RFC3966_EXTN_PREFIX = ";ext=";
private static final String RFC3966_PREFIX = "tel:";
- // We include the "+" here since RFC3966 format specifies that the context must be specified in
- // international format.
- private static final String RFC3966_PHONE_CONTEXT = ";phone-context=+";
+ private static final String RFC3966_PHONE_CONTEXT = ";phone-context=";
+ private static final String RFC3966_ISDN_SUBADDRESS = ";isub=";
// A map that contains characters that are essential when dialling. That means any of the
// characters in this map must not be removed from a number when dialing, otherwise the call will
@@ -172,7 +172,7 @@ public class PhoneNumberUtil {
HashMap<Character, Character> diallableCharMap = new HashMap<Character, Character>();
diallableCharMap.putAll(asciiDigitMappings);
- diallableCharMap.put('+', '+');
+ diallableCharMap.put(PLUS_SIGN, PLUS_SIGN);
diallableCharMap.put('*', '*');
DIALLABLE_CHAR_MAPPINGS = Collections.unmodifiableMap(diallableCharMap);
@@ -219,7 +219,7 @@ public class PhoneNumberUtil {
// placeholder for carrier information in some phone numbers. Full-width variants are also
// present.
static final String VALID_PUNCTUATION = "-x\u2010-\u2015\u2212\u30FC\uFF0D-\uFF0F " +
- "\u00A0\u200B\u2060\u3000()\uFF08\uFF09\uFF3B\uFF3D.\\[\\]/~\u2053\u223C\uFF5E";
+ "\u00A0\u00AD\u200B\u2060\u3000()\uFF08\uFF09\uFF3B\uFF3D.\\[\\]/~\u2053\u223C\uFF5E";
private static final String DIGITS = "\\p{Nd}";
// We accept alpha characters in phone numbers, ASCII only, upper and lower case.
@@ -617,7 +617,7 @@ public class PhoneNumberUtil {
/**
* Checks to see if the string of characters could possibly be a phone number at all. At the
- * moment, checks to see that the string begins with at least 3 digits, ignoring any punctuation
+ * moment, checks to see that the string begins with at least 2 digits, ignoring any punctuation
* commonly found in phone numbers.
* This method does not require the number to be normalized in advance - but does assume that
* leading non-number symbols have been removed, such as by the method extractPossibleNumber.
@@ -1341,7 +1341,9 @@ public class PhoneNumberUtil {
// If no digit is inserted/removed/modified as a result of our formatting, we return the
// formatted phone number; otherwise we return the raw input the user entered.
return (formattedNumber != null &&
- normalizeDigitsOnly(formattedNumber).equals(normalizeDigitsOnly(rawInput)))
+ normalizeHelper(formattedNumber, DIALLABLE_CHAR_MAPPINGS, true /* remove non matches */)
+ .equals(normalizeHelper(
+ rawInput, DIALLABLE_CHAR_MAPPINGS, true /* remove non matches */)))
? formattedNumber
: rawInput;
}
@@ -2272,7 +2274,7 @@ public class PhoneNumberUtil {
phoneNumber.setCountryCodeSource(countryCodeSource);
}
if (countryCodeSource != CountryCodeSource.FROM_DEFAULT_COUNTRY) {
- if (fullNumber.length() < MIN_LENGTH_FOR_NSN) {
+ if (fullNumber.length() <= MIN_LENGTH_FOR_NSN) {
throw new NumberParseException(NumberParseException.ErrorType.TOO_SHORT_AFTER_IDD,
"Phone number had an IDD, but after this was not "
+ "long enough to be a viable phone number.");
@@ -2494,7 +2496,8 @@ public class PhoneNumberUtil {
* particular region is not performed. This can be done separately with {@link #isValidNumber}.
*
* @param numberToParse number that we are attempting to parse. This can contain formatting
- * such as +, ( and -, as well as a phone number extension.
+ * such as +, ( and -, as well as a phone number extension. It can also
+ * be provided in RFC3966 format.
* @param defaultRegion region that we are expecting the number to be from. This is only used
* if the number being parsed is not written in international format.
* The country_code for the number in this case would be stored as that
@@ -2613,24 +2616,8 @@ public class PhoneNumberUtil {
"The string supplied was too long to parse.");
}
- int indexOfPhoneContext = numberToParse.indexOf(RFC3966_PHONE_CONTEXT);
StringBuilder nationalNumber = new StringBuilder();
- if (indexOfPhoneContext > 0) {
- // Prefix the number with the phone context. The offset here is because the context we are
- // expecting to match should start with a "+" sign, and we want to include this at the start
- // of the number.
- nationalNumber.append(numberToParse.substring(indexOfPhoneContext +
- RFC3966_PHONE_CONTEXT.length() - 1));
- // Now append everything between the "tel:" prefix and the phone-context.
- nationalNumber.append(numberToParse.substring(
- numberToParse.indexOf(RFC3966_PREFIX) + RFC3966_PREFIX.length(), indexOfPhoneContext));
- // Note that phone-contexts that are URLs will not be parsed - isViablePhoneNumber will throw
- // an exception below.
- } else {
- // Extract a possible number from the string passed in (this strips leading characters that
- // could not be the start of a phone number.)
- nationalNumber.append(extractPossibleNumber(numberToParse));
- }
+ buildNationalNumberForParsing(numberToParse, nationalNumber);
if (!isViablePhoneNumber(nationalNumber.toString())) {
throw new NumberParseException(NumberParseException.ErrorType.NOT_A_NUMBER,
@@ -2725,6 +2712,50 @@ public class PhoneNumberUtil {
}
/**
+ * Converts numberToParse to a form that we can parse and write it to nationalNumber if it is
+ * written in RFC3966; otherwise extract a possible number out of it and write to nationalNumber.
+ */
+ private void buildNationalNumberForParsing(String numberToParse, StringBuilder nationalNumber) {
+ int indexOfPhoneContext = numberToParse.indexOf(RFC3966_PHONE_CONTEXT);
+ if (indexOfPhoneContext > 0) {
+ int phoneContextStart = indexOfPhoneContext + RFC3966_PHONE_CONTEXT.length();
+ // If the phone context contains a phone number prefix, we need to capture it, whereas domains
+ // will be ignored.
+ if (numberToParse.charAt(phoneContextStart) == PLUS_SIGN) {
+ // Additional parameters might follow the phone context. If so, we will remove them here
+ // because the parameters after phone context are not important for parsing the
+ // phone number.
+ int phoneContextEnd = numberToParse.indexOf(';', phoneContextStart);
+ if (phoneContextEnd > 0) {
+ nationalNumber.append(numberToParse.substring(phoneContextStart, phoneContextEnd));
+ } else {
+ nationalNumber.append(numberToParse.substring(phoneContextStart));
+ }
+ }
+
+ // Now append everything between the "tel:" prefix and the phone-context. This should include
+ // the national number, an optional extension or isdn-subaddress component.
+ nationalNumber.append(numberToParse.substring(
+ numberToParse.indexOf(RFC3966_PREFIX) + RFC3966_PREFIX.length(), indexOfPhoneContext));
+ } else {
+ // Extract a possible number from the string passed in (this strips leading characters that
+ // could not be the start of a phone number.)
+ nationalNumber.append(extractPossibleNumber(numberToParse));
+ }
+
+ // Delete the isdn-subaddress and everything after it if it is present. Note extension won't
+ // appear at the same time with isdn-subaddress according to paragraph 5.3 of the RFC3966 spec,
+ int indexOfIsdn = nationalNumber.indexOf(RFC3966_ISDN_SUBADDRESS);
+ if (indexOfIsdn > 0) {
+ nationalNumber.delete(indexOfIsdn, nationalNumber.length());
+ }
+ // If both phone context and isdn-subaddress are absent but other parameters are present, the
+ // parameters are left in nationalNumber. This is because we are concerned about deleting
+ // content from a potential number string when there is no strong evidence that the number is
+ // actually written in RFC3966.
+ }
+
+ /**
* Takes two phone numbers and compares them for equality.
*
* <p>Returns EXACT_MATCH if the country_code, NSN, presence of a leading zero for Italian numbers
diff --git a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_870 b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_870
new file mode 100644
index 00000000..2e8834e3
--- /dev/null
+++ b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_870
Binary files differ
diff --git a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_878 b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_878
new file mode 100644
index 00000000..205a5795
--- /dev/null
+++ b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_878
Binary files differ
diff --git a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_881 b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_881
new file mode 100644
index 00000000..3bda4511
--- /dev/null
+++ b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_881
Binary files differ
diff --git a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_882 b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_882
new file mode 100644
index 00000000..9befe415
--- /dev/null
+++ b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_882
Binary files differ
diff --git a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_AC b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_AC
index 52de7be7..ae456ab8 100644
--- a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_AC
+++ b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_AC
Binary files differ
diff --git a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_AE b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_AE
index 4fde50dd..b75959f6 100644
--- a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_AE
+++ b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_AE
Binary files differ
diff --git a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_AN b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_AN
index 10f648f3..ba0f3984 100644
--- a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_AN
+++ b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_AN
Binary files differ
diff --git a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_BF b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_BF
index c1ad0237..479d8fc3 100644
--- a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_BF
+++ b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_BF
Binary files differ
diff --git a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_BH b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_BH
index 9cc62646..ebf37a24 100644
--- a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_BH
+++ b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_BH
Binary files differ
diff --git a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_CA b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_CA
index ca99fc0b..19604989 100644
--- a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_CA
+++ b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_CA
Binary files differ
diff --git a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_CI b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_CI
index 5598d7fb..857e66b3 100644
--- a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_CI
+++ b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_CI
Binary files differ
diff --git a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_CR b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_CR
index de374d10..3803a1aa 100644
--- a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_CR
+++ b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_CR
Binary files differ
diff --git a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_CZ b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_CZ
index 484f15d3..84ac0f54 100644
--- a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_CZ
+++ b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_CZ
Binary files differ
diff --git a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_DE b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_DE
index 9163e1b0..b35d44f0 100644
--- a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_DE
+++ b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_DE
Binary files differ
diff --git a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_DK b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_DK
index fe2db61d..739f03b3 100644
--- a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_DK
+++ b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_DK
Binary files differ
diff --git a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_EE b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_EE
index 5b832761..192c1751 100644
--- a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_EE
+++ b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_EE
Binary files differ
diff --git a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_EG b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_EG
index 16582aa0..89b83ded 100644
--- a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_EG
+++ b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_EG
Binary files differ
diff --git a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_ES b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_ES
index fbc99608..d4bc38d9 100644
--- a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_ES
+++ b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_ES
Binary files differ
diff --git a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_ET b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_ET
index 15e0c7d7..fe51d429 100644
--- a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_ET
+++ b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_ET
Binary files differ
diff --git a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_HK b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_HK
index 0b3561a8..cab9953f 100644
--- a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_HK
+++ b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_HK
Binary files differ
diff --git a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_IL b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_IL
index 5faf3433..9419291f 100644
--- a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_IL
+++ b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_IL
Binary files differ
diff --git a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_IN b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_IN
index 15576b09..1ec08ab2 100644
--- a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_IN
+++ b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_IN
Binary files differ
diff --git a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_IR b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_IR
index 5383277b..5af5d869 100644
--- a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_IR
+++ b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_IR
Binary files differ
diff --git a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_IS b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_IS
index d9fc3f99..97006bee 100644
--- a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_IS
+++ b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_IS
Binary files differ
diff --git a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_JO b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_JO
index b6a16d97..de03296d 100644
--- a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_JO
+++ b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_JO
Binary files differ
diff --git a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_KH b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_KH
index 9e97693e..e5792b0f 100644
--- a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_KH
+++ b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_KH
Binary files differ
diff --git a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_KW b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_KW
index cf386eea..27a156e5 100644
--- a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_KW
+++ b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_KW
Binary files differ
diff --git a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_LA b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_LA
index bb616c29..5ee5bdc9 100644
--- a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_LA
+++ b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_LA
Binary files differ
diff --git a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_LB b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_LB
index 6b2dba9c..e8b1b4be 100644
--- a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_LB
+++ b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_LB
Binary files differ
diff --git a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_LI b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_LI
index 7819739c..76ad0671 100644
--- a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_LI
+++ b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_LI
Binary files differ
diff --git a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_LR b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_LR
index c0e47ee0..0f2380c1 100644
--- a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_LR
+++ b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_LR
Binary files differ
diff --git a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_MA b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_MA
index bf444b7f..909ac3c1 100644
--- a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_MA
+++ b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_MA
Binary files differ
diff --git a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_MD b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_MD
index a1f84c75..270b2cf7 100644
--- a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_MD
+++ b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_MD
Binary files differ
diff --git a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_ME b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_ME
index 14dbe77f..949f4500 100644
--- a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_ME
+++ b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_ME
Binary files differ
diff --git a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_MK b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_MK
index 5dcd3849..c84ddd77 100644
--- a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_MK
+++ b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_MK
Binary files differ
diff --git a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_MM b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_MM
index 6074b5af..e0eb9f87 100644
--- a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_MM
+++ b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_MM
Binary files differ
diff --git a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_MN b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_MN
index e4acf01c..14bc955b 100644
--- a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_MN
+++ b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_MN
Binary files differ
diff --git a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_PA b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_PA
index 61fb88ad..a725f8c3 100644
--- a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_PA
+++ b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_PA
Binary files differ
diff --git a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_QA b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_QA
index 5648f1c5..4c54b7a6 100644
--- a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_QA
+++ b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_QA
Binary files differ
diff --git a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_RO b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_RO
index e3924d3f..3e8489d1 100644
--- a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_RO
+++ b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_RO
Binary files differ
diff --git a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_SA b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_SA
index fd3ed6b4..deafc553 100644
--- a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_SA
+++ b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_SA
Binary files differ
diff --git a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_SG b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_SG
index 8cf8e837..713a01a9 100644
--- a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_SG
+++ b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_SG
Binary files differ
diff --git a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_SI b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_SI
index 6b254965..fd2af8a3 100644
--- a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_SI
+++ b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_SI
Binary files differ
diff --git a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_SS b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_SS
index a8293fd4..8ba01081 100644
--- a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_SS
+++ b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_SS
Binary files differ
diff --git a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_SX b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_SX
index a15f1183..6d336acd 100644
--- a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_SX
+++ b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_SX
Binary files differ
diff --git a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_TC b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_TC
index 08144198..ecdaced3 100644
--- a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_TC
+++ b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_TC
Binary files differ
diff --git a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_TH b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_TH
index 545ddc01..881a9a5e 100644
--- a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_TH
+++ b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_TH
Binary files differ
diff --git a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_TL b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_TL
index 9a11d90d..f6ced143 100644
--- a/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_TL
+++ b/java/src/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProto_TL
Binary files differ
diff --git a/java/src/com/android/i18n/phonenumbers/geocoding/data/1431_en b/java/src/com/android/i18n/phonenumbers/geocoding/data/1431_en
new file mode 100644
index 00000000..412c0099
--- /dev/null
+++ b/java/src/com/android/i18n/phonenumbers/geocoding/data/1431_en
Binary files differ
diff --git a/java/src/com/android/i18n/phonenumbers/geocoding/data/1669_en b/java/src/com/android/i18n/phonenumbers/geocoding/data/1669_en
new file mode 100644
index 00000000..b3bf8a03
--- /dev/null
+++ b/java/src/com/android/i18n/phonenumbers/geocoding/data/1669_en
Binary files differ
diff --git a/java/src/com/android/i18n/phonenumbers/geocoding/data/1873_en b/java/src/com/android/i18n/phonenumbers/geocoding/data/1873_en
new file mode 100644
index 00000000..78e7da11
--- /dev/null
+++ b/java/src/com/android/i18n/phonenumbers/geocoding/data/1873_en
Binary files differ
diff --git a/java/src/com/android/i18n/phonenumbers/geocoding/data/221_en b/java/src/com/android/i18n/phonenumbers/geocoding/data/221_en
index b876d301..87a8cc14 100644
--- a/java/src/com/android/i18n/phonenumbers/geocoding/data/221_en
+++ b/java/src/com/android/i18n/phonenumbers/geocoding/data/221_en
Binary files differ
diff --git a/java/src/com/android/i18n/phonenumbers/geocoding/data/224_en b/java/src/com/android/i18n/phonenumbers/geocoding/data/224_en
index e63507da..1a9cae3c 100644
--- a/java/src/com/android/i18n/phonenumbers/geocoding/data/224_en
+++ b/java/src/com/android/i18n/phonenumbers/geocoding/data/224_en
Binary files differ
diff --git a/java/src/com/android/i18n/phonenumbers/geocoding/data/226_en b/java/src/com/android/i18n/phonenumbers/geocoding/data/226_en
index ed31886e..41298f15 100644
--- a/java/src/com/android/i18n/phonenumbers/geocoding/data/226_en
+++ b/java/src/com/android/i18n/phonenumbers/geocoding/data/226_en
Binary files differ
diff --git a/java/src/com/android/i18n/phonenumbers/geocoding/data/242_en b/java/src/com/android/i18n/phonenumbers/geocoding/data/242_en
index 86c316fa..2ad2a1a1 100644
--- a/java/src/com/android/i18n/phonenumbers/geocoding/data/242_en
+++ b/java/src/com/android/i18n/phonenumbers/geocoding/data/242_en
Binary files differ
diff --git a/java/src/com/android/i18n/phonenumbers/geocoding/data/244_en b/java/src/com/android/i18n/phonenumbers/geocoding/data/244_en
index 59c00b9d..7234500a 100644
--- a/java/src/com/android/i18n/phonenumbers/geocoding/data/244_en
+++ b/java/src/com/android/i18n/phonenumbers/geocoding/data/244_en
Binary files differ
diff --git a/java/src/com/android/i18n/phonenumbers/geocoding/data/244_pt b/java/src/com/android/i18n/phonenumbers/geocoding/data/244_pt
index 34cf12b9..0395f3ec 100644
--- a/java/src/com/android/i18n/phonenumbers/geocoding/data/244_pt
+++ b/java/src/com/android/i18n/phonenumbers/geocoding/data/244_pt
Binary files differ
diff --git a/java/src/com/android/i18n/phonenumbers/geocoding/data/245_en b/java/src/com/android/i18n/phonenumbers/geocoding/data/245_en
index 2738fe8b..377f1634 100644
--- a/java/src/com/android/i18n/phonenumbers/geocoding/data/245_en
+++ b/java/src/com/android/i18n/phonenumbers/geocoding/data/245_en
Binary files differ
diff --git a/java/src/com/android/i18n/phonenumbers/geocoding/data/245_pt b/java/src/com/android/i18n/phonenumbers/geocoding/data/245_pt
index 2738fe8b..40171fab 100644
--- a/java/src/com/android/i18n/phonenumbers/geocoding/data/245_pt
+++ b/java/src/com/android/i18n/phonenumbers/geocoding/data/245_pt
Binary files differ
diff --git a/java/src/com/android/i18n/phonenumbers/geocoding/data/886_en b/java/src/com/android/i18n/phonenumbers/geocoding/data/886_en
index 497c293d..7bed31bb 100644
--- a/java/src/com/android/i18n/phonenumbers/geocoding/data/886_en
+++ b/java/src/com/android/i18n/phonenumbers/geocoding/data/886_en
Binary files differ
diff --git a/java/src/com/android/i18n/phonenumbers/geocoding/data/config b/java/src/com/android/i18n/phonenumbers/geocoding/data/config
index 1f71c413..181a1e21 100644
--- a/java/src/com/android/i18n/phonenumbers/geocoding/data/config
+++ b/java/src/com/android/i18n/phonenumbers/geocoding/data/config
Binary files differ
diff --git a/java/test/com/android/i18n/phonenumbers/CountryCodeToRegionCodeMapForTesting.java b/java/test/com/android/i18n/phonenumbers/CountryCodeToRegionCodeMapForTesting.java
index 6d904478..8f64e427 100644
--- a/java/test/com/android/i18n/phonenumbers/CountryCodeToRegionCodeMapForTesting.java
+++ b/java/test/com/android/i18n/phonenumbers/CountryCodeToRegionCodeMapForTesting.java
@@ -31,10 +31,10 @@ public class CountryCodeToRegionCodeMapForTesting {
// countries sharing a calling code, such as the NANPA countries, the one
// indicated with "isMainCountryForCode" in the metadata should be first.
static Map<Integer, List<String>> getCountryCodeToRegionCodeMap() {
- // The capacity is set to 22 as there are 17 different country codes,
+ // The capacity is set to 24 as there are 18 different country codes,
// and this offers a load factor of roughly 0.75.
Map<Integer, List<String>> countryCodeToRegionCodeMap =
- new HashMap<Integer, List<String>>(22);
+ new HashMap<Integer, List<String>>(24);
ArrayList<String> listWithRegionCode;
@@ -108,6 +108,10 @@ public class CountryCodeToRegionCodeMapForTesting {
listWithRegionCode.add("001");
countryCodeToRegionCodeMap.put(800, listWithRegionCode);
+ listWithRegionCode = new ArrayList<String>(1);
+ listWithRegionCode.add("001");
+ countryCodeToRegionCodeMap.put(979, listWithRegionCode);
+
return countryCodeToRegionCodeMap;
}
}
diff --git a/java/test/com/android/i18n/phonenumbers/ExampleNumbersTest.java b/java/test/com/android/i18n/phonenumbers/ExampleNumbersTest.java
index 04e2c7f7..a3bfc060 100644
--- a/java/test/com/android/i18n/phonenumbers/ExampleNumbersTest.java
+++ b/java/test/com/android/i18n/phonenumbers/ExampleNumbersTest.java
@@ -176,9 +176,8 @@ public class ExampleNumbersTest extends TestCase {
assertEquals(0, wrongTypeCases.size());
}
- // TODO: Update this to use connectsToEmergencyNumber or similar once that is
- // implemented.
public void testEmergency() throws Exception {
+ ShortNumberUtil shortUtil = new ShortNumberUtil(phoneNumberUtil);
int wrongTypeCounter = 0;
for (String regionCode : phoneNumberUtil.getSupportedRegions()) {
PhoneNumberDesc desc =
@@ -186,7 +185,7 @@ public class ExampleNumbersTest extends TestCase {
if (desc.hasExampleNumber()) {
String exampleNumber = desc.getExampleNumber();
if (!exampleNumber.matches(desc.getPossibleNumberPattern()) ||
- !exampleNumber.matches(desc.getNationalNumberPattern())) {
+ !shortUtil.isEmergencyNumber(exampleNumber, regionCode)) {
wrongTypeCounter++;
LOGGER.log(Level.SEVERE, "Emergency example number test failed for " + regionCode);
}
diff --git a/java/test/com/android/i18n/phonenumbers/PhoneNumberUtilTest.java b/java/test/com/android/i18n/phonenumbers/PhoneNumberUtilTest.java
index 1abf9826..6f39d82b 100644
--- a/java/test/com/android/i18n/phonenumbers/PhoneNumberUtilTest.java
+++ b/java/test/com/android/i18n/phonenumbers/PhoneNumberUtilTest.java
@@ -99,8 +99,13 @@ public class PhoneNumberUtilTest extends TestMetadataTestCase {
.setRawInput("000-000-0000");
private static final PhoneNumber INTERNATIONAL_TOLL_FREE =
new PhoneNumber().setCountryCode(800).setNationalNumber(12345678L);
+ // We set this to be the same length as numbers for the other non-geographical country prefix that
+ // we have in our test metadata. However, this is not considered valid because they differ in
+ // their country calling code.
private static final PhoneNumber INTERNATIONAL_TOLL_FREE_TOO_LONG =
- new PhoneNumber().setCountryCode(800).setNationalNumber(1234567890L);
+ new PhoneNumber().setCountryCode(800).setNationalNumber(123456789L);
+ private static final PhoneNumber UNIVERSAL_PREMIUM_RATE =
+ new PhoneNumber().setCountryCode(979).setNationalNumber(123456789L);
public void testGetSupportedRegions() {
assertTrue(phoneUtil.getSupportedRegions().size() > 0);
@@ -286,6 +291,7 @@ public class PhoneNumberUtilTest extends TestMetadataTestCase {
public void testGetExampleNumberForNonGeoEntity() {
assertEquals(INTERNATIONAL_TOLL_FREE, phoneUtil.getExampleNumberForNonGeoEntity(800));
+ assertEquals(UNIVERSAL_PREMIUM_RATE, phoneUtil.getExampleNumberForNonGeoEntity(979));
}
public void testConvertAlphaCharactersInNumber() {
@@ -296,7 +302,7 @@ public class PhoneNumberUtilTest extends TestMetadataTestCase {
}
public void testNormaliseRemovePunctuation() {
- String inputNumber = "034-56&+#234";
+ String inputNumber = "034-56&+#2\u00AD34";
String expectedOutput = "03456234";
assertEquals("Conversion did not correctly remove punctuation",
expectedOutput,
@@ -868,6 +874,12 @@ public class PhoneNumberUtilTest extends TestMetadataTestCase {
phoneUtil.parseAndKeepRawInput("0011 16502530000", RegionCode.AU);
assertEquals("0011 1 650 253 0000",
phoneUtil.formatInOriginalFormat(outOfCountryNumberFromAU2, RegionCode.AU));
+
+ // Test the star sign is not removed from or added to the original input by this method.
+ PhoneNumber starNumber = phoneUtil.parseAndKeepRawInput("*1234", RegionCode.JP);
+ assertEquals("*1234", phoneUtil.formatInOriginalFormat(starNumber, RegionCode.JP));
+ PhoneNumber numberWithoutStar = phoneUtil.parseAndKeepRawInput("1234", RegionCode.JP);
+ assertEquals("1234", phoneUtil.formatInOriginalFormat(numberWithoutStar, RegionCode.JP));
}
public void testIsPremiumRate() {
@@ -892,6 +904,9 @@ public class PhoneNumberUtilTest extends TestMetadataTestCase {
premiumRateNumber.setCountryCode(49).setNationalNumber(90091234567L);
assertEquals(PhoneNumberUtil.PhoneNumberType.PREMIUM_RATE,
phoneUtil.getNumberType(premiumRateNumber));
+
+ assertEquals(PhoneNumberUtil.PhoneNumberType.PREMIUM_RATE,
+ phoneUtil.getNumberType(UNIVERSAL_PREMIUM_RATE));
}
public void testIsTollFree() {
@@ -977,6 +992,7 @@ public class PhoneNumberUtilTest extends TestMetadataTestCase {
assertTrue(phoneUtil.isValidNumber(IT_NUMBER));
assertTrue(phoneUtil.isValidNumber(GB_MOBILE));
assertTrue(phoneUtil.isValidNumber(INTERNATIONAL_TOLL_FREE));
+ assertTrue(phoneUtil.isValidNumber(UNIVERSAL_PREMIUM_RATE));
PhoneNumber nzNumber = new PhoneNumber().setCountryCode(64).setNationalNumber(21387835L);
assertTrue(phoneUtil.isValidNumber(nzNumber));
@@ -1061,6 +1077,7 @@ public class PhoneNumberUtilTest extends TestMetadataTestCase {
assertEquals(RegionCode.GB, phoneUtil.getRegionCodeForCountryCode(44));
assertEquals(RegionCode.DE, phoneUtil.getRegionCodeForCountryCode(49));
assertEquals(RegionCode.UN001, phoneUtil.getRegionCodeForCountryCode(800));
+ assertEquals(RegionCode.UN001, phoneUtil.getRegionCodeForCountryCode(979));
}
public void testGetRegionCodeForNumber() {
@@ -1068,6 +1085,7 @@ public class PhoneNumberUtilTest extends TestMetadataTestCase {
assertEquals(RegionCode.US, phoneUtil.getRegionCodeForNumber(US_NUMBER));
assertEquals(RegionCode.GB, phoneUtil.getRegionCodeForNumber(GB_MOBILE));
assertEquals(RegionCode.UN001, phoneUtil.getRegionCodeForNumber(INTERNATIONAL_TOLL_FREE));
+ assertEquals(RegionCode.UN001, phoneUtil.getRegionCodeForNumber(UNIVERSAL_PREMIUM_RATE));
}
public void testGetCountryCodeForRegion() {
@@ -1158,7 +1176,7 @@ public class PhoneNumberUtilTest extends TestMetadataTestCase {
adNumber.setCountryCode(376).setNationalNumber(12345L);
assertEquals(PhoneNumberUtil.ValidationResult.IS_POSSIBLE,
phoneUtil.isPossibleNumberWithReason(adNumber));
- adNumber.setCountryCode(376).setNationalNumber(13L);
+ adNumber.setCountryCode(376).setNationalNumber(1L);
assertEquals(PhoneNumberUtil.ValidationResult.TOO_SHORT,
phoneUtil.isPossibleNumberWithReason(adNumber));
adNumber.setCountryCode(376).setNationalNumber(12345678901234567L);
@@ -1535,7 +1553,14 @@ public class PhoneNumberUtilTest extends TestMetadataTestCase {
assertEquals(NZ_NUMBER, phoneUtil.parse("tel:03-331-6005;phone-context=+64", RegionCode.NZ));
assertEquals(NZ_NUMBER, phoneUtil.parse("tel:331-6005;phone-context=+64-3", RegionCode.NZ));
assertEquals(NZ_NUMBER, phoneUtil.parse("tel:331-6005;phone-context=+64-3", RegionCode.US));
-
+ // Test parsing RFC3966 format with optional user-defined parameters. The parameters will appear
+ // after the context if present.
+ assertEquals(NZ_NUMBER, phoneUtil.parse("tel:03-331-6005;phone-context=+64;a=%A1",
+ RegionCode.NZ));
+ // Test parsing RFC3966 with an ISDN subaddress.
+ assertEquals(NZ_NUMBER, phoneUtil.parse("tel:03-331-6005;isub=12345;phone-context=+64",
+ RegionCode.NZ));
+ assertEquals(NZ_NUMBER, phoneUtil.parse("tel:+64-3-331-6005;isub=12345", RegionCode.NZ));
// Testing international prefixes.
// Should strip country calling code.
assertEquals(NZ_NUMBER, phoneUtil.parse("0064 3 331 6005", RegionCode.NZ));
@@ -1549,6 +1574,17 @@ public class PhoneNumberUtilTest extends TestMetadataTestCase {
assertEquals(NZ_NUMBER, phoneUtil.parse("+0064 3 331 6005", RegionCode.NZ));
assertEquals(NZ_NUMBER, phoneUtil.parse("+ 00 64 3 331 6005", RegionCode.NZ));
+ assertEquals(US_LOCAL_NUMBER,
+ phoneUtil.parse("tel:253-0000;phone-context=www.google.com", RegionCode.US));
+ assertEquals(US_LOCAL_NUMBER,
+ phoneUtil.parse("tel:253-0000;isub=12345;phone-context=www.google.com", RegionCode.US));
+ // This is invalid because no "+" sign is present as part of phone-context. The phone context
+ // is simply ignored in this case just as if it contains a domain.
+ assertEquals(US_LOCAL_NUMBER,
+ phoneUtil.parse("tel:2530000;isub=12345;phone-context=1-650", RegionCode.US));
+ assertEquals(US_LOCAL_NUMBER,
+ phoneUtil.parse("tel:2530000;isub=12345;phone-context=1234.com", RegionCode.US));
+
PhoneNumber nzNumber = new PhoneNumber();
nzNumber.setCountryCode(64).setNationalNumber(64123456L);
assertEquals(nzNumber, phoneUtil.parse("64(0)64123456", RegionCode.NZ));
@@ -1633,6 +1669,8 @@ public class PhoneNumberUtilTest extends TestMetadataTestCase {
public void testParseNonAscii() throws Exception {
// Using a full-width plus sign.
assertEquals(US_NUMBER, phoneUtil.parse("\uFF0B1 (650) 253-0000", RegionCode.SG));
+ // Using a soft hyphen U+00AD.
+ assertEquals(US_NUMBER, phoneUtil.parse("1 (650) 253\u00AD-0000", RegionCode.US));
// The whole number, including punctuation, is here represented in full-width form.
assertEquals(US_NUMBER, phoneUtil.parse("\uFF0B\uFF11\u3000\uFF08\uFF16\uFF15\uFF10\uFF09" +
"\u3000\uFF12\uFF15\uFF13\uFF0D\uFF10\uFF10\uFF10" +
@@ -1904,31 +1942,26 @@ public class PhoneNumberUtilTest extends TestMetadataTestCase {
fail("Null string - but should not throw a null pointer exception.");
}
try {
- String domainRfcPhoneContext = "tel:555-1234;phone-context:www.google.com";
- phoneUtil.parse(domainRfcPhoneContext, RegionCode.US);
- fail("Domain provided for phone context - should fail.");
+ String domainRfcPhoneContext = "tel:555-1234;phone-context=www.google.com";
+ phoneUtil.parse(domainRfcPhoneContext, RegionCode.ZZ);
+ fail("'Unknown' region code not allowed: should fail.");
} catch (NumberParseException e) {
// Expected this exception.
assertEquals("Wrong error type stored in exception.",
- NumberParseException.ErrorType.NOT_A_NUMBER,
+ NumberParseException.ErrorType.INVALID_COUNTRY_CODE,
e.getErrorType());
- } catch (NullPointerException e) {
- fail("Domain provided for phone context - but should not throw a null pointer exception.");
}
try {
// This is invalid because no "+" sign is present as part of phone-context. This should not
// succeed in being parsed.
- String invalidRfcPhoneContext = "tel:555-1234;phone-context:1-331";
- phoneUtil.parse(invalidRfcPhoneContext, RegionCode.US);
- fail("No leading plus provided in phone context - should fail.");
+ String invalidRfcPhoneContext = "tel:555-1234;phone-context=1-331";
+ phoneUtil.parse(invalidRfcPhoneContext, RegionCode.ZZ);
+ fail("'Unknown' region code not allowed: should fail.");
} catch (NumberParseException e) {
// Expected this exception.
assertEquals("Wrong error type stored in exception.",
- NumberParseException.ErrorType.NOT_A_NUMBER,
+ NumberParseException.ErrorType.INVALID_COUNTRY_CODE,
e.getErrorType());
- } catch (NullPointerException e) {
- fail("No leading plus provided in phone context - but should not throw a null pointer " +
- "exception.");
}
}
@@ -1942,10 +1975,13 @@ public class PhoneNumberUtilTest extends TestMetadataTestCase {
assertEquals(NZ_NUMBER, phoneUtil.parse("Tel: +64 3 331 6005", RegionCode.ZZ));
assertEquals(NZ_NUMBER, phoneUtil.parse("+64 3 331 6005", null));
assertEquals(INTERNATIONAL_TOLL_FREE, phoneUtil.parse("+800 1234 5678", null));
+ assertEquals(UNIVERSAL_PREMIUM_RATE, phoneUtil.parse("+979 123 456 789", null));
// Test parsing RFC3966 format with a phone context.
assertEquals(NZ_NUMBER, phoneUtil.parse("tel:03-331-6005;phone-context=+64", RegionCode.ZZ));
assertEquals(NZ_NUMBER, phoneUtil.parse(" tel:03-331-6005;phone-context=+64", RegionCode.ZZ));
+ assertEquals(NZ_NUMBER, phoneUtil.parse("tel:03-331-6005;isub=12345;phone-context=+64",
+ RegionCode.ZZ));
// It is important that we set the carrier code to an empty string, since we used
// ParseAndKeepRawInput and no carrier code was found.
@@ -2112,6 +2148,8 @@ public class PhoneNumberUtilTest extends TestMetadataTestCase {
phoneUtil.isNumberMatch("+643 331-6005", "+6433316005"));
assertEquals(PhoneNumberUtil.MatchType.EXACT_MATCH,
phoneUtil.isNumberMatch("+64 3 331-6005", "+6433316005"));
+ assertEquals(PhoneNumberUtil.MatchType.EXACT_MATCH,
+ phoneUtil.isNumberMatch("+64 3 331-6005", "tel:+64-3-331-6005;isub=123"));
// Test alpha numbers.
assertEquals(PhoneNumberUtil.MatchType.EXACT_MATCH,
phoneUtil.isNumberMatch("+1800 siX-Flags", "+1 800 7493 5247"));
@@ -2162,6 +2200,9 @@ public class PhoneNumberUtilTest extends TestMetadataTestCase {
// Extension different, all else the same.
assertEquals(PhoneNumberUtil.MatchType.NO_MATCH,
phoneUtil.isNumberMatch("+64 3 331-6005 extn 1234", "0116433316005#1235"));
+ assertEquals(PhoneNumberUtil.MatchType.NO_MATCH,
+ phoneUtil.isNumberMatch(
+ "+64 3 331-6005 extn 1234", "tel:+64-3-331-6005;ext=1235"));
// NSN matches, but extension is different - not the same number.
assertEquals(PhoneNumberUtil.MatchType.NO_MATCH,
phoneUtil.isNumberMatch("+64 3 331-6005 ext.1235", "3 331 6005#1234"));
@@ -2182,6 +2223,9 @@ public class PhoneNumberUtilTest extends TestMetadataTestCase {
assertEquals(PhoneNumberUtil.MatchType.NSN_MATCH,
phoneUtil.isNumberMatch("+64 3 331-6005", "03 331 6005"));
assertEquals(PhoneNumberUtil.MatchType.NSN_MATCH,
+ phoneUtil.isNumberMatch(
+ "+64 3 331-6005", "tel:03-331-6005;isub=1234;phone-context=abc.nz"));
+ assertEquals(PhoneNumberUtil.MatchType.NSN_MATCH,
phoneUtil.isNumberMatch(NZ_NUMBER, "03 331 6005"));
// Here the second number possibly starts with the country calling code for New Zealand,
// although we are unsure.
@@ -2215,6 +2259,14 @@ public class PhoneNumberUtilTest extends TestMetadataTestCase {
// Short NSN matches with the country not specified for either one or both numbers.
assertEquals(PhoneNumberUtil.MatchType.SHORT_NSN_MATCH,
phoneUtil.isNumberMatch("+64 3 331-6005", "331 6005"));
+ assertEquals(PhoneNumberUtil.MatchType.SHORT_NSN_MATCH,
+ phoneUtil.isNumberMatch("+64 3 331-6005", "tel:331-6005;phone-context=abc.nz"));
+ assertEquals(PhoneNumberUtil.MatchType.SHORT_NSN_MATCH,
+ phoneUtil.isNumberMatch("+64 3 331-6005",
+ "tel:331-6005;isub=1234;phone-context=abc.nz"));
+ assertEquals(PhoneNumberUtil.MatchType.SHORT_NSN_MATCH,
+ phoneUtil.isNumberMatch("+64 3 331-6005",
+ "tel:331-6005;isub=1234;phone-context=abc.nz;a=%A1"));
// We did not know that the "0" was a national prefix since neither number has a country code,
// so this is considered a SHORT_NSN_MATCH.
assertEquals(PhoneNumberUtil.MatchType.SHORT_NSN_MATCH,
@@ -2222,6 +2274,8 @@ public class PhoneNumberUtilTest extends TestMetadataTestCase {
assertEquals(PhoneNumberUtil.MatchType.SHORT_NSN_MATCH,
phoneUtil.isNumberMatch("3 331-6005", "331 6005"));
assertEquals(PhoneNumberUtil.MatchType.SHORT_NSN_MATCH,
+ phoneUtil.isNumberMatch("3 331-6005", "tel:331-6005;phone-context=abc.nz"));
+ assertEquals(PhoneNumberUtil.MatchType.SHORT_NSN_MATCH,
phoneUtil.isNumberMatch("3 331-6005", "+64 331 6005"));
// Short NSN match with the country specified.
assertEquals(PhoneNumberUtil.MatchType.SHORT_NSN_MATCH,
diff --git a/java/test/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_979 b/java/test/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_979
new file mode 100644
index 00000000..0c143ce5
--- /dev/null
+++ b/java/test/com/android/i18n/phonenumbers/data/PhoneNumberMetadataProtoForTesting_979
Binary files differ