mirror of
https://github.com/etesync/android
synced 2024-11-22 16:08:13 +00:00
Allow large transactions
* version bump to 1.2.1-ose * upgrade to okhttp 3.4.1 * ical4android/vcard4android: split oversized transactions
This commit is contained in:
parent
f6cb92dd6d
commit
7fbdf96546
6
.gitmodules
vendored
6
.gitmodules
vendored
@ -1,12 +1,12 @@
|
|||||||
[submodule "dav4android"]
|
[submodule "dav4android"]
|
||||||
path = dav4android
|
path = dav4android
|
||||||
url = https://gitlab.com/bitfireAT/dav4android.git
|
url = ../dav4android.git
|
||||||
[submodule "ical4android"]
|
[submodule "ical4android"]
|
||||||
path = ical4android
|
path = ical4android
|
||||||
url = https://gitlab.com/bitfireAT/ical4android.git
|
url = ../ical4android.git
|
||||||
[submodule "vcard4android"]
|
[submodule "vcard4android"]
|
||||||
path = vcard4android
|
path = vcard4android
|
||||||
url = https://gitlab.com/bitfireAT/vcard4android.git
|
url = ../vcard4android.git
|
||||||
[submodule "MemorizingTrustManager"]
|
[submodule "MemorizingTrustManager"]
|
||||||
path = MemorizingTrustManager
|
path = MemorizingTrustManager
|
||||||
url = https://github.com/ge0rg/MemorizingTrustManager
|
url = https://github.com/ge0rg/MemorizingTrustManager
|
||||||
|
@ -17,14 +17,14 @@ android {
|
|||||||
minSdkVersion 14
|
minSdkVersion 14
|
||||||
targetSdkVersion 23
|
targetSdkVersion 23
|
||||||
|
|
||||||
versionCode 109
|
versionCode 110
|
||||||
|
|
||||||
buildConfigField "long", "buildTime", System.currentTimeMillis() + "L"
|
buildConfigField "long", "buildTime", System.currentTimeMillis() + "L"
|
||||||
}
|
}
|
||||||
|
|
||||||
productFlavors {
|
productFlavors {
|
||||||
standard {
|
standard {
|
||||||
versionName "1.2-ose"
|
versionName "1.2.1-ose"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,6 +80,6 @@ dependencies {
|
|||||||
|
|
||||||
// for tests
|
// for tests
|
||||||
testCompile 'junit:junit:4.12'
|
testCompile 'junit:junit:4.12'
|
||||||
testCompile 'com.squareup.okhttp3:mockwebserver:3.3.1'
|
testCompile 'com.squareup.okhttp3:mockwebserver:3.4.1'
|
||||||
androidTestCompile 'com.squareup.okhttp3:mockwebserver:3.3.1'
|
androidTestCompile 'com.squareup.okhttp3:mockwebserver:3.4.1'
|
||||||
}
|
}
|
||||||
|
@ -203,14 +203,15 @@ public class LocalCalendar extends AndroidCalendar implements LocalCollection {
|
|||||||
|
|
||||||
BatchOperation batch = new BatchOperation(provider);
|
BatchOperation batch = new BatchOperation(provider);
|
||||||
// re-schedule original event and set it to DIRTY
|
// re-schedule original event and set it to DIRTY
|
||||||
batch.enqueue(ContentProviderOperation.newUpdate(
|
batch.enqueue(new BatchOperation.Operation(
|
||||||
syncAdapterURI(ContentUris.withAppendedId(Events.CONTENT_URI, originalID)))
|
ContentProviderOperation.newUpdate(syncAdapterURI(ContentUris.withAppendedId(Events.CONTENT_URI, originalID)))
|
||||||
.withValue(LocalEvent.COLUMN_SEQUENCE, originalSequence + 1)
|
.withValue(LocalEvent.COLUMN_SEQUENCE, originalSequence + 1)
|
||||||
.withValue(Events.DIRTY, DIRTY_INCREASE_SEQUENCE)
|
.withValue(Events.DIRTY, DIRTY_INCREASE_SEQUENCE)
|
||||||
.build());
|
));
|
||||||
// remove exception
|
// remove exception
|
||||||
batch.enqueue(ContentProviderOperation.newDelete(
|
batch.enqueue(new BatchOperation.Operation(
|
||||||
syncAdapterURI(ContentUris.withAppendedId(Events.CONTENT_URI, id))).build());
|
ContentProviderOperation.newDelete(syncAdapterURI(ContentUris.withAppendedId(Events.CONTENT_URI, id)))
|
||||||
|
));
|
||||||
batch.commit();
|
batch.commit();
|
||||||
}
|
}
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
@ -232,16 +233,16 @@ public class LocalCalendar extends AndroidCalendar implements LocalCollection {
|
|||||||
|
|
||||||
BatchOperation batch = new BatchOperation(provider);
|
BatchOperation batch = new BatchOperation(provider);
|
||||||
// original event to DIRTY
|
// original event to DIRTY
|
||||||
batch.enqueue(ContentProviderOperation.newUpdate(
|
batch.enqueue(new BatchOperation.Operation(
|
||||||
syncAdapterURI(ContentUris.withAppendedId(Events.CONTENT_URI, originalID)))
|
ContentProviderOperation.newUpdate(syncAdapterURI(ContentUris.withAppendedId(Events.CONTENT_URI, originalID)))
|
||||||
.withValue(Events.DIRTY, DIRTY_DONT_INCREASE_SEQUENCE)
|
.withValue(Events.DIRTY, DIRTY_DONT_INCREASE_SEQUENCE)
|
||||||
.build());
|
));
|
||||||
// increase SEQUENCE and set DIRTY to 0
|
// increase SEQUENCE and set DIRTY to 0
|
||||||
batch.enqueue(ContentProviderOperation.newUpdate(
|
batch.enqueue(new BatchOperation.Operation(
|
||||||
syncAdapterURI(ContentUris.withAppendedId(Events.CONTENT_URI, id)))
|
ContentProviderOperation.newUpdate(syncAdapterURI(ContentUris.withAppendedId(Events.CONTENT_URI, id)))
|
||||||
.withValue(LocalEvent.COLUMN_SEQUENCE, sequence + 1)
|
.withValue(LocalEvent.COLUMN_SEQUENCE, sequence + 1)
|
||||||
.withValue(Events.DIRTY, 0)
|
.withValue(Events.DIRTY, 0)
|
||||||
.build());
|
));
|
||||||
batch.commit();
|
batch.commit();
|
||||||
}
|
}
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
|
@ -98,14 +98,17 @@ public class LocalContact extends AndroidContact implements LocalResource {
|
|||||||
super.insertDataRows(batch);
|
super.insertDataRows(batch);
|
||||||
|
|
||||||
if (contact.unknownProperties != null) {
|
if (contact.unknownProperties != null) {
|
||||||
ContentProviderOperation.Builder builder = ContentProviderOperation.newInsert(dataSyncURI());
|
final BatchOperation.Operation op;
|
||||||
if (id == null)
|
final ContentProviderOperation.Builder builder = ContentProviderOperation.newInsert(dataSyncURI());
|
||||||
builder.withValueBackReference(UnknownProperties.RAW_CONTACT_ID, 0);
|
if (id == null) {
|
||||||
else
|
op = new BatchOperation.Operation(builder, UnknownProperties.RAW_CONTACT_ID, 0);
|
||||||
|
} else {
|
||||||
|
op = new BatchOperation.Operation(builder);
|
||||||
builder.withValue(UnknownProperties.RAW_CONTACT_ID, id);
|
builder.withValue(UnknownProperties.RAW_CONTACT_ID, id);
|
||||||
|
}
|
||||||
builder .withValue(UnknownProperties.MIMETYPE, UnknownProperties.CONTENT_ITEM_TYPE)
|
builder .withValue(UnknownProperties.MIMETYPE, UnknownProperties.CONTENT_ITEM_TYPE)
|
||||||
.withValue(UnknownProperties.UNKNOWN_PROPERTIES, contact.unknownProperties);
|
.withValue(UnknownProperties.UNKNOWN_PROPERTIES, contact.unknownProperties);
|
||||||
batch.enqueue(builder.build());
|
batch.enqueue(op);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -113,35 +116,32 @@ public class LocalContact extends AndroidContact implements LocalResource {
|
|||||||
|
|
||||||
public void addToGroup(BatchOperation batch, long groupID) {
|
public void addToGroup(BatchOperation batch, long groupID) {
|
||||||
assertID();
|
assertID();
|
||||||
batch.enqueue(ContentProviderOperation
|
batch.enqueue(new BatchOperation.Operation(
|
||||||
.newInsert(dataSyncURI())
|
ContentProviderOperation.newInsert(dataSyncURI())
|
||||||
.withValue(GroupMembership.MIMETYPE, GroupMembership.CONTENT_ITEM_TYPE)
|
.withValue(GroupMembership.MIMETYPE, GroupMembership.CONTENT_ITEM_TYPE)
|
||||||
.withValue(GroupMembership.RAW_CONTACT_ID, id)
|
.withValue(GroupMembership.RAW_CONTACT_ID, id)
|
||||||
.withValue(GroupMembership.GROUP_ROW_ID, groupID)
|
.withValue(GroupMembership.GROUP_ROW_ID, groupID)
|
||||||
.build()
|
));
|
||||||
);
|
|
||||||
|
|
||||||
batch.enqueue(ContentProviderOperation
|
batch.enqueue(new BatchOperation.Operation(
|
||||||
.newInsert(dataSyncURI())
|
ContentProviderOperation.newInsert(dataSyncURI())
|
||||||
.withValue(CachedGroupMembership.MIMETYPE, CachedGroupMembership.CONTENT_ITEM_TYPE)
|
.withValue(CachedGroupMembership.MIMETYPE, CachedGroupMembership.CONTENT_ITEM_TYPE)
|
||||||
.withValue(CachedGroupMembership.RAW_CONTACT_ID, id)
|
.withValue(CachedGroupMembership.RAW_CONTACT_ID, id)
|
||||||
.withValue(CachedGroupMembership.GROUP_ID, groupID)
|
.withValue(CachedGroupMembership.GROUP_ID, groupID)
|
||||||
.withYieldAllowed(true)
|
.withYieldAllowed(true)
|
||||||
.build()
|
));
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeGroupMemberships(BatchOperation batch) {
|
public void removeGroupMemberships(BatchOperation batch) {
|
||||||
assertID();
|
assertID();
|
||||||
batch.enqueue(ContentProviderOperation
|
batch.enqueue(new BatchOperation.Operation(
|
||||||
.newDelete(dataSyncURI())
|
ContentProviderOperation.newDelete(dataSyncURI())
|
||||||
.withSelection(
|
.withSelection(
|
||||||
Data.RAW_CONTACT_ID + "=? AND " + Data.MIMETYPE + " IN (?,?)",
|
Data.RAW_CONTACT_ID + "=? AND " + Data.MIMETYPE + " IN (?,?)",
|
||||||
new String[] { String.valueOf(id), GroupMembership.CONTENT_ITEM_TYPE, CachedGroupMembership.CONTENT_ITEM_TYPE }
|
new String[] { String.valueOf(id), GroupMembership.CONTENT_ITEM_TYPE, CachedGroupMembership.CONTENT_ITEM_TYPE }
|
||||||
)
|
)
|
||||||
.withYieldAllowed(true)
|
.withYieldAllowed(true)
|
||||||
.build()
|
));
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -19,7 +19,6 @@ import android.provider.ContactsContract.CommonDataKinds.GroupMembership;
|
|||||||
import android.provider.ContactsContract.Groups;
|
import android.provider.ContactsContract.Groups;
|
||||||
import android.provider.ContactsContract.RawContacts;
|
import android.provider.ContactsContract.RawContacts;
|
||||||
import android.provider.ContactsContract.RawContacts.Data;
|
import android.provider.ContactsContract.RawContacts.Data;
|
||||||
import android.provider.ContactsContract.RawContactsEntity;
|
|
||||||
|
|
||||||
import org.apache.commons.lang3.ArrayUtils;
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
|
|
||||||
@ -66,24 +65,23 @@ public class LocalGroup extends AndroidGroup implements LocalResource {
|
|||||||
BatchOperation batch = new BatchOperation(addressBook.provider);
|
BatchOperation batch = new BatchOperation(addressBook.provider);
|
||||||
|
|
||||||
// delete cached group memberships
|
// delete cached group memberships
|
||||||
batch.enqueue(ContentProviderOperation
|
batch.enqueue(new BatchOperation.Operation(
|
||||||
.newDelete(addressBook.syncAdapterURI(ContactsContract.Data.CONTENT_URI))
|
ContentProviderOperation.newDelete(addressBook.syncAdapterURI(ContactsContract.Data.CONTENT_URI))
|
||||||
.withSelection(
|
.withSelection(
|
||||||
CachedGroupMembership.MIMETYPE + "=? AND " + CachedGroupMembership.GROUP_ID + "=?",
|
CachedGroupMembership.MIMETYPE + "=? AND " + CachedGroupMembership.GROUP_ID + "=?",
|
||||||
new String[] { CachedGroupMembership.CONTENT_ITEM_TYPE, String.valueOf(id) }
|
new String[] { CachedGroupMembership.CONTENT_ITEM_TYPE, String.valueOf(id) }
|
||||||
).build()
|
)
|
||||||
);
|
));
|
||||||
|
|
||||||
// insert updated cached group memberships
|
// insert updated cached group memberships
|
||||||
for (long member : getMembers())
|
for (long member : getMembers())
|
||||||
batch.enqueue(ContentProviderOperation
|
batch.enqueue(new BatchOperation.Operation(
|
||||||
.newInsert(addressBook.syncAdapterURI(ContactsContract.Data.CONTENT_URI))
|
ContentProviderOperation.newInsert(addressBook.syncAdapterURI(ContactsContract.Data.CONTENT_URI))
|
||||||
.withValue(CachedGroupMembership.MIMETYPE, CachedGroupMembership.CONTENT_ITEM_TYPE)
|
.withValue(CachedGroupMembership.MIMETYPE, CachedGroupMembership.CONTENT_ITEM_TYPE)
|
||||||
.withValue(CachedGroupMembership.RAW_CONTACT_ID, member)
|
.withValue(CachedGroupMembership.RAW_CONTACT_ID, member)
|
||||||
.withValue(CachedGroupMembership.GROUP_ID, id)
|
.withValue(CachedGroupMembership.GROUP_ID, id)
|
||||||
.withYieldAllowed(true)
|
.withYieldAllowed(true)
|
||||||
.build()
|
));
|
||||||
);
|
|
||||||
|
|
||||||
batch.commit();
|
batch.commit();
|
||||||
}
|
}
|
||||||
@ -120,12 +118,11 @@ public class LocalGroup extends AndroidGroup implements LocalResource {
|
|||||||
BatchOperation batch = new BatchOperation(addressBook.provider);
|
BatchOperation batch = new BatchOperation(addressBook.provider);
|
||||||
|
|
||||||
for (long member : getMembers())
|
for (long member : getMembers())
|
||||||
batch.enqueue(ContentProviderOperation
|
batch.enqueue(new BatchOperation.Operation(
|
||||||
.newUpdate(addressBook.syncAdapterURI(ContentUris.withAppendedId(RawContacts.CONTENT_URI, member)))
|
ContentProviderOperation.newUpdate(addressBook.syncAdapterURI(ContentUris.withAppendedId(RawContacts.CONTENT_URI, member)))
|
||||||
.withValue(RawContacts.DIRTY, 1)
|
.withValue(RawContacts.DIRTY, 1)
|
||||||
.withYieldAllowed(true)
|
.withYieldAllowed(true)
|
||||||
.build()
|
));
|
||||||
);
|
|
||||||
|
|
||||||
batch.commit();
|
batch.commit();
|
||||||
}
|
}
|
||||||
@ -151,15 +148,14 @@ public class LocalGroup extends AndroidGroup implements LocalResource {
|
|||||||
Constants.log.fine("Assigning members to group " + id);
|
Constants.log.fine("Assigning members to group " + id);
|
||||||
|
|
||||||
// delete all memberships and cached memberships for this group
|
// delete all memberships and cached memberships for this group
|
||||||
batch.enqueue(ContentProviderOperation
|
batch.enqueue(new BatchOperation.Operation(
|
||||||
.newDelete(addressBook.syncAdapterURI(ContactsContract.Data.CONTENT_URI))
|
ContentProviderOperation.newDelete(addressBook.syncAdapterURI(ContactsContract.Data.CONTENT_URI))
|
||||||
.withSelection(
|
.withSelection(
|
||||||
"(" + GroupMembership.MIMETYPE + "=? AND " + GroupMembership.GROUP_ROW_ID + "=?) OR (" +
|
"(" + GroupMembership.MIMETYPE + "=? AND " + GroupMembership.GROUP_ROW_ID + "=?) OR (" +
|
||||||
CachedGroupMembership.MIMETYPE + "=? AND " + CachedGroupMembership.GROUP_ID + "=?)",
|
CachedGroupMembership.MIMETYPE + "=? AND " + CachedGroupMembership.GROUP_ID + "=?)",
|
||||||
new String[] { GroupMembership.CONTENT_ITEM_TYPE, String.valueOf(id), CachedGroupMembership.CONTENT_ITEM_TYPE, String.valueOf(id) })
|
new String[] { GroupMembership.CONTENT_ITEM_TYPE, String.valueOf(id), CachedGroupMembership.CONTENT_ITEM_TYPE, String.valueOf(id) })
|
||||||
.withYieldAllowed(true)
|
.withYieldAllowed(true)
|
||||||
.build()
|
));
|
||||||
);
|
|
||||||
|
|
||||||
// extract list of member UIDs
|
// extract list of member UIDs
|
||||||
List<String> members = new LinkedList<>();
|
List<String> members = new LinkedList<>();
|
||||||
@ -181,12 +177,11 @@ public class LocalGroup extends AndroidGroup implements LocalResource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// remove pending memberships
|
// remove pending memberships
|
||||||
batch.enqueue(ContentProviderOperation
|
batch.enqueue(new BatchOperation.Operation(
|
||||||
.newUpdate(addressBook.syncAdapterURI(ContentUris.withAppendedId(Groups.CONTENT_URI, id)))
|
ContentProviderOperation.newUpdate(addressBook.syncAdapterURI(ContentUris.withAppendedId(Groups.CONTENT_URI, id)))
|
||||||
.withValue(COLUMN_PENDING_MEMBERS, null)
|
.withValue(COLUMN_PENDING_MEMBERS, null)
|
||||||
.withYieldAllowed(true)
|
.withYieldAllowed(true)
|
||||||
.build()
|
));
|
||||||
);
|
|
||||||
|
|
||||||
batch.commit();
|
batch.commit();
|
||||||
}
|
}
|
||||||
|
@ -211,12 +211,11 @@ public class ContactsSyncManager extends SyncManager {
|
|||||||
currentGroups = contact.getGroupMemberships();
|
currentGroups = contact.getGroupMemberships();
|
||||||
for (Long groupID : SetUtils.disjunction(cachedGroups, currentGroups)) {
|
for (Long groupID : SetUtils.disjunction(cachedGroups, currentGroups)) {
|
||||||
App.log.fine("Marking group as dirty: " + groupID);
|
App.log.fine("Marking group as dirty: " + groupID);
|
||||||
batch.enqueue(ContentProviderOperation
|
batch.enqueue(new BatchOperation.Operation(
|
||||||
.newUpdate(addressBook.syncAdapterURI(ContentUris.withAppendedId(Groups.CONTENT_URI, groupID)))
|
ContentProviderOperation.newUpdate(addressBook.syncAdapterURI(ContentUris.withAppendedId(Groups.CONTENT_URI, groupID)))
|
||||||
.withValue(Groups.DIRTY, 1)
|
.withValue(Groups.DIRTY, 1)
|
||||||
.withYieldAllowed(true)
|
.withYieldAllowed(true)
|
||||||
.build()
|
));
|
||||||
);
|
|
||||||
}
|
}
|
||||||
} catch(FileNotFoundException ignored) {
|
} catch(FileNotFoundException ignored) {
|
||||||
}
|
}
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit d5487a1623d7fb7b9b25b41661dec4706bd4001e
|
Subproject commit bf2004e9052241345c435c2d46090ab9baf43eb8
|
@ -1 +1 @@
|
|||||||
Subproject commit ee884d351b590e2f148561b17814db6d0d9e2a69
|
Subproject commit 2a0421f34909a7ac7989fdbd073c64891686f2fb
|
@ -1 +1 @@
|
|||||||
Subproject commit 3a6692f0969afc782358d37b92f291179f72276e
|
Subproject commit e6798f6c7ddc596c5bbc27e9b3e0f994921451fa
|
Loading…
Reference in New Issue
Block a user