Merge "Temp fix to the problem of incorrectly classifying Brazilian local numbers as emergency numbers."

This commit is contained in:
David Brown
2011-09-23 11:25:57 -07:00
committed by Android (Google) Code Review
2 changed files with 11 additions and 0 deletions

View File

@@ -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) {
}

View File

@@ -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"));
}
}