mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-21 17:29:32 +01:00
Fix legacy restore options in new restore flows.
This commit is contained in:
committed by
Michelle Tang
parent
3ea2c01c15
commit
be45bdb562
@@ -18,7 +18,9 @@ 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.keyvalue.SignalStore;
|
||||
import org.thoughtcrime.securesms.notifications.NotificationChannels;
|
||||
import org.thoughtcrime.securesms.util.RemoteConfig;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@@ -42,14 +44,20 @@ final class NewDeviceServerTask implements ServerTask {
|
||||
DataRestoreConstraint.setRestoringData(true);
|
||||
SQLiteDatabase database = SignalDatabase.getBackupDatabase();
|
||||
|
||||
String passphrase = "deadbeef";
|
||||
String passphrase;
|
||||
if (RemoteConfig.restoreAfterRegistration()) {
|
||||
passphrase = SignalStore.account().getAccountEntropyPool().getValue();
|
||||
} else {
|
||||
passphrase = "deadbeef";
|
||||
}
|
||||
|
||||
BackupPassphrase.set(context, passphrase);
|
||||
FullBackupImporter.importFile(context,
|
||||
AttachmentSecretProvider.getInstance(context).getOrCreateAttachmentSecret(),
|
||||
database,
|
||||
inputStream,
|
||||
passphrase);
|
||||
passphrase,
|
||||
RemoteConfig.restoreAfterRegistration());
|
||||
|
||||
SignalDatabase.runPostBackupRestoreTasks(database);
|
||||
NotificationChannels.getInstance().restoreContactNotificationChannels();
|
||||
|
||||
@@ -15,6 +15,7 @@ import org.thoughtcrime.securesms.crypto.AttachmentSecretProvider;
|
||||
import org.thoughtcrime.securesms.database.SignalDatabase;
|
||||
import org.thoughtcrime.securesms.keyvalue.SignalStore;
|
||||
import org.thoughtcrime.securesms.net.DeviceTransferBlockingInterceptor;
|
||||
import org.thoughtcrime.securesms.util.RemoteConfig;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
@@ -39,11 +40,18 @@ final class OldDeviceClientTask implements ClientTask {
|
||||
|
||||
EventBus.getDefault().register(this);
|
||||
try {
|
||||
String passphrase;
|
||||
if (RemoteConfig.restoreAfterRegistration()) {
|
||||
passphrase = SignalStore.account().getAccountEntropyPool().getValue();
|
||||
} else {
|
||||
passphrase = "deadbeef";
|
||||
}
|
||||
|
||||
FullBackupExporter.transfer(context,
|
||||
AttachmentSecretProvider.getInstance(context).getOrCreateAttachmentSecret(),
|
||||
SignalDatabase.getBackupDatabase(),
|
||||
outputStream,
|
||||
"deadbeef");
|
||||
passphrase);
|
||||
} catch (Exception e) {
|
||||
DeviceTransferBlockingInterceptor.getInstance().unblockNetwork();
|
||||
throw e;
|
||||
|
||||
Reference in New Issue
Block a user