Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c6027ee4 authored by Shaopeng Jia's avatar Shaopeng Jia
Browse files

Temp fix to the problem of incorrectly classifying Brazilian local

numbers as emergency numbers.

Bug: 5247602
Change-Id: Ib1626ef25ced2e149c526601bfac72de39e3f1b9
parent 013ccb70
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -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) {
      }
+3 −0
Original line number Diff line number Diff line
@@ -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"));
    }
}