summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZheng Fu <zhengfu@google.com>2015-07-17 23:05:02 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-07-17 23:05:02 +0000
commita266119d041fe28deb0c5364ad1cc2b3ec90d90b (patch)
tree6ac8535d7b1eb9280e0de3021935957f2223d954
parentece8c3ecfc258ec9e58c0c3b8b07339b051858b1 (diff)
parent724455322098713441c3e923166e54e3f4186d8e (diff)
downloadpackages_providers_ContactsProvider-a266119d041fe28deb0c5364ad1cc2b3ec90d90b.zip
packages_providers_ContactsProvider-a266119d041fe28deb0c5364ad1cc2b3ec90d90b.tar.gz
packages_providers_ContactsProvider-a266119d041fe28deb0c5364ad1cc2b3ec90d90b.tar.bz2
am 72445532: am 0dc8027b: am f3d2981b: Should update aggregate data after marking raw contact deleted.
* commit '724455322098713441c3e923166e54e3f4186d8e': Should update aggregate data after marking raw contact deleted.
-rw-r--r--src/com/android/providers/contacts/ContactsProvider2.java19
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;
}
/**