Skip to content

Commit e45beeb

Browse files
David BrownAndroid (Google) Code Review
authored andcommitted
Merge "Temp fix to the problem of incorrectly classifying Brazilian local numbers as emergency numbers."
2 parents 5c267ec + c6027ee commit e45beeb

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

telephony/java/android/telephony/PhoneNumberUtils.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1567,6 +1567,14 @@ public static boolean isEmergencyNumber(String number, String defaultCountryIso)
15671567
// that has been collected.
15681568
if (util.isValidNumber(pn)) {
15691569
return false;
1570+
} else if ("BR".equalsIgnoreCase(defaultCountryIso) && number.length() >= 8) {
1571+
// This is to prevent Brazilian local numbers which start with 911 being incorrectly
1572+
// classified as emergency numbers. 911 is not an emergency number in Brazil; it is also
1573+
// not possible to append additional digits to an emergency number to dial the number in
1574+
// Brazil - it won't connect.
1575+
// TODO: Clean this up once a list of country-specific known emergency numbers is
1576+
// collected.
1577+
return false;
15701578
}
15711579
} catch (NumberParseException e) {
15721580
}

telephony/tests/telephonytests/src/com/android/internal/telephony/PhoneNumberUtilsTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,5 +551,8 @@ public void testIsEmergencyNumber() {
551551
// A valid fixed-line phone number from Brazil shouldn't be classified as an emergency number
552552
// in Brazil, as 112 is not an emergency number there.
553553
assertFalse(PhoneNumberUtils.isEmergencyNumber("1121234567", "BR"));
554+
// A valid local phone number from Brazil shouldn't be classified as an emergency number in
555+
// Brazil.
556+
assertFalse(PhoneNumberUtils.isEmergencyNumber("91112345", "BR"));
554557
}
555558
}

0 commit comments

Comments
 (0)