discord-jadx/app/src/main/java/androidx/work/CoroutineWorker.java

138 lines
5.2 KiB
Java
Raw Normal View History

2021-06-27 20:44:35 +00:00
package androidx.work;
import android.content.Context;
import androidx.work.ListenableWorker;
import androidx.work.impl.utils.futures.SettableFuture;
import androidx.work.impl.utils.taskexecutor.TaskExecutor;
2021-12-21 23:37:30 +00:00
import b.i.a.f.e.o.f;
import b.i.b.d.a.a;
2021-11-08 18:25:28 +00:00
import d0.w.h.b;
import d0.w.h.c;
import d0.w.i.a.g;
import d0.z.d.m;
2021-06-27 20:44:35 +00:00
import java.util.concurrent.ExecutionException;
import kotlin.Unit;
import kotlin.coroutines.Continuation;
2021-07-09 21:07:36 +00:00
import kotlinx.coroutines.CoroutineDispatcher;
2021-12-17 22:03:14 +00:00
import s.a.f1;
import s.a.k0;
import s.a.l;
import s.a.u;
2021-06-27 20:44:35 +00:00
/* compiled from: CoroutineWorker.kt */
public abstract class CoroutineWorker extends ListenableWorker {
2021-07-09 21:07:36 +00:00
private final CoroutineDispatcher coroutineContext;
2021-06-27 20:44:35 +00:00
private final SettableFuture<ListenableWorker.Result> future;
2021-12-17 22:03:14 +00:00
private final u job = new f1(null);
2021-06-27 20:44:35 +00:00
/* compiled from: CoroutineWorker.kt */
/* renamed from: androidx.work.CoroutineWorker$1 reason: invalid class name */
public static final class AnonymousClass1 implements Runnable {
public final /* synthetic */ CoroutineWorker this$0;
public AnonymousClass1(CoroutineWorker coroutineWorker) {
this.this$0 = coroutineWorker;
}
@Override // java.lang.Runnable
public final void run() {
if (this.this$0.getFuture$work_runtime_ktx_release().isCancelled()) {
2022-01-27 00:50:41 +00:00
f.t(this.this$0.getJob$work_runtime_ktx_release(), null, 1, null);
2021-06-27 20:44:35 +00:00
}
}
}
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public CoroutineWorker(Context context, WorkerParameters workerParameters) {
super(context, workerParameters);
m.checkParameterIsNotNull(context, "appContext");
m.checkParameterIsNotNull(workerParameters, "params");
SettableFuture<ListenableWorker.Result> create = SettableFuture.create();
m.checkExpressionValueIsNotNull(create, "SettableFuture.create()");
this.future = create;
AnonymousClass1 r4 = new AnonymousClass1(this);
TaskExecutor taskExecutor = getTaskExecutor();
m.checkExpressionValueIsNotNull(taskExecutor, "taskExecutor");
create.addListener(r4, taskExecutor.getBackgroundExecutor());
2021-12-17 22:03:14 +00:00
this.coroutineContext = k0.a;
2021-06-27 20:44:35 +00:00
}
public static /* synthetic */ void coroutineContext$annotations() {
}
public abstract Object doWork(Continuation<? super ListenableWorker.Result> continuation);
2021-07-09 21:07:36 +00:00
public CoroutineDispatcher getCoroutineContext() {
2021-06-27 20:44:35 +00:00
return this.coroutineContext;
}
public final SettableFuture<ListenableWorker.Result> getFuture$work_runtime_ktx_release() {
return this.future;
}
2021-12-17 22:03:14 +00:00
public final u getJob$work_runtime_ktx_release() {
2021-06-27 20:44:35 +00:00
return this.job;
}
@Override // androidx.work.ListenableWorker
public final void onStopped() {
super.onStopped();
this.future.cancel(false);
}
public final Object setForeground(ForegroundInfo foregroundInfo, Continuation<? super Unit> continuation) {
Object obj;
2021-11-08 18:25:28 +00:00
a<Void> foregroundAsync = setForegroundAsync(foregroundInfo);
2021-06-27 20:44:35 +00:00
m.checkExpressionValueIsNotNull(foregroundAsync, "setForegroundAsync(foregroundInfo)");
if (foregroundAsync.isDone()) {
try {
obj = foregroundAsync.get();
} catch (ExecutionException e) {
Throwable cause = e.getCause();
if (cause != null) {
throw cause;
}
throw e;
}
} else {
2021-12-17 22:03:14 +00:00
l lVar = new l(b.intercepted(continuation), 1);
foregroundAsync.addListener(new CoroutineWorker$await$$inlined$suspendCancellableCoroutine$lambda$2(lVar, foregroundAsync), DirectExecutor.INSTANCE);
obj = lVar.u();
2021-06-27 20:44:35 +00:00
if (obj == c.getCOROUTINE_SUSPENDED()) {
g.probeCoroutineSuspended(continuation);
}
}
return obj == c.getCOROUTINE_SUSPENDED() ? obj : Unit.a;
}
public final Object setProgress(Data data, Continuation<? super Unit> continuation) {
Object obj;
2021-11-08 18:25:28 +00:00
a<Void> progressAsync = setProgressAsync(data);
2021-06-27 20:44:35 +00:00
m.checkExpressionValueIsNotNull(progressAsync, "setProgressAsync(data)");
if (progressAsync.isDone()) {
try {
obj = progressAsync.get();
} catch (ExecutionException e) {
Throwable cause = e.getCause();
if (cause != null) {
throw cause;
}
throw e;
}
} else {
2021-12-17 22:03:14 +00:00
l lVar = new l(b.intercepted(continuation), 1);
progressAsync.addListener(new CoroutineWorker$await$$inlined$suspendCancellableCoroutine$lambda$1(lVar, progressAsync), DirectExecutor.INSTANCE);
obj = lVar.u();
2021-06-27 20:44:35 +00:00
if (obj == c.getCOROUTINE_SUSPENDED()) {
g.probeCoroutineSuspended(continuation);
}
}
return obj == c.getCOROUTINE_SUSPENDED() ? obj : Unit.a;
}
@Override // androidx.work.ListenableWorker
2021-11-08 18:25:28 +00:00
public final a<ListenableWorker.Result> startWork() {
2022-01-27 00:50:41 +00:00
f.H0(f.c(getCoroutineContext().plus(this.job)), null, null, new CoroutineWorker$startWork$1(this, null), 3, null);
2021-06-27 20:44:35 +00:00
return this.future;
}
}