diff options
Diffstat (limited to 'repackaged/libphonenumber/src/com/android/i18n/phonenumbers/PhoneNumberUtil.java')
-rw-r--r-- | repackaged/libphonenumber/src/com/android/i18n/phonenumbers/PhoneNumberUtil.java | 46 |
1 files changed, 41 insertions, 5 deletions
diff --git a/repackaged/libphonenumber/src/com/android/i18n/phonenumbers/PhoneNumberUtil.java b/repackaged/libphonenumber/src/com/android/i18n/phonenumbers/PhoneNumberUtil.java index e2eb31e6..dfed4561 100644 --- a/repackaged/libphonenumber/src/com/android/i18n/phonenumbers/PhoneNumberUtil.java +++ b/repackaged/libphonenumber/src/com/android/i18n/phonenumbers/PhoneNumberUtil.java @@ -392,43 +392,58 @@ public class PhoneNumberUtil { * * Note: If you are considering storing the number in a neutral format, you are highly advised to * use the PhoneNumber class. - * @hide This class is not part of the Android public SDK API + * @hide This class is not part of the Android public SDK API */ public enum PhoneNumberFormat { + @dalvik.annotation.compat.UnsupportedAppUsage E164, + @dalvik.annotation.compat.UnsupportedAppUsage INTERNATIONAL, + @dalvik.annotation.compat.UnsupportedAppUsage NATIONAL, + @dalvik.annotation.compat.UnsupportedAppUsage RFC3966 } /** * Type of phone numbers. - * @hide This class is not part of the Android public SDK API + * @hide This class is not part of the Android public SDK API */ public enum PhoneNumberType { + @dalvik.annotation.compat.UnsupportedAppUsage FIXED_LINE, + @dalvik.annotation.compat.UnsupportedAppUsage MOBILE, // In some regions (e.g. the USA), it is impossible to distinguish between fixed-line and // mobile numbers by looking at the phone number itself. + @dalvik.annotation.compat.UnsupportedAppUsage FIXED_LINE_OR_MOBILE, // Freephone lines + @dalvik.annotation.compat.UnsupportedAppUsage TOLL_FREE, + @dalvik.annotation.compat.UnsupportedAppUsage PREMIUM_RATE, // The cost of this call is shared between the caller and the recipient, and is hence typically // less than PREMIUM_RATE calls. See // http://en.wikipedia.org/wiki/Shared_Cost_Service for // more information. + @dalvik.annotation.compat.UnsupportedAppUsage SHARED_COST, // Voice over IP numbers. This includes TSoIP (Telephony Service over IP). + @dalvik.annotation.compat.UnsupportedAppUsage VOIP, // A personal number is associated with a particular person, and may be routed to either a // MOBILE or FIXED_LINE number. Some more information can be found here: // http://en.wikipedia.org/wiki/Personal_Numbers + @dalvik.annotation.compat.UnsupportedAppUsage PERSONAL_NUMBER, + @dalvik.annotation.compat.UnsupportedAppUsage PAGER, // Used for "Universal Access Numbers" or "Company Numbers". They may be further routed to // specific offices, but allow one number to be used for a company. + @dalvik.annotation.compat.UnsupportedAppUsage UAN, // Used for "Voice Mail Access Numbers". + @dalvik.annotation.compat.UnsupportedAppUsage VOICEMAIL, // A phone number is of type UNKNOWN when it does not fit any of the known patterns for a // specific region. @@ -437,22 +452,28 @@ public class PhoneNumberUtil { /** * Types of phone number matches. See detailed description beside the isNumberMatch() method. - * @hide This class is not part of the Android public SDK API + * @hide This class is not part of the Android public SDK API */ public enum MatchType { + @dalvik.annotation.compat.UnsupportedAppUsage NOT_A_NUMBER, + @dalvik.annotation.compat.UnsupportedAppUsage NO_MATCH, + @dalvik.annotation.compat.UnsupportedAppUsage SHORT_NSN_MATCH, + @dalvik.annotation.compat.UnsupportedAppUsage NSN_MATCH, + @dalvik.annotation.compat.UnsupportedAppUsage EXACT_MATCH, } /** * Possible outcomes when testing if a PhoneNumber is possible. - * @hide This class is not part of the Android public SDK API + * @hide This class is not part of the Android public SDK API */ public enum ValidationResult { /** The number length matches that of valid numbers for this region. */ + @dalvik.annotation.compat.UnsupportedAppUsage IS_POSSIBLE, /** * The number length matches that of local numbers for this region only (i.e. numbers that may @@ -473,19 +494,21 @@ public class PhoneNumberUtil { */ INVALID_LENGTH, /** The number is longer than all valid numbers for this region. */ + @dalvik.annotation.compat.UnsupportedAppUsage TOO_LONG, } /** * Leniency when {@linkplain PhoneNumberUtil#findNumbers finding} potential phone numbers in text * segments. The levels here are ordered in increasing strictness. - * @hide This class is not part of the Android public SDK API + * @hide This class is not part of the Android public SDK API */ public enum Leniency { /** * Phone numbers accepted are {@linkplain PhoneNumberUtil#isPossibleNumber(PhoneNumber) * possible}, but not necessarily {@linkplain PhoneNumberUtil#isValidNumber(PhoneNumber) valid}. */ + @dalvik.annotation.compat.UnsupportedAppUsage POSSIBLE { @Override boolean verify(PhoneNumber number, CharSequence candidate, PhoneNumberUtil util) { @@ -1079,6 +1102,7 @@ public class PhoneNumberUtil { * * @return a PhoneNumberUtil instance */ + @dalvik.annotation.compat.UnsupportedAppUsage public static synchronized PhoneNumberUtil getInstance() { if (instance == null) { setInstance(createInstance(MetadataManager.DEFAULT_METADATA_LOADER)); @@ -1182,6 +1206,7 @@ public class PhoneNumberUtil { * @param numberFormat the format the phone number should be formatted into * @return the formatted phone number */ + @dalvik.annotation.compat.UnsupportedAppUsage public String format(PhoneNumber number, PhoneNumberFormat numberFormat) { if (number.getNationalNumber() == 0 && number.hasRawInput()) { // Unparseable numbers that kept their raw input just use that. @@ -1561,6 +1586,7 @@ public class PhoneNumberUtil { * has one * @return the formatted phone number in its original number format */ + @dalvik.annotation.compat.UnsupportedAppUsage public String formatInOriginalFormat(PhoneNumber number, String regionCallingFrom) { if (number.hasRawInput() && !hasFormattingPatternForNumber(number)) { // We check if we have the formatting pattern because without that, we might format the number @@ -1812,6 +1838,7 @@ public class PhoneNumberUtil { * @param number the phone number for which the national significant number is needed * @return the national significant number of the PhoneNumber object passed in */ + @dalvik.annotation.compat.UnsupportedAppUsage public String getNationalSignificantNumber(PhoneNumber number) { // If leading zero(s) have been set, we prefix this now. Note this is not a national prefix. StringBuilder nationalNumber = new StringBuilder(); @@ -2155,6 +2182,7 @@ public class PhoneNumberUtil { * @param number the phone number that we want to know the type * @return the type of the phone number, or UNKNOWN if it is invalid */ + @dalvik.annotation.compat.UnsupportedAppUsage public PhoneNumberType getNumberType(PhoneNumber number) { String regionCode = getRegionCodeForNumber(number); PhoneMetadata metadata = getMetadataForRegionOrCallingCode(number.getCountryCode(), regionCode); @@ -2254,6 +2282,7 @@ public class PhoneNumberUtil { * @param number the phone number that we want to validate * @return a boolean that indicates whether the number is of a valid pattern */ + @dalvik.annotation.compat.UnsupportedAppUsage public boolean isValidNumber(PhoneNumber number) { String regionCode = getRegionCodeForNumber(number); return isValidNumberForRegion(number, regionCode); @@ -2298,6 +2327,7 @@ public class PhoneNumberUtil { * @return the region where the phone number is from, or null if no region matches this calling * code */ + @dalvik.annotation.compat.UnsupportedAppUsage public String getRegionCodeForNumber(PhoneNumber number) { int countryCode = number.getCountryCode(); List<String> regions = countryCallingCodeToRegionCodeMap.get(countryCode); @@ -2362,6 +2392,7 @@ public class PhoneNumberUtil { * @param regionCode the region that we want to get the country calling code for * @return the country calling code for the region denoted by regionCode */ + @dalvik.annotation.compat.UnsupportedAppUsage public int getCountryCodeForRegion(String regionCode) { if (!isValidRegionCode(regionCode)) { logger.log(Level.WARNING, @@ -2465,6 +2496,7 @@ public class PhoneNumberUtil { * @param number the number that needs to be checked * @return true if the number is possible */ + @dalvik.annotation.compat.UnsupportedAppUsage public boolean isPossibleNumber(PhoneNumber number) { ValidationResult result = isPossibleNumberWithReason(number); return result == ValidationResult.IS_POSSIBLE @@ -2593,6 +2625,7 @@ public class PhoneNumberUtil { * @param number the number that needs to be checked * @return a ValidationResult object which indicates whether the number is possible */ + @dalvik.annotation.compat.UnsupportedAppUsage public ValidationResult isPossibleNumberWithReason(PhoneNumber number) { return isPossibleNumberForTypeWithReason(number, PhoneNumberType.UNKNOWN); } @@ -2702,6 +2735,7 @@ public class PhoneNumberUtil { * @return an {@link com.android.i18n.phonenumbers.AsYouTypeFormatter} object, which can be used * to format phone numbers in the specific region "as you type" */ + @dalvik.annotation.compat.UnsupportedAppUsage public AsYouTypeFormatter getAsYouTypeFormatter(String regionCode) { return new AsYouTypeFormatter(regionCode); } @@ -3097,6 +3131,7 @@ public class PhoneNumberUtil { * This is to cover degenerate cases where the text has a lot of false positives in it. Must * be {@code >= 0}. */ + @dalvik.annotation.compat.UnsupportedAppUsage public Iterable<PhoneNumberMatch> findNumbers( final CharSequence text, final String defaultRegion, final Leniency leniency, final long maxTries) { @@ -3343,6 +3378,7 @@ public class PhoneNumberUtil { * @return NO_MATCH, SHORT_NSN_MATCH, NSN_MATCH or EXACT_MATCH depending on the level of equality * of the two numbers, described in the method definition. */ + @dalvik.annotation.compat.UnsupportedAppUsage public MatchType isNumberMatch(PhoneNumber firstNumberIn, PhoneNumber secondNumberIn) { // We only care about the fields that uniquely define a number, so we copy these across // explicitly. |