diff options
author | Dmitri Plotnikov <dplotnikov@google.com> | 2010-10-14 10:10:25 -0700 |
---|---|---|
committer | Dmitri Plotnikov <dplotnikov@google.com> | 2010-10-14 10:10:25 -0700 |
commit | afcfc0005f7c93d46c28cdd8e18f956287ca0d18 (patch) | |
tree | f7a4f31845fc500458e930dec5108b770219f652 | |
parent | 72c7667755dfabba69a2afa479185a3ab458e948 (diff) | |
download | packages_providers_ContactsProvider-afcfc0005f7c93d46c28cdd8e18f956287ca0d18.tar.gz packages_providers_ContactsProvider-afcfc0005f7c93d46c28cdd8e18f956287ca0d18.tar.bz2 packages_providers_ContactsProvider-afcfc0005f7c93d46c28cdd8e18f956287ca0d18.zip |
Fixing ContactAggregator breakage revealed by an automated test
If you have an automatic aggregate of three or more
raw contacts and you confirm the aggregation by adding
an explicit manual override between two of the raw contacts,
the third raw contact falls out of the aggregate.
This CL fixes the problem.
Bug: 3097139
Change-Id: I96b717eeb03e1a49a45b28ee395924f9d61c3e99
-rw-r--r-- | src/com/android/providers/contacts/ContactAggregator.java | 4 | ||||
-rw-r--r-- | tests/src/com/android/providers/contacts/ContactAggregatorTest.java | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/src/com/android/providers/contacts/ContactAggregator.java b/src/com/android/providers/contacts/ContactAggregator.java index b3a3baad..314ed0ab 100644 --- a/src/com/android/providers/contacts/ContactAggregator.java +++ b/src/com/android/providers/contacts/ContactAggregator.java @@ -539,8 +539,8 @@ public class ContactAggregator { // If we found an aggregate to join, but it already contains raw contacts from // the same account, not only will we not join it, but also we will split // that other aggregate - if (contactId != -1 && containsRawContactsFromAccount( - db, contactId, accountType, accountName)) { + if (contactId != -1 && contactId != currentContactId && + containsRawContactsFromAccount(db, contactId, accountType, accountName)) { contactIdToSplit = contactId; contactId = -1; } diff --git a/tests/src/com/android/providers/contacts/ContactAggregatorTest.java b/tests/src/com/android/providers/contacts/ContactAggregatorTest.java index 66675648..328b03ce 100644 --- a/tests/src/com/android/providers/contacts/ContactAggregatorTest.java +++ b/tests/src/com/android/providers/contacts/ContactAggregatorTest.java @@ -547,6 +547,8 @@ public class ContactAggregatorTest extends BaseContactsProvider2Test { long rawContactId1 = createRawContactWithName("John", "Doe", ACCOUNT_1); long rawContactId2 = createRawContactWithName("John", "Doe", ACCOUNT_2); long rawContactId3 = createRawContactWithName("John", "Doe", ACCOUNT_3); + assertAggregated(rawContactId1, rawContactId2); + assertAggregated(rawContactId1, rawContactId3); setAggregationException( AggregationExceptions.TYPE_KEEP_TOGETHER, rawContactId1, rawContactId2); assertAggregated(rawContactId1, rawContactId2); |