diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2017-12-14 22:14:49 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2017-12-14 22:14:49 +0000 |
commit | 7c98fd6015531737c4af01748385da8d25cef658 (patch) | |
tree | e8ac965f799aa1be24268c241280223b86157ec0 /java/com/android/dialer/app/calllog/CallLogGroupBuilder.java | |
parent | 35363b349d9542a0dd124307a498a3daa0e73390 (diff) | |
parent | 2d5167b475d64b4bad0f0cde2508bca55c4b7643 (diff) |
Merge "Take into consideration special characters when we do contact match."
Diffstat (limited to 'java/com/android/dialer/app/calllog/CallLogGroupBuilder.java')
-rw-r--r-- | java/com/android/dialer/app/calllog/CallLogGroupBuilder.java | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/java/com/android/dialer/app/calllog/CallLogGroupBuilder.java b/java/com/android/dialer/app/calllog/CallLogGroupBuilder.java index 513c8aa59..a48de0f51 100644 --- a/java/com/android/dialer/app/calllog/CallLogGroupBuilder.java +++ b/java/com/android/dialer/app/calllog/CallLogGroupBuilder.java @@ -189,13 +189,26 @@ public class CallLogGroupBuilder { mGroupCreator.addGroup(count - groupSize, groupSize); } + /** + * Returns true when the two input numbers can be considered identical enough for caller ID + * purposes and put in a call log group. + */ @VisibleForTesting boolean equalNumbers(@Nullable String number1, @Nullable String number2) { if (PhoneNumberHelper.isUriNumber(number1) || PhoneNumberHelper.isUriNumber(number2)) { return compareSipAddresses(number1, number2); - } else { - return PhoneNumberUtils.compare(number1, number2); } + + // PhoneNumberUtils.compare(String, String) ignores special characters such as '#'. For example, + // it thinks "123" and "#123" are identical enough for caller ID purposes. + // When either input number contains special characters, we put the two in the same group iff + // their raw numbers are exactly the same. + if (PhoneNumberHelper.numberHasSpecialChars(number1) + || PhoneNumberHelper.numberHasSpecialChars(number2)) { + return PhoneNumberHelper.sameRawNumbers(number1, number2); + } + + return PhoneNumberUtils.compare(number1, number2); } private boolean isSameAccount(String name1, String name2, String id1, String id2) { |