diff options
author | Chiao Cheng <chiaocheng@google.com> | 2013-11-22 16:05:02 -0800 |
---|---|---|
committer | Ethan Chen <intervigil@gmail.com> | 2014-11-24 20:23:35 +0000 |
commit | 7ee37679397cdeb3e8d30931df4c27d2f10302e4 (patch) | |
tree | c3ae6119752cf640bdb5bb7b5a17326078ba80cc | |
parent | 7e63d3885e016e83b64ccd98f14fcf309be2d6db (diff) | |
download | android_packages_providers_ContactsProvider-shipping/cm-11.0.tar.gz android_packages_providers_ContactsProvider-shipping/cm-11.0.tar.bz2 android_packages_providers_ContactsProvider-shipping/cm-11.0.zip |
Fixes cases when a contact was deleted via the contacts app.cm-11.0-XNPH05Q-tomato-9828f8e9ccstable/cm-11.0-XNF8Yshipping/cm-11.0
In this case, the contact id of the raw contact is nulled out. This has the
side effect of making the IN clause of sqlite never equal. Similar to:
SELECT 1 as id WHERE id NOT IN (SELECT null);
always returns 0 rows because the comparison to null is always false.
Protect against this case by eliminating null contact ids.
Bug: 11826565
Change-Id: Ide9b150bb7f94d03c210d43dbc8cdd5c42c21cf9
(cherry picked from commit 9fc2d9abb7b5034e86006d360ba49c8b1b55058c)
-rw-r--r-- | src/com/android/providers/contacts/ContactsProvider2.java | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/com/android/providers/contacts/ContactsProvider2.java b/src/com/android/providers/contacts/ContactsProvider2.java index d94191ca..3ea307ae 100644 --- a/src/com/android/providers/contacts/ContactsProvider2.java +++ b/src/com/android/providers/contacts/ContactsProvider2.java @@ -5005,10 +5005,14 @@ public class ContactsProvider2 extends AbstractContactsProvider " FROM " + Tables.RAW_CONTACTS + " WHERE " + RawContactsColumns.ACCOUNT_ID + " = ?1" + " AND " + RawContactsColumns.CONCRETE_CONTACT_ID + + " IS NOT NULL" + + " AND " + RawContactsColumns.CONCRETE_CONTACT_ID + " NOT IN (" + " SELECT " + RawContactsColumns.CONCRETE_CONTACT_ID + " FROM " + Tables.RAW_CONTACTS + " WHERE " + RawContactsColumns.ACCOUNT_ID + " != ?1" + + " AND " + RawContactsColumns.CONCRETE_CONTACT_ID + + " IS NOT NULL" + ")", accountIdParams); try { while (cursor.moveToNext()) { |