summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/com/android/providers/contacts/aggregation/AbstractContactAggregator.java12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/com/android/providers/contacts/aggregation/AbstractContactAggregator.java b/src/com/android/providers/contacts/aggregation/AbstractContactAggregator.java
index 0caa861..cfbad32 100644
--- a/src/com/android/providers/contacts/aggregation/AbstractContactAggregator.java
+++ b/src/com/android/providers/contacts/aggregation/AbstractContactAggregator.java
@@ -1928,7 +1928,17 @@ public abstract class AbstractContactAggregator {
db.beginTransaction();
try {
List<MatchScore> bestMatches = findMatchingContacts(db, contactId, parameters);
- return queryMatchingContacts(qb, db, projection, bestMatches, maxSuggestions, filter);
+ List<MatchScore> bestMatchesWithoutDuplicateContactIds = new ArrayList<>();
+ Set<Long> contactIds = new HashSet<>();
+ for (MatchScore bestMatch : bestMatches) {
+ long cid = bestMatch.getContactId();
+ if (!contactIds.contains(cid)) {
+ bestMatchesWithoutDuplicateContactIds.add(bestMatch);
+ contactIds.add(cid);
+ }
+ }
+ return queryMatchingContacts(qb, db, projection, bestMatchesWithoutDuplicateContactIds,
+ maxSuggestions, filter);
} finally {
db.endTransaction();
}