package androidx.work.impl; import android.content.Context; import androidx.work.ForegroundUpdater; import androidx.work.ListenableWorker; import androidx.work.Logger; import androidx.work.impl.model.WorkSpec; import androidx.work.impl.utils.WorkForegroundKt; import androidx.work.impl.utils.taskexecutor.TaskExecutor; import com.google.common.util.concurrent.ListenableFuture; import kotlin.ResultKt; import kotlin.Unit; import kotlin.coroutines.Continuation; import kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsKt; import kotlin.coroutines.jvm.internal.DebugMetadata; import kotlin.coroutines.jvm.internal.SuspendLambda; import kotlin.jvm.functions.Function2; import kotlin.jvm.internal.Intrinsics; import kotlin.jvm.internal.SourceDebugExtension; import kotlinx.coroutines.CoroutineScope; @DebugMetadata(c = "androidx.work.impl.WorkerWrapper$runWorker$result$1", f = "WorkerWrapper.kt", l = {300, 311}, m = "invokeSuspend") @SourceDebugExtension({"SMAP\nWorkerWrapper.kt\nKotlin\n*S Kotlin\n*F\n+ 1 WorkerWrapper.kt\nandroidx/work/impl/WorkerWrapper$runWorker$result$1\n+ 2 LoggerExt.kt\nandroidx/work/LoggerExtKt\n*L\n1#1,607:1\n19#2:608\n*S KotlinDebug\n*F\n+ 1 WorkerWrapper.kt\nandroidx/work/impl/WorkerWrapper$runWorker$result$1\n*L\n307#1:608\n*E\n"}) /* loaded from: classes.dex */ public final class WorkerWrapper$runWorker$result$1 extends SuspendLambda implements Function2 { final /* synthetic */ ForegroundUpdater $foregroundUpdater; final /* synthetic */ ListenableWorker $worker; int label; final /* synthetic */ WorkerWrapper this$0; /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ public WorkerWrapper$runWorker$result$1(WorkerWrapper workerWrapper, ListenableWorker listenableWorker, ForegroundUpdater foregroundUpdater, Continuation continuation) { super(2, continuation); this.this$0 = workerWrapper; this.$worker = listenableWorker; this.$foregroundUpdater = foregroundUpdater; } @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl public final Continuation create(Object obj, Continuation continuation) { return new WorkerWrapper$runWorker$result$1(this.this$0, this.$worker, this.$foregroundUpdater, continuation); } @Override // kotlin.jvm.functions.Function2 public final Object invoke(CoroutineScope coroutineScope, Continuation continuation) { return ((WorkerWrapper$runWorker$result$1) create(coroutineScope, continuation)).invokeSuspend(Unit.INSTANCE); } @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl public final Object invokeSuspend(Object obj) { Object coroutine_suspended; Context context; TaskExecutor taskExecutor; String str; coroutine_suspended = IntrinsicsKt__IntrinsicsKt.getCOROUTINE_SUSPENDED(); int i = this.label; if (i == 0) { ResultKt.throwOnFailure(obj); context = this.this$0.appContext; WorkSpec workSpec = this.this$0.getWorkSpec(); ListenableWorker listenableWorker = this.$worker; ForegroundUpdater foregroundUpdater = this.$foregroundUpdater; taskExecutor = this.this$0.workTaskExecutor; this.label = 1; if (WorkForegroundKt.workForeground(context, workSpec, listenableWorker, foregroundUpdater, taskExecutor, this) == coroutine_suspended) { return coroutine_suspended; } } else { if (i != 1) { if (i == 2) { ResultKt.throwOnFailure(obj); } throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine"); } ResultKt.throwOnFailure(obj); } str = WorkerWrapperKt.TAG; WorkerWrapper workerWrapper = this.this$0; Logger.get().debug(str, "Starting work for " + workerWrapper.getWorkSpec().workerClassName); ListenableFuture startWork = this.$worker.startWork(); Intrinsics.checkNotNullExpressionValue(startWork, "worker.startWork()"); ListenableWorker listenableWorker2 = this.$worker; this.label = 2; obj = WorkerWrapperKt.awaitWithin(startWork, listenableWorker2, this); return obj == coroutine_suspended ? coroutine_suspended : obj; } }