johanw666 / Signal-Android

Fork from a private messenger for Android with extra options added: full backup and (partial, ony text) xml backup of messages. Restore can happen at any time, not only after a fresh install. Import SMS database. Import of (unencrypted) WhatsApp databases. Removed apk expire. Choose between passphrase protection and the Android screenlock. Choice for the backup location (internal or removable storage on Android < 11 (on 11 and higher this is already possible)). Set the maptype in the place picker. Option to treat view-once media as normal media. Option to ignore remote deletion. Choose between FCM or websocket notification delivery.
https://johanw.home.xs4all.nl/Signal/signal-jw.html
GNU Affero General Public License v3.0
246 stars 16 forks source link

App stops working when restoring backup #78

Closed ghost closed 1 year ago

ghost commented 1 year ago

Hi, I just want to ask if this problem is from your side or is it from the original Signal app itself.

I install the app the first time, I launch it and try to restore the messages as usual from a normal signal backup, but when it completes the restoring the App crashes and will never open again, this problem is not on 6.18.4, so we can't tell if this is because of them they didn't publish a recent update of 6.19.*.

I hope you'll take a look into it and by the way I finally completed my fork from your App that builds with the CI and added the AMOLED Dark as I always wanted.

johanw666 commented 1 year ago

Can you give a debug log?

ghost commented 1 year ago

I honestly don't know how

eAyNWFl1qzE commented 1 year ago

I am experiencing the same issue, I started writing a separate report using the Signal template and then realised that this is the same issue (should be titled "App stops working after restoring backup"). So I will rather reply here.


Bug description

I am moving from a device running mainline Signal on LineageOS to Signal-JW on a new device running GrapheneOS. I want to keep my message history but take advantage of some of the features of Signal-JW. However Signal-JW stops working after restoring the backup.

I created two versions of encrypted backup on the first device (in case it was a size/memory problem).

I built Signal-JW from source, ran zipalign, used apksigner to sign it with my own key, and then installed the APK on the new device.

I am able to register a new account. However I tried to restore my old account in 3 different ways, none of which were successful. There is a progressive backoff on restoring phone numbers so despite having three SIMs/possible numbers available for this task I'm hitting frustrating waiting periods from trying over and over, and so I thought best to reach out for help!

Noting that I have to change the phone number associated with my Signal registration as I unfortunately no longer have access to my original number. I wondered if the registered number is included in a hash or something and therefore the restore is rejected if a new number is provided. However you (@johanw666 ) say elsewhere that this should not be a problem. Something I could try is to update my number first on the old device, create a backup, and then restore that, but I'm currently in a waiting period.

Steps to reproduce

First I clone/build/align/sign/install Signal-JW.

git clone https://github.com/johanw666/Signal-Android
# The gradle version wasn't compatible with my java version, so I updated it from 7.5.1 to 7.6.1 in /gradle/wrapper/gradle-wrapper.properties
sudo ./gradlew assemblePlayProdRelease --debug --write-verification-metadata sha256 
keytool -genkey -v -keystore $USERNAME.keystore -alias $ALIAS -keyalg RSA -keysize 2048 -validity 10000
sudo /opt/android-sdk/build-tools/32.0.0/zipalign -p -f -v 4 Signal-Android-play-prod-arm64-v8a-release-unsigned-6.19.8.0.apk SignalJW-aligned.apk
sudo /opt/android-sdk/build-tools/32.0.0/apksigner sign -verbose -ks ~/keystore/$USERNAME.keystore --out SignalJW-signed.apk SignalJW-aligned.apk
adb install SignalJW-signed.apk

Then I tried several methods to restore my message history.

  1. First, I tried to use the mainline Signal "Transfer Account" functionality between the two devices over WiFi. This successfully restored the backup, but none of the Signal-JW settings were available in the menu (it is possible but unlikely that I accidentally installed mainline Signal). Is this expected behaviour - i.e. would restoring over WiFi in this way result in hiding the fork settings?
  2. I reinstalled and then I tried to restore from my backup. After the backup finished restoring, I went through the registration process, but the app either hangs after completing the entry of the SMS code, or crashes when I boot it up. For obvious reasons, I can't get a debug log out of the Signal settings in this case. I could attempt to debug over ADB if you could give me pointers on where to find fruitful information?
  3. I reinstalled and then went through the registration process without transferring my account. Then went into the menu and tried to restore the backup. I tap kebab menu, Import/Export, Restore encrypted backup. I set the folder to the location where I placed my backup file (/storage/emulated/0/Signal). I'm prompted to confirm and tap "Restore". An error message toast at the bottom says "No encrypted backup found!". In this case, I can get a debug log, a link to which I have attached.

I also tried the above three steps with the smaller backup file, to the same effect.

Actual result: Signal-JW either restores the backup but does not have Signal-JW functionality, crashes after the backup is restored, or states that the encrypted backup is not found in the folder I gave it. Expected result: My mainline Signal message history is restored to a new install of Signal-JW and still make use of the Signal-JW functionality.

Next steps I will try

  1. See if I can convert the encrypted Signal database to the format used by Signal-JW for the plaintext import, and try to import that.
  2. Try a different (and smaller) db: Create a totally separate new mainline Signal account, send a few messages, create backup, restore the backup.
  3. Change my phone number on mainline signal and restore using the same number (might combine this with (2).

Any other ideas very welcomed.

Device info

Device: Google Pixel 3A XL Android version: GrapheneOS 12 Signal version: 6.19.8.0-JW

Build environment

DISTRIB_ID=ManjaroLinux DISTRIB_RELEASE=22.1.0 DISTRIB_CODENAME=Talos DISTRIB_DESCRIPTION="Manjaro Linux"

Android Debug Bridge version 1.0.41 Version 34.0.1-9680074 Installed as /opt/android-sdk/platform-tools/adb

Screenshots

image

Link to debug log

https://debuglogs.org/android/6.19.8-JW/13f6f71015dfbb002bbea0914adba58159e2fedc26b9dfc07aea4bc93556734f