package androidx.lifecycle; import androidx.annotation.MainThread; import c.q.a.k.a; import d0.z.d.m; import kotlin.Unit; import kotlin.coroutines.Continuation; import kotlin.jvm.functions.Function0; import kotlin.jvm.functions.Function2; import kotlinx.coroutines.CoroutineDispatcher; import kotlinx.coroutines.CoroutineScope; import kotlinx.coroutines.Job; import s.a.a.n; import s.a.j0; /* compiled from: CoroutineLiveData.kt */ public final class BlockRunner { private final Function2, Continuation, Object> block; private Job cancellationJob; private final CoroutineLiveData liveData; private final Function0 onDone; private Job runningJob; private final CoroutineScope scope; private final long timeoutInMs; /* JADX DEBUG: Multi-variable search result rejected for r3v0, resolved type: kotlin.jvm.functions.Function2, ? super kotlin.coroutines.Continuation, ? extends java.lang.Object> */ /* JADX WARN: Multi-variable type inference failed */ public BlockRunner(CoroutineLiveData coroutineLiveData, Function2, ? super Continuation, ? extends Object> function2, long j, CoroutineScope coroutineScope, Function0 function0) { m.checkNotNullParameter(coroutineLiveData, "liveData"); m.checkNotNullParameter(function2, "block"); m.checkNotNullParameter(coroutineScope, "scope"); m.checkNotNullParameter(function0, "onDone"); this.liveData = coroutineLiveData; this.block = function2; this.timeoutInMs = j; this.scope = coroutineScope; this.onDone = function0; } public static final /* synthetic */ Function2 access$getBlock$p(BlockRunner blockRunner) { return blockRunner.block; } public static final /* synthetic */ CoroutineLiveData access$getLiveData$p(BlockRunner blockRunner) { return blockRunner.liveData; } public static final /* synthetic */ Function0 access$getOnDone$p(BlockRunner blockRunner) { return blockRunner.onDone; } public static final /* synthetic */ Job access$getRunningJob$p(BlockRunner blockRunner) { return blockRunner.runningJob; } public static final /* synthetic */ long access$getTimeoutInMs$p(BlockRunner blockRunner) { return blockRunner.timeoutInMs; } public static final /* synthetic */ void access$setRunningJob$p(BlockRunner blockRunner, Job job) { blockRunner.runningJob = job; } @MainThread public final void cancel() { if (this.cancellationJob == null) { CoroutineScope coroutineScope = this.scope; CoroutineDispatcher coroutineDispatcher = j0.a; this.cancellationJob = a.G(coroutineScope, n.b.H(), null, new BlockRunner$cancel$1(this, null), 2, null); return; } throw new IllegalStateException("Cancel call cannot happen without a maybeRun".toString()); } @MainThread public final void maybeRun() { Job job = this.cancellationJob; if (job != null) { a.k(job, null, 1, null); } this.cancellationJob = null; if (this.runningJob == null) { this.runningJob = a.G(this.scope, null, null, new BlockRunner$maybeRun$1(this, null), 3, null); } } }