Merge "Temp fix to the problem of incorrectly classifying Brazilian local numbers as emergency numbers."
This commit is contained in:
@@ -1567,6 +1567,14 @@ public class PhoneNumberUtils
|
||||
// that has been collected.
|
||||
if (util.isValidNumber(pn)) {
|
||||
return false;
|
||||
} else if ("BR".equalsIgnoreCase(defaultCountryIso) && number.length() >= 8) {
|
||||
// This is to prevent Brazilian local numbers which start with 911 being incorrectly
|
||||
// classified as emergency numbers. 911 is not an emergency number in Brazil; it is also
|
||||
// not possible to append additional digits to an emergency number to dial the number in
|
||||
// Brazil - it won't connect.
|
||||
// TODO: Clean this up once a list of country-specific known emergency numbers is
|
||||
// collected.
|
||||
return false;
|
||||
}
|
||||
} catch (NumberParseException e) {
|
||||
}
|
||||
|
||||
@@ -551,5 +551,8 @@ public class PhoneNumberUtilsTest extends AndroidTestCase {
|
||||
// A valid fixed-line phone number from Brazil shouldn't be classified as an emergency number
|
||||
// in Brazil, as 112 is not an emergency number there.
|
||||
assertFalse(PhoneNumberUtils.isEmergencyNumber("1121234567", "BR"));
|
||||
// A valid local phone number from Brazil shouldn't be classified as an emergency number in
|
||||
// Brazil.
|
||||
assertFalse(PhoneNumberUtils.isEmergencyNumber("91112345", "BR"));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user