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

Skip to content
Commit 1a811695 authored by David Brown's avatar David Brown
Browse files

Add "potential" variants for PhoneNumberUtils.isEmergencyNumber()

The phone app needs a way to distinguish between (a) numbers that are
definitely emergency numbers, and (b) numbers that *might* result in an
emergency call being dialed, but aren't specifically emergency numbers
themselves.

(The phone app needs this distinction in order to enforce the restriction
that 3rd party apps should not be allowed to make emergency calls using
the ACTION_CALL intent, while still making sure that the in-call UI only
displays the "emergency call" state for numbers that are *definitely*
emergency numbers.  See bug 5493790 for the full details;)

So this change adds a full set of "isPotentialEmergencyNumber()" methods
to go along with the "isEmergencyNumber()" methods we've had all along.
The "potential" variants behave identically to the original methods,
*except* that they ultimately use number.startsWith() rather than
number.equals() when comparing against the list of emergency numbers.

TESTED:

- Unit test 'PhoneNumberUtilsTest#testIsEmergencyNumber' passes.
  (The PhoneNumberUtilsTest class doesn't pass in its entirety, but it was
  broken before this change also.)

- Also see the commit description of change
  Ib949fea3c0ce6b341a90e617a03ba3f22c69018b for the exact tests I ran
  against the phone app.

This change should be submitted along with
  Change-Id: Ib949fea3c0ce6b341a90e617a03ba3f22c69018b
in apps/Phone (but this change must go in first to avoid breaking the
build.)

Bug: 5493790
Change-Id: Ic528cfcc555734cdaf4ca8a18a50199771ba49b1
parent b445362b
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment