mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-20 16:49:40 +01:00
Fix SQL crash in backup restore by preventing job from running until restore complete.
This commit is contained in:
@@ -17,6 +17,7 @@ import org.thoughtcrime.securesms.backup.BackupPassphrase;
|
||||
import org.thoughtcrime.securesms.backup.FullBackupImporter;
|
||||
import org.thoughtcrime.securesms.crypto.AttachmentSecretProvider;
|
||||
import org.thoughtcrime.securesms.database.SignalDatabase;
|
||||
import org.thoughtcrime.securesms.jobmanager.impl.DataRestoreConstraint;
|
||||
import org.thoughtcrime.securesms.notifications.NotificationChannels;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -38,6 +39,7 @@ final class NewDeviceServerTask implements ServerTask {
|
||||
|
||||
EventBus.getDefault().register(this);
|
||||
try {
|
||||
DataRestoreConstraint.setRestoringData(true);
|
||||
SQLiteDatabase database = SignalDatabase.getBackupDatabase();
|
||||
|
||||
String passphrase = "deadbeef";
|
||||
@@ -66,6 +68,7 @@ final class NewDeviceServerTask implements ServerTask {
|
||||
EventBus.getDefault().post(new Status(0, Status.State.FAILURE_UNKNOWN));
|
||||
} finally {
|
||||
EventBus.getDefault().unregister(this);
|
||||
DataRestoreConstraint.setRestoringData(false);
|
||||
}
|
||||
|
||||
long end = System.currentTimeMillis();
|
||||
|
||||
Reference in New Issue
Block a user