From 1234ce117adc6fef495688ed8032c43e77445f90 Mon Sep 17 00:00:00 2001 From: Nick Kralevich Date: Tue, 7 Dec 2010 09:51:14 -0800 Subject: 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 --- telephony/java/android/telephony/PhoneNumberUtils.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'telephony') 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")); } /** -- cgit v1.1