diff options
author | Nick Kralevich <nnk@google.com> | 2010-12-07 09:51:14 -0800 |
---|---|---|
committer | Nick Kralevich <nnk@google.com> | 2010-12-07 11:27:20 -0800 |
commit | 1234ce117adc6fef495688ed8032c43e77445f90 (patch) | |
tree | 40f0e94ee1addf4f166c6964c70b19dfd4214f96 /telephony | |
parent | 59b3866653a5a561a65d85851061e19123c5755c (diff) | |
download | frameworks_base-1234ce117adc6fef495688ed8032c43e77445f90.zip frameworks_base-1234ce117adc6fef495688ed8032c43e77445f90.tar.gz frameworks_base-1234ce117adc6fef495688ed8032c43e77445f90.tar.bz2 |
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
Diffstat (limited to 'telephony')
-rw-r--r-- | telephony/java/android/telephony/PhoneNumberUtils.java | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/telephony/java/android/telephony/PhoneNumberUtils.java b/telephony/java/android/telephony/PhoneNumberUtils.java index 893ae88..ad2a887 100644 --- a/telephony/java/android/telephony/PhoneNumberUtils.java +++ b/telephony/java/android/telephony/PhoneNumberUtils.java @@ -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")); } /** |