- Added realracing3-community.apk (71.57 MB) - Removed 32-bit support (armeabi-v7a) - Only includes arm64-v8a libraries - Decompiled source code included - Added README-community.md with analysis
201 lines
12 KiB
Java
201 lines
12 KiB
Java
package androidx.work.impl;
|
|
|
|
import androidx.annotation.RestrictTo;
|
|
import androidx.work.Configuration;
|
|
import androidx.work.ExistingWorkPolicy;
|
|
import androidx.work.ListenableFutureKt;
|
|
import androidx.work.Operation;
|
|
import androidx.work.OperationKt;
|
|
import androidx.work.Tracer;
|
|
import androidx.work.WorkInfo;
|
|
import androidx.work.WorkManager;
|
|
import androidx.work.WorkRequest;
|
|
import androidx.work.impl.model.WorkSpec;
|
|
import androidx.work.impl.model.WorkSpecDao;
|
|
import androidx.work.impl.model.WorkTagDao;
|
|
import androidx.work.impl.utils.EnqueueRunnable;
|
|
import androidx.work.impl.utils.EnqueueUtilsKt;
|
|
import androidx.work.impl.utils.taskexecutor.SerialExecutor;
|
|
import com.google.common.util.concurrent.ListenableFuture;
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
import java.util.Set;
|
|
import kotlin.Unit;
|
|
import kotlin.collections.CollectionsKt__CollectionsJVMKt;
|
|
import kotlin.collections.CollectionsKt___CollectionsKt;
|
|
import kotlin.jvm.functions.Function0;
|
|
import kotlin.jvm.functions.Function1;
|
|
import kotlin.jvm.internal.Intrinsics;
|
|
import kotlin.jvm.internal.SourceDebugExtension;
|
|
|
|
@SourceDebugExtension({"SMAP\nWorkerUpdater.kt\nKotlin\n*S Kotlin\n*F\n+ 1 WorkerUpdater.kt\nandroidx/work/impl/WorkerUpdater\n+ 2 _Collections.kt\nkotlin/collections/CollectionsKt___CollectionsKt\n*L\n1#1,165:1\n1855#2,2:166\n*S KotlinDebug\n*F\n+ 1 WorkerUpdater.kt\nandroidx/work/impl/WorkerUpdater\n*L\n56#1:166,2\n*E\n"})
|
|
/* loaded from: classes.dex */
|
|
public final class WorkerUpdater {
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public static final WorkManager.UpdateResult updateWorkImpl(Processor processor, final WorkDatabase workDatabase, Configuration configuration, final List<? extends Scheduler> list, final WorkSpec workSpec, final Set<String> set) {
|
|
final String str = workSpec.id;
|
|
final WorkSpec workSpec2 = workDatabase.workSpecDao().getWorkSpec(str);
|
|
if (workSpec2 == null) {
|
|
throw new IllegalArgumentException("Worker with " + str + " doesn't exist");
|
|
}
|
|
if (workSpec2.state.isFinished()) {
|
|
return WorkManager.UpdateResult.NOT_APPLIED;
|
|
}
|
|
if (workSpec2.isPeriodic() ^ workSpec.isPeriodic()) {
|
|
WorkerUpdater$updateWorkImpl$type$1 workerUpdater$updateWorkImpl$type$1 = new Function1() { // from class: androidx.work.impl.WorkerUpdater$updateWorkImpl$type$1
|
|
@Override // kotlin.jvm.functions.Function1
|
|
public final String invoke(WorkSpec spec) {
|
|
Intrinsics.checkNotNullParameter(spec, "spec");
|
|
return spec.isPeriodic() ? "Periodic" : "OneTime";
|
|
}
|
|
};
|
|
throw new UnsupportedOperationException("Can't update " + ((String) workerUpdater$updateWorkImpl$type$1.invoke((Object) workSpec2)) + " Worker to " + ((String) workerUpdater$updateWorkImpl$type$1.invoke((Object) workSpec)) + " Worker. Update operation must preserve worker's type.");
|
|
}
|
|
final boolean isEnqueued = processor.isEnqueued(str);
|
|
if (!isEnqueued) {
|
|
Iterator<T> it = list.iterator();
|
|
while (it.hasNext()) {
|
|
((Scheduler) it.next()).cancel(str);
|
|
}
|
|
}
|
|
workDatabase.runInTransaction(new Runnable() { // from class: androidx.work.impl.WorkerUpdater$$ExternalSyntheticLambda0
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
WorkerUpdater.updateWorkImpl$lambda$2(WorkDatabase.this, workSpec2, workSpec, list, str, set, isEnqueued);
|
|
}
|
|
});
|
|
if (!isEnqueued) {
|
|
Schedulers.schedule(configuration, workDatabase, list);
|
|
}
|
|
return isEnqueued ? WorkManager.UpdateResult.APPLIED_FOR_NEXT_RUN : WorkManager.UpdateResult.APPLIED_IMMEDIATELY;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public static final void updateWorkImpl$lambda$2(WorkDatabase workDatabase, WorkSpec workSpec, WorkSpec workSpec2, List list, String str, Set set, boolean z) {
|
|
WorkSpecDao workSpecDao = workDatabase.workSpecDao();
|
|
WorkTagDao workTagDao = workDatabase.workTagDao();
|
|
WorkSpec copy$default = WorkSpec.copy$default(workSpec2, null, workSpec.state, null, null, null, null, 0L, 0L, 0L, null, workSpec.runAttemptCount, null, 0L, workSpec.lastEnqueueTime, 0L, 0L, false, null, workSpec.getPeriodCount(), workSpec.getGeneration() + 1, workSpec.getNextScheduleTimeOverride(), workSpec.getNextScheduleTimeOverrideGeneration(), 0, null, 12835837, null);
|
|
if (workSpec2.getNextScheduleTimeOverrideGeneration() == 1) {
|
|
copy$default.setNextScheduleTimeOverride(workSpec2.getNextScheduleTimeOverride());
|
|
copy$default.setNextScheduleTimeOverrideGeneration(copy$default.getNextScheduleTimeOverrideGeneration() + 1);
|
|
}
|
|
workSpecDao.updateWorkSpec(EnqueueUtilsKt.wrapWorkSpecIfNeeded(list, copy$default));
|
|
workTagDao.deleteByWorkSpecId(str);
|
|
workTagDao.insertTags(str, set);
|
|
if (z) {
|
|
return;
|
|
}
|
|
workSpecDao.markWorkSpecScheduled(str, -1L);
|
|
workDatabase.workProgressDao().delete(str);
|
|
}
|
|
|
|
public static final ListenableFuture updateWorkImpl(final WorkManagerImpl workManagerImpl, final WorkRequest workRequest) {
|
|
Intrinsics.checkNotNullParameter(workManagerImpl, "<this>");
|
|
Intrinsics.checkNotNullParameter(workRequest, "workRequest");
|
|
SerialExecutor serialTaskExecutor = workManagerImpl.getWorkTaskExecutor().getSerialTaskExecutor();
|
|
Intrinsics.checkNotNullExpressionValue(serialTaskExecutor, "workTaskExecutor.serialTaskExecutor");
|
|
return ListenableFutureKt.executeAsync(serialTaskExecutor, "updateWorkImpl", new Function0() { // from class: androidx.work.impl.WorkerUpdater$updateWorkImpl$3
|
|
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
|
|
{
|
|
super(0);
|
|
}
|
|
|
|
@Override // kotlin.jvm.functions.Function0
|
|
public final WorkManager.UpdateResult invoke() {
|
|
WorkManager.UpdateResult updateWorkImpl;
|
|
Processor processor = WorkManagerImpl.this.getProcessor();
|
|
Intrinsics.checkNotNullExpressionValue(processor, "processor");
|
|
WorkDatabase workDatabase = WorkManagerImpl.this.getWorkDatabase();
|
|
Intrinsics.checkNotNullExpressionValue(workDatabase, "workDatabase");
|
|
Configuration configuration = WorkManagerImpl.this.getConfiguration();
|
|
Intrinsics.checkNotNullExpressionValue(configuration, "configuration");
|
|
List<Scheduler> schedulers = WorkManagerImpl.this.getSchedulers();
|
|
Intrinsics.checkNotNullExpressionValue(schedulers, "schedulers");
|
|
updateWorkImpl = WorkerUpdater.updateWorkImpl(processor, workDatabase, configuration, schedulers, workRequest.getWorkSpec(), workRequest.getTags());
|
|
return updateWorkImpl;
|
|
}
|
|
});
|
|
}
|
|
|
|
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
|
|
public static final Operation enqueueUniquelyNamedPeriodic(final WorkManagerImpl workManagerImpl, final String name, final WorkRequest workRequest) {
|
|
Intrinsics.checkNotNullParameter(workManagerImpl, "<this>");
|
|
Intrinsics.checkNotNullParameter(name, "name");
|
|
Intrinsics.checkNotNullParameter(workRequest, "workRequest");
|
|
Tracer tracer = workManagerImpl.getConfiguration().getTracer();
|
|
String str = "enqueueUniquePeriodic_" + name;
|
|
SerialExecutor serialTaskExecutor = workManagerImpl.getWorkTaskExecutor().getSerialTaskExecutor();
|
|
Intrinsics.checkNotNullExpressionValue(serialTaskExecutor, "workTaskExecutor.serialTaskExecutor");
|
|
return OperationKt.launchOperation(tracer, str, serialTaskExecutor, new Function0() { // from class: androidx.work.impl.WorkerUpdater$enqueueUniquelyNamedPeriodic$1
|
|
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
|
|
{
|
|
super(0);
|
|
}
|
|
|
|
@Override // kotlin.jvm.functions.Function0
|
|
public /* bridge */ /* synthetic */ Object invoke() {
|
|
m187invoke();
|
|
return Unit.INSTANCE;
|
|
}
|
|
|
|
/* renamed from: invoke, reason: collision with other method in class */
|
|
public final void m187invoke() {
|
|
Object firstOrNull;
|
|
final WorkRequest workRequest2 = workRequest;
|
|
final WorkManagerImpl workManagerImpl2 = WorkManagerImpl.this;
|
|
final String str2 = name;
|
|
Function0 function0 = new Function0() { // from class: androidx.work.impl.WorkerUpdater$enqueueUniquelyNamedPeriodic$1$enqueueNew$1
|
|
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
|
|
{
|
|
super(0);
|
|
}
|
|
|
|
@Override // kotlin.jvm.functions.Function0
|
|
public /* bridge */ /* synthetic */ Object invoke() {
|
|
m188invoke();
|
|
return Unit.INSTANCE;
|
|
}
|
|
|
|
/* renamed from: invoke, reason: collision with other method in class */
|
|
public final void m188invoke() {
|
|
EnqueueRunnable.enqueue(new WorkContinuationImpl(workManagerImpl2, str2, ExistingWorkPolicy.KEEP, CollectionsKt__CollectionsJVMKt.listOf(WorkRequest.this)));
|
|
}
|
|
};
|
|
WorkSpecDao workSpecDao = WorkManagerImpl.this.getWorkDatabase().workSpecDao();
|
|
List<WorkSpec.IdAndState> workSpecIdAndStatesForName = workSpecDao.getWorkSpecIdAndStatesForName(name);
|
|
if (workSpecIdAndStatesForName.size() > 1) {
|
|
throw new UnsupportedOperationException("Can't apply UPDATE policy to the chains of work.");
|
|
}
|
|
firstOrNull = CollectionsKt___CollectionsKt.firstOrNull((List) workSpecIdAndStatesForName);
|
|
WorkSpec.IdAndState idAndState = (WorkSpec.IdAndState) firstOrNull;
|
|
if (idAndState == null) {
|
|
function0.invoke();
|
|
return;
|
|
}
|
|
WorkSpec workSpec = workSpecDao.getWorkSpec(idAndState.id);
|
|
if (workSpec == null) {
|
|
throw new IllegalStateException("WorkSpec with " + idAndState.id + ", that matches a name \"" + name + "\", wasn't found");
|
|
}
|
|
if (!workSpec.isPeriodic()) {
|
|
throw new UnsupportedOperationException("Can't update OneTimeWorker to Periodic Worker. Update operation must preserve worker's type.");
|
|
}
|
|
if (idAndState.state == WorkInfo.State.CANCELLED) {
|
|
workSpecDao.delete(idAndState.id);
|
|
function0.invoke();
|
|
return;
|
|
}
|
|
WorkSpec copy$default = WorkSpec.copy$default(workRequest.getWorkSpec(), idAndState.id, null, null, null, null, null, 0L, 0L, 0L, null, 0, null, 0L, 0L, 0L, 0L, false, null, 0, 0, 0L, 0, 0, null, 16777214, null);
|
|
Processor processor = WorkManagerImpl.this.getProcessor();
|
|
Intrinsics.checkNotNullExpressionValue(processor, "processor");
|
|
WorkDatabase workDatabase = WorkManagerImpl.this.getWorkDatabase();
|
|
Intrinsics.checkNotNullExpressionValue(workDatabase, "workDatabase");
|
|
Configuration configuration = WorkManagerImpl.this.getConfiguration();
|
|
Intrinsics.checkNotNullExpressionValue(configuration, "configuration");
|
|
List<Scheduler> schedulers = WorkManagerImpl.this.getSchedulers();
|
|
Intrinsics.checkNotNullExpressionValue(schedulers, "schedulers");
|
|
WorkerUpdater.updateWorkImpl(processor, workDatabase, configuration, schedulers, copy$default, workRequest.getTags());
|
|
}
|
|
});
|
|
}
|
|
}
|