-
-
Notifications
You must be signed in to change notification settings - Fork 6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement storage service protocol changes.
- Loading branch information
1 parent
d3b123f
commit 75a52f8
Showing
9 changed files
with
108 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
app/src/main/java/org/thoughtcrime/securesms/migrations/StorageKeyRotationMigrationJob.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package org.thoughtcrime.securesms.migrations; | ||
|
||
import androidx.annotation.NonNull; | ||
|
||
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies; | ||
import org.thoughtcrime.securesms.jobmanager.Data; | ||
import org.thoughtcrime.securesms.jobmanager.Job; | ||
import org.thoughtcrime.securesms.jobmanager.JobManager; | ||
import org.thoughtcrime.securesms.jobs.MultiDeviceKeysUpdateJob; | ||
import org.thoughtcrime.securesms.jobs.MultiDeviceStorageSyncRequestJob; | ||
import org.thoughtcrime.securesms.jobs.StorageForcePushJob; | ||
import org.thoughtcrime.securesms.jobs.StorageSyncJob; | ||
import org.thoughtcrime.securesms.keyvalue.SignalStore; | ||
import org.thoughtcrime.securesms.logging.Log; | ||
import org.thoughtcrime.securesms.util.TextSecurePreferences; | ||
|
||
public class StorageKeyRotationMigrationJob extends MigrationJob { | ||
|
||
private static final String TAG = Log.tag(StorageKeyRotationMigrationJob.class); | ||
|
||
public static final String KEY = "StorageKeyRotationMigrationJob"; | ||
|
||
StorageKeyRotationMigrationJob() { | ||
this(new Parameters.Builder().build()); | ||
} | ||
|
||
private StorageKeyRotationMigrationJob(@NonNull Parameters parameters) { | ||
super(parameters); | ||
} | ||
|
||
@Override | ||
public boolean isUiBlocking() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public @NonNull String getFactoryKey() { | ||
return KEY; | ||
} | ||
|
||
@Override | ||
public void performMigration() { | ||
JobManager jobManager = ApplicationDependencies.getJobManager(); | ||
SignalStore.storageServiceValues().rotateStorageMasterKey(); | ||
|
||
if (TextSecurePreferences.isMultiDevice(context)) { | ||
Log.i(TAG, "Multi-device."); | ||
jobManager.startChain(new StorageForcePushJob()) | ||
.then(new MultiDeviceKeysUpdateJob()) | ||
.then(new MultiDeviceStorageSyncRequestJob()) | ||
.enqueue(); | ||
} else { | ||
Log.i(TAG, "Single-device."); | ||
jobManager.add(new StorageForcePushJob()); | ||
} | ||
} | ||
|
||
@Override | ||
boolean shouldRetry(@NonNull Exception e) { | ||
return false; | ||
} | ||
|
||
public static class Factory implements Job.Factory<StorageKeyRotationMigrationJob> { | ||
@Override | ||
public @NonNull StorageKeyRotationMigrationJob create(@NonNull Parameters parameters, @NonNull Data data) { | ||
return new StorageKeyRotationMigrationJob(parameters); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters