diff options
| author | 2014-06-06 17:37:37 +0000 | |
|---|---|---|
| committer | 2014-06-06 17:37:37 +0000 | |
| commit | 67a0ed001dbd59cd58992508e386f6eb6fefe7ed (patch) | |
| tree | 3cc569237e54585da624db359d2be564015e4e52 | |
| parent | 71f75f1e7be4107c9ffbcb37d816c053d9675367 (diff) | |
| parent | 282129fd3f789739c47fe5506bcf29c1a2712b3e (diff) | |
Merge "API changes to Telephony per API review"
4 files changed, 16 insertions, 17 deletions
diff --git a/api/current.txt b/api/current.txt index 4e314a9c0c68..eab14e2c0673 100644 --- a/api/current.txt +++ b/api/current.txt @@ -28089,7 +28089,7 @@ package android.telephony { method public static boolean isEmergencyNumber(java.lang.String); method public static boolean isGlobalPhoneNumber(java.lang.String); method public static boolean isISODigit(char); - method public static boolean isLocalEmergencyNumber(java.lang.String, android.content.Context); + method public static boolean isLocalEmergencyNumber(android.content.Context, java.lang.String); method public static final boolean isNonSeparator(char); method public static final boolean isReallyDialable(char); method public static final boolean isStartsPostDial(char); diff --git a/telephony/java/android/telephony/PhoneNumberUtils.java b/telephony/java/android/telephony/PhoneNumberUtils.java index 9da032a87807..ed7f6b8fabd7 100644 --- a/telephony/java/android/telephony/PhoneNumberUtils.java +++ b/telephony/java/android/telephony/PhoneNumberUtils.java @@ -1742,15 +1742,15 @@ public class PhoneNumberUtils /** * Checks if a given number is an emergency number for the country that the user is in. - * - * @param number the number to look up. * @param context the specific context which the number should be checked against + * @param number the number to look up. + * * @return true if the specified number is an emergency number for the country the user * is currently in. */ - public static boolean isLocalEmergencyNumber(String number, Context context) { - return isLocalEmergencyNumberInternal(number, - context, + public static boolean isLocalEmergencyNumber(Context context, String number) { + return isLocalEmergencyNumberInternal(context, + number, true /* useExactMatch */); } @@ -1767,27 +1767,26 @@ public class PhoneNumberUtils * This method is intended for internal use by the phone app when * deciding whether to allow ACTION_CALL intents from 3rd party apps * (where we're required to *not* allow emergency calls to be placed.) - * - * @param number the number to look up. * @param context the specific context which the number should be checked against + * @param number the number to look up. + * * @return true if the specified number is an emergency number for a local country, based on the * CountryDetector. * * @see android.location.CountryDetector * @hide */ - public static boolean isPotentialLocalEmergencyNumber(String number, Context context) { - return isLocalEmergencyNumberInternal(number, - context, + public static boolean isPotentialLocalEmergencyNumber(Context context, String number) { + return isLocalEmergencyNumberInternal(context, + number, false /* useExactMatch */); } /** * Helper function for isLocalEmergencyNumber() and * isPotentialLocalEmergencyNumber(). - * - * @param number the number to look up. * @param context the specific context which the number should be checked against + * @param number the number to look up. * @param useExactMatch if true, consider a number to be an emergency * number only if it *exactly* matches a number listed in * the RIL / SIM. If false, a number is considered to be an @@ -1799,8 +1798,8 @@ public class PhoneNumberUtils * * @see android.location.CountryDetector */ - private static boolean isLocalEmergencyNumberInternal(String number, - Context context, + private static boolean isLocalEmergencyNumberInternal(Context context, + String number, boolean useExactMatch) { String countryIso; CountryDetector detector = (CountryDetector) context.getSystemService( diff --git a/telephony/java/com/android/internal/telephony/CallerInfo.java b/telephony/java/com/android/internal/telephony/CallerInfo.java index f6143eddbd38..f8dd7cf3de41 100644 --- a/telephony/java/com/android/internal/telephony/CallerInfo.java +++ b/telephony/java/com/android/internal/telephony/CallerInfo.java @@ -276,7 +276,7 @@ public class CallerInfo { // Change the callerInfo number ONLY if it is an emergency number // or if it is the voicemail number. If it is either, take a // shortcut and skip the query. - if (PhoneNumberUtils.isLocalEmergencyNumber(number, context)) { + if (PhoneNumberUtils.isLocalEmergencyNumber(context, number)) { return new CallerInfo().markAsEmergency(context); } else if (PhoneNumberUtils.isVoiceMailNumber(number)) { return new CallerInfo().markAsVoiceMail(); diff --git a/telephony/java/com/android/internal/telephony/CallerInfoAsyncQuery.java b/telephony/java/com/android/internal/telephony/CallerInfoAsyncQuery.java index 74f73b52fbd1..34fed5ececcf 100644 --- a/telephony/java/com/android/internal/telephony/CallerInfoAsyncQuery.java +++ b/telephony/java/com/android/internal/telephony/CallerInfoAsyncQuery.java @@ -399,7 +399,7 @@ public class CallerInfoAsyncQuery { cw.number = number; // check to see if these are recognized numbers, and use shortcuts if we can. - if (PhoneNumberUtils.isLocalEmergencyNumber(number, context)) { + if (PhoneNumberUtils.isLocalEmergencyNumber(context, number)) { cw.event = EVENT_EMERGENCY_NUMBER; } else if (PhoneNumberUtils.isVoiceMailNumber(number)) { cw.event = EVENT_VOICEMAIL_NUMBER; |