Modify emergency number detection

It's possible for an application to dial an emergency
number by appending extra digits to the phone number.

For example, one could dial "9111" instead of "911",
and a strict .equals wouldn't detect this as an emergency
number.

Replace .equals() with .startsWith()

Change-Id: I87f34fc2b9bbee2c4fa6be511bcc3b955559e0a9
This commit is contained in:
Nick Kralevich
2010-12-07 09:51:14 -08:00
parent 59b3866653
commit 1234ce117a

View File

@@ -1497,7 +1497,7 @@ public class PhoneNumberUtils
// searches through the comma-separated list for a match,
// return true if one is found.
for (String emergencyNum : numbers.split(",")) {
if (emergencyNum.equals(number)) {
if (number.startsWith(emergencyNum)) {
return true;
}
}
@@ -1506,7 +1506,7 @@ public class PhoneNumberUtils
}
//no ecclist system property, so use our own list.
return (number.equals("112") || number.equals("911"));
return (number.startsWith("112") || number.startsWith("911"));
}
/**