Remove job-based decryption support and MCPv1.

This commit is contained in:
Cody Henthorne
2023-08-16 14:28:14 -04:00
committed by GitHub
parent 3d94122abc
commit fbf4de0ec5
43 changed files with 476 additions and 5165 deletions

View File

@@ -121,7 +121,7 @@ public class ApplicationMigrations {
static final int GLIDE_CACHE_CLEAR = 77;
static final int SYSTEM_NAME_RESYNC = 78;
static final int RECOVERY_PASSWORD_SYNC = 79;
static final int DECRYPTIONS_DRAINED = 80;
// static final int DECRYPTIONS_DRAINED = 80;
static final int REBUILD_MESSAGE_FTS_INDEX_3 = 81;
static final int TO_FROM_RECIPIENTS = 82;
static final int REBUILD_MESSAGE_FTS_INDEX_4 = 83;
@@ -556,9 +556,10 @@ public class ApplicationMigrations {
jobs.put(Version.RECOVERY_PASSWORD_SYNC, new AttributesMigrationJob());
}
if (lastSeenVersion < Version.DECRYPTIONS_DRAINED) {
jobs.put(Version.DECRYPTIONS_DRAINED, new DecryptionsDrainedMigrationJob());
}
// Needed for the conversion to inline decryptions and is no longer necessary
// if (lastSeenVersion < Version.DECRYPTIONS_DRAINED) {
// jobs.put(Version.DECRYPTIONS_DRAINED, new DecryptionsDrainedMigrationJob());
// }
if (lastSeenVersion < Version.REBUILD_MESSAGE_FTS_INDEX_3) {
jobs.put(Version.REBUILD_MESSAGE_FTS_INDEX_3, new RebuildMessageSearchIndexMigrationJob());

View File

@@ -1,35 +0,0 @@
package org.thoughtcrime.securesms.migrations
import org.signal.core.util.logging.Log
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies
import org.thoughtcrime.securesms.jobmanager.Job
import org.thoughtcrime.securesms.jobs.PushDecryptDrainedJob
/**
* Kicks off a job to notify the [org.thoughtcrime.securesms.messages.IncomingMessageObserver] when the decryption queue is empty.
*/
internal class DecryptionsDrainedMigrationJob(
parameters: Parameters = Parameters.Builder().build()
) : MigrationJob(parameters) {
companion object {
val TAG = Log.tag(DecryptionsDrainedMigrationJob::class.java)
const val KEY = "DecryptionsDrainedMigrationJob"
}
override fun getFactoryKey(): String = KEY
override fun isUiBlocking(): Boolean = false
override fun performMigration() {
ApplicationDependencies.getJobManager().add(PushDecryptDrainedJob())
}
override fun shouldRetry(e: Exception): Boolean = false
class Factory : Job.Factory<DecryptionsDrainedMigrationJob> {
override fun create(parameters: Parameters, serializedData: ByteArray?): DecryptionsDrainedMigrationJob {
return DecryptionsDrainedMigrationJob(parameters)
}
}
}

View File

@@ -12,16 +12,13 @@ import org.thoughtcrime.securesms.crypto.MasterSecret;
import org.thoughtcrime.securesms.database.AttachmentTable;
import org.thoughtcrime.securesms.database.MessageTable;
import org.thoughtcrime.securesms.database.MessageTable.MmsReader;
import org.thoughtcrime.securesms.database.PushTable;
import org.thoughtcrime.securesms.database.SignalDatabase;
import org.thoughtcrime.securesms.database.model.MessageRecord;
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies;
import org.thoughtcrime.securesms.jobmanager.Job;
import org.thoughtcrime.securesms.jobmanager.JobManager;
import org.thoughtcrime.securesms.jobs.AttachmentDownloadJob;
import org.thoughtcrime.securesms.jobs.DirectoryRefreshJob;
import org.thoughtcrime.securesms.jobs.PreKeysSyncJob;
import org.thoughtcrime.securesms.jobs.PushDecryptMessageJob;
import org.thoughtcrime.securesms.jobs.RefreshAttributesJob;
import org.thoughtcrime.securesms.keyvalue.SignalStore;
import org.thoughtcrime.securesms.mms.GlideApp;
@@ -30,7 +27,6 @@ import org.thoughtcrime.securesms.transport.RetryLaterException;
import org.thoughtcrime.securesms.util.FileUtils;
import org.thoughtcrime.securesms.util.TextSecurePreferences;
import org.thoughtcrime.securesms.util.VersionTracker;
import org.whispersystems.signalservice.api.messages.SignalServiceEnvelope;
import java.io.File;
import java.util.List;
@@ -131,20 +127,20 @@ public class LegacyMigrationJob extends MigrationJob {
PreKeysSyncJob.enqueueIfNeeded();
}
if (lastSeenVersion < NO_DECRYPT_QUEUE_VERSION) {
scheduleMessagesInPushDatabase(context);
}
// if (lastSeenVersion < NO_DECRYPT_QUEUE_VERSION) {
// scheduleMessagesInPushDatabase(context);
// }
if (lastSeenVersion < PUSH_DECRYPT_SERIAL_ID_VERSION) {
scheduleMessagesInPushDatabase(context);
}
// if (lastSeenVersion < PUSH_DECRYPT_SERIAL_ID_VERSION) {
// scheduleMessagesInPushDatabase(context);
// }
if (lastSeenVersion < MIGRATE_SESSION_PLAINTEXT) {
// new TextSecureSessionStore(context, masterSecret).migrateSessions();
// new TextSecurePreKeyStore(context, masterSecret).migrateRecords();
scheduleMessagesInPushDatabase(context);;
}
// if (lastSeenVersion < MIGRATE_SESSION_PLAINTEXT) {
//// new TextSecureSessionStore(context, masterSecret).migrateSessions();
//// new TextSecurePreKeyStore(context, masterSecret).migrateRecords();
//
// scheduleMessagesInPushDatabase(context);;
// }
if (lastSeenVersion < CONTACTS_ACCOUNT_VERSION) {
ApplicationDependencies.getJobManager().add(new DirectoryRefreshJob(false));
@@ -184,9 +180,9 @@ public class LegacyMigrationJob extends MigrationJob {
}
}
if (lastSeenVersion < SQLCIPHER) {
scheduleMessagesInPushDatabase(context);
}
// if (lastSeenVersion < SQLCIPHER) {
// scheduleMessagesInPushDatabase(context);
// }
if (lastSeenVersion < SQLCIPHER_COMPLETE) {
File file = context.getDatabasePath("messages.db");
@@ -264,17 +260,17 @@ public class LegacyMigrationJob extends MigrationJob {
}
}
private static void scheduleMessagesInPushDatabase(@NonNull Context context) {
PushTable pushDatabase = SignalDatabase.push();
JobManager jobManager = ApplicationDependencies.getJobManager();
try (PushTable.Reader pushReader = pushDatabase.readerFor(pushDatabase.getPending())) {
SignalServiceEnvelope envelope;
while ((envelope = pushReader.getNext()) != null) {
jobManager.add(new PushDecryptMessageJob(envelope));
}
}
}
// private static void scheduleMessagesInPushDatabase(@NonNull Context context) {
// PushTable pushDatabase = SignalDatabase.push();
// JobManager jobManager = ApplicationDependencies.getJobManager();
//
// try (PushTable.Reader pushReader = pushDatabase.readerFor(pushDatabase.getPending())) {
// SignalServiceEnvelope envelope;
// while ((envelope = pushReader.getNext()) != null) {
// jobManager.add(new PushDecryptMessageJob(envelope));
// }
// }
// }
public interface DatabaseUpgradeListener {
void setProgress(int progress, int total);