Update WorkManager to 1.0.0-alpha11.

This commit is contained in:
Greyson Parrelli 2018-11-27 12:34:42 -08:00
parent 8a1a47e773
commit 81055e61a6
52 changed files with 184 additions and 112 deletions

View File

@ -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',

View File

@ -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();
}

View File

@ -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);
}

View File

@ -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) {

View File

@ -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();

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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;
}

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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<SyncMessageId> messageIds) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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);
}

View File

@ -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();

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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);
}

View File

@ -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<Long> 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<Long> messageIds) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {