bitfireAT / davx5-ose

DAVx⁵ is an open-source CalDAV/CardDAV suite and sync app for Android. You can also access your online files (WebDAV) with it.
https://www.davx5.com
GNU General Public License v3.0
1.58k stars 78 forks source link

Contacts gone after rebooting from Safe Mode #1046

Closed rfc2822 closed 3 weeks ago

rfc2822 commented 1 month ago

We should see

Discussed in https://github.com/bitfireAT/davx5-ose/discussions/1038

Originally posted by **TinfoilSubmarine** September 23, 2024 To reproduce: 1. Have address book(s) already synchronized from Nextcloud (30.0.0). 2. Reboot device to safe mode. 3. Reboot again to normal mode. 4. See that address books are not synchronized and must be manually synchronized.
ArnyminerZ commented 1 month ago

Similar case https://xiaomi.eu/community/threads/after-boot-in-safe-mode-and-restart-the-contacts-and-calendar-information-still-missing.66162/

rfc2822 commented 1 month ago

Maybe the accounts are not active in safe mode, although the content provider is active (and then deletes all orphaned address books)?

@ArnyminerZ Are there adb logs when booting into safe mode? Do you have any other idea how to find out what happens?

ArnyminerZ commented 4 weeks ago

Rebooted to safe mode after having synchronized the contacts. If querying them through ADB this is the response:

$ adb shell content query --uri content://com.android.contacts/raw_contacts
No result found.

Booting back to the device, as reported, did not show any contacts, neither on ADB:

$ adb shell content query --uri content://com.android.contacts/raw_contacts
No result found.

nor the contacts app. The addressbook is there, but it's empty:

Show Screenshot ![address_book_after_safe](https://github.com/user-attachments/assets/7418f76e-56b8-44cf-8a0b-ae776451d8cc)

After synchronizing, all the contacts are back.

No rellevant logs are found in DAVx⁵, no strange sync works or anything.

sunkup commented 3 weeks ago

Same here. On my physical test device (Samsung Galaxy A30) booting into safe mode actually removed all DAVx5 accounts too. After booting into normal mode the accounts were all restored, but the contacts are gone.

ArnyminerZ commented 3 weeks ago

I did ask ChatGPT if this is possible, just to see if he/she/it had any clues, and said that it might happen because accounts added by third-party apps are not considered "system accounts" (whatever that means), and they are considered cache, and removed automatically.

sunkup commented 3 weeks ago

I tried with the contacts sync baked into google play services and contacts stored in google accounts are not deleted when rebooting into safe mode.

We just got to make DAVx5 a system app, then we're good :P

Would probably solve the battery exemption, work quota and long running work / foreground notification problems too. Would be interesting to know whether this happens on devices with /e/ OS where DAVx5 operates as system app?

rfc2822 commented 3 weeks ago

Have also tried again. Seems that rebooting into safe mode

  1. prevents the DAVx5 app from being started,
  2. thus there is no DAVx5 address book account,
  3. so the contacts provider (which is started as a system app) actually removes the contacts.

After another reboot, DAVx5 may start again, and the account is there, but the contacts are gone. The sync state is stored in the contacts DB, too (not in the account), so at the next sync, the contacts are re-synced.

@devvv4ever Should we document this in the manual and/or an FAQ?

rfc2822 commented 3 weeks ago

Documented in https://github.com/bitfireAT/davx5-manual/pull/36

See https://manual.davx5.com/accounts_collections.html#safe-mode

devvv4ever commented 3 weeks ago

In the FAQ would be also good I guess! But let's do this if people still write about that in the future and if they don't find the answer in the manual.