Android 7+: Contact sync after each call and SMS



  • I use DavDroid since a long time and it works really great. Thank you for davdroid.

    Since 2-3 month everytime i make a phone call to a contact in my addressbook or someone calls me, this contact gets automatically synced after a few seconds. (Android 7.1.1, DavDroid 1.3.5, Baikal)

    I have just deleted my davdroid account, deleted contact storage cache, reinstalled davdroid and recreated the davdroid account. Same behavior. Contact sync after each call.

    On a second phone (Android 6.0.1, DavDroid 1.3.5, Baikal) i dont have that behavior.
    Does anyone else has that behavior or know how to turn that of.

    Best regards

    --

    http://pastebin.com/tWWG1TX8 (debug.txt)

    Steps to reproduze:

    • I have created a new contact "Aaa, Aaa".
      Automatically this new entry gets synced because it was newly created.
      http://pastebin.com/9nZyBgZd (Debug Log)
    BEGIN:VCARD
    VERSION:3.0
    PRODID:+//IDN bitfire.at//DAVdroid/1.3.5-ose vcard4android ez-vcard/0.10.0
    UID:ee4548ab-dbb0-4dab-bc67-0964fec09614
    FN:Aaa Aaa
    N:Aaa;Aaa
    TEL;TYPE=cell:+49111111111
    REV:2016-12-30T02:08:57Z
    END:VCARD
    
    • Then I make a phone call to contact "Aaa, Aaa".
      This contact gets synced again after a few seconds and only the REV property gets updated.
      http://pastebin.com/jPb4Yg7Z (Debug Log)
    BEGIN:VCARD
    VERSION:3.0
    PRODID:+//IDN bitfire.at//DAVdroid/1.3.5-ose vcard4android ez-vcard/0.10.0
    UID:ee4548ab-dbb0-4dab-bc67-0964fec09614
    FN:Aaa Aaa
    N:Aaa;Aaa
    TEL;TYPE=cell:+49111111111
    REV:2016-12-30T02:10:32Z
    END:VCARD
    
    • When I call again the contact get updated again.

  • developer

    I guess the system updates the LAST_TIME_CONTACTED field of the contact when you call it. Maybe Android 7.1.1 sets the DAVdroid raw contact to DIRTY in this case too?


  • developer

    I can confirm that this also happens in the Android 7.1.1 emulator. As soon as a call is done, the respective DAVdroid raw contact's last_time_contacted is updated and thus set to dirty and the sync manager (DAVdroid) is called.


  • developer

    The reason seems to be commit 8609f2b0 in android/platform/packages/providers/ContactsProvider, which has first been tagged with Android 7.0.

    In our tests, Android 7.0 and later versions are affected.

    It seems that this behavior is intended: raw contacts are intentionally set to dirty (= shall sync) when data usage / last time contacted is updated. So this is basically an Android feature.


  • developer

    I have created an Android bug report for that: https://code.google.com/p/android/issues/detail?id=231260


  • developer

    Also happens when an SMS is sent to a contact.



  • Thank you so much for your fast response and the android bug report.
    Happy new year!


  • developer

    We're now in direct contact with Google in this case and hope that we'll receive more information soon, so that we can provide a solution. :ghost:


  • developer

    According to Google,

    1. the behavior that contacts are set to DIRTY after each call/SMS will be fixed with Android 8.0,
    2. however the sync will be initiated nevertheless.

    There are possible workarounds and solutions. We're having a look at that.



  • Could DAVdroid introduce a workaround for this case? Somewhere in DAVDroid, there must be a place where local and remote contacts get compared. In that place, one could possibly check for these three things:

    • How many changes are there overall?
    • If there's exactly one change
    • AND that change is to the local VCard
    • AND that change happens to be REV

    then, we just discard this?

    I have no Idea if this opens up a huge can of worms, but If (as you suggest) this will remain in all of android 7, then we're stuck with this behaviour for the next few years. With the vast majority of people getting to 7 this or next year. And then dragging this bug around for 3-4 years to come until android 8 is widely available.


  • developer

    Should be worked around by davdroid/faaaa330 (further testing required).



  • Can I help testing somehow? (I only have my regular day-to-day phone for testing, but I do have backups, just in case).


  • developer

    @ccoenen said in Android 7+: Contact sync after each call and SMS:

    Can I help testing somehow? (I only have my regular day-to-day phone for testing, but I do have backups, just in case).

    We could always use some testing. Are you interested in beta testing? Where did you get DAVdroid from/which signature?



  • @rfc2822 said in Android 7+: Contact sync after each call and SMS:

    @ccoenen said in Android 7+: Contact sync after each call and SMS:

    Can I help testing somehow? (I only have my regular day-to-day phone for testing, but I do have backups, just in case).

    We could always use some testing. Are you interested in beta testing? Where did you get DAVdroid from/which signature?

    I'm normally using the release from F-Droid.


  • admin

    Hello,

    I've sent you a updated version of DAVdroid to your email address. Can you please try if it works?

    Important: you need to completely uninstall and re-install DAVdroid, otherwise the signatures will not match!


  • developer

    Should be worked around with DAVdroid 1.4.0, please test it and tell us whether it works for you.



  • @devvv4ever I received that mail, however I couldn't simply install it over the current F-Droid version, I didn't have the time to double check my backup for the uninstall-reinstall-restore cycle then. Sorry for letting you wait.



  • From what I can tell (very short testing period so far), It will be dirty once after the update, as two things change: the REV and the PRODID. I haven't seen single REV changes since the update to 1.4. I also didn't notice any sync problem. I'll report back if anything comes up. Looks good to me.



  • So far, everything looked alright. Tonight I had one incident that I can't quite put my finger on it: One of my contacts just lost their groups. Here's the diff (anonymized):

    diff --git a/55cd82aa-5d0d-444e-b414-3905d2193d42.vcf b/55cd82aa-5d0d-444e-b414-3905d2193d42.vcf
    index 3ae5862..1a0367f 100644
    --- a/55cd82aa-5d0d-444e-b414-3905d2193d42.vcf
    +++ b/55cd82aa-5d0d-444e-b414-3905d2193d42.vcf
    @@ -1,13 +1,13 @@
     BEGIN:VCARD
    -VERSION:3.0
    -PRODID:-//Sabre//Sabre VObject 4.1.1//EN
    +VERSION:4.0
    +PRODID:+//IDN bitfire.at//DAVdroid/1.4.0.2-ose vcard4android ez-vcard/0.10.
    + 1
     UID:55cd82aa-5d0d-444e-b414-3905d2193d42
    -CATEGORIES:work,friends
     FN:First Name Last Name
     N:Last Name;First Name;;;
     TEL;TYPE=cell:+49 123 4567
     EMAIL;TYPE=work:something@example.com
     ORG:some org
     BDAY:18000415
    -REV:20170212T223553Z
    -END:VCARD
    \ No newline at end of file
    +REV:20170215T095941Z
    +END:VCARD
    

    So, instead of the categories, suddenly there's a line just saying <space>1 (1 with leading space). This is not forum formatting, or the leading space of the diff format, this is actually in the vcard.

    I did have other syncs that same day which still have their catetegories. They also have the <space>1 extra line.

    Again, not sure if this is related, but I thought I'd mention it.



  • I now believe this to be unrelated, I started another thread for the CATEGORIES issue.


Log in to reply
 

Looks like your connection to Bitfire App Forums was lost, please wait while we try to reconnect.