diff --git a/core/api/current.txt b/core/api/current.txt index e5421a0b2cecc..9f4af3791d859 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -40497,12 +40497,13 @@ package android.telephony { public class PhoneNumberUtils { ctor public PhoneNumberUtils(); method public static void addTtsSpan(android.text.Spannable, int, int); + method public static boolean areSamePhoneNumber(@NonNull String, @NonNull String, @NonNull String); method @Deprecated public static String calledPartyBCDFragmentToString(byte[], int, int); method public static String calledPartyBCDFragmentToString(byte[], int, int, int); method @Deprecated public static String calledPartyBCDToString(byte[], int, int); method public static String calledPartyBCDToString(byte[], int, int, int); - method public static boolean compare(String, String); - method public static boolean compare(android.content.Context, String, String); + method @Deprecated public static boolean compare(String, String); + method @Deprecated public static boolean compare(android.content.Context, String, String); method public static String convertKeypadLettersToDigits(String); method public static android.text.style.TtsSpan createTtsSpan(String); method public static CharSequence createTtsSpannable(CharSequence); diff --git a/telephony/java/android/telephony/PhoneNumberUtils.java b/telephony/java/android/telephony/PhoneNumberUtils.java index ed09d538a3b16..1273aa3abbc9b 100644 --- a/telephony/java/android/telephony/PhoneNumberUtils.java +++ b/telephony/java/android/telephony/PhoneNumberUtils.java @@ -478,7 +478,9 @@ public class PhoneNumberUtils { /** * Compare phone numbers a and b, return true if they're identical enough for caller ID purposes. + * @deprecated use {@link #areSamePhoneNumber(String, String, String)} instead */ + @Deprecated public static boolean compare(String a, String b) { // We've used loose comparation at least Eclair, which may change in the future. @@ -489,7 +491,9 @@ public class PhoneNumberUtils { * Compare phone numbers a and b, and return true if they're identical * enough for caller ID purposes. Checks a resource to determine whether * to use a strict or loose comparison algorithm. + * @deprecated use {@link #areSamePhoneNumber(String, String, String)} instead */ + @Deprecated public static boolean compare(Context context, String a, String b) { boolean useStrict = context.getResources().getBoolean( com.android.internal.R.bool.config_use_strict_phone_number_comparation); @@ -3218,7 +3222,7 @@ public class PhoneNumberUtils { } // The conversion map is not defined (this is default). Skip conversion. - if (sConvertToEmergencyMap == null || sConvertToEmergencyMap.length == 0 ) { + if (sConvertToEmergencyMap == null || sConvertToEmergencyMap.length == 0) { return number; } @@ -3254,4 +3258,47 @@ public class PhoneNumberUtils { } return number; } + + /** + * Determines if two phone numbers are the same. + *

+ * Matching is based on