diff --git a/build.gradle b/build.gradle index d8bb9f366d..e7ef001443 100644 --- a/build.gradle +++ b/build.gradle @@ -70,7 +70,7 @@ dependencies { compile 'com.android.support:multidex:1.0.3' compile 'android.arch.lifecycle:extensions:1.1.1' compile 'android.arch.lifecycle:common-java8:1.1.1' - compile 'android.arch.work:work-runtime:1.0.0-alpha09' + compile 'android.arch.work:work-runtime:1.0.0-alpha11' compile 'com.google.android.gms:play-services-gcm:9.6.1' compile 'com.google.android.gms:play-services-maps:9.6.1' @@ -149,7 +149,6 @@ dependencies { } } -// TODO: Update dependencies after getting final libsignal dependencyVerification { verify = [ 'com.android.support:design:7874ad1904eedc74aa41cffffb7f759d8990056f3bbbc9264911651c67c42f5f', @@ -167,7 +166,7 @@ dependencyVerification { 'com.android.support:gridlayout-v7:5029529f7db66f8773426bf7318645f0840fc50d74f66355cd60c5e58d2da087', 'com.android.support:exifinterface:bbf44e519edd6333a24a3285aa21fd00181b920b81ca8aa89a8899f03ab4d6b0', 'com.android.support:multidex:ecf6098572e23b5155bab3b9a82b2fd1530eda6c6c157745e0f5287c66eec60c', - 'android.arch.work:work-runtime:eda29b2cad202dee05a2e5aafe0a37c93ba9cde8f7cc0d0c8926a9f1a9498a8f', + 'android.arch.work:work-runtime:e2cff8a2231da07519b65af64e77e5da20b1fc5a016bb49ddade40beb44a63ff', 'android.arch.lifecycle:extensions:429426b2feec2245ffc5e75b3b5309bedb36159cf06dc71843ae43526ac289b6', 'android.arch.lifecycle:common-java8:7078b5c8ccb94203df9cc2a463c69cf0021596e6cf966d78fbfd697aaafe0630', 'com.google.android.gms:play-services-gcm:312e61253a236f2d9b750b9c04fc92fd190d23b0b2755c99de6ce4a28b259dae', @@ -240,7 +239,7 @@ dependencyVerification { 'com.android.support:localbroadcastmanager:d287c823af5fdde72c099fcfc5f630efe9687af7a914343ae6fd92de32c8a806', 'com.android.support:print:4be8a812d73e4a80e35b91ceae127def3f0bb9726bf3bc439aa0cc81503f5728', 'com.android.support:support-annotations:5d5b9414f02d3fa0ee7526b8d5ddae0da67c8ecc8c4d63ffa6cf91488a93b927', - 'androidx.concurrent:futures:1f63078c41efd29d20ee3444fba93c6cdfaeeb862c6d3b6166ff8debd37d471a', + 'com.google.guava:listenablefuture:e4ad7607e5c0477c6f890ef26a49cb8d1bb4dffb650bab4502afee64644e3069', 'org.signal:signal-metadata-android:d9d798aab7ee7200373ecff8718baf8aaeb632c123604e8a41b7b4c0c97eeee1', 'org.whispersystems:signal-service-java:a156f4025ce59abb1b48c089719323cd0e82d6ab4bdd345c408a5e44121499b1', 'com.github.bumptech.glide:disklrucache:c1b1b6f5bbd01e2fcdc9d7f60913c8d338bdb65ed4a93bfa02b56f19daaade4b', @@ -250,8 +249,6 @@ dependencyVerification { 'com.klinkerapps:logger:177e325259a8b111ad6745ec10db5861723c99f402222b80629f576f49408541', 'com.google.android:flexbox:a9989fd13ae2ee42765dfc515fe362edf4f326e74925d02a10369df8092a4935', 'org.jsoup:jsoup:abeaf34795a4de70f72aed6de5966d2955ec7eb348eeb813324f23c999575473', - 'com.google.guava:listenablefuture:e4ad7607e5c0477c6f890ef26a49cb8d1bb4dffb650bab4502afee64644e3069', - 'androidx.annotation:annotation:04f22f257944ce223701d5aa1bdc36fb7f4594e87b539044045cd161d965468e', 'org.whispersystems:signal-protocol-android:b41b7c3a47b0a4ce35802474ae7c5ddc8f033d80209e98abf7ec669543b2b3ee', 'org.signal:signal-metadata-java:af1d0dd766b1e301ed1c44e65161084cf03e2587fe97fdd29ecbea58c6aa6930', 'org.whispersystems:signal-protocol-java:b08207f7e1847228f2a1f0d49e113f93c96c6ed8490be14edddd4be55b2a4a4e', diff --git a/src/org/thoughtcrime/securesms/components/AlbumThumbnailView.java b/src/org/thoughtcrime/securesms/components/AlbumThumbnailView.java index c4286fe18f..293be81534 100644 --- a/src/org/thoughtcrime/securesms/components/AlbumThumbnailView.java +++ b/src/org/thoughtcrime/securesms/components/AlbumThumbnailView.java @@ -3,6 +3,8 @@ package org.thoughtcrime.securesms.components; import android.content.Context; import android.support.annotation.ColorInt; import android.support.annotation.IdRes; +import android.support.annotation.NonNull; +import android.support.annotation.Nullable; import android.util.AttributeSet; import android.view.ViewGroup; import android.widget.FrameLayout; @@ -17,9 +19,6 @@ import org.thoughtcrime.securesms.util.views.Stub; import java.util.List; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - public class AlbumThumbnailView extends FrameLayout { private @Nullable SlideClickListener thumbnailClickListener; @@ -38,12 +37,12 @@ public class AlbumThumbnailView extends FrameLayout { private final OnLongClickListener defaultLongClickListener = v -> this.performLongClick(); - public AlbumThumbnailView(@NonNull @android.support.annotation.NonNull Context context) { + public AlbumThumbnailView(@NonNull Context context) { super(context); initialize(); } - public AlbumThumbnailView(@NonNull @android.support.annotation.NonNull Context context, @Nullable @android.support.annotation.Nullable AttributeSet attrs) { + public AlbumThumbnailView(@NonNull Context context, @Nullable AttributeSet attrs) { super(context, attrs); initialize(); } diff --git a/src/org/thoughtcrime/securesms/components/emoji/AsciiEmojiView.java b/src/org/thoughtcrime/securesms/components/emoji/AsciiEmojiView.java index 22d1d8902f..4da39902b0 100644 --- a/src/org/thoughtcrime/securesms/components/emoji/AsciiEmojiView.java +++ b/src/org/thoughtcrime/securesms/components/emoji/AsciiEmojiView.java @@ -3,6 +3,7 @@ package org.thoughtcrime.securesms.components.emoji; import android.content.Context; import android.graphics.Canvas; import android.graphics.Paint; +import android.support.annotation.Nullable; import android.text.TextUtils; import android.util.AttributeSet; import android.view.View; @@ -10,8 +11,6 @@ import android.view.View; import org.thoughtcrime.securesms.R; import org.thoughtcrime.securesms.util.ResUtil; -import androidx.annotation.Nullable; - public class AsciiEmojiView extends View { private final Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG); @@ -22,7 +21,7 @@ public class AsciiEmojiView extends View { super(context); } - public AsciiEmojiView(Context context, @Nullable @android.support.annotation.Nullable AttributeSet attrs) { + public AsciiEmojiView(Context context, @Nullable AttributeSet attrs) { super(context, attrs); } diff --git a/src/org/thoughtcrime/securesms/jobmanager/Job.java b/src/org/thoughtcrime/securesms/jobmanager/Job.java index 5cc54edf06..01590a804b 100644 --- a/src/org/thoughtcrime/securesms/jobmanager/Job.java +++ b/src/org/thoughtcrime/securesms/jobmanager/Job.java @@ -1,5 +1,6 @@ package org.thoughtcrime.securesms.jobmanager; +import android.annotation.SuppressLint; import android.content.Context; import android.support.annotation.NonNull; import android.support.annotation.Nullable; @@ -14,6 +15,7 @@ import org.thoughtcrime.securesms.logging.Log; import org.thoughtcrime.securesms.service.GenericForegroundService; import java.io.Serializable; +import java.util.Collections; import java.util.HashMap; import java.util.Map; import java.util.UUID; @@ -45,7 +47,10 @@ public abstract class Job extends Worker implements Serializable { /** * Invoked when a job is first created in our own codebase. */ - protected Job(@Nullable JobParameters parameters) { + @SuppressLint("RestrictedApi") + protected Job(@NonNull Context context, @Nullable JobParameters parameters) { + //noinspection ConstantConditions + super(context, new WorkerParameters(null, null, Collections.emptySet(), null, 0, null, null, null)); this.parameters = parameters; } @@ -119,13 +124,8 @@ public abstract class Job extends Worker implements Serializable { } @Override - public void onStopped(boolean cancelled) { - if (cancelled) { - warn("onStopped() with cancellation signal." + logSuffix()); - onCanceled(); - } else { - log("onStopped()" + logSuffix()); - } + public void onStopped() { + log("onStopped()" + logSuffix()); } final void onSubmit(@NonNull Context context, @NonNull UUID id) { diff --git a/src/org/thoughtcrime/securesms/jobmanager/JobManager.java b/src/org/thoughtcrime/securesms/jobmanager/JobManager.java index 5644e75230..4cc3dda281 100644 --- a/src/org/thoughtcrime/securesms/jobmanager/JobManager.java +++ b/src/org/thoughtcrime/securesms/jobmanager/JobManager.java @@ -3,6 +3,9 @@ package org.thoughtcrime.securesms.jobmanager; import android.content.Context; import android.support.annotation.NonNull; +import org.thoughtcrime.securesms.logging.Log; + +import java.util.concurrent.ExecutionException; import java.util.concurrent.Executor; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; @@ -17,6 +20,8 @@ import androidx.work.WorkManager; public class JobManager { + private static final String TAG = JobManager.class.getSimpleName(); + private static final Constraints NETWORK_CONSTRAINT = new Constraints.Builder() .setRequiredNetworkType(NetworkType.CONNECTED) .build(); @@ -33,7 +38,11 @@ public class JobManager { public void add(Job job) { executor.execute(() -> { - workManager.synchronous().pruneWorkSync(); + try { + workManager.pruneWork().getResult().get(); + } catch (ExecutionException | InterruptedException e) { + Log.w(TAG, "Failed to prune work.", e); + } JobParameters jobParameters = job.getJobParameters(); diff --git a/src/org/thoughtcrime/securesms/jobs/AttachmentDownloadJob.java b/src/org/thoughtcrime/securesms/jobs/AttachmentDownloadJob.java index b57a6f2d8f..6ee53eaf22 100644 --- a/src/org/thoughtcrime/securesms/jobs/AttachmentDownloadJob.java +++ b/src/org/thoughtcrime/securesms/jobs/AttachmentDownloadJob.java @@ -38,6 +38,7 @@ import java.io.InputStream; import javax.inject.Inject; import androidx.work.Data; +import androidx.work.WorkerParameters; public class AttachmentDownloadJob extends ContextJob implements InjectableType { private static final long serialVersionUID = 2L; @@ -56,8 +57,8 @@ public class AttachmentDownloadJob extends ContextJob implements InjectableType private long partUniqueId; private boolean manual; - public AttachmentDownloadJob() { - super(null, null); + public AttachmentDownloadJob(@NonNull Context context, @NonNull WorkerParameters workerParameters) { + super(context, workerParameters); } public AttachmentDownloadJob(Context context, long messageId, AttachmentId attachmentId, boolean manual) { diff --git a/src/org/thoughtcrime/securesms/jobs/AvatarDownloadJob.java b/src/org/thoughtcrime/securesms/jobs/AvatarDownloadJob.java index 760437b6e4..2f1af5d214 100644 --- a/src/org/thoughtcrime/securesms/jobs/AvatarDownloadJob.java +++ b/src/org/thoughtcrime/securesms/jobs/AvatarDownloadJob.java @@ -30,6 +30,7 @@ import java.io.InputStream; import javax.inject.Inject; import androidx.work.Data; +import androidx.work.WorkerParameters; public class AvatarDownloadJob extends ContextJob implements InjectableType { @@ -44,8 +45,8 @@ public class AvatarDownloadJob extends ContextJob implements InjectableType { private byte[] groupId; - public AvatarDownloadJob() { - super(null, null); + public AvatarDownloadJob(@NonNull Context context, @NonNull WorkerParameters workerParameters) { + super(context, workerParameters); } public AvatarDownloadJob(Context context, @NonNull byte[] groupId) { diff --git a/src/org/thoughtcrime/securesms/jobs/CleanPreKeysJob.java b/src/org/thoughtcrime/securesms/jobs/CleanPreKeysJob.java index e404c39d60..c83377f390 100644 --- a/src/org/thoughtcrime/securesms/jobs/CleanPreKeysJob.java +++ b/src/org/thoughtcrime/securesms/jobs/CleanPreKeysJob.java @@ -27,6 +27,7 @@ import java.util.concurrent.TimeUnit; import javax.inject.Inject; import androidx.work.Data; +import androidx.work.WorkerParameters; import static org.thoughtcrime.securesms.dependencies.AxolotlStorageModule.SignedPreKeyStoreFactory; @@ -39,8 +40,8 @@ public class CleanPreKeysJob extends ContextJob implements InjectableType { @Inject transient SignalServiceAccountManager accountManager; @Inject transient SignedPreKeyStoreFactory signedPreKeyStoreFactory; - public CleanPreKeysJob() { - super(null, null); + public CleanPreKeysJob(@NonNull Context context, @NonNull WorkerParameters workerParameters) { + super(context, workerParameters); } public CleanPreKeysJob(Context context) { diff --git a/src/org/thoughtcrime/securesms/jobs/ContextJob.java b/src/org/thoughtcrime/securesms/jobs/ContextJob.java index b8b5bb6f7e..7f0df4f2e2 100644 --- a/src/org/thoughtcrime/securesms/jobs/ContextJob.java +++ b/src/org/thoughtcrime/securesms/jobs/ContextJob.java @@ -1,17 +1,24 @@ package org.thoughtcrime.securesms.jobs; import android.content.Context; +import android.support.annotation.NonNull; import org.thoughtcrime.securesms.jobmanager.Job; import org.thoughtcrime.securesms.jobmanager.JobParameters; import org.thoughtcrime.securesms.jobmanager.dependencies.ContextDependent; +import androidx.work.WorkerParameters; + public abstract class ContextJob extends Job implements ContextDependent { protected transient Context context; - protected ContextJob(Context context, JobParameters parameters) { - super(parameters); + protected ContextJob(@NonNull Context context, @NonNull WorkerParameters workerParameters) { + super(context, workerParameters); + } + + protected ContextJob(@NonNull Context context, @NonNull JobParameters parameters) { + super(context, parameters); this.context = context; } diff --git a/src/org/thoughtcrime/securesms/jobs/CreateSignedPreKeyJob.java b/src/org/thoughtcrime/securesms/jobs/CreateSignedPreKeyJob.java index 72a1482695..c4e7f28dbe 100644 --- a/src/org/thoughtcrime/securesms/jobs/CreateSignedPreKeyJob.java +++ b/src/org/thoughtcrime/securesms/jobs/CreateSignedPreKeyJob.java @@ -21,6 +21,7 @@ import java.io.IOException; import javax.inject.Inject; import androidx.work.Data; +import androidx.work.WorkerParameters; public class CreateSignedPreKeyJob extends ContextJob implements InjectableType { @@ -30,8 +31,8 @@ public class CreateSignedPreKeyJob extends ContextJob implements InjectableType @Inject transient SignalServiceAccountManager accountManager; - public CreateSignedPreKeyJob() { - super(null, null); + public CreateSignedPreKeyJob(@NonNull Context context, @NonNull WorkerParameters workerParameters) { + super(context, workerParameters); } public CreateSignedPreKeyJob(Context context) { diff --git a/src/org/thoughtcrime/securesms/jobs/DirectoryRefreshJob.java b/src/org/thoughtcrime/securesms/jobs/DirectoryRefreshJob.java index 789167d09a..9fa70d9881 100644 --- a/src/org/thoughtcrime/securesms/jobs/DirectoryRefreshJob.java +++ b/src/org/thoughtcrime/securesms/jobs/DirectoryRefreshJob.java @@ -16,6 +16,7 @@ import org.whispersystems.signalservice.api.push.exceptions.PushNetworkException import java.io.IOException; import androidx.work.Data; +import androidx.work.WorkerParameters; public class DirectoryRefreshJob extends ContextJob { @@ -27,8 +28,8 @@ public class DirectoryRefreshJob extends ContextJob { @Nullable private transient Recipient recipient; private transient boolean notifyOfNewUsers; - public DirectoryRefreshJob() { - super(null, null); + public DirectoryRefreshJob(@NonNull Context context, @NonNull WorkerParameters workerParameters) { + super(context, workerParameters); } public DirectoryRefreshJob(@NonNull Context context, boolean notifyOfNewUsers) { diff --git a/src/org/thoughtcrime/securesms/jobs/GcmRefreshJob.java b/src/org/thoughtcrime/securesms/jobs/GcmRefreshJob.java index 561014dcfa..81394efc5a 100644 --- a/src/org/thoughtcrime/securesms/jobs/GcmRefreshJob.java +++ b/src/org/thoughtcrime/securesms/jobs/GcmRefreshJob.java @@ -44,6 +44,7 @@ import org.whispersystems.signalservice.api.push.exceptions.NonSuccessfulRespons import javax.inject.Inject; import androidx.work.Data; +import androidx.work.WorkerParameters; public class GcmRefreshJob extends ContextJob implements InjectableType { @@ -53,8 +54,8 @@ public class GcmRefreshJob extends ContextJob implements InjectableType { @Inject transient SignalServiceAccountManager textSecureAccountManager; - public GcmRefreshJob() { - super(null, null); + public GcmRefreshJob(@NonNull Context context, @NonNull WorkerParameters workerParameters) { + super(context, workerParameters); } public GcmRefreshJob(Context context) { diff --git a/src/org/thoughtcrime/securesms/jobs/LocalBackupJob.java b/src/org/thoughtcrime/securesms/jobs/LocalBackupJob.java index d3b6bfc9d1..3fb82ef846 100644 --- a/src/org/thoughtcrime/securesms/jobs/LocalBackupJob.java +++ b/src/org/thoughtcrime/securesms/jobs/LocalBackupJob.java @@ -28,13 +28,14 @@ import java.util.Date; import java.util.Locale; import androidx.work.Data; +import androidx.work.WorkerParameters; public class LocalBackupJob extends ContextJob { private static final String TAG = LocalBackupJob.class.getSimpleName(); - public LocalBackupJob() { - super(null, null); + public LocalBackupJob(@NonNull Context context, @NonNull WorkerParameters workerParameters) { + super(context, workerParameters); } public LocalBackupJob(@NonNull Context context) { diff --git a/src/org/thoughtcrime/securesms/jobs/MmsDownloadJob.java b/src/org/thoughtcrime/securesms/jobs/MmsDownloadJob.java index 12e7a2c0d0..ccaae9ba4b 100644 --- a/src/org/thoughtcrime/securesms/jobs/MmsDownloadJob.java +++ b/src/org/thoughtcrime/securesms/jobs/MmsDownloadJob.java @@ -48,6 +48,7 @@ import java.util.List; import java.util.Set; import androidx.work.Data; +import androidx.work.WorkerParameters; public class MmsDownloadJob extends ContextJob { @@ -63,8 +64,8 @@ public class MmsDownloadJob extends ContextJob { private long threadId; private boolean automatic; - public MmsDownloadJob() { - super(null, null); + public MmsDownloadJob(@NonNull Context context, @NonNull WorkerParameters workerParameters) { + super(context, workerParameters); } public MmsDownloadJob(Context context, long messageId, long threadId, boolean automatic) { diff --git a/src/org/thoughtcrime/securesms/jobs/MmsReceiveJob.java b/src/org/thoughtcrime/securesms/jobs/MmsReceiveJob.java index 18e6f1a1bf..7518e3e052 100644 --- a/src/org/thoughtcrime/securesms/jobs/MmsReceiveJob.java +++ b/src/org/thoughtcrime/securesms/jobs/MmsReceiveJob.java @@ -25,6 +25,7 @@ import org.thoughtcrime.securesms.util.Util; import java.io.IOException; import androidx.work.Data; +import androidx.work.WorkerParameters; public class MmsReceiveJob extends ContextJob { @@ -38,8 +39,8 @@ public class MmsReceiveJob extends ContextJob { private byte[] data; private int subscriptionId; - public MmsReceiveJob() { - super(null, null); + public MmsReceiveJob(@NonNull Context context, @NonNull WorkerParameters workerParameters) { + super(context, workerParameters); } public MmsReceiveJob(Context context, byte[] data, int subscriptionId) { diff --git a/src/org/thoughtcrime/securesms/jobs/MmsSendJob.java b/src/org/thoughtcrime/securesms/jobs/MmsSendJob.java index 35e6fd935b..aa9fc8be1b 100644 --- a/src/org/thoughtcrime/securesms/jobs/MmsSendJob.java +++ b/src/org/thoughtcrime/securesms/jobs/MmsSendJob.java @@ -50,6 +50,7 @@ import java.util.Arrays; import java.util.List; import androidx.work.Data; +import androidx.work.WorkerParameters; public class MmsSendJob extends SendJob { @@ -61,8 +62,8 @@ public class MmsSendJob extends SendJob { private long messageId; - public MmsSendJob() { - super(null, null); + public MmsSendJob(@NonNull Context context, @NonNull WorkerParameters workerParameters) { + super(context, workerParameters); } public MmsSendJob(Context context, long messageId) { diff --git a/src/org/thoughtcrime/securesms/jobs/MultiDeviceBlockedUpdateJob.java b/src/org/thoughtcrime/securesms/jobs/MultiDeviceBlockedUpdateJob.java index cd723bd316..81e2831353 100644 --- a/src/org/thoughtcrime/securesms/jobs/MultiDeviceBlockedUpdateJob.java +++ b/src/org/thoughtcrime/securesms/jobs/MultiDeviceBlockedUpdateJob.java @@ -28,6 +28,7 @@ import java.util.List; import javax.inject.Inject; import androidx.work.Data; +import androidx.work.WorkerParameters; public class MultiDeviceBlockedUpdateJob extends ContextJob implements InjectableType { @@ -38,8 +39,8 @@ public class MultiDeviceBlockedUpdateJob extends ContextJob implements Injectabl @Inject transient SignalServiceMessageSender messageSender; - public MultiDeviceBlockedUpdateJob() { - super(null, null); + public MultiDeviceBlockedUpdateJob(@NonNull Context context, @NonNull WorkerParameters workerParameters) { + super(context, workerParameters); } public MultiDeviceBlockedUpdateJob(Context context) { diff --git a/src/org/thoughtcrime/securesms/jobs/MultiDeviceConfigurationUpdateJob.java b/src/org/thoughtcrime/securesms/jobs/MultiDeviceConfigurationUpdateJob.java index b91d1f3686..26778f47a5 100644 --- a/src/org/thoughtcrime/securesms/jobs/MultiDeviceConfigurationUpdateJob.java +++ b/src/org/thoughtcrime/securesms/jobs/MultiDeviceConfigurationUpdateJob.java @@ -22,6 +22,7 @@ import java.io.IOException; import javax.inject.Inject; import androidx.work.Data; +import androidx.work.WorkerParameters; public class MultiDeviceConfigurationUpdateJob extends ContextJob implements InjectableType { @@ -39,8 +40,8 @@ public class MultiDeviceConfigurationUpdateJob extends ContextJob implements Inj private boolean typingIndicatorsEnabled; private boolean unidentifiedDeliveryIndicatorsEnabled; - public MultiDeviceConfigurationUpdateJob() { - super(null, null); + public MultiDeviceConfigurationUpdateJob(@NonNull Context context, @NonNull WorkerParameters workerParameters) { + super(context, workerParameters); } public MultiDeviceConfigurationUpdateJob(Context context, boolean readReceiptsEnabled, boolean typingIndicatorsEnabled, boolean unidentifiedDeliveryIndicatorsEnabled) { diff --git a/src/org/thoughtcrime/securesms/jobs/MultiDeviceContactUpdateJob.java b/src/org/thoughtcrime/securesms/jobs/MultiDeviceContactUpdateJob.java index 49a09f75db..34a74c14f0 100644 --- a/src/org/thoughtcrime/securesms/jobs/MultiDeviceContactUpdateJob.java +++ b/src/org/thoughtcrime/securesms/jobs/MultiDeviceContactUpdateJob.java @@ -50,6 +50,7 @@ import java.util.concurrent.TimeUnit; import javax.inject.Inject; import androidx.work.Data; +import androidx.work.WorkerParameters; public class MultiDeviceContactUpdateJob extends ContextJob implements InjectableType { @@ -68,8 +69,8 @@ public class MultiDeviceContactUpdateJob extends ContextJob implements Injectabl private boolean forceSync; - public MultiDeviceContactUpdateJob() { - super(null, null); + public MultiDeviceContactUpdateJob(@NonNull Context context, @NonNull WorkerParameters workerParameters) { + super(context, workerParameters); } public MultiDeviceContactUpdateJob(@NonNull Context context) { diff --git a/src/org/thoughtcrime/securesms/jobs/MultiDeviceGroupUpdateJob.java b/src/org/thoughtcrime/securesms/jobs/MultiDeviceGroupUpdateJob.java index 38066e965c..22953b7ee3 100644 --- a/src/org/thoughtcrime/securesms/jobs/MultiDeviceGroupUpdateJob.java +++ b/src/org/thoughtcrime/securesms/jobs/MultiDeviceGroupUpdateJob.java @@ -37,6 +37,7 @@ import java.util.List; import javax.inject.Inject; import androidx.work.Data; +import androidx.work.WorkerParameters; public class MultiDeviceGroupUpdateJob extends ContextJob implements InjectableType { @@ -45,8 +46,8 @@ public class MultiDeviceGroupUpdateJob extends ContextJob implements InjectableT @Inject transient SignalServiceMessageSender messageSender; - public MultiDeviceGroupUpdateJob() { - super(null, null); + public MultiDeviceGroupUpdateJob(@NonNull Context context, @NonNull WorkerParameters workerParameters) { + super(context, workerParameters); } public MultiDeviceGroupUpdateJob(Context context) { diff --git a/src/org/thoughtcrime/securesms/jobs/MultiDeviceProfileKeyUpdateJob.java b/src/org/thoughtcrime/securesms/jobs/MultiDeviceProfileKeyUpdateJob.java index cabc25bf8c..f9782d60f8 100644 --- a/src/org/thoughtcrime/securesms/jobs/MultiDeviceProfileKeyUpdateJob.java +++ b/src/org/thoughtcrime/securesms/jobs/MultiDeviceProfileKeyUpdateJob.java @@ -31,6 +31,7 @@ import java.io.IOException; import javax.inject.Inject; import androidx.work.Data; +import androidx.work.WorkerParameters; public class MultiDeviceProfileKeyUpdateJob extends ContextJob implements InjectableType { @@ -39,8 +40,8 @@ public class MultiDeviceProfileKeyUpdateJob extends ContextJob implements Inject @Inject transient SignalServiceMessageSender messageSender; - public MultiDeviceProfileKeyUpdateJob() { - super(null, null); + public MultiDeviceProfileKeyUpdateJob(@NonNull Context context, @NonNull WorkerParameters workerParameters) { + super(context, workerParameters); } public MultiDeviceProfileKeyUpdateJob(Context context) { diff --git a/src/org/thoughtcrime/securesms/jobs/MultiDeviceReadReceiptUpdateJob.java b/src/org/thoughtcrime/securesms/jobs/MultiDeviceReadReceiptUpdateJob.java index a0178e4631..c08250f8e2 100644 --- a/src/org/thoughtcrime/securesms/jobs/MultiDeviceReadReceiptUpdateJob.java +++ b/src/org/thoughtcrime/securesms/jobs/MultiDeviceReadReceiptUpdateJob.java @@ -22,6 +22,7 @@ import java.io.IOException; import javax.inject.Inject; import androidx.work.Data; +import androidx.work.WorkerParameters; /** * Use {@link MultiDeviceConfigurationUpdateJob}. @@ -39,8 +40,8 @@ public class MultiDeviceReadReceiptUpdateJob extends ContextJob implements Injec private boolean enabled; - public MultiDeviceReadReceiptUpdateJob() { - super(null, null); + public MultiDeviceReadReceiptUpdateJob(@NonNull Context context, @NonNull WorkerParameters workerParameters) { + super(context, workerParameters); } public MultiDeviceReadReceiptUpdateJob(Context context, boolean enabled) { diff --git a/src/org/thoughtcrime/securesms/jobs/MultiDeviceReadUpdateJob.java b/src/org/thoughtcrime/securesms/jobs/MultiDeviceReadUpdateJob.java index 7abd69a3f6..9df30509cc 100644 --- a/src/org/thoughtcrime/securesms/jobs/MultiDeviceReadUpdateJob.java +++ b/src/org/thoughtcrime/securesms/jobs/MultiDeviceReadUpdateJob.java @@ -31,6 +31,7 @@ import java.util.List; import javax.inject.Inject; import androidx.work.Data; +import androidx.work.WorkerParameters; public class MultiDeviceReadUpdateJob extends ContextJob implements InjectableType { @@ -43,8 +44,8 @@ public class MultiDeviceReadUpdateJob extends ContextJob implements InjectableTy @Inject transient SignalServiceMessageSender messageSender; - public MultiDeviceReadUpdateJob() { - super(null, null); + public MultiDeviceReadUpdateJob(@NonNull Context context, @NonNull WorkerParameters workerParameters) { + super(context, workerParameters); } public MultiDeviceReadUpdateJob(Context context, List messageIds) { diff --git a/src/org/thoughtcrime/securesms/jobs/MultiDeviceVerifiedUpdateJob.java b/src/org/thoughtcrime/securesms/jobs/MultiDeviceVerifiedUpdateJob.java index c7a9f873f3..862a117b39 100644 --- a/src/org/thoughtcrime/securesms/jobs/MultiDeviceVerifiedUpdateJob.java +++ b/src/org/thoughtcrime/securesms/jobs/MultiDeviceVerifiedUpdateJob.java @@ -29,6 +29,7 @@ import java.io.IOException; import javax.inject.Inject; import androidx.work.Data; +import androidx.work.WorkerParameters; public class MultiDeviceVerifiedUpdateJob extends ContextJob implements InjectableType { @@ -49,8 +50,8 @@ public class MultiDeviceVerifiedUpdateJob extends ContextJob implements Injectab private VerifiedStatus verifiedStatus; private long timestamp; - public MultiDeviceVerifiedUpdateJob() { - super(null, null); + public MultiDeviceVerifiedUpdateJob(@NonNull Context context, @NonNull WorkerParameters workerParameters) { + super(context, workerParameters); } public MultiDeviceVerifiedUpdateJob(Context context, Address destination, IdentityKey identityKey, VerifiedStatus verifiedStatus) { diff --git a/src/org/thoughtcrime/securesms/jobs/PushContentReceiveJob.java b/src/org/thoughtcrime/securesms/jobs/PushContentReceiveJob.java index 5e99f976d4..319c23fe1b 100644 --- a/src/org/thoughtcrime/securesms/jobs/PushContentReceiveJob.java +++ b/src/org/thoughtcrime/securesms/jobs/PushContentReceiveJob.java @@ -14,6 +14,7 @@ import org.whispersystems.signalservice.api.messages.SignalServiceEnvelope; import java.io.IOException; import androidx.work.Data; +import androidx.work.WorkerParameters; public class PushContentReceiveJob extends PushReceivedJob { @@ -24,8 +25,8 @@ public class PushContentReceiveJob extends PushReceivedJob { private String data; - public PushContentReceiveJob() { - super(null, null); + public PushContentReceiveJob(@NonNull Context context, @NonNull WorkerParameters workerParameters) { + super(context, workerParameters); } public PushContentReceiveJob(Context context) { diff --git a/src/org/thoughtcrime/securesms/jobs/PushDecryptJob.java b/src/org/thoughtcrime/securesms/jobs/PushDecryptJob.java index 61a03c116d..7c5d5c83f1 100644 --- a/src/org/thoughtcrime/securesms/jobs/PushDecryptJob.java +++ b/src/org/thoughtcrime/securesms/jobs/PushDecryptJob.java @@ -105,6 +105,7 @@ import java.util.LinkedList; import java.util.List; import androidx.work.Data; +import androidx.work.WorkerParameters; public class PushDecryptJob extends ContextJob { @@ -118,8 +119,8 @@ public class PushDecryptJob extends ContextJob { private long messageId; private long smsMessageId; - public PushDecryptJob() { - super(null, null); + public PushDecryptJob(@NonNull Context context, @NonNull WorkerParameters workerParameters) { + super(context, workerParameters); } public PushDecryptJob(Context context) { diff --git a/src/org/thoughtcrime/securesms/jobs/PushGroupSendJob.java b/src/org/thoughtcrime/securesms/jobs/PushGroupSendJob.java index 3d2e59f11c..4af6a08def 100644 --- a/src/org/thoughtcrime/securesms/jobs/PushGroupSendJob.java +++ b/src/org/thoughtcrime/securesms/jobs/PushGroupSendJob.java @@ -53,6 +53,7 @@ import java.util.concurrent.TimeUnit; import javax.inject.Inject; import androidx.work.Data; +import androidx.work.WorkerParameters; public class PushGroupSendJob extends PushSendJob implements InjectableType { @@ -69,8 +70,8 @@ public class PushGroupSendJob extends PushSendJob implements InjectableType { private long filterRecipientId; // Deprecated private String filterAddress; - public PushGroupSendJob() { - super(null, null); + public PushGroupSendJob(@NonNull Context context, @NonNull WorkerParameters workerParameters) { + super(context, workerParameters); } public PushGroupSendJob(Context context, long messageId, @NonNull Address destination, @Nullable Address filterAddress) { diff --git a/src/org/thoughtcrime/securesms/jobs/PushGroupUpdateJob.java b/src/org/thoughtcrime/securesms/jobs/PushGroupUpdateJob.java index 12afebc2c2..420ea39730 100644 --- a/src/org/thoughtcrime/securesms/jobs/PushGroupUpdateJob.java +++ b/src/org/thoughtcrime/securesms/jobs/PushGroupUpdateJob.java @@ -35,6 +35,7 @@ import java.util.concurrent.TimeUnit; import javax.inject.Inject; import androidx.work.Data; +import androidx.work.WorkerParameters; public class PushGroupUpdateJob extends ContextJob implements InjectableType { @@ -50,8 +51,8 @@ public class PushGroupUpdateJob extends ContextJob implements InjectableType { private String source; private byte[] groupId; - public PushGroupUpdateJob() { - super(null, null); + public PushGroupUpdateJob(@NonNull Context context, @NonNull WorkerParameters workerParameters) { + super(context, workerParameters); } public PushGroupUpdateJob(Context context, String source, byte[] groupId) { diff --git a/src/org/thoughtcrime/securesms/jobs/PushMediaSendJob.java b/src/org/thoughtcrime/securesms/jobs/PushMediaSendJob.java index 6c69992aca..e7f728e646 100644 --- a/src/org/thoughtcrime/securesms/jobs/PushMediaSendJob.java +++ b/src/org/thoughtcrime/securesms/jobs/PushMediaSendJob.java @@ -39,6 +39,7 @@ import java.util.List; import javax.inject.Inject; import androidx.work.Data; +import androidx.work.WorkerParameters; public class PushMediaSendJob extends PushSendJob implements InjectableType { @@ -52,8 +53,8 @@ public class PushMediaSendJob extends PushSendJob implements InjectableType { private long messageId; - public PushMediaSendJob() { - super(null, null); + public PushMediaSendJob(@NonNull Context context, @NonNull WorkerParameters workerParameters) { + super(context, workerParameters); } public PushMediaSendJob(Context context, long messageId, Address destination) { diff --git a/src/org/thoughtcrime/securesms/jobs/PushNotificationReceiveJob.java b/src/org/thoughtcrime/securesms/jobs/PushNotificationReceiveJob.java index 6c5141608e..e1d1ac9486 100644 --- a/src/org/thoughtcrime/securesms/jobs/PushNotificationReceiveJob.java +++ b/src/org/thoughtcrime/securesms/jobs/PushNotificationReceiveJob.java @@ -17,6 +17,7 @@ import java.io.IOException; import javax.inject.Inject; import androidx.work.Data; +import androidx.work.WorkerParameters; public class PushNotificationReceiveJob extends PushReceivedJob implements InjectableType { @@ -24,8 +25,8 @@ public class PushNotificationReceiveJob extends PushReceivedJob implements Injec @Inject transient SignalServiceMessageReceiver receiver; - public PushNotificationReceiveJob() { - super(null, null); + public PushNotificationReceiveJob(@NonNull Context context, @NonNull WorkerParameters workerParameters) { + super(context, workerParameters); } public PushNotificationReceiveJob(Context context) { diff --git a/src/org/thoughtcrime/securesms/jobs/PushReceivedJob.java b/src/org/thoughtcrime/securesms/jobs/PushReceivedJob.java index 787edf487e..74a605f593 100644 --- a/src/org/thoughtcrime/securesms/jobs/PushReceivedJob.java +++ b/src/org/thoughtcrime/securesms/jobs/PushReceivedJob.java @@ -14,12 +14,18 @@ import org.thoughtcrime.securesms.logging.Log; import org.thoughtcrime.securesms.recipients.Recipient; import org.whispersystems.signalservice.api.messages.SignalServiceEnvelope; +import androidx.work.WorkerParameters; + public abstract class PushReceivedJob extends ContextJob { private static final String TAG = PushReceivedJob.class.getSimpleName(); public static final Object RECEIVE_LOCK = new Object(); + protected PushReceivedJob(@NonNull Context context, @NonNull WorkerParameters workerParameters) { + super(context, workerParameters); + } + protected PushReceivedJob(Context context, JobParameters parameters) { super(context, parameters); } diff --git a/src/org/thoughtcrime/securesms/jobs/PushSendJob.java b/src/org/thoughtcrime/securesms/jobs/PushSendJob.java index 3d78341f7b..0b4eff3e14 100644 --- a/src/org/thoughtcrime/securesms/jobs/PushSendJob.java +++ b/src/org/thoughtcrime/securesms/jobs/PushSendJob.java @@ -41,12 +41,18 @@ import java.util.List; import java.util.UUID; import java.util.concurrent.TimeUnit; +import androidx.work.WorkerParameters; + public abstract class PushSendJob extends SendJob { private static final long serialVersionUID = 5906098204770900739L; private static final String TAG = PushSendJob.class.getSimpleName(); private static final long CERTIFICATE_EXPIRATION_BUFFER = TimeUnit.DAYS.toMillis(1); + protected PushSendJob(@NonNull Context context, @NonNull WorkerParameters workerParameters) { + super(context, workerParameters); + } + protected PushSendJob(Context context, JobParameters parameters) { super(context, parameters); } @@ -213,7 +219,7 @@ public abstract class PushSendJob extends SendJob { Log.d(TAG, "Certificate is valid."); } catch (InvalidCertificateException e) { Log.w(TAG, "Certificate was invalid at send time. Fetching a new one.", e); - RotateCertificateJob certificateJob = new RotateCertificateJob(); + RotateCertificateJob certificateJob = new RotateCertificateJob(context); ApplicationContext.getInstance(context).injectDependencies(certificateJob); certificateJob.setContext(context); certificateJob.onRun(); diff --git a/src/org/thoughtcrime/securesms/jobs/PushTextSendJob.java b/src/org/thoughtcrime/securesms/jobs/PushTextSendJob.java index 47aefe0192..87fe6921a2 100644 --- a/src/org/thoughtcrime/securesms/jobs/PushTextSendJob.java +++ b/src/org/thoughtcrime/securesms/jobs/PushTextSendJob.java @@ -34,6 +34,7 @@ import java.io.IOException; import javax.inject.Inject; import androidx.work.Data; +import androidx.work.WorkerParameters; public class PushTextSendJob extends PushSendJob implements InjectableType { @@ -47,8 +48,8 @@ public class PushTextSendJob extends PushSendJob implements InjectableType { private long messageId; - public PushTextSendJob() { - super(null, null); + public PushTextSendJob(@NonNull Context context, @NonNull WorkerParameters workerParameters) { + super(context, workerParameters); } public PushTextSendJob(Context context, long messageId, Address destination) { diff --git a/src/org/thoughtcrime/securesms/jobs/RefreshAttributesJob.java b/src/org/thoughtcrime/securesms/jobs/RefreshAttributesJob.java index bae0adb205..4227f93c95 100644 --- a/src/org/thoughtcrime/securesms/jobs/RefreshAttributesJob.java +++ b/src/org/thoughtcrime/securesms/jobs/RefreshAttributesJob.java @@ -20,6 +20,7 @@ import java.io.IOException; import javax.inject.Inject; import androidx.work.Data; +import androidx.work.WorkerParameters; public class RefreshAttributesJob extends ContextJob implements InjectableType { @@ -29,8 +30,8 @@ public class RefreshAttributesJob extends ContextJob implements InjectableType { @Inject transient SignalServiceAccountManager signalAccountManager; - public RefreshAttributesJob() { - super(null, null); + public RefreshAttributesJob(@NonNull Context context, @NonNull WorkerParameters workerParameters) { + super(context, workerParameters); } public RefreshAttributesJob(Context context) { diff --git a/src/org/thoughtcrime/securesms/jobs/RefreshPreKeysJob.java b/src/org/thoughtcrime/securesms/jobs/RefreshPreKeysJob.java index 9906a0a8f0..e377644318 100644 --- a/src/org/thoughtcrime/securesms/jobs/RefreshPreKeysJob.java +++ b/src/org/thoughtcrime/securesms/jobs/RefreshPreKeysJob.java @@ -25,6 +25,7 @@ import java.util.List; import javax.inject.Inject; import androidx.work.Data; +import androidx.work.WorkerParameters; public class RefreshPreKeysJob extends ContextJob implements InjectableType { @@ -34,8 +35,8 @@ public class RefreshPreKeysJob extends ContextJob implements InjectableType { @Inject transient SignalServiceAccountManager accountManager; - public RefreshPreKeysJob() { - super(null, null); + public RefreshPreKeysJob(@NonNull Context context, @NonNull WorkerParameters workerParameters) { + super(context, workerParameters); } public RefreshPreKeysJob(Context context) { diff --git a/src/org/thoughtcrime/securesms/jobs/RefreshUnidentifiedDeliveryAbilityJob.java b/src/org/thoughtcrime/securesms/jobs/RefreshUnidentifiedDeliveryAbilityJob.java index f7440c5084..8f210a3ea7 100644 --- a/src/org/thoughtcrime/securesms/jobs/RefreshUnidentifiedDeliveryAbilityJob.java +++ b/src/org/thoughtcrime/securesms/jobs/RefreshUnidentifiedDeliveryAbilityJob.java @@ -24,6 +24,7 @@ import java.io.IOException; import javax.inject.Inject; import androidx.work.Data; +import androidx.work.WorkerParameters; public class RefreshUnidentifiedDeliveryAbilityJob extends ContextJob implements InjectableType { @@ -31,8 +32,8 @@ public class RefreshUnidentifiedDeliveryAbilityJob extends ContextJob implements @Inject transient SignalServiceMessageReceiver receiver; - public RefreshUnidentifiedDeliveryAbilityJob() { - super(null, null); + public RefreshUnidentifiedDeliveryAbilityJob(@NonNull Context context, @NonNull WorkerParameters workerParameters) { + super(context, workerParameters); } public RefreshUnidentifiedDeliveryAbilityJob(Context context) { diff --git a/src/org/thoughtcrime/securesms/jobs/RequestGroupInfoJob.java b/src/org/thoughtcrime/securesms/jobs/RequestGroupInfoJob.java index 7bf46f8bc0..6ff58a84cb 100644 --- a/src/org/thoughtcrime/securesms/jobs/RequestGroupInfoJob.java +++ b/src/org/thoughtcrime/securesms/jobs/RequestGroupInfoJob.java @@ -24,6 +24,7 @@ import java.io.IOException; import javax.inject.Inject; import androidx.work.Data; +import androidx.work.WorkerParameters; public class RequestGroupInfoJob extends ContextJob implements InjectableType { @@ -40,8 +41,8 @@ public class RequestGroupInfoJob extends ContextJob implements InjectableType { private String source; private byte[] groupId; - public RequestGroupInfoJob() { - super(null, null); + public RequestGroupInfoJob(@NonNull Context context, @NonNull WorkerParameters workerParameters) { + super(context, workerParameters); } public RequestGroupInfoJob(@NonNull Context context, @NonNull String source, @NonNull byte[] groupId) { diff --git a/src/org/thoughtcrime/securesms/jobs/RetrieveProfileAvatarJob.java b/src/org/thoughtcrime/securesms/jobs/RetrieveProfileAvatarJob.java index 7d8ee23711..45f38f1b32 100644 --- a/src/org/thoughtcrime/securesms/jobs/RetrieveProfileAvatarJob.java +++ b/src/org/thoughtcrime/securesms/jobs/RetrieveProfileAvatarJob.java @@ -27,6 +27,7 @@ import java.io.InputStream; import javax.inject.Inject; import androidx.work.Data; +import androidx.work.WorkerParameters; public class RetrieveProfileAvatarJob extends ContextJob implements InjectableType { @@ -42,8 +43,8 @@ public class RetrieveProfileAvatarJob extends ContextJob implements InjectableTy private String profileAvatar; private Recipient recipient; - public RetrieveProfileAvatarJob() { - super(null, null); + public RetrieveProfileAvatarJob(@NonNull Context context, @NonNull WorkerParameters workerParameters) { + super(context, workerParameters); } public RetrieveProfileAvatarJob(Context context, Recipient recipient, String profileAvatar) { diff --git a/src/org/thoughtcrime/securesms/jobs/RetrieveProfileJob.java b/src/org/thoughtcrime/securesms/jobs/RetrieveProfileJob.java index 1cff017f5e..73dbd716cd 100644 --- a/src/org/thoughtcrime/securesms/jobs/RetrieveProfileJob.java +++ b/src/org/thoughtcrime/securesms/jobs/RetrieveProfileJob.java @@ -39,6 +39,7 @@ import java.util.List; import javax.inject.Inject; import androidx.work.Data; +import androidx.work.WorkerParameters; public class RetrieveProfileJob extends ContextJob implements InjectableType { @@ -50,8 +51,8 @@ public class RetrieveProfileJob extends ContextJob implements InjectableType { private Recipient recipient; - public RetrieveProfileJob() { - super(null, null); + public RetrieveProfileJob(@NonNull Context context, @NonNull WorkerParameters workerParameters) { + super(context, workerParameters); } public RetrieveProfileJob(Context context, Recipient recipient) { diff --git a/src/org/thoughtcrime/securesms/jobs/RotateCertificateJob.java b/src/org/thoughtcrime/securesms/jobs/RotateCertificateJob.java index 94ab124beb..0672115e48 100644 --- a/src/org/thoughtcrime/securesms/jobs/RotateCertificateJob.java +++ b/src/org/thoughtcrime/securesms/jobs/RotateCertificateJob.java @@ -17,6 +17,7 @@ import java.io.IOException; import javax.inject.Inject; import androidx.work.Data; +import androidx.work.WorkerParameters; @SuppressWarnings("WeakerAccess") public class RotateCertificateJob extends ContextJob implements InjectableType { @@ -27,8 +28,8 @@ public class RotateCertificateJob extends ContextJob implements InjectableType { @Inject transient SignalServiceAccountManager accountManager; - public RotateCertificateJob() { - super(null, null); + public RotateCertificateJob(@NonNull Context context, @NonNull WorkerParameters workerParameters) { + super(context, workerParameters); } public RotateCertificateJob(Context context) { diff --git a/src/org/thoughtcrime/securesms/jobs/RotateProfileKeyJob.java b/src/org/thoughtcrime/securesms/jobs/RotateProfileKeyJob.java index d6f4b00139..895f9475a2 100644 --- a/src/org/thoughtcrime/securesms/jobs/RotateProfileKeyJob.java +++ b/src/org/thoughtcrime/securesms/jobs/RotateProfileKeyJob.java @@ -23,13 +23,14 @@ import java.io.IOException; import javax.inject.Inject; import androidx.work.Data; +import androidx.work.WorkerParameters; public class RotateProfileKeyJob extends ContextJob implements InjectableType { @Inject SignalServiceAccountManager accountManager; - public RotateProfileKeyJob() { - super(null, null); + public RotateProfileKeyJob(@NonNull Context context, @NonNull WorkerParameters workerParameters) { + super(context, workerParameters); } public RotateProfileKeyJob(Context context) { diff --git a/src/org/thoughtcrime/securesms/jobs/RotateSignedPreKeyJob.java b/src/org/thoughtcrime/securesms/jobs/RotateSignedPreKeyJob.java index 12a9b08d1a..553952d197 100644 --- a/src/org/thoughtcrime/securesms/jobs/RotateSignedPreKeyJob.java +++ b/src/org/thoughtcrime/securesms/jobs/RotateSignedPreKeyJob.java @@ -21,6 +21,7 @@ import org.whispersystems.signalservice.api.push.exceptions.PushNetworkException import javax.inject.Inject; import androidx.work.Data; +import androidx.work.WorkerParameters; public class RotateSignedPreKeyJob extends ContextJob implements InjectableType { @@ -28,8 +29,8 @@ public class RotateSignedPreKeyJob extends ContextJob implements InjectableType @Inject transient SignalServiceAccountManager accountManager; - public RotateSignedPreKeyJob() { - super(null, null); + public RotateSignedPreKeyJob(@NonNull Context context, @NonNull WorkerParameters workerParameters) { + super(context, workerParameters); } public RotateSignedPreKeyJob(Context context) { diff --git a/src/org/thoughtcrime/securesms/jobs/SendDeliveryReceiptJob.java b/src/org/thoughtcrime/securesms/jobs/SendDeliveryReceiptJob.java index 937bb40897..c4a418342a 100644 --- a/src/org/thoughtcrime/securesms/jobs/SendDeliveryReceiptJob.java +++ b/src/org/thoughtcrime/securesms/jobs/SendDeliveryReceiptJob.java @@ -23,6 +23,7 @@ import java.util.Collections; import javax.inject.Inject; import androidx.work.Data; +import androidx.work.WorkerParameters; public class SendDeliveryReceiptJob extends ContextJob implements InjectableType { @@ -41,8 +42,8 @@ public class SendDeliveryReceiptJob extends ContextJob implements InjectableType private long messageId; private long timestamp; - public SendDeliveryReceiptJob() { - super(null, null); + public SendDeliveryReceiptJob(@NonNull Context context, @NonNull WorkerParameters workerParameters) { + super(context, workerParameters); } public SendDeliveryReceiptJob(Context context, Address address, long messageId) { diff --git a/src/org/thoughtcrime/securesms/jobs/SendJob.java b/src/org/thoughtcrime/securesms/jobs/SendJob.java index 7eb3b7b2d1..2cbfa5d591 100644 --- a/src/org/thoughtcrime/securesms/jobs/SendJob.java +++ b/src/org/thoughtcrime/securesms/jobs/SendJob.java @@ -23,11 +23,17 @@ import java.io.IOException; import java.util.LinkedList; import java.util.List; +import androidx.work.WorkerParameters; + public abstract class SendJob extends ContextJob { @SuppressWarnings("unused") private final static String TAG = SendJob.class.getSimpleName(); + protected SendJob(@NonNull Context context, @NonNull WorkerParameters workerParameters) { + super(context, workerParameters); + } + public SendJob(Context context, JobParameters parameters) { super(context, parameters); } diff --git a/src/org/thoughtcrime/securesms/jobs/SendReadReceiptJob.java b/src/org/thoughtcrime/securesms/jobs/SendReadReceiptJob.java index b5af6f666b..dbea519867 100644 --- a/src/org/thoughtcrime/securesms/jobs/SendReadReceiptJob.java +++ b/src/org/thoughtcrime/securesms/jobs/SendReadReceiptJob.java @@ -25,6 +25,7 @@ import java.util.List; import javax.inject.Inject; import androidx.work.Data; +import androidx.work.WorkerParameters; public class SendReadReceiptJob extends ContextJob implements InjectableType { @@ -42,8 +43,8 @@ public class SendReadReceiptJob extends ContextJob implements InjectableType { private List messageIds; private long timestamp; - public SendReadReceiptJob() { - super(null, null); + public SendReadReceiptJob(@NonNull Context context, @NonNull WorkerParameters workerParameters) { + super(context, workerParameters); } public SendReadReceiptJob(Context context, Address address, List messageIds) { diff --git a/src/org/thoughtcrime/securesms/jobs/ServiceOutageDetectionJob.java b/src/org/thoughtcrime/securesms/jobs/ServiceOutageDetectionJob.java index 4a4c1a511a..21b79bf379 100644 --- a/src/org/thoughtcrime/securesms/jobs/ServiceOutageDetectionJob.java +++ b/src/org/thoughtcrime/securesms/jobs/ServiceOutageDetectionJob.java @@ -16,6 +16,7 @@ import java.net.InetAddress; import java.net.UnknownHostException; import androidx.work.Data; +import androidx.work.WorkerParameters; public class ServiceOutageDetectionJob extends ContextJob { @@ -25,8 +26,8 @@ public class ServiceOutageDetectionJob extends ContextJob { private static final String IP_FAILURE = "127.0.0.2"; private static final long CHECK_TIME = 1000 * 60; - public ServiceOutageDetectionJob() { - super(null, null); + public ServiceOutageDetectionJob(@NonNull Context context, @NonNull WorkerParameters workerParameters) { + super(context, workerParameters); } public ServiceOutageDetectionJob(Context context) { diff --git a/src/org/thoughtcrime/securesms/jobs/SmsReceiveJob.java b/src/org/thoughtcrime/securesms/jobs/SmsReceiveJob.java index 83d0aecb3a..79513f8727 100644 --- a/src/org/thoughtcrime/securesms/jobs/SmsReceiveJob.java +++ b/src/org/thoughtcrime/securesms/jobs/SmsReceiveJob.java @@ -24,6 +24,7 @@ import java.util.LinkedList; import java.util.List; import androidx.work.Data; +import androidx.work.WorkerParameters; public class SmsReceiveJob extends ContextJob { @@ -38,8 +39,8 @@ public class SmsReceiveJob extends ContextJob { private int subscriptionId; - public SmsReceiveJob() { - super(null, null); + public SmsReceiveJob(@NonNull Context context, @NonNull WorkerParameters workerParameters) { + super(context, workerParameters); } public SmsReceiveJob(@NonNull Context context, @Nullable Object[] pdus, int subscriptionId) { diff --git a/src/org/thoughtcrime/securesms/jobs/SmsSendJob.java b/src/org/thoughtcrime/securesms/jobs/SmsSendJob.java index fd53b16dd9..0548cdec26 100644 --- a/src/org/thoughtcrime/securesms/jobs/SmsSendJob.java +++ b/src/org/thoughtcrime/securesms/jobs/SmsSendJob.java @@ -31,6 +31,7 @@ import org.thoughtcrime.securesms.jobmanager.JobParameters; import java.util.ArrayList; import androidx.work.Data; +import androidx.work.WorkerParameters; public class SmsSendJob extends SendJob { @@ -43,8 +44,8 @@ public class SmsSendJob extends SendJob { private long messageId; private int runAttempt; - public SmsSendJob() { - super(null, null); + public SmsSendJob(@NonNull Context context, @NonNull WorkerParameters workerParameters) { + super(context, workerParameters); } public SmsSendJob(Context context, long messageId, String name) { diff --git a/src/org/thoughtcrime/securesms/jobs/SmsSentJob.java b/src/org/thoughtcrime/securesms/jobs/SmsSentJob.java index 50c83ae485..ba654cf692 100644 --- a/src/org/thoughtcrime/securesms/jobs/SmsSentJob.java +++ b/src/org/thoughtcrime/securesms/jobs/SmsSentJob.java @@ -19,6 +19,7 @@ import org.thoughtcrime.securesms.notifications.MessageNotifier; import org.thoughtcrime.securesms.service.SmsDeliveryListener; import androidx.work.Data; +import androidx.work.WorkerParameters; public class SmsSentJob extends ContextJob { @@ -35,8 +36,8 @@ public class SmsSentJob extends ContextJob { private int result; private int runAttempt; - public SmsSentJob() { - super(null, null); + public SmsSentJob(@NonNull Context context, @NonNull WorkerParameters workerParameters) { + super(context, workerParameters); } public SmsSentJob(Context context, long messageId, String action, int result, int runAttempt) { diff --git a/src/org/thoughtcrime/securesms/jobs/TrimThreadJob.java b/src/org/thoughtcrime/securesms/jobs/TrimThreadJob.java index 790eef6142..6cc4b3e807 100644 --- a/src/org/thoughtcrime/securesms/jobs/TrimThreadJob.java +++ b/src/org/thoughtcrime/securesms/jobs/TrimThreadJob.java @@ -26,6 +26,7 @@ import org.thoughtcrime.securesms.logging.Log; import org.thoughtcrime.securesms.util.TextSecurePreferences; import androidx.work.Data; +import androidx.work.WorkerParameters; public class TrimThreadJob extends ContextJob { @@ -35,8 +36,8 @@ public class TrimThreadJob extends ContextJob { private long threadId; - public TrimThreadJob() { - super(null, null); + public TrimThreadJob(@NonNull Context context, @NonNull WorkerParameters workerParameters) { + super(context, workerParameters); } public TrimThreadJob(Context context, long threadId) { diff --git a/src/org/thoughtcrime/securesms/jobs/TypingSendJob.java b/src/org/thoughtcrime/securesms/jobs/TypingSendJob.java index f54f788e86..34c242a561 100644 --- a/src/org/thoughtcrime/securesms/jobs/TypingSendJob.java +++ b/src/org/thoughtcrime/securesms/jobs/TypingSendJob.java @@ -27,6 +27,7 @@ import java.util.List; import javax.inject.Inject; import androidx.work.Data; +import androidx.work.WorkerParameters; public class TypingSendJob extends ContextJob implements InjectableType { @@ -40,8 +41,8 @@ public class TypingSendJob extends ContextJob implements InjectableType { @Inject SignalServiceMessageSender messageSender; - public TypingSendJob() { - super(null, null); + public TypingSendJob(@NonNull Context context, @NonNull WorkerParameters workerParameters) { + super(context, workerParameters); } public TypingSendJob(Context context, long threadId, boolean typing) { diff --git a/src/org/thoughtcrime/securesms/jobs/UpdateApkJob.java b/src/org/thoughtcrime/securesms/jobs/UpdateApkJob.java index c435bb501b..a22ba78920 100644 --- a/src/org/thoughtcrime/securesms/jobs/UpdateApkJob.java +++ b/src/org/thoughtcrime/securesms/jobs/UpdateApkJob.java @@ -30,6 +30,7 @@ import java.io.IOException; import java.security.MessageDigest; import androidx.work.Data; +import androidx.work.WorkerParameters; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.Response; @@ -38,8 +39,8 @@ public class UpdateApkJob extends ContextJob { private static final String TAG = UpdateApkJob.class.getSimpleName(); - public UpdateApkJob() { - super(null, null); + public UpdateApkJob(@NonNull Context context, @NonNull WorkerParameters workerParameters) { + super(context, workerParameters); } public UpdateApkJob(Context context) {