From 8a8ddc3d1ceee9872ace06326ebe999ba171f70b Mon Sep 17 00:00:00 2001 From: Makoto Onuki Date: Thu, 24 Jul 2014 18:17:57 -0700 Subject: Do not build NAME_LOOKUP from phonetic names This prevents aggregation by phonetic name Note: if a contact only has a phonetic name (i.e. without any non-phonetic name components), then its display name is set from the phonetic name. This CL does *not* prevent phonetic-name-based display names getting into NAME_LOOKUP, meaning if two contacts have no names but the same phonetic name, then they *will* still be aggregated. But this shouldn't be an issue since what was an issue was "aggregating two contacts with *different* names with the same phonetic name". Bug 10957673 Change-Id: I6484128b1f7e4bbe1b08c57969a8a1ef147d5c7d --- .../providers/contacts/ContactsDatabaseHelper.java | 27 ++++++---------------- 1 file changed, 7 insertions(+), 20 deletions(-) (limited to 'src/com/android/providers/contacts/ContactsDatabaseHelper.java') diff --git a/src/com/android/providers/contacts/ContactsDatabaseHelper.java b/src/com/android/providers/contacts/ContactsDatabaseHelper.java index bda9826..f23d245 100644 --- a/src/com/android/providers/contacts/ContactsDatabaseHelper.java +++ b/src/com/android/providers/contacts/ContactsDatabaseHelper.java @@ -116,7 +116,7 @@ public class ContactsDatabaseHelper extends SQLiteOpenHelper { * 900-999 L * */ - static final int DATABASE_VERSION = 906; + static final int DATABASE_VERSION = 907; public interface Tables { public static final String CONTACTS = "contacts"; @@ -2776,6 +2776,12 @@ public class ContactsDatabaseHelper extends SQLiteOpenHelper { oldVersion = 906; } + if (oldVersion < 907) { + // Rebuild NAME_LOOKUP. + upgradeNameLookup = true; + oldVersion = 907; + } + if (upgradeViewsAndTriggers) { createContactsViews(db); createGroupsView(db); @@ -5653,25 +5659,6 @@ public class ContactsDatabaseHelper extends SQLiteOpenHelper { } } - public void insertNameLookupForPhoneticName(long rawContactId, long dataId, String familyName, - String middleName, String givenName) { - mSb.setLength(0); - if (familyName != null) { - mSb.append(familyName.trim()); - } - if (middleName != null) { - mSb.append(middleName.trim()); - } - if (givenName != null) { - mSb.append(givenName.trim()); - } - - if (mSb.length() > 0) { - insertNameLookup(rawContactId, dataId, NameLookupType.NAME_COLLATION_KEY, - NameNormalizer.normalize(mSb.toString())); - } - } - /** * Performs a query and returns true if any Data item of the raw contact with the given * id and mimetype is marked as super-primary -- cgit v1.1