[4.0.1.48] Signal can't sync contacts

REPRODUCIBILITY: 100%
BUILD ID: 4.1.0.48
HARDWARE: Sony Xperia XA2 Ultra
UI LANGUAGE: Finnish
REGRESSION: No

DESCRIPTION:

Signal application can’t sync contacts from phone address book. logcat indicates that it tries and fails, with sqlite/sqlcipher error messages.

PRECONDITIONS:

Install Android app support and download Signal from https://signal.org/android/apk/ (or from Play Store should you have access to it).

STEPS TO REPRODUCE:

  1. Have some contacts with phone numbers in address book
  2. Install and open Signal
  3. Click the pen to create a new message
  4. Click the three dots menu
  5. Select Update

EXPECTED RESULT:

Contacts get updated (or, rather, contacts show up in Signal)

ACTUAL RESULT:

Contacts don’t get updater or pulled from the address book.

ADDITIONAL INFORMATION:

  • Signal app version is 5.3.12
  • All contacts are synced from a CardDAV account (OwnCloud 10)
  • Signal permissions are enabled
  • WhatsApp can access device contacts (as long as it works in the first place…)

Logcat output:

Finalizing a Cursor that has not been deactivated or closed. database = /data/user/0/org.thoughtcrime.securesms/databases/signal.db, table = recipient, query = SELECT _id, system_display_name, phone, email, system_phone_label, system_phone_type, registered, ab
net.sqlcipher.database.DatabaseObjectNotClosedException: Application did not close the cursor or database object that was opened here
	at net.sqlcipher.database.SQLiteCursor.<init>(SQLiteCursor.java:237)
	at net.sqlcipher.database.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:71)
	at net.sqlcipher.database.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1965)
	at net.sqlcipher.database.SQLiteDatabase.queryWithFactory(SQLiteDatabase.java:1740)
	at net.sqlcipher.database.SQLiteDatabase.query(SQLiteDatabase.java:1692)
	at net.sqlcipher.database.SQLiteDatabase.query(SQLiteDatabase.java:1781)
	at org.thoughtcrime.securesms.database.SQLiteDatabase.lambda$query$2(SQLiteDatabase.java:138)
	at org.thoughtcrime.securesms.database.SQLiteDatabase.lambda$query$2$SQLiteDatabase(Unknown Source:0)
	at org.thoughtcrime.securesms.database.-$$Lambda$SQLiteDatabase$cvMxOy0u0-aa46LyDnbjGx12KKk.run(Unknown Source:16)
	at org.thoughtcrime.securesms.database.SQLiteDatabase.traceSql(SQLiteDatabase.java:92)
	at org.thoughtcrime.securesms.database.SQLiteDatabase.query(SQLiteDatabase.java:138)
	at org.thoughtcrime.securesms.database.RecipientDatabase.getSignalContacts(RecipientDatabase.java:2300)
	at org.thoughtcrime.securesms.contacts.ContactRepository.querySignalContacts(ContactRepository.java:117)
	at org.thoughtcrime.securesms.contacts.ContactsCursorLoader.getContactsCursors(ContactsCursorLoader.java:309)
	at org.thoughtcrime.securesms.contacts.ContactsCursorLoader.addContactsSection(ContactsCursorLoader.java:162)
	at org.thoughtcrime.securesms.contacts.ContactsCursorLoader.getUnfilteredResults(ContactsCursorLoader.java:128)
	at org.thoughtcrime.securesms.contacts.ContactsCursorLoader.loadInBackground(ContactsCursorLoader.java:102)
	at org.thoughtcrime.securesms.contacts.ContactsCursorLoader.loadInBackground(ContactsCursorLoader.java:54)
	at androidx.loader.content.AsyncTaskLoader.onLoadInBackground(AsyncTaskLoader.java:307)
	at androidx.loader.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:60)
	at androidx.loader.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:48)
	at androidx.loader.content.ModernAsyncTask$2.call(ModernAsyncTask.java:141)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
	at java.lang.Thread.run(Thread.java:764)
