[SailfishDevel] Contacts/qtcontacts-sqlite vs privileged/Contacts/qtcontacts-sqlite

Chris Adams chris.adams at jolla.com
Wed Apr 1 01:58:53 UTC 2015


Hi,

Currently, we "forward-synchronize" data from the privileged database to the third-party
database.  This allows third-party, non-privileged applications to use the contact data
which is owned by the user.  Going forward, my understanding is that we are improving
the security model so that the user can grant specific applications rights to access
specific types of data/functionality, so this might change, but right now any app can
access the non-privileged database.

We do not currently "back-synchronize" data written by third-party applications into the
third-party database, to the privileged database.  The major reason for this is that
it could cause synchronization loops (with external services) due to the way we currently
detect changes and trigger syncs.  Some services (like Google) do not support some
of the data annotations which the QtContacts API supports, which means that some
sync cycles will be guaranteed to be lossy.  On the SailfishOS side, this is not an issue,
because it's our code performing the sync and detecting the server-to-device delta; but
if some other non-privileged application (either native or Android) starts to sync data
from some service (like Google) to the third party database, and then that gets back-
synchronized to the privileged database, well, we have no way of detecting this delta
and handling the "lossy-cycle" case properly (there are workarounds / throttles etc, but
no perfect solution that I can think of - perhaps I'm wrong).  The data in the third party
database is all treated as "local" / "user-owned" data, a problem which might be resolved
after we port to the latest upstream QtContacts API, but more about that later.

One other "problem" is that if two-way sync is enabled for any given service, we
currently synchronize all "service-synced contacts" (ie originating from that service)
and all "locally-owned contacts" (ie originating from the local device or user via
Bluetooth sync or direct vCard import) up to the service.  It may be that to avoid
the previously described endless-sync-cycles we may have to change the semantic
so that only "service-synced-contacts" are synced; in that case, to sync a local contact
to some service, the user would have to explicitly mark it as such.  To be clear, the
current API and the sync plugins all support this behaviour, but some changes would
have to be made to turn it on.

Finally, the QtContacts upstream API now supports "collections" (separated
addressbooks) which make per-service data segregation much simpler to enforce at
the API level, including perhaps for the third-party database (although, of course, we
cannot be sure that an app might contaminate some collection inappropriately...).
We're hoping at some stage to port our internal software to that API and then some of
these problems will be simplified, at least.

None of which really answers your question ;-)
As to documentation, it's just in-code comments in qtcontacts-sqlite and contactsd.
See https://github.com/nemomobile/contactsd/blob/master/plugins/exporter/cdexportercontroller.cpp
for the plugin which handles privileged-to-non-privileged database synchronization.

Cheers,
Chris.



From: devel-bounces at lists.sailfishos.org [devel-bounces at lists.sailfishos.org] on behalf of Dmitry [energycsdx at gmail.com]
Sent: Wednesday, April 01, 2015 4:46 AM
To: Sailfish OS Developers
Subject: Re: [SailfishDevel] Contacts/qtcontacts-sqlite vs privileged/Contacts/qtcontacts-sqlite


Yes.

https://lists.sailfishos.org/pipermail/devel/2014-January/003042.html

On 31 March 2015 at 19:53, Javier <jolla at javispedro.com>
 wrote:
There seems to be two copies of the Contacts sqlite database, one in a
location that is only available to the privileged group, and one that
seems to be world-readable.

What is the goal of this? What constraints does the "unprivileged"
database have? (Any docs I can read?)

I've been trying to diagnose an issue where "unprivileged" QtContacts
seems to miss phone numbers for some contacts, specially if those
phone numbers come from a Mail For Exchange or any other sync account.
Is this by design?

Javier.

_______________________________________________

SailfishOS.org Devel mailing list

To unsubscribe, please send a mail to 
devel-unsubscribe at lists.sailfishos.org


More information about the Devel mailing list