|
|
|
@ -456,8 +456,9 @@ public class ShortNumberInfo { |
|
|
|
|
|
|
|
/** |
|
|
|
* Given a valid short number, determines whether it is carrier-specific (however, nothing is |
|
|
|
* implied about its validity). If it is important that the number is valid, then its validity |
|
|
|
* must first be checked using {@link #isValidShortNumber} or |
|
|
|
* implied about its validity). Carrier-specific numbers may connect to a different end-point, or |
|
|
|
* not connect at all, depending on the user's carrier. If it is important that the number is |
|
|
|
* valid, then its validity must first be checked using {@link #isValidShortNumber} or |
|
|
|
* {@link #isValidShortNumberForRegion}. |
|
|
|
* |
|
|
|
* @param number the valid short number to check |
|
|
|
@ -474,6 +475,31 @@ public class ShortNumberInfo { |
|
|
|
phoneMetadata.getCarrierSpecific())); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Given a valid short number, determines whether it is carrier-specific when dialed from the |
|
|
|
* given region (however, nothing is implied about its validity). Carrier-specific numbers may |
|
|
|
* connect to a different end-point, or not connect at all, depending on the user's carrier. If |
|
|
|
* it is important that the number is valid, then its validity must first be checked using |
|
|
|
* {@link #isValidShortNumber} or {@link #isValidShortNumberForRegion}. Returns false if the |
|
|
|
* number doesn't match the region provided. |
|
|
|
* |
|
|
|
* @param number the valid short number to check |
|
|
|
* @param regionDialingFrom the region from which the number is dialed |
|
|
|
* @return whether the short number is carrier-specific (assuming the input was a valid short |
|
|
|
* number) |
|
|
|
*/ |
|
|
|
public boolean isCarrierSpecificForRegion(PhoneNumber number, String regionDialingFrom) { |
|
|
|
if (!regionDialingFromMatchesNumber(number, regionDialingFrom)) { |
|
|
|
return false; |
|
|
|
} |
|
|
|
String nationalNumber = getNationalSignificantNumber(number); |
|
|
|
PhoneMetadata phoneMetadata = |
|
|
|
MetadataManager.getShortNumberMetadataForRegion(regionDialingFrom); |
|
|
|
return (phoneMetadata != null) |
|
|
|
&& (matchesPossibleNumberAndNationalNumber(nationalNumber, |
|
|
|
phoneMetadata.getCarrierSpecific())); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Gets the national significant number of the a phone number. Note a national significant number |
|
|
|
* doesn't contain a national prefix or any formatting. |
|
|
|
|