When I change 2 independent dates (eg. subject, location) of a calender entry, the version on the server wins.
Correct.
When I change an calendar entry on one side and delete it on the other, the version in davdroid wins
If you delete the entry on the device and change it on the server, the next time DAVdroid syncs it:
- tries to delete the entry (but only the exact entry it has stored, marked by its ETag) from the server, which will do nothing becaues the entry has been changed,
- syncs all entries from the server to the device, resulting in the entry that was changed on the server to be downloaded.
“server wins”
If you delete the entry on the server and change it on your device, the next time DAVdroid syncs it:
- tries to upload the contact, which will succeed,
- syncs all entries from the service to the device, including the newly uploaded.
“DAVdroid wins”
a. I’m wondering why 2. is?
DAVdroid never overwrites data on the server.
b. I’d like to find the 2-way synch logic explained somewhere
https://github.com/rfc2822/davdroid/blob/master/src/at/bitfire/davdroid/syncadapter/SyncManager.java, see method “synchronize”
c. I’d like to see that changes in different fields could be merged.
iCalendars and VCards are whole entities. Merging would be very cumbersome and error-prone and may not be possible without user interaction. It may also result in data loss because the wrong version may be overwritten. Do you actively use a revision control system like svn or git? The same difficulties apply here.
d. I’d like to configure which side (davdroid or server) wins
I think it makes sense that the server always wins because there may not only be one client. If the client would win, there could be a situation where client A uploads its contact, then the next time client B uploads its contact, then A again, then B… see CalDAV RFC: Creating Calendar Object Resources for the proper use of HTTP precondition headers which imply a “server always wins” strategy.
But if you want to change it, feel free to download the code and change it for you. 