aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLiefu Liu <liefuliu@google.com>2021-04-19 23:06:01 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2021-04-19 23:06:01 +0000
commit7b7ef19c2660ff70f5c9792846637dcead6059b4 (patch)
tree85f28af6cdc9ead51c4c5e4bf779a666a518536c /src
parent631f66bc90929cbff251541c2c6e382bccc8bf74 (diff)
parentbc27940a7f956599c250a248448484a505601e0e (diff)
downloadContactsProvider-7b7ef19c2660ff70f5c9792846637dcead6059b4.tar.gz
Force SearchIndex.rowid identical with contact_id, and find the matched contact in SearchIndex table via rowId am: bc27940a7f
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/providers/ContactsProvider/+/14194127 Change-Id: I1143bb5d2efa05092917592e2f68c7dfc624ad02
Diffstat (limited to 'src')
-rw-r--r--src/com/android/providers/contacts/SearchIndexManager.java6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/com/android/providers/contacts/SearchIndexManager.java b/src/com/android/providers/contacts/SearchIndexManager.java
index e421654c..aeaa0e7d 100644
--- a/src/com/android/providers/contacts/SearchIndexManager.java
+++ b/src/com/android/providers/contacts/SearchIndexManager.java
@@ -55,7 +55,8 @@ public class SearchIndexManager {
private static final int MAX_STRING_BUILDER_SIZE = 1024 * 10;
public static final String PROPERTY_SEARCH_INDEX_VERSION = "search_index";
- private static final int SEARCH_INDEX_VERSION = 1;
+ private static final String ROW_ID_KEY = "rowid";
+ private static final int SEARCH_INDEX_VERSION = 2;
private static final class ContactIndexQuery {
public static final String[] COLUMNS = {
@@ -327,7 +328,7 @@ public class SearchIndexManager {
// Remove affected search_index rows.
final SQLiteDatabase db = mDbHelper.getWritableDatabase();
final int deleted = db.delete(Tables.SEARCH_INDEX,
- SearchIndexColumns.CONTACT_ID + " IN (SELECT " +
+ ROW_ID_KEY + " IN (SELECT " +
RawContacts.CONTACT_ID +
" FROM " + Tables.RAW_CONTACTS +
" WHERE " + rawContactsSelection +
@@ -400,6 +401,7 @@ public class SearchIndexManager {
mValues.put(SearchIndexColumns.NAME, builder.getName());
mValues.put(SearchIndexColumns.TOKENS, builder.getTokens());
mValues.put(SearchIndexColumns.CONTACT_ID, contactId);
+ mValues.put(ROW_ID_KEY, contactId);
db.insert(Tables.SEARCH_INDEX, null, mValues);
}
private int getSearchIndexVersion() {