Temp fix to the problem of incorrectly classifying Brazilian local

numbers as emergency numbers.

Bug: 5247602
Change-Id: Ib1626ef25ced2e149c526601bfac72de39e3f1b9
This commit is contained in:
Shaopeng Jia
2011-09-22 13:53:40 +02:00
parent 013ccb7010
commit c6027ee464
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"));
}
}