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

Commit e45beeb7 authored by David Brown's avatar David Brown Committed by Android (Google) Code Review
Browse files

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

Merge "Temp fix to the problem of incorrectly classifying Brazilian local numbers as emergency numbers."
parents 5c267ece c6027ee4
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"));
    }
}