Update WorkManager to alpha12.

This commit is contained in:
Greyson Parrelli 2018-12-07 09:39:08 -08:00
parent 40f9b32a75
commit 1a50910910
3 changed files with 11 additions and 13 deletions

View File

@ -73,7 +73,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-alpha11'
compile 'android.arch.work:work-runtime:1.0.0-alpha12'
compile 'com.google.android.gms:play-services-gcm:9.6.1'
compile 'com.google.android.gms:play-services-maps:9.6.1'
@ -169,7 +169,7 @@ dependencyVerification {
'com.android.support:gridlayout-v7:5029529f7db66f8773426bf7318645f0840fc50d74f66355cd60c5e58d2da087',
'com.android.support:exifinterface:bbf44e519edd6333a24a3285aa21fd00181b920b81ca8aa89a8899f03ab4d6b0',
'com.android.support:multidex:ecf6098572e23b5155bab3b9a82b2fd1530eda6c6c157745e0f5287c66eec60c',
'android.arch.work:work-runtime:e2cff8a2231da07519b65af64e77e5da20b1fc5a016bb49ddade40beb44a63ff',
'android.arch.work:work-runtime:b78d5a7b71dccf6c2549168ca1890f6848ba2d72782b903555b18099c459e472',
'android.arch.lifecycle:extensions:429426b2feec2245ffc5e75b3b5309bedb36159cf06dc71843ae43526ac289b6',
'android.arch.lifecycle:common-java8:7078b5c8ccb94203df9cc2a463c69cf0021596e6cf966d78fbfd697aaafe0630',
'com.google.android.gms:play-services-gcm:312e61253a236f2d9b750b9c04fc92fd190d23b0b2755c99de6ce4a28b259dae',

View File

@ -9,18 +9,16 @@ import org.thoughtcrime.securesms.ApplicationContext;
import org.thoughtcrime.securesms.R;
import org.thoughtcrime.securesms.jobmanager.dependencies.ContextDependent;
import org.thoughtcrime.securesms.jobmanager.requirements.NetworkRequirement;
import org.thoughtcrime.securesms.jobs.requirements.MasterSecretRequirement;
import org.thoughtcrime.securesms.jobs.requirements.SqlCipherMigrationRequirement;
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;
import androidx.work.Data;
import androidx.work.Result;
import androidx.work.Worker;
import androidx.work.WorkerParameters;
@ -99,7 +97,7 @@ public abstract class Job extends Worker implements Serializable {
onRun();
log("Successfully completed." + logSuffix());
return Result.SUCCESS;
return Result.success();
} else {
log("Retrying due to unmet requirements." + logSuffix());
return retry();
@ -201,12 +199,12 @@ public abstract class Job extends Worker implements Serializable {
private Result retry() {
onRetry();
return Result.RETRY;
return Result.retry();
}
private Result cancel() {
onCanceled();
return Result.SUCCESS;
return Result.success();
}
private boolean requirementsMet(@NonNull Data data) {

View File

@ -9,7 +9,7 @@ import java.util.Map;
import java.util.UUID;
import java.util.concurrent.Semaphore;
import androidx.work.Worker;
import androidx.work.Result;
class WorkLockManager {
@ -57,8 +57,8 @@ class WorkLockManager {
private final Semaphore lock;
private final UUID uuid;
private Worker.Result result;
private int count;
private Result result;
private int count;
private WorkLock(@NonNull UUID uuid) {
this.uuid = uuid;
@ -78,11 +78,11 @@ class WorkLockManager {
return lock;
}
void setResult(@NonNull Worker.Result result) {
void setResult(@NonNull Result result) {
this.result = result;
}
@Nullable Worker.Result getResult() {
@Nullable Result getResult() {
return result;
}