Use bulk delete for wiping contacts, now that it's implemented in ContactsProvider

Change-Id: I0363901902cc8c17116222eb78bacd2e96ad28d7
This commit is contained in:
Marc Blank 2009-08-31 21:43:54 -07:00
parent b3e4c79873
commit 469d07fdd4

View File

@ -262,24 +262,10 @@ public class ContactsSyncAdapter extends AbstractSyncAdapter {
@Override
public void wipe() {
// TODO Use the bulk delete when the CP supports it
// mContentResolver.delete(mAccountUri.buildUpon()
// .appendQueryParameter(ContactsContract.RawContacts.DELETE_PERMANENTLY, "true")
// .build(), null, null);
Cursor c = mContentResolver.query(mAccountUri, new String[] {"_id"}, null, null, null);
try {
while (c.moveToNext()) {
long id = c.getLong(0);
mContentResolver.delete(ContentUris
.withAppendedId(mAccountUri, id)
.buildUpon().appendQueryParameter(
ContactsContract.RawContacts.DELETE_PERMANENTLY, "true")
mContentResolver.delete(mAccountUri.buildUpon()
.appendQueryParameter(ContactsContract.RawContacts.DELETE_PERMANENTLY, "true")
.build(), null, null);
}
} finally {
c.close();
}
}
public void addData(String serverId, ContactOperations ops, Entity entity)
throws IOException {