ContactsDatabase: Adding number: +REMOVED ( <-- repeated 29 times )
DatabaseUtils: Writing exception to parcel
DatabaseUtils: android.content.OperationApplicationException: insert failed
DatabaseUtils: 	at android.content.ContentProviderOperation.apply(ContentProviderOperation.java:292)
DatabaseUtils: 	at com.android.providers.contacts.AbstractContactsProvider.applyBatch(AbstractContactsProvider.java:286)
DatabaseUtils: 	at com.android.providers.contacts.ContactsProvider2.applyBatch(ContactsProvider2.java:2405)
DatabaseUtils: 	at android.content.ContentProvider$Transport.applyBatch(ContentProvider.java:319)
DatabaseUtils: 	at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:181)
DatabaseUtils: 	at android.os.Binder.execTransact(Binder.java:731)
DirectoryHelper: Failed to update contacts.
DirectoryHelper: android.content.OperationApplicationException: insert failed
DirectoryHelper: 	at android.database.DatabaseUtils.readExceptionWithOperationApplicationExceptionFromParcel(DatabaseUtils.java:156)
DirectoryHelper: 	at android.content.ContentProviderProxy.applyBatch(ContentProviderNative.java:522)
DirectoryHelper: 	at android.content.ContentProviderClient.applyBatch(ContentProviderClient.java:474)
DirectoryHelper: 	at android.content.ContentResolver.applyBatch(ContentResolver.java:1626)
DirectoryHelper: 	at org.thoughtcrime.securesms.contacts.ContactsDatabase.setRegisteredUsers(ContactsDatabase.java:107)
DirectoryHelper: 	at org.thoughtcrime.securesms.contacts.sync.DirectoryHelper.updateContactsDatabase(DirectoryHelper.java:321)
DirectoryHelper: 	at org.thoughtcrime.securesms.contacts.sync.DirectoryHelper.refreshNumbers(DirectoryHelper.java:261)
DirectoryHelper: 	at org.thoughtcrime.securesms.contacts.sync.DirectoryHelper.refreshDirectory(DirectoryHelper.java:101)
DirectoryHelper: 	at org.thoughtcrime.securesms.ContactSelectionActivity$RefreshDirectoryTask.doInBackground(ContactSelectionActivity.java:144)
DirectoryHelper: 	at org.thoughtcrime.securesms.ContactSelectionActivity$RefreshDirectoryTask.doInBackground(ContactSelectionActivity.java:133)
DirectoryHelper: 	at android.os.AsyncTask$2.call(AsyncTask.java:333)
DirectoryHelper: 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
DirectoryHelper: 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
DirectoryHelper: 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
DirectoryHelper: 	at java.lang.Thread.run(Thread.java:764)
Cursor  : Filling cursor window with start position:0 required position:0
DirectoryHelper: [refresh] network: 6697  process-cds: 193  handle-unlisted: 2  update-registered: 29  contacts-db: 1216  total: 8137
JobSchedulerScheduler: JobScheduler enqueue of NETWORK (-1733499378)
Job     : [JOB::ff052796-1a8d-472a-8a75-4d58d8e1b134][StorageSyncJob] onSubmit() (Time Since Submission: 83 ms, Lifespan: 86400000 ms, Run Attempt: 1/1)
JobSchedulerScheduler: Waking due to job: -1733499378
JobRunner: [JOB::ff052796-1a8d-472a-8a75-4d58d8e1b134][StorageSyncJob][1] Running job. (Time Since Submission: 165 ms, Lifespan: 86400000 ms, Run Attempt: 1/1)
GoogleInputMethodService: GoogleInputMethodService.onStartInput():1906 
SessionManager: SessionManager.beginSession():53 Try to begin an already begun session [INPUT_SESSION], end it first
Cursor  : Filling cursor window with start position:0 required position:0
Cursor  : Filling cursor window with start position:0 required position:0
Cursor  : Filling cursor window with start position:0 required position:0
Cursor  : Filling cursor window with start position:0 required position:0
Cursor  : Filling cursor window with start position:0 required position:0
Cursor  : Filling cursor window with start position:0 required position:0
StorageSyncJob: Our version: 16, their version: 16
Cursor  : Filling cursor window with start position:0 required position:0
chatty  : uid=10056(org.thoughtcrime.securesms) signal-JobRunne identical 6 lines
Cursor  : Filling cursor window with start position:0 required position:0
StorageSyncJob: [Local Changes] No local changes.
JobRunner: [JOB::ff052796-1a8d-472a-8a75-4d58d8e1b134][StorageSyncJob][1] Job finished with result SUCCESS in 363 ms. (Time Since Submission: 528 ms, Lifespan: 86400000 ms, Run Attempt: 1/1)

This suggests a bug either in Signal or Android app support (or sqlcipher).

2 Likes

This is a known problem, and not version specific for koli. It has to do with the way signal imports contacts. It used to work, until a certain signal update where this way contacts were imported changed. There is not much to be done to make this work, unless signal fixes it themselves.

For you, I suggest the following:

  • Copy phone numbers to signal
  • Ask people irl to message you on signal
  • Use the native app whisperfish

When you have a conversation with your contacts, it can easily be found within signal, so the biggest problems are there until the first message.

1 Like

Thank you for the report. This problem has already been fixed and it will be available in upcoming releases.

4 Likes

Surprisingly on my phone the contacts get synced and listed in Signal app since a recent update. Not sure whether it started working after the update to SFOS 4.0.1.45 / 4.0.1.48 or the last update of the app. Eventually the contacts were shown without any special action by myself.

Holly smoke, that’s awesome (and fast)!

So just to clarify, after that fix, Signal can synchronize contacts properly? If so, I’ll mention this information in the comment I made in the Signal app bug report.

1 Like

Since the next update can be months away in the future, I noticed on my Xperia 10 that Signal seems to be able to pull contact for one number my operator had planted on the SIM card, but I hadn’t importet it to my phone. So if you find a way to sync your contacts to your SIM card, Signal might be able to update all of your contacts from there?

Thanks :smiley:
It would be great to publish a bug-fix only release, say 4.0.2, in february or march, so the major annoyances and papercuts be available quickly to users (sync contacts, nextcloud issues, captcha browser, etc.).

1 Like

There will be a fix for this in the next public OS release (April).

4 Likes

I experienced that signal only works with Wifi un my XA2, is this bug somehow related?

It’s also working with LTE on my XA2.

@Raymaen I had the same issue, I fixed it using AlienDalvik Control (from OpenRepo) which allow you to open global android settings.
Cellular data was disabled somehow on AlienDalvik, even if enabled on the SaiflishOS side. Just enable it and it should solve your problem.

Strangely, Firefox android app did work on both cellular data and wifi. Whatsapp and Signal worked only on Wifi. Those problems started about 10 days ago for me.

@Slan thats weird, i have also experienced that only a few days ago… as if something was changed in the hidden…

can you access contacts from dalvikcontrol ?

@shanti
Sorry for late reply.
No, I can’t access contacts from Aliendalvik. The developper has stopped maintaining this app, some features does not work anymore on SailfishOS since version 4.0.1 if I remember correctly.

However, contacts in signal are working well, so maybe you can try to download an Android contact application to access your contacts from Android side if you need (I didn’t try this)

same problem here using 10II