summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorBrian Attwell <brianattwell@google.com>2015-01-26 17:42:14 -0800
committerBrian Attwell <brianattwell@google.com>2015-01-26 17:51:38 -0800
commit75b452b88ad2841415a48e95706f538428ec200a (patch)
tree9cd5605d817ea42cbb369af436237cc7128b25fb /src/com
parent50f5cdd4a9c33896f2afadb0f8c4ebc09a75fa5a (diff)
downloadpackages_providers_ContactsProvider-75b452b88ad2841415a48e95706f538428ec200a.zip
packages_providers_ContactsProvider-75b452b88ad2841415a48e95706f538428ec200a.tar.gz
packages_providers_ContactsProvider-75b452b88ad2841415a48e95706f538428ec200a.tar.bz2
Change IS_SUPER_PRIMARY reset logic
CHANGES 1) change is_super_primary reset as discussed in go/proposed-change-to-resetting-super-primary-on-join 2) fix a bug in case #1 of testAggregation_clearSuperPrimary and extended the case a bit. Previously, both data rows had is_super_primary=false at setup instead of both true REASON This is mostly for the benefit of Lychee and future contact editor changes. This CL was also needed to make removing use of NAME_VERIFIED from GoogleContacts possible. At the very least, IS_SUPER_PRIMARY's behavior is now more consistent with NAME_VERIFIED. Bug: 5080996 Bug: 18777272 Change-Id: Ic3c17fcb1757f5966a7c6a52cf489083d5b8e51a
Diffstat (limited to 'src/com')
-rw-r--r--src/com/android/providers/contacts/aggregation/ContactAggregator.java14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/com/android/providers/contacts/aggregation/ContactAggregator.java b/src/com/android/providers/contacts/aggregation/ContactAggregator.java
index 8dcabca..ab87c7e 100644
--- a/src/com/android/providers/contacts/aggregation/ContactAggregator.java
+++ b/src/com/android/providers/contacts/aggregation/ContactAggregator.java
@@ -901,8 +901,8 @@ public class ContactAggregator {
private void clearSuperPrimarySetting(SQLiteDatabase db, long contactId, long rawContactId) {
final String[] args = {String.valueOf(contactId), String.valueOf(rawContactId)};
- // Find out which mime-types are shared by raw contact of rawContactId and raw contacts
- // of contactId
+ // Find out which mime-types exist with is_super_primary=true on both the raw contact of
+ // rawContactId and raw contacts of contactId
int index = 0;
final StringBuilder mimeTypeCondition = new StringBuilder();
mimeTypeCondition.append(" AND " + DataColumns.MIMETYPE_ID + " IN (");
@@ -910,10 +910,12 @@ public class ContactAggregator {
final Cursor c = db.rawQuery(
"SELECT DISTINCT(a." + DataColumns.MIMETYPE_ID + ")" +
" FROM (SELECT " + DataColumns.MIMETYPE_ID + " FROM " + Tables.DATA + " WHERE " +
+ Data.IS_SUPER_PRIMARY + " =1 AND " +
Data.RAW_CONTACT_ID + " IN (SELECT " + RawContacts._ID + " FROM " +
Tables.RAW_CONTACTS + " WHERE " + RawContacts.CONTACT_ID + "=?1)) AS a" +
- " JOIN (SELECT " + DataColumns.MIMETYPE_ID + " FROM " + Tables.DATA + " WHERE "
- + Data.RAW_CONTACT_ID + "=?2) AS b" +
+ " JOIN (SELECT " + DataColumns.MIMETYPE_ID + " FROM " + Tables.DATA + " WHERE " +
+ Data.IS_SUPER_PRIMARY + " =1 AND " +
+ Data.RAW_CONTACT_ID + "=?2) AS b" +
" ON a." + DataColumns.MIMETYPE_ID + "=b." + DataColumns.MIMETYPE_ID,
args);
try {
@@ -929,8 +931,8 @@ public class ContactAggregator {
c.close();
}
- // Clear is_super_primary setting for all the mime-types exist in both raw contact
- // of rawContactId and raw contacts of contactId
+ // Clear is_super_primary setting for all the mime-types with is_super_primary=true
+ // in both raw contact of rawContactId and raw contacts of contactId
String superPrimaryUpdateSql = "UPDATE " + Tables.DATA +
" SET " + Data.IS_SUPER_PRIMARY + "=0" +
" WHERE (" + Data.RAW_CONTACT_ID +