diff options
author | Zheng Fu <zhengfu@google.com> | 2015-07-17 22:48:01 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2015-07-17 22:48:01 +0000 |
commit | 724455322098713441c3e923166e54e3f4186d8e (patch) | |
tree | c11ed3ac7e43dd0557055a15cf5ad904fe33d3fb | |
parent | a99fa8a5bf4d6db9da5fae2f09245a4dcec73645 (diff) | |
parent | 0dc8027bc70dc24c411d875a60781d44a0cfcf34 (diff) | |
download | packages_providers_ContactsProvider-724455322098713441c3e923166e54e3f4186d8e.zip packages_providers_ContactsProvider-724455322098713441c3e923166e54e3f4186d8e.tar.gz packages_providers_ContactsProvider-724455322098713441c3e923166e54e3f4186d8e.tar.bz2 |
am 0dc8027b: am f3d2981b: Should update aggregate data after marking raw contact deleted.
* commit '0dc8027bc70dc24c411d875a60781d44a0cfcf34':
Should update aggregate data after marking raw contact deleted.
-rw-r--r-- | src/com/android/providers/contacts/ContactsProvider2.java | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/com/android/providers/contacts/ContactsProvider2.java b/src/com/android/providers/contacts/ContactsProvider2.java index dba3709..200c25c 100644 --- a/src/com/android/providers/contacts/ContactsProvider2.java +++ b/src/com/android/providers/contacts/ContactsProvider2.java @@ -3733,27 +3733,26 @@ public class ContactsProvider2 extends AbstractContactsProvider c.close(); } + final boolean contactIsSingleton = + ContactsTableUtil.deleteContactIfSingleton(db, rawContactId) == 1; + final int count; + if (callerIsSyncAdapter || rawContactIsLocal(rawContactId)) { // When a raw contact is deleted, a SQLite trigger deletes the parent contact. // TODO: all contact deletes was consolidated into ContactTableUtil but this one can't // because it's in a trigger. Consider removing trigger and replacing with java code. // This has to happen before the raw contact is deleted since it relies on the number // of raw contacts. - if (ContactsTableUtil.deleteContactIfSingleton(db, rawContactId) == 0) { - mAggregator.get().updateAggregateData(mTransactionContext.get(), contactId); - } - db.delete(Tables.PRESENCE, PresenceColumns.RAW_CONTACT_ID + "=" + rawContactId, null); - int count = db.delete(Tables.RAW_CONTACTS, RawContacts._ID + "=" + rawContactId, null); - + count = db.delete(Tables.RAW_CONTACTS, RawContacts._ID + "=" + rawContactId, null); mTransactionContext.get().markRawContactChangedOrDeletedOrInserted(rawContactId); - return count; + } else { + count = markRawContactAsDeleted(db, rawContactId, callerIsSyncAdapter); } - - if (ContactsTableUtil.deleteContactIfSingleton(db, rawContactId) == 0) { + if (!contactIsSingleton) { mAggregator.get().updateAggregateData(mTransactionContext.get(), contactId); } - return markRawContactAsDeleted(db, rawContactId, callerIsSyncAdapter); + return count; } /** |