Add decompiled APK source code (JADX)

- 28,932 files
- Full Java source code
- Smali files
- Resources

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-02-18 14:52:23 -08:00
parent cc210a65ea
commit f9d20bb3fc
26991 changed files with 2541449 additions and 0 deletions

View File

@@ -0,0 +1,85 @@
package kotlinx.coroutines;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.functions.Function2;
/* loaded from: classes5.dex */
public abstract class AbstractCoroutine extends JobSupport implements Job, Continuation, CoroutineScope {
public final CoroutineContext context;
@Override // kotlin.coroutines.Continuation
public final CoroutineContext getContext() {
return this.context;
}
@Override // kotlinx.coroutines.CoroutineScope
public CoroutineContext getCoroutineContext() {
return this.context;
}
public void onCancelled(Throwable th, boolean z) {
}
public void onCompleted(Object obj) {
}
public AbstractCoroutine(CoroutineContext coroutineContext, boolean z, boolean z2) {
super(z2);
if (z) {
initParentJob((Job) coroutineContext.get(Job.Key));
}
this.context = coroutineContext.plus(this);
}
@Override // kotlinx.coroutines.JobSupport, kotlinx.coroutines.Job
public boolean isActive() {
return super.isActive();
}
@Override // kotlinx.coroutines.JobSupport
public String cancellationExceptionMessage() {
return DebugStringsKt.getClassSimpleName(this) + " was cancelled";
}
@Override // kotlinx.coroutines.JobSupport
public final void onCompletionInternal(Object obj) {
if (obj instanceof CompletedExceptionally) {
CompletedExceptionally completedExceptionally = (CompletedExceptionally) obj;
onCancelled(completedExceptionally.cause, completedExceptionally.getHandled());
} else {
onCompleted(obj);
}
}
@Override // kotlin.coroutines.Continuation
public final void resumeWith(Object obj) {
Object makeCompletingOnce$kotlinx_coroutines_core = makeCompletingOnce$kotlinx_coroutines_core(CompletionStateKt.toState$default(obj, null, 1, null));
if (makeCompletingOnce$kotlinx_coroutines_core == JobSupportKt.COMPLETING_WAITING_CHILDREN) {
return;
}
afterResume(makeCompletingOnce$kotlinx_coroutines_core);
}
public void afterResume(Object obj) {
afterCompletion(obj);
}
@Override // kotlinx.coroutines.JobSupport
public final void handleOnCompletionException$kotlinx_coroutines_core(Throwable th) {
CoroutineExceptionHandlerKt.handleCoroutineException(this.context, th);
}
@Override // kotlinx.coroutines.JobSupport
public String nameString$kotlinx_coroutines_core() {
String coroutineName = CoroutineContextKt.getCoroutineName(this.context);
if (coroutineName == null) {
return super.nameString$kotlinx_coroutines_core();
}
return '\"' + coroutineName + "\":" + super.nameString$kotlinx_coroutines_core();
}
public final void start(CoroutineStart coroutineStart, Object obj, Function2 function2) {
coroutineStart.invoke(function2, obj, this);
}
}

View File

@@ -0,0 +1,5 @@
package kotlinx.coroutines;
/* loaded from: classes5.dex */
public abstract class AbstractTimeSource {
}

View File

@@ -0,0 +1,8 @@
package kotlinx.coroutines;
/* loaded from: classes5.dex */
public abstract class AbstractTimeSourceKt {
public static final AbstractTimeSource getTimeSource() {
return null;
}
}

View File

@@ -0,0 +1,10 @@
package kotlinx.coroutines;
/* loaded from: classes5.dex */
public final class Active implements NotCompleted {
public static final Active INSTANCE = new Active();
public String toString() {
return "Active";
}
}

View File

@@ -0,0 +1,150 @@
package kotlinx.coroutines;
import java.util.ArrayList;
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
import kotlin.Result;
import kotlin.Unit;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsJvmKt;
import kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsKt;
import kotlin.coroutines.jvm.internal.DebugProbesKt;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes5.dex */
public final class AwaitAll {
public static final AtomicIntegerFieldUpdater notCompletedCount$FU = AtomicIntegerFieldUpdater.newUpdater(AwaitAll.class, "notCompletedCount");
public final Deferred[] deferreds;
private volatile int notCompletedCount;
public AwaitAll(Deferred[] deferredArr) {
this.deferreds = deferredArr;
this.notCompletedCount = deferredArr.length;
}
public final class DisposeHandlersOnCancel extends CancelHandler {
public final AwaitAllNode[] nodes;
public DisposeHandlersOnCancel(AwaitAllNode[] awaitAllNodeArr) {
this.nodes = awaitAllNodeArr;
}
@Override // kotlin.jvm.functions.Function1
public /* bridge */ /* synthetic */ Object invoke(Object obj) {
invoke((Throwable) obj);
return Unit.INSTANCE;
}
@Override // kotlinx.coroutines.CancelHandlerBase
public void invoke(Throwable th) {
disposeAll();
}
public String toString() {
return "DisposeHandlersOnCancel[" + this.nodes + ']';
}
public final void disposeAll() {
for (AwaitAllNode awaitAllNode : this.nodes) {
awaitAllNode.getHandle().dispose();
}
}
}
public final class AwaitAllNode extends JobNode {
public static final AtomicReferenceFieldUpdater _disposer$FU = AtomicReferenceFieldUpdater.newUpdater(AwaitAllNode.class, Object.class, "_disposer");
private volatile Object _disposer;
public final CancellableContinuation continuation;
public DisposableHandle handle;
public final void setHandle(DisposableHandle disposableHandle) {
this.handle = disposableHandle;
}
public AwaitAllNode(CancellableContinuation cancellableContinuation) {
this.continuation = cancellableContinuation;
}
@Override // kotlin.jvm.functions.Function1
public /* bridge */ /* synthetic */ Object invoke(Object obj) {
invoke((Throwable) obj);
return Unit.INSTANCE;
}
public final DisposableHandle getHandle() {
DisposableHandle disposableHandle = this.handle;
if (disposableHandle != null) {
return disposableHandle;
}
Intrinsics.throwUninitializedPropertyAccessException("handle");
return null;
}
public final DisposeHandlersOnCancel getDisposer() {
return (DisposeHandlersOnCancel) _disposer$FU.get(this);
}
public final void setDisposer(DisposeHandlersOnCancel disposeHandlersOnCancel) {
_disposer$FU.set(this, disposeHandlersOnCancel);
}
@Override // kotlinx.coroutines.CompletionHandlerBase
public void invoke(Throwable th) {
if (th != null) {
Object tryResumeWithException = this.continuation.tryResumeWithException(th);
if (tryResumeWithException != null) {
this.continuation.completeResume(tryResumeWithException);
DisposeHandlersOnCancel disposer = getDisposer();
if (disposer != null) {
disposer.disposeAll();
return;
}
return;
}
return;
}
if (AwaitAll.notCompletedCount$FU.decrementAndGet(AwaitAll.this) == 0) {
CancellableContinuation cancellableContinuation = this.continuation;
Deferred[] deferredArr = AwaitAll.this.deferreds;
ArrayList arrayList = new ArrayList(deferredArr.length);
for (Deferred deferred : deferredArr) {
arrayList.add(deferred.getCompleted());
}
cancellableContinuation.resumeWith(Result.m4060constructorimpl(arrayList));
}
}
}
public final Object await(Continuation continuation) {
Continuation intercepted;
Object coroutine_suspended;
intercepted = IntrinsicsKt__IntrinsicsJvmKt.intercepted(continuation);
CancellableContinuationImpl cancellableContinuationImpl = new CancellableContinuationImpl(intercepted, 1);
cancellableContinuationImpl.initCancellability();
int length = this.deferreds.length;
AwaitAllNode[] awaitAllNodeArr = new AwaitAllNode[length];
for (int i = 0; i < length; i++) {
Deferred deferred = this.deferreds[i];
deferred.start();
AwaitAllNode awaitAllNode = new AwaitAllNode(cancellableContinuationImpl);
awaitAllNode.setHandle(deferred.invokeOnCompletion(awaitAllNode));
Unit unit = Unit.INSTANCE;
awaitAllNodeArr[i] = awaitAllNode;
}
DisposeHandlersOnCancel disposeHandlersOnCancel = new DisposeHandlersOnCancel(awaitAllNodeArr);
for (int i2 = 0; i2 < length; i2++) {
awaitAllNodeArr[i2].setDisposer(disposeHandlersOnCancel);
}
if (cancellableContinuationImpl.isCompleted()) {
disposeHandlersOnCancel.disposeAll();
} else {
cancellableContinuationImpl.invokeOnCancellation(disposeHandlersOnCancel);
}
Object result = cancellableContinuationImpl.getResult();
coroutine_suspended = IntrinsicsKt__IntrinsicsKt.getCOROUTINE_SUSPENDED();
if (result == coroutine_suspended) {
DebugProbesKt.probeCoroutineSuspended(continuation);
}
return result;
}
}

View File

@@ -0,0 +1,11 @@
package kotlinx.coroutines;
import kotlin.collections.CollectionsKt__CollectionsKt;
import kotlin.coroutines.Continuation;
/* loaded from: classes5.dex */
public abstract class AwaitKt {
public static final Object awaitAll(Deferred[] deferredArr, Continuation continuation) {
return deferredArr.length == 0 ? CollectionsKt__CollectionsKt.emptyList() : new AwaitAll(deferredArr).await(continuation);
}
}

View File

@@ -0,0 +1,76 @@
package kotlinx.coroutines;
import java.util.concurrent.locks.LockSupport;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes5.dex */
public final class BlockingCoroutine extends AbstractCoroutine {
public final Thread blockedThread;
public final EventLoop eventLoop;
@Override // kotlinx.coroutines.JobSupport
public boolean isScopedCoroutine() {
return true;
}
public BlockingCoroutine(CoroutineContext coroutineContext, Thread thread, EventLoop eventLoop) {
super(coroutineContext, true, true);
this.blockedThread = thread;
this.eventLoop = eventLoop;
}
@Override // kotlinx.coroutines.JobSupport
public void afterCompletion(Object obj) {
if (Intrinsics.areEqual(Thread.currentThread(), this.blockedThread)) {
return;
}
Thread thread = this.blockedThread;
AbstractTimeSourceKt.getTimeSource();
LockSupport.unpark(thread);
}
public final Object joinBlocking() {
AbstractTimeSourceKt.getTimeSource();
try {
EventLoop eventLoop = this.eventLoop;
if (eventLoop != null) {
EventLoop.incrementUseCount$default(eventLoop, false, 1, null);
}
while (!Thread.interrupted()) {
try {
EventLoop eventLoop2 = this.eventLoop;
long processNextEvent = eventLoop2 != null ? eventLoop2.processNextEvent() : Long.MAX_VALUE;
if (!isCompleted()) {
AbstractTimeSourceKt.getTimeSource();
LockSupport.parkNanos(this, processNextEvent);
} else {
EventLoop eventLoop3 = this.eventLoop;
if (eventLoop3 != null) {
EventLoop.decrementUseCount$default(eventLoop3, false, 1, null);
}
AbstractTimeSourceKt.getTimeSource();
Object unboxState = JobSupportKt.unboxState(getState$kotlinx_coroutines_core());
CompletedExceptionally completedExceptionally = unboxState instanceof CompletedExceptionally ? (CompletedExceptionally) unboxState : null;
if (completedExceptionally == null) {
return unboxState;
}
throw completedExceptionally.cause;
}
} catch (Throwable th) {
EventLoop eventLoop4 = this.eventLoop;
if (eventLoop4 != null) {
EventLoop.decrementUseCount$default(eventLoop4, false, 1, null);
}
throw th;
}
}
InterruptedException interruptedException = new InterruptedException();
cancelCoroutine(interruptedException);
throw interruptedException;
} catch (Throwable th2) {
AbstractTimeSourceKt.getTimeSource();
throw th2;
}
}
}

View File

@@ -0,0 +1,15 @@
package kotlinx.coroutines;
/* loaded from: classes5.dex */
public final class BlockingEventLoop extends EventLoopImplBase {
public final Thread thread;
@Override // kotlinx.coroutines.EventLoopImplPlatform
public Thread getThread() {
return this.thread;
}
public BlockingEventLoop(Thread thread) {
this.thread = thread;
}
}

View File

@@ -0,0 +1,24 @@
package kotlinx.coroutines;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.functions.Function2;
/* loaded from: classes5.dex */
public abstract class BuildersKt {
public static final Deferred async(CoroutineScope coroutineScope, CoroutineContext coroutineContext, CoroutineStart coroutineStart, Function2 function2) {
return BuildersKt__Builders_commonKt.async(coroutineScope, coroutineContext, coroutineStart, function2);
}
public static final Job launch(CoroutineScope coroutineScope, CoroutineContext coroutineContext, CoroutineStart coroutineStart, Function2 function2) {
return BuildersKt__Builders_commonKt.launch(coroutineScope, coroutineContext, coroutineStart, function2);
}
public static final Object runBlocking(CoroutineContext coroutineContext, Function2 function2) {
return BuildersKt__BuildersKt.runBlocking(coroutineContext, function2);
}
public static final Object withContext(CoroutineContext coroutineContext, Function2 function2, Continuation continuation) {
return BuildersKt__Builders_commonKt.withContext(coroutineContext, function2, continuation);
}
}

View File

@@ -0,0 +1,41 @@
package kotlinx.coroutines;
import kotlin.coroutines.ContinuationInterceptor;
import kotlin.coroutines.CoroutineContext;
import kotlin.coroutines.EmptyCoroutineContext;
import kotlin.jvm.functions.Function2;
/* loaded from: classes5.dex */
public abstract /* synthetic */ class BuildersKt__BuildersKt {
public static /* synthetic */ Object runBlocking$default(CoroutineContext coroutineContext, Function2 function2, int i, Object obj) {
if ((i & 1) != 0) {
coroutineContext = EmptyCoroutineContext.INSTANCE;
}
return BuildersKt.runBlocking(coroutineContext, function2);
}
public static final Object runBlocking(CoroutineContext coroutineContext, Function2 function2) {
EventLoop currentOrNull$kotlinx_coroutines_core;
CoroutineContext newCoroutineContext;
Thread currentThread = Thread.currentThread();
ContinuationInterceptor continuationInterceptor = (ContinuationInterceptor) coroutineContext.get(ContinuationInterceptor.Key);
if (continuationInterceptor == null) {
currentOrNull$kotlinx_coroutines_core = ThreadLocalEventLoop.INSTANCE.getEventLoop$kotlinx_coroutines_core();
newCoroutineContext = CoroutineContextKt.newCoroutineContext(GlobalScope.INSTANCE, coroutineContext.plus(currentOrNull$kotlinx_coroutines_core));
} else {
EventLoop eventLoop = continuationInterceptor instanceof EventLoop ? (EventLoop) continuationInterceptor : null;
if (eventLoop != null) {
EventLoop eventLoop2 = eventLoop.shouldBeProcessedFromContext() ? eventLoop : null;
if (eventLoop2 != null) {
currentOrNull$kotlinx_coroutines_core = eventLoop2;
newCoroutineContext = CoroutineContextKt.newCoroutineContext(GlobalScope.INSTANCE, coroutineContext);
}
}
currentOrNull$kotlinx_coroutines_core = ThreadLocalEventLoop.INSTANCE.currentOrNull$kotlinx_coroutines_core();
newCoroutineContext = CoroutineContextKt.newCoroutineContext(GlobalScope.INSTANCE, coroutineContext);
}
BlockingCoroutine blockingCoroutine = new BlockingCoroutine(newCoroutineContext, currentThread, currentOrNull$kotlinx_coroutines_core);
blockingCoroutine.start(CoroutineStart.DEFAULT, blockingCoroutine, function2);
return blockingCoroutine.joinBlocking();
}
}

View File

@@ -0,0 +1,97 @@
package kotlinx.coroutines;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.ContinuationInterceptor;
import kotlin.coroutines.CoroutineContext;
import kotlin.coroutines.EmptyCoroutineContext;
import kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsKt;
import kotlin.coroutines.jvm.internal.DebugProbesKt;
import kotlin.jvm.functions.Function2;
import kotlin.jvm.internal.Intrinsics;
import kotlinx.coroutines.internal.ScopeCoroutine;
import kotlinx.coroutines.internal.ThreadContextKt;
import kotlinx.coroutines.intrinsics.CancellableKt;
import kotlinx.coroutines.intrinsics.UndispatchedKt;
/* loaded from: classes5.dex */
public abstract /* synthetic */ class BuildersKt__Builders_commonKt {
public static /* synthetic */ Job launch$default(CoroutineScope coroutineScope, CoroutineContext coroutineContext, CoroutineStart coroutineStart, Function2 function2, int i, Object obj) {
if ((i & 1) != 0) {
coroutineContext = EmptyCoroutineContext.INSTANCE;
}
if ((i & 2) != 0) {
coroutineStart = CoroutineStart.DEFAULT;
}
return BuildersKt.launch(coroutineScope, coroutineContext, coroutineStart, function2);
}
public static final Job launch(CoroutineScope coroutineScope, CoroutineContext coroutineContext, CoroutineStart coroutineStart, Function2 function2) {
StandaloneCoroutine standaloneCoroutine;
CoroutineContext newCoroutineContext = CoroutineContextKt.newCoroutineContext(coroutineScope, coroutineContext);
if (coroutineStart.isLazy()) {
standaloneCoroutine = new LazyStandaloneCoroutine(newCoroutineContext, function2);
} else {
standaloneCoroutine = new StandaloneCoroutine(newCoroutineContext, true);
}
standaloneCoroutine.start(coroutineStart, standaloneCoroutine, function2);
return standaloneCoroutine;
}
public static /* synthetic */ Deferred async$default(CoroutineScope coroutineScope, CoroutineContext coroutineContext, CoroutineStart coroutineStart, Function2 function2, int i, Object obj) {
if ((i & 1) != 0) {
coroutineContext = EmptyCoroutineContext.INSTANCE;
}
if ((i & 2) != 0) {
coroutineStart = CoroutineStart.DEFAULT;
}
return BuildersKt.async(coroutineScope, coroutineContext, coroutineStart, function2);
}
public static final Deferred async(CoroutineScope coroutineScope, CoroutineContext coroutineContext, CoroutineStart coroutineStart, Function2 function2) {
DeferredCoroutine deferredCoroutine;
CoroutineContext newCoroutineContext = CoroutineContextKt.newCoroutineContext(coroutineScope, coroutineContext);
if (coroutineStart.isLazy()) {
deferredCoroutine = new LazyDeferredCoroutine(newCoroutineContext, function2);
} else {
deferredCoroutine = new DeferredCoroutine(newCoroutineContext, true);
}
deferredCoroutine.start(coroutineStart, deferredCoroutine, function2);
return deferredCoroutine;
}
public static final Object withContext(CoroutineContext coroutineContext, Function2 function2, Continuation continuation) {
Object result$kotlinx_coroutines_core;
Object coroutine_suspended;
CoroutineContext context = continuation.getContext();
CoroutineContext newCoroutineContext = CoroutineContextKt.newCoroutineContext(context, coroutineContext);
JobKt.ensureActive(newCoroutineContext);
if (newCoroutineContext == context) {
ScopeCoroutine scopeCoroutine = new ScopeCoroutine(newCoroutineContext, continuation);
result$kotlinx_coroutines_core = UndispatchedKt.startUndispatchedOrReturn(scopeCoroutine, scopeCoroutine, function2);
} else {
ContinuationInterceptor.Key key = ContinuationInterceptor.Key;
if (Intrinsics.areEqual(newCoroutineContext.get(key), context.get(key))) {
UndispatchedCoroutine undispatchedCoroutine = new UndispatchedCoroutine(newCoroutineContext, continuation);
CoroutineContext context2 = undispatchedCoroutine.getContext();
Object updateThreadContext = ThreadContextKt.updateThreadContext(context2, null);
try {
Object startUndispatchedOrReturn = UndispatchedKt.startUndispatchedOrReturn(undispatchedCoroutine, undispatchedCoroutine, function2);
ThreadContextKt.restoreThreadContext(context2, updateThreadContext);
result$kotlinx_coroutines_core = startUndispatchedOrReturn;
} catch (Throwable th) {
ThreadContextKt.restoreThreadContext(context2, updateThreadContext);
throw th;
}
} else {
DispatchedCoroutine dispatchedCoroutine = new DispatchedCoroutine(newCoroutineContext, continuation);
CancellableKt.startCoroutineCancellable$default(function2, dispatchedCoroutine, dispatchedCoroutine, null, 4, null);
result$kotlinx_coroutines_core = dispatchedCoroutine.getResult$kotlinx_coroutines_core();
}
}
coroutine_suspended = IntrinsicsKt__IntrinsicsKt.getCOROUTINE_SUSPENDED();
if (result$kotlinx_coroutines_core == coroutine_suspended) {
DebugProbesKt.probeCoroutineSuspended(continuation);
}
return result$kotlinx_coroutines_core;
}
}

View File

@@ -0,0 +1,30 @@
package kotlinx.coroutines;
import java.util.concurrent.Future;
import kotlin.Unit;
/* loaded from: classes5.dex */
public final class CancelFutureOnCancel extends CancelHandler {
public final Future future;
public CancelFutureOnCancel(Future future) {
this.future = future;
}
@Override // kotlin.jvm.functions.Function1
public /* bridge */ /* synthetic */ Object invoke(Object obj) {
invoke((Throwable) obj);
return Unit.INSTANCE;
}
@Override // kotlinx.coroutines.CancelHandlerBase
public void invoke(Throwable th) {
if (th != null) {
this.future.cancel(false);
}
}
public String toString() {
return "CancelFutureOnCancel[" + this.future + ']';
}
}

View File

@@ -0,0 +1,5 @@
package kotlinx.coroutines;
/* loaded from: classes5.dex */
public abstract class CancelHandler extends CancelHandlerBase implements NotCompleted {
}

View File

@@ -0,0 +1,8 @@
package kotlinx.coroutines;
import kotlin.jvm.functions.Function1;
/* loaded from: classes5.dex */
public abstract class CancelHandlerBase implements Function1 {
public abstract void invoke(Throwable th);
}

View File

@@ -0,0 +1,37 @@
package kotlinx.coroutines;
import kotlin.coroutines.Continuation;
import kotlin.jvm.functions.Function1;
/* loaded from: classes5.dex */
public interface CancellableContinuation extends Continuation {
boolean cancel(Throwable th);
void completeResume(Object obj);
void invokeOnCancellation(Function1 function1);
boolean isActive();
boolean isCompleted();
void resume(Object obj, Function1 function1);
void resumeUndispatched(CoroutineDispatcher coroutineDispatcher, Object obj);
Object tryResume(Object obj, Object obj2, Function1 function1);
Object tryResumeWithException(Throwable th);
public static final class DefaultImpls {
public static /* synthetic */ boolean cancel$default(CancellableContinuation cancellableContinuation, Throwable th, int i, Object obj) {
if (obj != null) {
throw new UnsupportedOperationException("Super calls with default arguments not supported in this target, function: cancel");
}
if ((i & 1) != 0) {
th = null;
}
return cancellableContinuation.cancel(th);
}
}
}

View File

@@ -0,0 +1,531 @@
package kotlinx.coroutines;
import androidx.concurrent.futures.AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0;
import com.facebook.internal.AnalyticsEvents;
import com.google.android.gms.drive.DriveFile;
import java.util.concurrent.CancellationException;
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
import kotlin.KotlinNothingValueException;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.CoroutineContext;
import kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsKt;
import kotlin.coroutines.jvm.internal.CoroutineStackFrame;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.Intrinsics;
import kotlinx.coroutines.Job;
import kotlinx.coroutines.internal.DispatchedContinuation;
import kotlinx.coroutines.internal.Segment;
import kotlinx.coroutines.internal.Symbol;
/* loaded from: classes5.dex */
public class CancellableContinuationImpl extends DispatchedTask implements CancellableContinuation, CoroutineStackFrame, Waiter {
private volatile int _decisionAndIndex;
private volatile Object _parentHandle;
private volatile Object _state;
public final CoroutineContext context;
public final Continuation delegate;
public static final AtomicIntegerFieldUpdater _decisionAndIndex$FU = AtomicIntegerFieldUpdater.newUpdater(CancellableContinuationImpl.class, "_decisionAndIndex");
public static final AtomicReferenceFieldUpdater _state$FU = AtomicReferenceFieldUpdater.newUpdater(CancellableContinuationImpl.class, Object.class, "_state");
public static final AtomicReferenceFieldUpdater _parentHandle$FU = AtomicReferenceFieldUpdater.newUpdater(CancellableContinuationImpl.class, Object.class, "_parentHandle");
@Override // kotlin.coroutines.Continuation
public CoroutineContext getContext() {
return this.context;
}
@Override // kotlinx.coroutines.DispatchedTask
public final Continuation getDelegate$kotlinx_coroutines_core() {
return this.delegate;
}
public String nameString() {
return "CancellableContinuation";
}
public CancellableContinuationImpl(Continuation continuation, int i) {
super(i);
this.delegate = continuation;
this.context = continuation.getContext();
this._decisionAndIndex = 536870911;
this._state = Active.INSTANCE;
}
public final DisposableHandle getParentHandle() {
return (DisposableHandle) _parentHandle$FU.get(this);
}
public final Object getState$kotlinx_coroutines_core() {
return _state$FU.get(this);
}
@Override // kotlinx.coroutines.CancellableContinuation
public boolean isActive() {
return getState$kotlinx_coroutines_core() instanceof NotCompleted;
}
@Override // kotlinx.coroutines.CancellableContinuation
public boolean isCompleted() {
return !(getState$kotlinx_coroutines_core() instanceof NotCompleted);
}
public final String getStateDebugRepresentation() {
Object state$kotlinx_coroutines_core = getState$kotlinx_coroutines_core();
return state$kotlinx_coroutines_core instanceof NotCompleted ? "Active" : state$kotlinx_coroutines_core instanceof CancelledContinuation ? AnalyticsEvents.PARAMETER_DIALOG_OUTCOME_VALUE_CANCELLED : AnalyticsEvents.PARAMETER_DIALOG_OUTCOME_VALUE_COMPLETED;
}
public void initCancellability() {
DisposableHandle installParentHandle = installParentHandle();
if (installParentHandle != null && isCompleted()) {
installParentHandle.dispose();
_parentHandle$FU.set(this, NonDisposableHandle.INSTANCE);
}
}
public final boolean isReusable() {
if (DispatchedTaskKt.isReusableMode(this.resumeMode)) {
Continuation continuation = this.delegate;
Intrinsics.checkNotNull(continuation, "null cannot be cast to non-null type kotlinx.coroutines.internal.DispatchedContinuation<*>");
if (((DispatchedContinuation) continuation).isReusable$kotlinx_coroutines_core()) {
return true;
}
}
return false;
}
public final boolean resetStateReusable() {
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater = _state$FU;
Object obj = atomicReferenceFieldUpdater.get(this);
if (!(obj instanceof CompletedContinuation) || ((CompletedContinuation) obj).idempotentResume == null) {
_decisionAndIndex$FU.set(this, 536870911);
atomicReferenceFieldUpdater.set(this, Active.INSTANCE);
return true;
}
detachChild$kotlinx_coroutines_core();
return false;
}
@Override // kotlin.coroutines.jvm.internal.CoroutineStackFrame
public CoroutineStackFrame getCallerFrame() {
Continuation continuation = this.delegate;
if (continuation instanceof CoroutineStackFrame) {
return (CoroutineStackFrame) continuation;
}
return null;
}
@Override // kotlinx.coroutines.DispatchedTask
public Object takeState$kotlinx_coroutines_core() {
return getState$kotlinx_coroutines_core();
}
@Override // kotlinx.coroutines.DispatchedTask
public void cancelCompletedResult$kotlinx_coroutines_core(Object obj, Throwable th) {
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater = _state$FU;
while (true) {
Object obj2 = atomicReferenceFieldUpdater.get(this);
if (obj2 instanceof NotCompleted) {
throw new IllegalStateException("Not completed".toString());
}
if (obj2 instanceof CompletedExceptionally) {
return;
}
if (obj2 instanceof CompletedContinuation) {
CompletedContinuation completedContinuation = (CompletedContinuation) obj2;
if (!(!completedContinuation.getCancelled())) {
throw new IllegalStateException("Must be called at most once".toString());
}
if (AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0.m(_state$FU, this, obj2, CompletedContinuation.copy$default(completedContinuation, null, null, null, null, th, 15, null))) {
completedContinuation.invokeHandlers(this, th);
return;
}
} else if (AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0.m(_state$FU, this, obj2, new CompletedContinuation(obj2, null, null, null, th, 14, null))) {
return;
}
}
}
public final boolean cancelLater(Throwable th) {
if (!isReusable()) {
return false;
}
Continuation continuation = this.delegate;
Intrinsics.checkNotNull(continuation, "null cannot be cast to non-null type kotlinx.coroutines.internal.DispatchedContinuation<*>");
return ((DispatchedContinuation) continuation).postponeCancellation$kotlinx_coroutines_core(th);
}
@Override // kotlinx.coroutines.CancellableContinuation
public boolean cancel(Throwable th) {
Object obj;
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater = _state$FU;
do {
obj = atomicReferenceFieldUpdater.get(this);
if (!(obj instanceof NotCompleted)) {
return false;
}
} while (!AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0.m(_state$FU, this, obj, new CancelledContinuation(this, th, (obj instanceof CancelHandler) || (obj instanceof Segment))));
NotCompleted notCompleted = (NotCompleted) obj;
if (notCompleted instanceof CancelHandler) {
callCancelHandler((CancelHandler) obj, th);
} else if (notCompleted instanceof Segment) {
callSegmentOnCancellation((Segment) obj, th);
}
detachChildIfNonResuable();
dispatchResume(this.resumeMode);
return true;
}
public final void parentCancelled$kotlinx_coroutines_core(Throwable th) {
if (cancelLater(th)) {
return;
}
cancel(th);
detachChildIfNonResuable();
}
public final void callCancelHandler(CancelHandler cancelHandler, Throwable th) {
try {
cancelHandler.invoke(th);
} catch (Throwable th2) {
CoroutineExceptionHandlerKt.handleCoroutineException(getContext(), new CompletionHandlerException("Exception in invokeOnCancellation handler for " + this, th2));
}
}
public final void callSegmentOnCancellation(Segment segment, Throwable th) {
int i = _decisionAndIndex$FU.get(this) & 536870911;
if (i == 536870911) {
throw new IllegalStateException("The index for Segment.onCancellation(..) is broken".toString());
}
try {
segment.onCancellation(i, th, getContext());
} catch (Throwable th2) {
CoroutineExceptionHandlerKt.handleCoroutineException(getContext(), new CompletionHandlerException("Exception in invokeOnCancellation handler for " + this, th2));
}
}
public final void callOnCancellation(Function1 function1, Throwable th) {
try {
function1.invoke(th);
} catch (Throwable th2) {
CoroutineExceptionHandlerKt.handleCoroutineException(getContext(), new CompletionHandlerException("Exception in resume onCancellation handler for " + this, th2));
}
}
public Throwable getContinuationCancellationCause(Job job) {
return job.getCancellationException();
}
public final boolean trySuspend() {
int i;
AtomicIntegerFieldUpdater atomicIntegerFieldUpdater = _decisionAndIndex$FU;
do {
i = atomicIntegerFieldUpdater.get(this);
int i2 = i >> 29;
if (i2 != 0) {
if (i2 == 2) {
return false;
}
throw new IllegalStateException("Already suspended".toString());
}
} while (!_decisionAndIndex$FU.compareAndSet(this, i, DriveFile.MODE_WRITE_ONLY + (536870911 & i)));
return true;
}
public final boolean tryResume() {
int i;
AtomicIntegerFieldUpdater atomicIntegerFieldUpdater = _decisionAndIndex$FU;
do {
i = atomicIntegerFieldUpdater.get(this);
int i2 = i >> 29;
if (i2 != 0) {
if (i2 == 1) {
return false;
}
throw new IllegalStateException("Already resumed".toString());
}
} while (!_decisionAndIndex$FU.compareAndSet(this, i, 1073741824 + (536870911 & i)));
return true;
}
public final Object getResult() {
Job job;
Object coroutine_suspended;
boolean isReusable = isReusable();
if (trySuspend()) {
if (getParentHandle() == null) {
installParentHandle();
}
if (isReusable) {
releaseClaimedReusableContinuation$kotlinx_coroutines_core();
}
coroutine_suspended = IntrinsicsKt__IntrinsicsKt.getCOROUTINE_SUSPENDED();
return coroutine_suspended;
}
if (isReusable) {
releaseClaimedReusableContinuation$kotlinx_coroutines_core();
}
Object state$kotlinx_coroutines_core = getState$kotlinx_coroutines_core();
if (state$kotlinx_coroutines_core instanceof CompletedExceptionally) {
throw ((CompletedExceptionally) state$kotlinx_coroutines_core).cause;
}
if (DispatchedTaskKt.isCancellableMode(this.resumeMode) && (job = (Job) getContext().get(Job.Key)) != null && !job.isActive()) {
CancellationException cancellationException = job.getCancellationException();
cancelCompletedResult$kotlinx_coroutines_core(state$kotlinx_coroutines_core, cancellationException);
throw cancellationException;
}
return getSuccessfulResult$kotlinx_coroutines_core(state$kotlinx_coroutines_core);
}
public final DisposableHandle installParentHandle() {
Job job = (Job) getContext().get(Job.Key);
if (job == null) {
return null;
}
DisposableHandle invokeOnCompletion$default = Job.DefaultImpls.invokeOnCompletion$default(job, true, false, new ChildContinuation(this), 2, null);
AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0.m(_parentHandle$FU, this, null, invokeOnCompletion$default);
return invokeOnCompletion$default;
}
public final void releaseClaimedReusableContinuation$kotlinx_coroutines_core() {
Throwable tryReleaseClaimedContinuation$kotlinx_coroutines_core;
Continuation continuation = this.delegate;
DispatchedContinuation dispatchedContinuation = continuation instanceof DispatchedContinuation ? (DispatchedContinuation) continuation : null;
if (dispatchedContinuation == null || (tryReleaseClaimedContinuation$kotlinx_coroutines_core = dispatchedContinuation.tryReleaseClaimedContinuation$kotlinx_coroutines_core(this)) == null) {
return;
}
detachChild$kotlinx_coroutines_core();
cancel(tryReleaseClaimedContinuation$kotlinx_coroutines_core);
}
@Override // kotlin.coroutines.Continuation
public void resumeWith(Object obj) {
resumeImpl$default(this, CompletionStateKt.toState(obj, this), this.resumeMode, null, 4, null);
}
@Override // kotlinx.coroutines.CancellableContinuation
public void resume(Object obj, Function1 function1) {
resumeImpl(obj, this.resumeMode, function1);
}
@Override // kotlinx.coroutines.Waiter
public void invokeOnCancellation(Segment segment, int i) {
int i2;
AtomicIntegerFieldUpdater atomicIntegerFieldUpdater = _decisionAndIndex$FU;
do {
i2 = atomicIntegerFieldUpdater.get(this);
if ((i2 & 536870911) != 536870911) {
throw new IllegalStateException("invokeOnCancellation should be called at most once".toString());
}
} while (!atomicIntegerFieldUpdater.compareAndSet(this, i2, ((i2 >> 29) << 29) + i));
invokeOnCancellationImpl(segment);
}
@Override // kotlinx.coroutines.CancellableContinuation
public void invokeOnCancellation(Function1 function1) {
invokeOnCancellationImpl(makeCancelHandler(function1));
}
public final void invokeOnCancellationImpl(Object obj) {
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater = _state$FU;
while (true) {
Object obj2 = atomicReferenceFieldUpdater.get(this);
if (obj2 instanceof Active) {
if (AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0.m(_state$FU, this, obj2, obj)) {
return;
}
} else if ((obj2 instanceof CancelHandler) || (obj2 instanceof Segment)) {
multipleHandlersError(obj, obj2);
} else {
boolean z = obj2 instanceof CompletedExceptionally;
if (z) {
CompletedExceptionally completedExceptionally = (CompletedExceptionally) obj2;
if (!completedExceptionally.makeHandled()) {
multipleHandlersError(obj, obj2);
}
if (obj2 instanceof CancelledContinuation) {
if (!z) {
completedExceptionally = null;
}
Throwable th = completedExceptionally != null ? completedExceptionally.cause : null;
if (obj instanceof CancelHandler) {
callCancelHandler((CancelHandler) obj, th);
return;
} else {
Intrinsics.checkNotNull(obj, "null cannot be cast to non-null type kotlinx.coroutines.internal.Segment<*>");
callSegmentOnCancellation((Segment) obj, th);
return;
}
}
return;
}
if (obj2 instanceof CompletedContinuation) {
CompletedContinuation completedContinuation = (CompletedContinuation) obj2;
if (completedContinuation.cancelHandler != null) {
multipleHandlersError(obj, obj2);
}
if (obj instanceof Segment) {
return;
}
Intrinsics.checkNotNull(obj, "null cannot be cast to non-null type kotlinx.coroutines.CancelHandler");
CancelHandler cancelHandler = (CancelHandler) obj;
if (completedContinuation.getCancelled()) {
callCancelHandler(cancelHandler, completedContinuation.cancelCause);
return;
} else {
if (AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0.m(_state$FU, this, obj2, CompletedContinuation.copy$default(completedContinuation, null, cancelHandler, null, null, null, 29, null))) {
return;
}
}
} else {
if (obj instanceof Segment) {
return;
}
Intrinsics.checkNotNull(obj, "null cannot be cast to non-null type kotlinx.coroutines.CancelHandler");
if (AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0.m(_state$FU, this, obj2, new CompletedContinuation(obj2, (CancelHandler) obj, null, null, null, 28, null))) {
return;
}
}
}
}
}
public final void multipleHandlersError(Object obj, Object obj2) {
throw new IllegalStateException(("It's prohibited to register multiple handlers, tried to register " + obj + ", already has " + obj2).toString());
}
public final CancelHandler makeCancelHandler(Function1 function1) {
return function1 instanceof CancelHandler ? (CancelHandler) function1 : new InvokeOnCancel(function1);
}
public final void dispatchResume(int i) {
if (tryResume()) {
return;
}
DispatchedTaskKt.dispatch(this, i);
}
public final Object resumedState(NotCompleted notCompleted, Object obj, int i, Function1 function1, Object obj2) {
if (obj instanceof CompletedExceptionally) {
return obj;
}
if (!DispatchedTaskKt.isCancellableMode(i) && obj2 == null) {
return obj;
}
if (function1 == null && !(notCompleted instanceof CancelHandler) && obj2 == null) {
return obj;
}
return new CompletedContinuation(obj, notCompleted instanceof CancelHandler ? (CancelHandler) notCompleted : null, function1, obj2, null, 16, null);
}
public static /* synthetic */ void resumeImpl$default(CancellableContinuationImpl cancellableContinuationImpl, Object obj, int i, Function1 function1, int i2, Object obj2) {
if (obj2 != null) {
throw new UnsupportedOperationException("Super calls with default arguments not supported in this target, function: resumeImpl");
}
if ((i2 & 4) != 0) {
function1 = null;
}
cancellableContinuationImpl.resumeImpl(obj, i, function1);
}
public final void resumeImpl(Object obj, int i, Function1 function1) {
Object obj2;
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater = _state$FU;
do {
obj2 = atomicReferenceFieldUpdater.get(this);
if (obj2 instanceof NotCompleted) {
} else {
if (obj2 instanceof CancelledContinuation) {
CancelledContinuation cancelledContinuation = (CancelledContinuation) obj2;
if (cancelledContinuation.makeResumed()) {
if (function1 != null) {
callOnCancellation(function1, cancelledContinuation.cause);
return;
}
return;
}
}
alreadyResumedError(obj);
throw new KotlinNothingValueException();
}
} while (!AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0.m(_state$FU, this, obj2, resumedState((NotCompleted) obj2, obj, i, function1, null)));
detachChildIfNonResuable();
dispatchResume(i);
}
public final Symbol tryResumeImpl(Object obj, Object obj2, Function1 function1) {
Object obj3;
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater = _state$FU;
do {
obj3 = atomicReferenceFieldUpdater.get(this);
if (obj3 instanceof NotCompleted) {
} else {
if ((obj3 instanceof CompletedContinuation) && obj2 != null && ((CompletedContinuation) obj3).idempotentResume == obj2) {
return CancellableContinuationImplKt.RESUME_TOKEN;
}
return null;
}
} while (!AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0.m(_state$FU, this, obj3, resumedState((NotCompleted) obj3, obj, this.resumeMode, function1, obj2)));
detachChildIfNonResuable();
return CancellableContinuationImplKt.RESUME_TOKEN;
}
public final Void alreadyResumedError(Object obj) {
throw new IllegalStateException(("Already resumed, but proposed with update " + obj).toString());
}
public final void detachChildIfNonResuable() {
if (isReusable()) {
return;
}
detachChild$kotlinx_coroutines_core();
}
public final void detachChild$kotlinx_coroutines_core() {
DisposableHandle parentHandle = getParentHandle();
if (parentHandle == null) {
return;
}
parentHandle.dispose();
_parentHandle$FU.set(this, NonDisposableHandle.INSTANCE);
}
@Override // kotlinx.coroutines.CancellableContinuation
public Object tryResume(Object obj, Object obj2, Function1 function1) {
return tryResumeImpl(obj, obj2, function1);
}
@Override // kotlinx.coroutines.CancellableContinuation
public Object tryResumeWithException(Throwable th) {
return tryResumeImpl(new CompletedExceptionally(th, false, 2, null), null, null);
}
@Override // kotlinx.coroutines.CancellableContinuation
public void completeResume(Object obj) {
dispatchResume(this.resumeMode);
}
@Override // kotlinx.coroutines.CancellableContinuation
public void resumeUndispatched(CoroutineDispatcher coroutineDispatcher, Object obj) {
Continuation continuation = this.delegate;
DispatchedContinuation dispatchedContinuation = continuation instanceof DispatchedContinuation ? (DispatchedContinuation) continuation : null;
resumeImpl$default(this, obj, (dispatchedContinuation != null ? dispatchedContinuation.dispatcher : null) == coroutineDispatcher ? 4 : this.resumeMode, null, 4, null);
}
@Override // kotlinx.coroutines.DispatchedTask
public Object getSuccessfulResult$kotlinx_coroutines_core(Object obj) {
return obj instanceof CompletedContinuation ? ((CompletedContinuation) obj).result : obj;
}
@Override // kotlinx.coroutines.DispatchedTask
public Throwable getExceptionalResult$kotlinx_coroutines_core(Object obj) {
Throwable exceptionalResult$kotlinx_coroutines_core = super.getExceptionalResult$kotlinx_coroutines_core(obj);
if (exceptionalResult$kotlinx_coroutines_core != null) {
return exceptionalResult$kotlinx_coroutines_core;
}
return null;
}
public String toString() {
return nameString() + '(' + DebugStringsKt.toDebugString(this.delegate) + "){" + getStateDebugRepresentation() + "}@" + DebugStringsKt.getHexAddress(this);
}
}

View File

@@ -0,0 +1,8 @@
package kotlinx.coroutines;
import kotlinx.coroutines.internal.Symbol;
/* loaded from: classes5.dex */
public abstract class CancellableContinuationImplKt {
public static final Symbol RESUME_TOKEN = new Symbol("RESUME_TOKEN");
}

View File

@@ -0,0 +1,27 @@
package kotlinx.coroutines;
import kotlin.coroutines.Continuation;
import kotlinx.coroutines.internal.DispatchedContinuation;
/* loaded from: classes5.dex */
public abstract class CancellableContinuationKt {
public static final CancellableContinuationImpl getOrCreateCancellableContinuation(Continuation continuation) {
if (!(continuation instanceof DispatchedContinuation)) {
return new CancellableContinuationImpl(continuation, 1);
}
CancellableContinuationImpl claimReusableCancellableContinuation$kotlinx_coroutines_core = ((DispatchedContinuation) continuation).claimReusableCancellableContinuation$kotlinx_coroutines_core();
if (claimReusableCancellableContinuation$kotlinx_coroutines_core != null) {
if (!claimReusableCancellableContinuation$kotlinx_coroutines_core.resetStateReusable()) {
claimReusableCancellableContinuation$kotlinx_coroutines_core = null;
}
if (claimReusableCancellableContinuation$kotlinx_coroutines_core != null) {
return claimReusableCancellableContinuation$kotlinx_coroutines_core;
}
}
return new CancellableContinuationImpl(continuation, 2);
}
public static final void disposeOnCancellation(CancellableContinuation cancellableContinuation, DisposableHandle disposableHandle) {
cancellableContinuation.invokeOnCancellation(new DisposeOnCancel(disposableHandle));
}
}

View File

@@ -0,0 +1,41 @@
package kotlinx.coroutines;
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
/* loaded from: classes5.dex */
public final class CancelledContinuation extends CompletedExceptionally {
public static final AtomicIntegerFieldUpdater _resumed$FU = AtomicIntegerFieldUpdater.newUpdater(CancelledContinuation.class, "_resumed");
private volatile int _resumed;
/* JADX WARN: Illegal instructions before constructor call */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public CancelledContinuation(kotlin.coroutines.Continuation r3, java.lang.Throwable r4, boolean r5) {
/*
r2 = this;
if (r4 != 0) goto L1d
java.util.concurrent.CancellationException r4 = new java.util.concurrent.CancellationException
java.lang.StringBuilder r0 = new java.lang.StringBuilder
r0.<init>()
java.lang.String r1 = "Continuation "
r0.append(r1)
r0.append(r3)
java.lang.String r3 = " was cancelled normally"
r0.append(r3)
java.lang.String r3 = r0.toString()
r4.<init>(r3)
L1d:
r2.<init>(r4, r5)
r3 = 0
r2._resumed = r3
return
*/
throw new UnsupportedOperationException("Method not decompiled: kotlinx.coroutines.CancelledContinuation.<init>(kotlin.coroutines.Continuation, java.lang.Throwable, boolean):void");
}
public final boolean makeResumed() {
return _resumed$FU.compareAndSet(this, 0, 1);
}
}

View File

@@ -0,0 +1,24 @@
package kotlinx.coroutines;
import kotlin.Unit;
/* loaded from: classes5.dex */
public final class ChildContinuation extends JobCancellingNode {
public final CancellableContinuationImpl child;
@Override // kotlin.jvm.functions.Function1
public /* bridge */ /* synthetic */ Object invoke(Object obj) {
invoke((Throwable) obj);
return Unit.INSTANCE;
}
public ChildContinuation(CancellableContinuationImpl cancellableContinuationImpl) {
this.child = cancellableContinuationImpl;
}
@Override // kotlinx.coroutines.CompletionHandlerBase
public void invoke(Throwable th) {
CancellableContinuationImpl cancellableContinuationImpl = this.child;
cancellableContinuationImpl.parentCancelled$kotlinx_coroutines_core(cancellableContinuationImpl.getContinuationCancellationCause(getJob()));
}
}

View File

@@ -0,0 +1,8 @@
package kotlinx.coroutines;
/* loaded from: classes5.dex */
public interface ChildHandle extends DisposableHandle {
boolean childCancelled(Throwable th);
Job getParent();
}

View File

@@ -0,0 +1,33 @@
package kotlinx.coroutines;
import kotlin.Unit;
/* loaded from: classes5.dex */
public final class ChildHandleNode extends JobCancellingNode implements ChildHandle {
public final ChildJob childJob;
@Override // kotlin.jvm.functions.Function1
public /* bridge */ /* synthetic */ Object invoke(Object obj) {
invoke((Throwable) obj);
return Unit.INSTANCE;
}
public ChildHandleNode(ChildJob childJob) {
this.childJob = childJob;
}
@Override // kotlinx.coroutines.ChildHandle
public Job getParent() {
return getJob();
}
@Override // kotlinx.coroutines.CompletionHandlerBase
public void invoke(Throwable th) {
this.childJob.parentCancelled(getJob());
}
@Override // kotlinx.coroutines.ChildHandle
public boolean childCancelled(Throwable th) {
return getJob().childCancelled(th);
}
}

View File

@@ -0,0 +1,6 @@
package kotlinx.coroutines;
/* loaded from: classes5.dex */
public interface ChildJob extends Job {
void parentCancelled(ParentJob parentJob);
}

View File

@@ -0,0 +1,8 @@
package kotlinx.coroutines;
/* loaded from: classes5.dex */
public interface CompletableDeferred extends Deferred {
boolean complete(Object obj);
boolean completeExceptionally(Throwable th);
}

View File

@@ -0,0 +1,39 @@
package kotlinx.coroutines;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsKt;
/* loaded from: classes5.dex */
public final class CompletableDeferredImpl extends JobSupport implements CompletableDeferred {
@Override // kotlinx.coroutines.JobSupport
public boolean getOnCancelComplete$kotlinx_coroutines_core() {
return true;
}
public CompletableDeferredImpl(Job job) {
super(true);
initParentJob(job);
}
@Override // kotlinx.coroutines.Deferred
public Object getCompleted() {
return getCompletedInternal$kotlinx_coroutines_core();
}
@Override // kotlinx.coroutines.Deferred
public Object await(Continuation continuation) {
Object awaitInternal = awaitInternal(continuation);
IntrinsicsKt__IntrinsicsKt.getCOROUTINE_SUSPENDED();
return awaitInternal;
}
@Override // kotlinx.coroutines.CompletableDeferred
public boolean complete(Object obj) {
return makeCompleting$kotlinx_coroutines_core(obj);
}
@Override // kotlinx.coroutines.CompletableDeferred
public boolean completeExceptionally(Throwable th) {
return makeCompleting$kotlinx_coroutines_core(new CompletedExceptionally(th, false, 2, null));
}
}

View File

@@ -0,0 +1,22 @@
package kotlinx.coroutines;
import kotlin.Result;
/* loaded from: classes5.dex */
public abstract class CompletableDeferredKt {
public static final boolean completeWith(CompletableDeferred completableDeferred, Object obj) {
Throwable m4062exceptionOrNullimpl = Result.m4062exceptionOrNullimpl(obj);
return m4062exceptionOrNullimpl == null ? completableDeferred.complete(obj) : completableDeferred.completeExceptionally(m4062exceptionOrNullimpl);
}
public static final CompletableDeferred CompletableDeferred(Job job) {
return new CompletableDeferredImpl(job);
}
public static /* synthetic */ CompletableDeferred CompletableDeferred$default(Job job, int i, Object obj) {
if ((i & 1) != 0) {
job = null;
}
return CompletableDeferred(job);
}
}

View File

@@ -0,0 +1,5 @@
package kotlinx.coroutines;
/* loaded from: classes5.dex */
public interface CompletableJob extends Job {
}

View File

@@ -0,0 +1,95 @@
package kotlinx.coroutines;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes5.dex */
public final class CompletedContinuation {
public final Throwable cancelCause;
public final CancelHandler cancelHandler;
public final Object idempotentResume;
public final Function1 onCancellation;
public final Object result;
public static /* synthetic */ CompletedContinuation copy$default(CompletedContinuation completedContinuation, Object obj, CancelHandler cancelHandler, Function1 function1, Object obj2, Throwable th, int i, Object obj3) {
if ((i & 1) != 0) {
obj = completedContinuation.result;
}
if ((i & 2) != 0) {
cancelHandler = completedContinuation.cancelHandler;
}
CancelHandler cancelHandler2 = cancelHandler;
if ((i & 4) != 0) {
function1 = completedContinuation.onCancellation;
}
Function1 function12 = function1;
if ((i & 8) != 0) {
obj2 = completedContinuation.idempotentResume;
}
Object obj4 = obj2;
if ((i & 16) != 0) {
th = completedContinuation.cancelCause;
}
return completedContinuation.copy(obj, cancelHandler2, function12, obj4, th);
}
public final CompletedContinuation copy(Object obj, CancelHandler cancelHandler, Function1 function1, Object obj2, Throwable th) {
return new CompletedContinuation(obj, cancelHandler, function1, obj2, th);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof CompletedContinuation)) {
return false;
}
CompletedContinuation completedContinuation = (CompletedContinuation) obj;
return Intrinsics.areEqual(this.result, completedContinuation.result) && Intrinsics.areEqual(this.cancelHandler, completedContinuation.cancelHandler) && Intrinsics.areEqual(this.onCancellation, completedContinuation.onCancellation) && Intrinsics.areEqual(this.idempotentResume, completedContinuation.idempotentResume) && Intrinsics.areEqual(this.cancelCause, completedContinuation.cancelCause);
}
public final boolean getCancelled() {
return this.cancelCause != null;
}
public int hashCode() {
Object obj = this.result;
int hashCode = (obj == null ? 0 : obj.hashCode()) * 31;
CancelHandler cancelHandler = this.cancelHandler;
int hashCode2 = (hashCode + (cancelHandler == null ? 0 : cancelHandler.hashCode())) * 31;
Function1 function1 = this.onCancellation;
int hashCode3 = (hashCode2 + (function1 == null ? 0 : function1.hashCode())) * 31;
Object obj2 = this.idempotentResume;
int hashCode4 = (hashCode3 + (obj2 == null ? 0 : obj2.hashCode())) * 31;
Throwable th = this.cancelCause;
return hashCode4 + (th != null ? th.hashCode() : 0);
}
public String toString() {
return "CompletedContinuation(result=" + this.result + ", cancelHandler=" + this.cancelHandler + ", onCancellation=" + this.onCancellation + ", idempotentResume=" + this.idempotentResume + ", cancelCause=" + this.cancelCause + ')';
}
public CompletedContinuation(Object obj, CancelHandler cancelHandler, Function1 function1, Object obj2, Throwable th) {
this.result = obj;
this.cancelHandler = cancelHandler;
this.onCancellation = function1;
this.idempotentResume = obj2;
this.cancelCause = th;
}
public /* synthetic */ CompletedContinuation(Object obj, CancelHandler cancelHandler, Function1 function1, Object obj2, Throwable th, int i, DefaultConstructorMarker defaultConstructorMarker) {
this(obj, (i & 2) != 0 ? null : cancelHandler, (i & 4) != 0 ? null : function1, (i & 8) != 0 ? null : obj2, (i & 16) != 0 ? null : th);
}
public final void invokeHandlers(CancellableContinuationImpl cancellableContinuationImpl, Throwable th) {
CancelHandler cancelHandler = this.cancelHandler;
if (cancelHandler != null) {
cancellableContinuationImpl.callCancelHandler(cancelHandler, th);
}
Function1 function1 = this.onCancellation;
if (function1 != null) {
cancellableContinuationImpl.callOnCancellation(function1, th);
}
}
}

View File

@@ -0,0 +1,32 @@
package kotlinx.coroutines;
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
import kotlin.jvm.internal.DefaultConstructorMarker;
/* loaded from: classes5.dex */
public class CompletedExceptionally {
public static final AtomicIntegerFieldUpdater _handled$FU = AtomicIntegerFieldUpdater.newUpdater(CompletedExceptionally.class, "_handled");
private volatile int _handled;
public final Throwable cause;
public CompletedExceptionally(Throwable th, boolean z) {
this.cause = th;
this._handled = z ? 1 : 0;
}
public /* synthetic */ CompletedExceptionally(Throwable th, boolean z, int i, DefaultConstructorMarker defaultConstructorMarker) {
this(th, (i & 2) != 0 ? false : z);
}
public final boolean getHandled() {
return _handled$FU.get(this) != 0;
}
public final boolean makeHandled() {
return _handled$FU.compareAndSet(this, 0, 1);
}
public String toString() {
return DebugStringsKt.getClassSimpleName(this) + '[' + this.cause + ']';
}
}

View File

@@ -0,0 +1,35 @@
package kotlinx.coroutines;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes5.dex */
public final class CompletedWithCancellation {
public final Function1 onCancellation;
public final Object result;
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof CompletedWithCancellation)) {
return false;
}
CompletedWithCancellation completedWithCancellation = (CompletedWithCancellation) obj;
return Intrinsics.areEqual(this.result, completedWithCancellation.result) && Intrinsics.areEqual(this.onCancellation, completedWithCancellation.onCancellation);
}
public int hashCode() {
Object obj = this.result;
return ((obj == null ? 0 : obj.hashCode()) * 31) + this.onCancellation.hashCode();
}
public String toString() {
return "CompletedWithCancellation(result=" + this.result + ", onCancellation=" + this.onCancellation + ')';
}
public CompletedWithCancellation(Object obj, Function1 function1) {
this.result = obj;
this.onCancellation = function1;
}
}

View File

@@ -0,0 +1,9 @@
package kotlinx.coroutines;
import kotlin.jvm.functions.Function1;
import kotlinx.coroutines.internal.LockFreeLinkedListNode;
/* loaded from: classes5.dex */
public abstract class CompletionHandlerBase extends LockFreeLinkedListNode implements Function1 {
public abstract void invoke(Throwable th);
}

View File

@@ -0,0 +1,8 @@
package kotlinx.coroutines;
/* loaded from: classes5.dex */
public final class CompletionHandlerException extends RuntimeException {
public CompletionHandlerException(String str, Throwable th) {
super(str, th);
}
}

View File

@@ -0,0 +1,37 @@
package kotlinx.coroutines;
import kotlin.Result;
import kotlin.ResultKt;
import kotlin.coroutines.Continuation;
import kotlin.jvm.functions.Function1;
/* loaded from: classes5.dex */
public abstract class CompletionStateKt {
public static /* synthetic */ Object toState$default(Object obj, Function1 function1, int i, Object obj2) {
if ((i & 1) != 0) {
function1 = null;
}
return toState(obj, function1);
}
public static final Object toState(Object obj, Function1 function1) {
Throwable m4062exceptionOrNullimpl = Result.m4062exceptionOrNullimpl(obj);
if (m4062exceptionOrNullimpl == null) {
return function1 != null ? new CompletedWithCancellation(obj, function1) : obj;
}
return new CompletedExceptionally(m4062exceptionOrNullimpl, false, 2, null);
}
public static final Object toState(Object obj, CancellableContinuation cancellableContinuation) {
Throwable m4062exceptionOrNullimpl = Result.m4062exceptionOrNullimpl(obj);
return m4062exceptionOrNullimpl == null ? obj : new CompletedExceptionally(m4062exceptionOrNullimpl, false, 2, null);
}
public static final Object recoverResult(Object obj, Continuation continuation) {
if (obj instanceof CompletedExceptionally) {
Result.Companion companion = Result.Companion;
return Result.m4060constructorimpl(ResultKt.createFailure(((CompletedExceptionally) obj).cause));
}
return Result.m4060constructorimpl(obj);
}
}

View File

@@ -0,0 +1,91 @@
package kotlinx.coroutines;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.ContinuationInterceptor;
import kotlin.coroutines.CoroutineContext;
import kotlin.coroutines.EmptyCoroutineContext;
import kotlin.coroutines.jvm.internal.CoroutineStackFrame;
import kotlin.jvm.functions.Function2;
import kotlin.jvm.internal.Ref;
/* loaded from: classes5.dex */
public abstract class CoroutineContextKt {
public static final String getCoroutineName(CoroutineContext coroutineContext) {
return null;
}
public static final CoroutineContext newCoroutineContext(CoroutineScope coroutineScope, CoroutineContext coroutineContext) {
CoroutineContext foldCopies = foldCopies(coroutineScope.getCoroutineContext(), coroutineContext, true);
return (foldCopies == Dispatchers.getDefault() || foldCopies.get(ContinuationInterceptor.Key) != null) ? foldCopies : foldCopies.plus(Dispatchers.getDefault());
}
public static final CoroutineContext newCoroutineContext(CoroutineContext coroutineContext, CoroutineContext coroutineContext2) {
return !hasCopyableElements(coroutineContext2) ? coroutineContext.plus(coroutineContext2) : foldCopies(coroutineContext, coroutineContext2, false);
}
public static final boolean hasCopyableElements(CoroutineContext coroutineContext) {
return ((Boolean) coroutineContext.fold(Boolean.FALSE, new Function2() { // from class: kotlinx.coroutines.CoroutineContextKt$hasCopyableElements$1
public final Boolean invoke(boolean z, CoroutineContext.Element element) {
return Boolean.valueOf(z);
}
@Override // kotlin.jvm.functions.Function2
public /* bridge */ /* synthetic */ Object invoke(Object obj, Object obj2) {
return invoke(((Boolean) obj).booleanValue(), (CoroutineContext.Element) obj2);
}
})).booleanValue();
}
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARN: Type inference failed for: r4v4, types: [T, java.lang.Object] */
public static final CoroutineContext foldCopies(CoroutineContext coroutineContext, CoroutineContext coroutineContext2, final boolean z) {
boolean hasCopyableElements = hasCopyableElements(coroutineContext);
boolean hasCopyableElements2 = hasCopyableElements(coroutineContext2);
if (!hasCopyableElements && !hasCopyableElements2) {
return coroutineContext.plus(coroutineContext2);
}
final Ref.ObjectRef objectRef = new Ref.ObjectRef();
objectRef.element = coroutineContext2;
EmptyCoroutineContext emptyCoroutineContext = EmptyCoroutineContext.INSTANCE;
CoroutineContext coroutineContext3 = (CoroutineContext) coroutineContext.fold(emptyCoroutineContext, new Function2() { // from class: kotlinx.coroutines.CoroutineContextKt$foldCopies$folded$1
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
{
super(2);
}
@Override // kotlin.jvm.functions.Function2
public final CoroutineContext invoke(CoroutineContext coroutineContext4, CoroutineContext.Element element) {
return coroutineContext4.plus(element);
}
});
if (hasCopyableElements2) {
objectRef.element = ((CoroutineContext) objectRef.element).fold(emptyCoroutineContext, new Function2() { // from class: kotlinx.coroutines.CoroutineContextKt$foldCopies$1
@Override // kotlin.jvm.functions.Function2
public final CoroutineContext invoke(CoroutineContext coroutineContext4, CoroutineContext.Element element) {
return coroutineContext4.plus(element);
}
});
}
return coroutineContext3.plus((CoroutineContext) objectRef.element);
}
public static final UndispatchedCoroutine updateUndispatchedCompletion(Continuation continuation, CoroutineContext coroutineContext, Object obj) {
if (!(continuation instanceof CoroutineStackFrame) || coroutineContext.get(UndispatchedMarker.INSTANCE) == null) {
return null;
}
UndispatchedCoroutine undispatchedCompletion = undispatchedCompletion((CoroutineStackFrame) continuation);
if (undispatchedCompletion != null) {
undispatchedCompletion.saveThreadContext(coroutineContext, obj);
}
return undispatchedCompletion;
}
public static final UndispatchedCoroutine undispatchedCompletion(CoroutineStackFrame coroutineStackFrame) {
while (!(coroutineStackFrame instanceof DispatchedCoroutine) && (coroutineStackFrame = coroutineStackFrame.getCallerFrame()) != null) {
if (coroutineStackFrame instanceof UndispatchedCoroutine) {
return (UndispatchedCoroutine) coroutineStackFrame;
}
}
return null;
}
}

View File

@@ -0,0 +1,85 @@
package kotlinx.coroutines;
import kotlin.coroutines.AbstractCoroutineContextElement;
import kotlin.coroutines.AbstractCoroutineContextKey;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.ContinuationInterceptor;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlinx.coroutines.internal.DispatchedContinuation;
import kotlinx.coroutines.internal.LimitedDispatcher;
import kotlinx.coroutines.internal.LimitedDispatcherKt;
/* loaded from: classes5.dex */
public abstract class CoroutineDispatcher extends AbstractCoroutineContextElement implements ContinuationInterceptor {
public static final Key Key = new Key(null);
/* renamed from: dispatch */
public abstract void mo4148dispatch(CoroutineContext coroutineContext, Runnable runnable);
public boolean isDispatchNeeded(CoroutineContext coroutineContext) {
return true;
}
public final CoroutineDispatcher plus(CoroutineDispatcher coroutineDispatcher) {
return coroutineDispatcher;
}
@Override // kotlin.coroutines.AbstractCoroutineContextElement, kotlin.coroutines.CoroutineContext.Element, kotlin.coroutines.CoroutineContext
public <E extends CoroutineContext.Element> E get(CoroutineContext.Key key) {
return (E) ContinuationInterceptor.DefaultImpls.get(this, key);
}
@Override // kotlin.coroutines.AbstractCoroutineContextElement, kotlin.coroutines.CoroutineContext
public CoroutineContext minusKey(CoroutineContext.Key key) {
return ContinuationInterceptor.DefaultImpls.minusKey(this, key);
}
public CoroutineDispatcher() {
super(ContinuationInterceptor.Key);
}
public static final class Key extends AbstractCoroutineContextKey {
public /* synthetic */ Key(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
public Key() {
super(ContinuationInterceptor.Key, new Function1() { // from class: kotlinx.coroutines.CoroutineDispatcher.Key.1
@Override // kotlin.jvm.functions.Function1
public final CoroutineDispatcher invoke(CoroutineContext.Element element) {
if (element instanceof CoroutineDispatcher) {
return (CoroutineDispatcher) element;
}
return null;
}
});
}
}
public CoroutineDispatcher limitedParallelism(int i) {
LimitedDispatcherKt.checkParallelism(i);
return new LimitedDispatcher(this, i);
}
public void dispatchYield(CoroutineContext coroutineContext, Runnable runnable) {
mo4148dispatch(coroutineContext, runnable);
}
@Override // kotlin.coroutines.ContinuationInterceptor
public final <T> Continuation interceptContinuation(Continuation continuation) {
return new DispatchedContinuation(this, continuation);
}
@Override // kotlin.coroutines.ContinuationInterceptor
public final void releaseInterceptedContinuation(Continuation continuation) {
Intrinsics.checkNotNull(continuation, "null cannot be cast to non-null type kotlinx.coroutines.internal.DispatchedContinuation<*>");
((DispatchedContinuation) continuation).release$kotlinx_coroutines_core();
}
public String toString() {
return DebugStringsKt.getClassSimpleName(this) + '@' + DebugStringsKt.getHexAddress(this);
}
}

View File

@@ -0,0 +1,33 @@
package kotlinx.coroutines;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.functions.Function2;
/* loaded from: classes5.dex */
public interface CoroutineExceptionHandler extends CoroutineContext.Element {
public static final Key Key = Key.$$INSTANCE;
public static final class Key implements CoroutineContext.Key {
public static final /* synthetic */ Key $$INSTANCE = new Key();
}
void handleException(CoroutineContext coroutineContext, Throwable th);
public static final class DefaultImpls {
public static Object fold(CoroutineExceptionHandler coroutineExceptionHandler, Object obj, Function2 function2) {
return CoroutineContext.Element.DefaultImpls.fold(coroutineExceptionHandler, obj, function2);
}
public static CoroutineContext.Element get(CoroutineExceptionHandler coroutineExceptionHandler, CoroutineContext.Key key) {
return CoroutineContext.Element.DefaultImpls.get(coroutineExceptionHandler, key);
}
public static CoroutineContext minusKey(CoroutineExceptionHandler coroutineExceptionHandler, CoroutineContext.Key key) {
return CoroutineContext.Element.DefaultImpls.minusKey(coroutineExceptionHandler, key);
}
public static CoroutineContext plus(CoroutineExceptionHandler coroutineExceptionHandler, CoroutineContext coroutineContext) {
return CoroutineContext.Element.DefaultImpls.plus(coroutineExceptionHandler, coroutineContext);
}
}
}

View File

@@ -0,0 +1,30 @@
package kotlinx.coroutines;
import kotlin.ExceptionsKt__ExceptionsKt;
import kotlin.coroutines.CoroutineContext;
import kotlinx.coroutines.internal.CoroutineExceptionHandlerImpl_commonKt;
/* loaded from: classes5.dex */
public abstract class CoroutineExceptionHandlerKt {
public static final void handleCoroutineException(CoroutineContext coroutineContext, Throwable th) {
try {
CoroutineExceptionHandler coroutineExceptionHandler = (CoroutineExceptionHandler) coroutineContext.get(CoroutineExceptionHandler.Key);
if (coroutineExceptionHandler != null) {
coroutineExceptionHandler.handleException(coroutineContext, th);
} else {
CoroutineExceptionHandlerImpl_commonKt.handleUncaughtCoroutineException(coroutineContext, th);
}
} catch (Throwable th2) {
CoroutineExceptionHandlerImpl_commonKt.handleUncaughtCoroutineException(coroutineContext, handlerException(th, th2));
}
}
public static final Throwable handlerException(Throwable th, Throwable th2) {
if (th == th2) {
return th;
}
RuntimeException runtimeException = new RuntimeException("Exception while trying to handle coroutine exception", th2);
ExceptionsKt__ExceptionsKt.addSuppressed(runtimeException, th);
return runtimeException;
}
}

View File

@@ -0,0 +1,45 @@
package kotlinx.coroutines;
import kotlin.coroutines.AbstractCoroutineContextElement;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes5.dex */
public final class CoroutineName extends AbstractCoroutineContextElement {
public static final Key Key = new Key(null);
public final String name;
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
return (obj instanceof CoroutineName) && Intrinsics.areEqual(this.name, ((CoroutineName) obj).name);
}
public final String getName() {
return this.name;
}
public int hashCode() {
return this.name.hashCode();
}
public CoroutineName(String str) {
super(Key);
this.name = str;
}
public static final class Key implements CoroutineContext.Key {
public /* synthetic */ Key(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
public Key() {
}
}
public String toString() {
return "CoroutineName(" + this.name + ')';
}
}

View File

@@ -0,0 +1,8 @@
package kotlinx.coroutines;
import kotlin.coroutines.CoroutineContext;
/* loaded from: classes5.dex */
public interface CoroutineScope {
CoroutineContext getCoroutineContext();
}

View File

@@ -0,0 +1,69 @@
package kotlinx.coroutines;
import java.util.concurrent.CancellationException;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.CoroutineContext;
import kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsKt;
import kotlin.coroutines.jvm.internal.DebugProbesKt;
import kotlin.jvm.functions.Function2;
import kotlinx.coroutines.internal.ContextScope;
import kotlinx.coroutines.internal.ScopeCoroutine;
import kotlinx.coroutines.intrinsics.UndispatchedKt;
/* loaded from: classes5.dex */
public abstract class CoroutineScopeKt {
public static final CoroutineScope plus(CoroutineScope coroutineScope, CoroutineContext coroutineContext) {
return new ContextScope(coroutineScope.getCoroutineContext().plus(coroutineContext));
}
public static final CoroutineScope MainScope() {
return new ContextScope(SupervisorKt.SupervisorJob$default(null, 1, null).plus(Dispatchers.getMain()));
}
public static final boolean isActive(CoroutineScope coroutineScope) {
Job job = (Job) coroutineScope.getCoroutineContext().get(Job.Key);
if (job != null) {
return job.isActive();
}
return true;
}
public static final Object coroutineScope(Function2 function2, Continuation continuation) {
Object coroutine_suspended;
ScopeCoroutine scopeCoroutine = new ScopeCoroutine(continuation.getContext(), continuation);
Object startUndispatchedOrReturn = UndispatchedKt.startUndispatchedOrReturn(scopeCoroutine, scopeCoroutine, function2);
coroutine_suspended = IntrinsicsKt__IntrinsicsKt.getCOROUTINE_SUSPENDED();
if (startUndispatchedOrReturn == coroutine_suspended) {
DebugProbesKt.probeCoroutineSuspended(continuation);
}
return startUndispatchedOrReturn;
}
public static final CoroutineScope CoroutineScope(CoroutineContext coroutineContext) {
CompletableJob Job$default;
if (coroutineContext.get(Job.Key) == null) {
Job$default = JobKt__JobKt.Job$default(null, 1, null);
coroutineContext = coroutineContext.plus(Job$default);
}
return new ContextScope(coroutineContext);
}
public static /* synthetic */ void cancel$default(CoroutineScope coroutineScope, CancellationException cancellationException, int i, Object obj) {
if ((i & 1) != 0) {
cancellationException = null;
}
cancel(coroutineScope, cancellationException);
}
public static final void cancel(CoroutineScope coroutineScope, CancellationException cancellationException) {
Job job = (Job) coroutineScope.getCoroutineContext().get(Job.Key);
if (job == null) {
throw new IllegalStateException(("Scope cannot be cancelled because it does not have a job: " + coroutineScope).toString());
}
job.cancel(cancellationException);
}
public static final void ensureActive(CoroutineScope coroutineScope) {
JobKt.ensureActive(coroutineScope.getCoroutineContext());
}
}

View File

@@ -0,0 +1,79 @@
package kotlinx.coroutines;
import kotlin.NoWhenBranchMatchedException;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.ContinuationKt;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.functions.Function2;
import kotlinx.coroutines.intrinsics.CancellableKt;
import kotlinx.coroutines.intrinsics.UndispatchedKt;
/* loaded from: classes5.dex */
public enum CoroutineStart {
DEFAULT,
LAZY,
ATOMIC,
UNDISPATCHED;
public /* synthetic */ class WhenMappings {
public static final /* synthetic */ int[] $EnumSwitchMapping$0;
static {
int[] iArr = new int[CoroutineStart.values().length];
try {
iArr[CoroutineStart.DEFAULT.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
iArr[CoroutineStart.ATOMIC.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
iArr[CoroutineStart.UNDISPATCHED.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
try {
iArr[CoroutineStart.LAZY.ordinal()] = 4;
} catch (NoSuchFieldError unused4) {
}
$EnumSwitchMapping$0 = iArr;
}
}
public static /* synthetic */ void isLazy$annotations() {
}
public final boolean isLazy() {
return this == LAZY;
}
public final <T> void invoke(Function1 function1, Continuation continuation) {
int i = WhenMappings.$EnumSwitchMapping$0[ordinal()];
if (i == 1) {
CancellableKt.startCoroutineCancellable(function1, continuation);
return;
}
if (i == 2) {
ContinuationKt.startCoroutine(function1, continuation);
} else if (i == 3) {
UndispatchedKt.startCoroutineUndispatched(function1, continuation);
} else if (i != 4) {
throw new NoWhenBranchMatchedException();
}
}
public final <R, T> void invoke(Function2 function2, R r, Continuation continuation) {
int i = WhenMappings.$EnumSwitchMapping$0[ordinal()];
if (i == 1) {
CancellableKt.startCoroutineCancellable$default(function2, r, continuation, null, 4, null);
return;
}
if (i == 2) {
ContinuationKt.startCoroutine(function2, r, continuation);
} else if (i == 3) {
UndispatchedKt.startCoroutineUndispatched(function2, r, continuation);
} else if (i != 4) {
throw new NoWhenBranchMatchedException();
}
}
}

View File

@@ -0,0 +1,8 @@
package kotlinx.coroutines;
/* loaded from: classes5.dex */
public final class CoroutinesInternalError extends Error {
public CoroutinesInternalError(String str, Throwable th) {
super(str, th);
}
}

View File

@@ -0,0 +1,35 @@
package kotlinx.coroutines;
import kotlin.Result;
import kotlin.ResultKt;
import kotlin.coroutines.Continuation;
import kotlinx.coroutines.internal.DispatchedContinuation;
/* loaded from: classes5.dex */
public abstract class DebugStringsKt {
public static final String getHexAddress(Object obj) {
return Integer.toHexString(System.identityHashCode(obj));
}
public static final String toDebugString(Continuation continuation) {
Object m4060constructorimpl;
if (continuation instanceof DispatchedContinuation) {
return continuation.toString();
}
try {
Result.Companion companion = Result.Companion;
m4060constructorimpl = Result.m4060constructorimpl(continuation + '@' + getHexAddress(continuation));
} catch (Throwable th) {
Result.Companion companion2 = Result.Companion;
m4060constructorimpl = Result.m4060constructorimpl(ResultKt.createFailure(th));
}
if (Result.m4062exceptionOrNullimpl(m4060constructorimpl) != null) {
m4060constructorimpl = continuation.getClass().getName() + '@' + getHexAddress(continuation);
}
return (String) m4060constructorimpl;
}
public static final String getClassSimpleName(Object obj) {
return obj.getClass().getSimpleName();
}
}

View File

@@ -0,0 +1,168 @@
package kotlinx.coroutines;
import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.LockSupport;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.internal.Intrinsics;
import kotlin.ranges.RangesKt___RangesKt;
import kotlinx.coroutines.EventLoopImplBase;
/* loaded from: classes5.dex */
public final class DefaultExecutor extends EventLoopImplBase implements Runnable {
public static final DefaultExecutor INSTANCE;
public static final long KEEP_ALIVE_NANOS;
private static volatile Thread _thread;
private static volatile int debugStatus;
public final boolean isShutDown() {
return debugStatus == 4;
}
public final boolean isShutdownRequested() {
int i = debugStatus;
return i == 2 || i == 3;
}
static {
Long l;
DefaultExecutor defaultExecutor = new DefaultExecutor();
INSTANCE = defaultExecutor;
EventLoop.incrementUseCount$default(defaultExecutor, false, 1, null);
TimeUnit timeUnit = TimeUnit.MILLISECONDS;
try {
l = Long.getLong("kotlinx.coroutines.DefaultExecutor.keepAlive", 1000L);
} catch (SecurityException unused) {
l = 1000L;
}
KEEP_ALIVE_NANOS = timeUnit.toNanos(l.longValue());
}
@Override // kotlinx.coroutines.EventLoopImplPlatform
public Thread getThread() {
Thread thread = _thread;
return thread == null ? createThreadSync() : thread;
}
@Override // kotlinx.coroutines.EventLoopImplBase
public void enqueue(Runnable runnable) {
if (isShutDown()) {
shutdownError();
}
super.enqueue(runnable);
}
@Override // kotlinx.coroutines.EventLoopImplPlatform
public void reschedule(long j, EventLoopImplBase.DelayedTask delayedTask) {
shutdownError();
}
public final void shutdownError() {
throw new RejectedExecutionException("DefaultExecutor was shut down. This error indicates that Dispatchers.shutdown() was invoked prior to completion of exiting coroutines, leaving coroutines in incomplete state. Please refer to Dispatchers.shutdown documentation for more details");
}
@Override // kotlinx.coroutines.EventLoopImplBase, kotlinx.coroutines.EventLoop
public void shutdown() {
debugStatus = 4;
super.shutdown();
}
@Override // kotlinx.coroutines.EventLoopImplBase, kotlinx.coroutines.Delay
public DisposableHandle invokeOnTimeout(long j, Runnable runnable, CoroutineContext coroutineContext) {
return scheduleInvokeOnTimeout(j, runnable);
}
@Override // java.lang.Runnable
public void run() {
boolean isEmpty;
ThreadLocalEventLoop.INSTANCE.setEventLoop$kotlinx_coroutines_core(this);
AbstractTimeSourceKt.getTimeSource();
try {
if (!notifyStartup()) {
if (isEmpty) {
return;
} else {
return;
}
}
long j = Long.MAX_VALUE;
while (true) {
Thread.interrupted();
long processNextEvent = processNextEvent();
if (processNextEvent == Long.MAX_VALUE) {
AbstractTimeSourceKt.getTimeSource();
long nanoTime = System.nanoTime();
if (j == Long.MAX_VALUE) {
j = KEEP_ALIVE_NANOS + nanoTime;
}
long j2 = j - nanoTime;
if (j2 <= 0) {
_thread = null;
acknowledgeShutdownIfNeeded();
AbstractTimeSourceKt.getTimeSource();
if (isEmpty()) {
return;
}
getThread();
return;
}
processNextEvent = RangesKt___RangesKt.coerceAtMost(processNextEvent, j2);
} else {
j = Long.MAX_VALUE;
}
if (processNextEvent > 0) {
if (isShutdownRequested()) {
_thread = null;
acknowledgeShutdownIfNeeded();
AbstractTimeSourceKt.getTimeSource();
if (isEmpty()) {
return;
}
getThread();
return;
}
AbstractTimeSourceKt.getTimeSource();
LockSupport.parkNanos(this, processNextEvent);
}
}
} finally {
_thread = null;
acknowledgeShutdownIfNeeded();
AbstractTimeSourceKt.getTimeSource();
if (!isEmpty()) {
getThread();
}
}
}
public final synchronized Thread createThreadSync() {
Thread thread;
thread = _thread;
if (thread == null) {
thread = new Thread(this, "kotlinx.coroutines.DefaultExecutor");
_thread = thread;
thread.setDaemon(true);
thread.start();
}
return thread;
}
public final synchronized boolean notifyStartup() {
if (isShutdownRequested()) {
return false;
}
debugStatus = 1;
Intrinsics.checkNotNull(this, "null cannot be cast to non-null type java.lang.Object");
notifyAll();
return true;
}
public final synchronized void acknowledgeShutdownIfNeeded() {
if (isShutdownRequested()) {
debugStatus = 3;
resetAll();
Intrinsics.checkNotNull(this, "null cannot be cast to non-null type java.lang.Object");
notifyAll();
}
}
}

View File

@@ -0,0 +1,23 @@
package kotlinx.coroutines;
import kotlinx.coroutines.internal.MainDispatchersKt;
import kotlinx.coroutines.internal.SystemPropsKt;
/* loaded from: classes5.dex */
public abstract class DefaultExecutorKt {
public static final boolean defaultMainDelayOptIn = SystemPropsKt.systemProp("kotlinx.coroutines.main.delay", false);
public static final Delay DefaultDelay = initializeDefaultDelay();
public static final Delay getDefaultDelay() {
return DefaultDelay;
}
/* JADX WARN: Multi-variable type inference failed */
public static final Delay initializeDefaultDelay() {
if (!defaultMainDelayOptIn) {
return DefaultExecutor.INSTANCE;
}
MainCoroutineDispatcher main = Dispatchers.getMain();
return (MainDispatchersKt.isMissing(main) || !(main instanceof Delay)) ? DefaultExecutor.INSTANCE : (Delay) main;
}
}

View File

@@ -0,0 +1,10 @@
package kotlinx.coroutines;
import kotlin.coroutines.Continuation;
/* loaded from: classes5.dex */
public interface Deferred extends Job {
Object await(Continuation continuation);
Object getCompleted();
}

View File

@@ -0,0 +1,28 @@
package kotlinx.coroutines;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.CoroutineContext;
import kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsKt;
/* loaded from: classes5.dex */
public class DeferredCoroutine extends AbstractCoroutine implements Deferred {
@Override // kotlinx.coroutines.Deferred
public Object await(Continuation continuation) {
return await$suspendImpl(this, continuation);
}
public DeferredCoroutine(CoroutineContext coroutineContext, boolean z) {
super(coroutineContext, true, z);
}
@Override // kotlinx.coroutines.Deferred
public Object getCompleted() {
return getCompletedInternal$kotlinx_coroutines_core();
}
public static /* synthetic */ Object await$suspendImpl(DeferredCoroutine deferredCoroutine, Continuation continuation) {
Object awaitInternal = deferredCoroutine.awaitInternal(continuation);
IntrinsicsKt__IntrinsicsKt.getCOROUTINE_SUSPENDED();
return awaitInternal;
}
}

View File

@@ -0,0 +1,17 @@
package kotlinx.coroutines;
import kotlin.coroutines.CoroutineContext;
/* loaded from: classes5.dex */
public interface Delay {
DisposableHandle invokeOnTimeout(long j, Runnable runnable, CoroutineContext coroutineContext);
/* renamed from: scheduleResumeAfterDelay */
void mo4149scheduleResumeAfterDelay(long j, CancellableContinuation cancellableContinuation);
public static final class DefaultImpls {
public static DisposableHandle invokeOnTimeout(Delay delay, long j, Runnable runnable, CoroutineContext coroutineContext) {
return DefaultExecutorKt.getDefaultDelay().invokeOnTimeout(j, runnable, coroutineContext);
}
}
}

View File

@@ -0,0 +1,21 @@
package kotlinx.coroutines;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.jvm.internal.ContinuationImpl;
/* loaded from: classes5.dex */
public final class DelayKt$awaitCancellation$1 extends ContinuationImpl {
public int label;
public /* synthetic */ Object result;
public DelayKt$awaitCancellation$1(Continuation continuation) {
super(continuation);
}
@Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
public final Object invokeSuspend(Object obj) {
this.result = obj;
this.label |= Integer.MIN_VALUE;
return DelayKt.awaitCancellation(this);
}
}

View File

@@ -0,0 +1,98 @@
package kotlinx.coroutines;
import kotlin.Unit;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.ContinuationInterceptor;
import kotlin.coroutines.CoroutineContext;
import kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsJvmKt;
import kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsKt;
import kotlin.coroutines.jvm.internal.DebugProbesKt;
/* loaded from: classes5.dex */
public abstract class DelayKt {
/* JADX WARN: Removed duplicated region for block: B:15:0x0031 */
/* JADX WARN: Removed duplicated region for block: B:8:0x0023 */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public static final java.lang.Object awaitCancellation(kotlin.coroutines.Continuation r4) {
/*
boolean r0 = r4 instanceof kotlinx.coroutines.DelayKt$awaitCancellation$1
if (r0 == 0) goto L13
r0 = r4
kotlinx.coroutines.DelayKt$awaitCancellation$1 r0 = (kotlinx.coroutines.DelayKt$awaitCancellation$1) r0
int r1 = r0.label
r2 = -2147483648(0xffffffff80000000, float:-0.0)
r3 = r1 & r2
if (r3 == 0) goto L13
int r1 = r1 - r2
r0.label = r1
goto L18
L13:
kotlinx.coroutines.DelayKt$awaitCancellation$1 r0 = new kotlinx.coroutines.DelayKt$awaitCancellation$1
r0.<init>(r4)
L18:
java.lang.Object r4 = r0.result
java.lang.Object r1 = kotlin.coroutines.intrinsics.IntrinsicsKt.getCOROUTINE_SUSPENDED()
int r2 = r0.label
r3 = 1
if (r2 == 0) goto L31
if (r2 == r3) goto L2d
java.lang.IllegalStateException r4 = new java.lang.IllegalStateException
java.lang.String r0 = "call to 'resume' before 'invoke' with coroutine"
r4.<init>(r0)
throw r4
L2d:
kotlin.ResultKt.throwOnFailure(r4)
goto L52
L31:
kotlin.ResultKt.throwOnFailure(r4)
r0.label = r3
kotlinx.coroutines.CancellableContinuationImpl r4 = new kotlinx.coroutines.CancellableContinuationImpl
kotlin.coroutines.Continuation r2 = kotlin.coroutines.intrinsics.IntrinsicsKt.intercepted(r0)
r4.<init>(r2, r3)
r4.initCancellability()
java.lang.Object r4 = r4.getResult()
java.lang.Object r2 = kotlin.coroutines.intrinsics.IntrinsicsKt.getCOROUTINE_SUSPENDED()
if (r4 != r2) goto L4f
kotlin.coroutines.jvm.internal.DebugProbesKt.probeCoroutineSuspended(r0)
L4f:
if (r4 != r1) goto L52
return r1
L52:
kotlin.KotlinNothingValueException r4 = new kotlin.KotlinNothingValueException
r4.<init>()
throw r4
*/
throw new UnsupportedOperationException("Method not decompiled: kotlinx.coroutines.DelayKt.awaitCancellation(kotlin.coroutines.Continuation):java.lang.Object");
}
public static final Object delay(long j, Continuation continuation) {
Continuation intercepted;
Object coroutine_suspended;
Object coroutine_suspended2;
if (j <= 0) {
return Unit.INSTANCE;
}
intercepted = IntrinsicsKt__IntrinsicsJvmKt.intercepted(continuation);
CancellableContinuationImpl cancellableContinuationImpl = new CancellableContinuationImpl(intercepted, 1);
cancellableContinuationImpl.initCancellability();
if (j < Long.MAX_VALUE) {
getDelay(cancellableContinuationImpl.getContext()).mo4149scheduleResumeAfterDelay(j, cancellableContinuationImpl);
}
Object result = cancellableContinuationImpl.getResult();
coroutine_suspended = IntrinsicsKt__IntrinsicsKt.getCOROUTINE_SUSPENDED();
if (result == coroutine_suspended) {
DebugProbesKt.probeCoroutineSuspended(continuation);
}
coroutine_suspended2 = IntrinsicsKt__IntrinsicsKt.getCOROUTINE_SUSPENDED();
return result == coroutine_suspended2 ? result : Unit.INSTANCE;
}
public static final Delay getDelay(CoroutineContext coroutineContext) {
CoroutineContext.Element element = coroutineContext.get(ContinuationInterceptor.Key);
Delay delay = element instanceof Delay ? (Delay) element : null;
return delay == null ? DefaultExecutorKt.getDefaultDelay() : delay;
}
}

View File

@@ -0,0 +1,75 @@
package kotlinx.coroutines;
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.CoroutineContext;
import kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsJvmKt;
import kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsKt;
import kotlinx.coroutines.internal.DispatchedContinuationKt;
import kotlinx.coroutines.internal.ScopeCoroutine;
/* loaded from: classes5.dex */
public final class DispatchedCoroutine extends ScopeCoroutine {
public static final AtomicIntegerFieldUpdater _decision$FU = AtomicIntegerFieldUpdater.newUpdater(DispatchedCoroutine.class, "_decision");
private volatile int _decision;
public DispatchedCoroutine(CoroutineContext coroutineContext, Continuation continuation) {
super(coroutineContext, continuation);
}
private final boolean trySuspend() {
AtomicIntegerFieldUpdater atomicIntegerFieldUpdater = _decision$FU;
do {
int i = atomicIntegerFieldUpdater.get(this);
if (i != 0) {
if (i == 2) {
return false;
}
throw new IllegalStateException("Already suspended".toString());
}
} while (!_decision$FU.compareAndSet(this, 0, 1));
return true;
}
private final boolean tryResume() {
AtomicIntegerFieldUpdater atomicIntegerFieldUpdater = _decision$FU;
do {
int i = atomicIntegerFieldUpdater.get(this);
if (i != 0) {
if (i == 1) {
return false;
}
throw new IllegalStateException("Already resumed".toString());
}
} while (!_decision$FU.compareAndSet(this, 0, 2));
return true;
}
@Override // kotlinx.coroutines.internal.ScopeCoroutine, kotlinx.coroutines.JobSupport
public void afterCompletion(Object obj) {
afterResume(obj);
}
@Override // kotlinx.coroutines.internal.ScopeCoroutine, kotlinx.coroutines.AbstractCoroutine
public void afterResume(Object obj) {
Continuation intercepted;
if (tryResume()) {
return;
}
intercepted = IntrinsicsKt__IntrinsicsJvmKt.intercepted(this.uCont);
DispatchedContinuationKt.resumeCancellableWith$default(intercepted, CompletionStateKt.recoverResult(obj, this.uCont), null, 2, null);
}
public final Object getResult$kotlinx_coroutines_core() {
Object coroutine_suspended;
if (trySuspend()) {
coroutine_suspended = IntrinsicsKt__IntrinsicsKt.getCOROUTINE_SUSPENDED();
return coroutine_suspended;
}
Object unboxState = JobSupportKt.unboxState(getState$kotlinx_coroutines_core());
if (unboxState instanceof CompletedExceptionally) {
throw ((CompletedExceptionally) unboxState).cause;
}
return unboxState;
}
}

View File

@@ -0,0 +1,117 @@
package kotlinx.coroutines;
import java.util.concurrent.CancellationException;
import kotlin.ExceptionsKt__ExceptionsKt;
import kotlin.Result;
import kotlin.ResultKt;
import kotlin.Unit;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.internal.Intrinsics;
import kotlinx.coroutines.internal.DispatchedContinuation;
import kotlinx.coroutines.internal.ThreadContextKt;
import kotlinx.coroutines.scheduling.Task;
import kotlinx.coroutines.scheduling.TaskContext;
/* loaded from: classes5.dex */
public abstract class DispatchedTask extends Task {
public int resumeMode;
public abstract void cancelCompletedResult$kotlinx_coroutines_core(Object obj, Throwable th);
public abstract Continuation getDelegate$kotlinx_coroutines_core();
public Object getSuccessfulResult$kotlinx_coroutines_core(Object obj) {
return obj;
}
public abstract Object takeState$kotlinx_coroutines_core();
public DispatchedTask(int i) {
this.resumeMode = i;
}
public final void handleFatalException$kotlinx_coroutines_core(Throwable th, Throwable th2) {
if (th == null && th2 == null) {
return;
}
if (th != null && th2 != null) {
ExceptionsKt__ExceptionsKt.addSuppressed(th, th2);
}
if (th == null) {
th = th2;
}
Intrinsics.checkNotNull(th);
CoroutineExceptionHandlerKt.handleCoroutineException(getDelegate$kotlinx_coroutines_core().getContext(), new CoroutinesInternalError("Fatal exception in coroutines machinery for " + this + ". Please read KDoc to 'handleFatalException' method and report this incident to maintainers", th));
}
public Throwable getExceptionalResult$kotlinx_coroutines_core(Object obj) {
CompletedExceptionally completedExceptionally = obj instanceof CompletedExceptionally ? (CompletedExceptionally) obj : null;
if (completedExceptionally != null) {
return completedExceptionally.cause;
}
return null;
}
@Override // java.lang.Runnable
public final void run() {
Object m4060constructorimpl;
Object m4060constructorimpl2;
TaskContext taskContext = this.taskContext;
try {
Continuation delegate$kotlinx_coroutines_core = getDelegate$kotlinx_coroutines_core();
Intrinsics.checkNotNull(delegate$kotlinx_coroutines_core, "null cannot be cast to non-null type kotlinx.coroutines.internal.DispatchedContinuation<T of kotlinx.coroutines.DispatchedTask>");
DispatchedContinuation dispatchedContinuation = (DispatchedContinuation) delegate$kotlinx_coroutines_core;
Continuation continuation = dispatchedContinuation.continuation;
Object obj = dispatchedContinuation.countOrElement;
CoroutineContext context = continuation.getContext();
Object updateThreadContext = ThreadContextKt.updateThreadContext(context, obj);
UndispatchedCoroutine updateUndispatchedCompletion = updateThreadContext != ThreadContextKt.NO_THREAD_ELEMENTS ? CoroutineContextKt.updateUndispatchedCompletion(continuation, context, updateThreadContext) : null;
try {
CoroutineContext context2 = continuation.getContext();
Object takeState$kotlinx_coroutines_core = takeState$kotlinx_coroutines_core();
Throwable exceptionalResult$kotlinx_coroutines_core = getExceptionalResult$kotlinx_coroutines_core(takeState$kotlinx_coroutines_core);
Job job = (exceptionalResult$kotlinx_coroutines_core == null && DispatchedTaskKt.isCancellableMode(this.resumeMode)) ? (Job) context2.get(Job.Key) : null;
if (job != null && !job.isActive()) {
CancellationException cancellationException = job.getCancellationException();
cancelCompletedResult$kotlinx_coroutines_core(takeState$kotlinx_coroutines_core, cancellationException);
Result.Companion companion = Result.Companion;
continuation.resumeWith(Result.m4060constructorimpl(ResultKt.createFailure(cancellationException)));
} else if (exceptionalResult$kotlinx_coroutines_core != null) {
Result.Companion companion2 = Result.Companion;
continuation.resumeWith(Result.m4060constructorimpl(ResultKt.createFailure(exceptionalResult$kotlinx_coroutines_core)));
} else {
Result.Companion companion3 = Result.Companion;
continuation.resumeWith(Result.m4060constructorimpl(getSuccessfulResult$kotlinx_coroutines_core(takeState$kotlinx_coroutines_core)));
}
Unit unit = Unit.INSTANCE;
if (updateUndispatchedCompletion == null || updateUndispatchedCompletion.clearThreadContext()) {
ThreadContextKt.restoreThreadContext(context, updateThreadContext);
}
try {
taskContext.afterTask();
m4060constructorimpl2 = Result.m4060constructorimpl(Unit.INSTANCE);
} catch (Throwable th) {
Result.Companion companion4 = Result.Companion;
m4060constructorimpl2 = Result.m4060constructorimpl(ResultKt.createFailure(th));
}
handleFatalException$kotlinx_coroutines_core(null, Result.m4062exceptionOrNullimpl(m4060constructorimpl2));
} catch (Throwable th2) {
if (updateUndispatchedCompletion == null || updateUndispatchedCompletion.clearThreadContext()) {
ThreadContextKt.restoreThreadContext(context, updateThreadContext);
}
throw th2;
}
} catch (Throwable th3) {
try {
Result.Companion companion5 = Result.Companion;
taskContext.afterTask();
m4060constructorimpl = Result.m4060constructorimpl(Unit.INSTANCE);
} catch (Throwable th4) {
Result.Companion companion6 = Result.Companion;
m4060constructorimpl = Result.m4060constructorimpl(ResultKt.createFailure(th4));
}
handleFatalException$kotlinx_coroutines_core(th3, Result.m4062exceptionOrNullimpl(m4060constructorimpl));
}
}
}

View File

@@ -0,0 +1,95 @@
package kotlinx.coroutines;
import kotlin.Result;
import kotlin.ResultKt;
import kotlin.Unit;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.internal.Intrinsics;
import kotlinx.coroutines.internal.DispatchedContinuation;
import kotlinx.coroutines.internal.ThreadContextKt;
/* loaded from: classes5.dex */
public abstract class DispatchedTaskKt {
public static final boolean isCancellableMode(int i) {
return i == 1 || i == 2;
}
public static final boolean isReusableMode(int i) {
return i == 2;
}
public static final void dispatch(DispatchedTask dispatchedTask, int i) {
Continuation delegate$kotlinx_coroutines_core = dispatchedTask.getDelegate$kotlinx_coroutines_core();
boolean z = i == 4;
if (!z && (delegate$kotlinx_coroutines_core instanceof DispatchedContinuation) && isCancellableMode(i) == isCancellableMode(dispatchedTask.resumeMode)) {
CoroutineDispatcher coroutineDispatcher = ((DispatchedContinuation) delegate$kotlinx_coroutines_core).dispatcher;
CoroutineContext context = delegate$kotlinx_coroutines_core.getContext();
if (coroutineDispatcher.isDispatchNeeded(context)) {
coroutineDispatcher.mo4148dispatch(context, dispatchedTask);
return;
} else {
resumeUnconfined(dispatchedTask);
return;
}
}
resume(dispatchedTask, delegate$kotlinx_coroutines_core, z);
}
public static final void resume(DispatchedTask dispatchedTask, Continuation continuation, boolean z) {
Object successfulResult$kotlinx_coroutines_core;
boolean clearThreadContext;
Object takeState$kotlinx_coroutines_core = dispatchedTask.takeState$kotlinx_coroutines_core();
Throwable exceptionalResult$kotlinx_coroutines_core = dispatchedTask.getExceptionalResult$kotlinx_coroutines_core(takeState$kotlinx_coroutines_core);
if (exceptionalResult$kotlinx_coroutines_core != null) {
Result.Companion companion = Result.Companion;
successfulResult$kotlinx_coroutines_core = ResultKt.createFailure(exceptionalResult$kotlinx_coroutines_core);
} else {
Result.Companion companion2 = Result.Companion;
successfulResult$kotlinx_coroutines_core = dispatchedTask.getSuccessfulResult$kotlinx_coroutines_core(takeState$kotlinx_coroutines_core);
}
Object m4060constructorimpl = Result.m4060constructorimpl(successfulResult$kotlinx_coroutines_core);
if (z) {
Intrinsics.checkNotNull(continuation, "null cannot be cast to non-null type kotlinx.coroutines.internal.DispatchedContinuation<T of kotlinx.coroutines.DispatchedTaskKt.resume>");
DispatchedContinuation dispatchedContinuation = (DispatchedContinuation) continuation;
Continuation continuation2 = dispatchedContinuation.continuation;
Object obj = dispatchedContinuation.countOrElement;
CoroutineContext context = continuation2.getContext();
Object updateThreadContext = ThreadContextKt.updateThreadContext(context, obj);
UndispatchedCoroutine updateUndispatchedCompletion = updateThreadContext != ThreadContextKt.NO_THREAD_ELEMENTS ? CoroutineContextKt.updateUndispatchedCompletion(continuation2, context, updateThreadContext) : null;
try {
dispatchedContinuation.continuation.resumeWith(m4060constructorimpl);
Unit unit = Unit.INSTANCE;
if (updateUndispatchedCompletion != null) {
if (!clearThreadContext) {
return;
}
}
return;
} finally {
if (updateUndispatchedCompletion == null || updateUndispatchedCompletion.clearThreadContext()) {
ThreadContextKt.restoreThreadContext(context, updateThreadContext);
}
}
}
continuation.resumeWith(m4060constructorimpl);
}
public static final void resumeUnconfined(DispatchedTask dispatchedTask) {
EventLoop eventLoop$kotlinx_coroutines_core = ThreadLocalEventLoop.INSTANCE.getEventLoop$kotlinx_coroutines_core();
if (eventLoop$kotlinx_coroutines_core.isUnconfinedLoopActive()) {
eventLoop$kotlinx_coroutines_core.dispatchUnconfined(dispatchedTask);
return;
}
eventLoop$kotlinx_coroutines_core.incrementUseCount(true);
try {
resume(dispatchedTask, dispatchedTask.getDelegate$kotlinx_coroutines_core(), true);
do {
} while (eventLoop$kotlinx_coroutines_core.processUnconfinedEvent());
} finally {
try {
} finally {
}
}
}
}

View File

@@ -0,0 +1,28 @@
package kotlinx.coroutines;
import java.util.concurrent.Executor;
import kotlin.coroutines.EmptyCoroutineContext;
/* loaded from: classes5.dex */
public final class DispatcherExecutor implements Executor {
public final CoroutineDispatcher dispatcher;
public DispatcherExecutor(CoroutineDispatcher coroutineDispatcher) {
this.dispatcher = coroutineDispatcher;
}
@Override // java.util.concurrent.Executor
public void execute(Runnable runnable) {
CoroutineDispatcher coroutineDispatcher = this.dispatcher;
EmptyCoroutineContext emptyCoroutineContext = EmptyCoroutineContext.INSTANCE;
if (coroutineDispatcher.isDispatchNeeded(emptyCoroutineContext)) {
this.dispatcher.mo4148dispatch(emptyCoroutineContext, runnable);
} else {
runnable.run();
}
}
public String toString() {
return this.dispatcher.toString();
}
}

View File

@@ -0,0 +1,25 @@
package kotlinx.coroutines;
import kotlinx.coroutines.internal.MainDispatcherLoader;
import kotlinx.coroutines.scheduling.DefaultIoScheduler;
import kotlinx.coroutines.scheduling.DefaultScheduler;
/* loaded from: classes5.dex */
public final class Dispatchers {
public static final Dispatchers INSTANCE = new Dispatchers();
public static final CoroutineDispatcher Default = DefaultScheduler.INSTANCE;
public static final CoroutineDispatcher Unconfined = Unconfined.INSTANCE;
public static final CoroutineDispatcher IO = DefaultIoScheduler.INSTANCE;
public static final CoroutineDispatcher getDefault() {
return Default;
}
public static final CoroutineDispatcher getIO() {
return IO;
}
public static final MainCoroutineDispatcher getMain() {
return MainDispatcherLoader.dispatcher;
}
}

View File

@@ -0,0 +1,21 @@
package kotlinx.coroutines;
import java.util.concurrent.Future;
/* loaded from: classes5.dex */
public final class DisposableFutureHandle implements DisposableHandle {
public final Future future;
public DisposableFutureHandle(Future future) {
this.future = future;
}
@Override // kotlinx.coroutines.DisposableHandle
public void dispose() {
this.future.cancel(false);
}
public String toString() {
return "DisposableFutureHandle[" + this.future + ']';
}
}

View File

@@ -0,0 +1,6 @@
package kotlinx.coroutines;
/* loaded from: classes5.dex */
public interface DisposableHandle {
void dispose();
}

View File

@@ -0,0 +1,27 @@
package kotlinx.coroutines;
import kotlin.Unit;
/* loaded from: classes5.dex */
public final class DisposeOnCancel extends CancelHandler {
public final DisposableHandle handle;
public DisposeOnCancel(DisposableHandle disposableHandle) {
this.handle = disposableHandle;
}
@Override // kotlin.jvm.functions.Function1
public /* bridge */ /* synthetic */ Object invoke(Object obj) {
invoke((Throwable) obj);
return Unit.INSTANCE;
}
@Override // kotlinx.coroutines.CancelHandlerBase
public void invoke(Throwable th) {
this.handle.dispose();
}
public String toString() {
return "DisposeOnCancel[" + this.handle + ']';
}
}

View File

@@ -0,0 +1,23 @@
package kotlinx.coroutines;
import kotlin.Unit;
/* loaded from: classes5.dex */
public final class DisposeOnCompletion extends JobNode {
public final DisposableHandle handle;
@Override // kotlin.jvm.functions.Function1
public /* bridge */ /* synthetic */ Object invoke(Object obj) {
invoke((Throwable) obj);
return Unit.INSTANCE;
}
public DisposeOnCompletion(DisposableHandle disposableHandle) {
this.handle = disposableHandle;
}
@Override // kotlinx.coroutines.CompletionHandlerBase
public void invoke(Throwable th) {
this.handle.dispose();
}
}

View File

@@ -0,0 +1,28 @@
package kotlinx.coroutines;
/* loaded from: classes5.dex */
public final class Empty implements Incomplete {
public final boolean isActive;
@Override // kotlinx.coroutines.Incomplete
public NodeList getList() {
return null;
}
@Override // kotlinx.coroutines.Incomplete
public boolean isActive() {
return this.isActive;
}
public Empty(boolean z) {
this.isActive = z;
}
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("Empty{");
sb.append(isActive() ? "Active" : "New");
sb.append('}');
return sb.toString();
}
}

View File

@@ -0,0 +1,101 @@
package kotlinx.coroutines;
import kotlin.collections.ArrayDeque;
import kotlinx.coroutines.internal.LimitedDispatcherKt;
/* loaded from: classes5.dex */
public abstract class EventLoop extends CoroutineDispatcher {
public boolean shared;
public ArrayDeque unconfinedQueue;
public long useCount;
public final long delta(boolean z) {
return z ? 4294967296L : 1L;
}
public abstract long processNextEvent();
public boolean shouldBeProcessedFromContext() {
return false;
}
public abstract void shutdown();
public long getNextTime() {
ArrayDeque arrayDeque = this.unconfinedQueue;
return (arrayDeque == null || arrayDeque.isEmpty()) ? Long.MAX_VALUE : 0L;
}
public final boolean processUnconfinedEvent() {
DispatchedTask dispatchedTask;
ArrayDeque arrayDeque = this.unconfinedQueue;
if (arrayDeque == null || (dispatchedTask = (DispatchedTask) arrayDeque.removeFirstOrNull()) == null) {
return false;
}
dispatchedTask.run();
return true;
}
public final void dispatchUnconfined(DispatchedTask dispatchedTask) {
ArrayDeque arrayDeque = this.unconfinedQueue;
if (arrayDeque == null) {
arrayDeque = new ArrayDeque();
this.unconfinedQueue = arrayDeque;
}
arrayDeque.addLast(dispatchedTask);
}
public final boolean isUnconfinedLoopActive() {
return this.useCount >= delta(true);
}
public final boolean isUnconfinedQueueEmpty() {
ArrayDeque arrayDeque = this.unconfinedQueue;
if (arrayDeque != null) {
return arrayDeque.isEmpty();
}
return true;
}
public static /* synthetic */ void incrementUseCount$default(EventLoop eventLoop, boolean z, int i, Object obj) {
if (obj != null) {
throw new UnsupportedOperationException("Super calls with default arguments not supported in this target, function: incrementUseCount");
}
if ((i & 1) != 0) {
z = false;
}
eventLoop.incrementUseCount(z);
}
public final void incrementUseCount(boolean z) {
this.useCount += delta(z);
if (z) {
return;
}
this.shared = true;
}
public static /* synthetic */ void decrementUseCount$default(EventLoop eventLoop, boolean z, int i, Object obj) {
if (obj != null) {
throw new UnsupportedOperationException("Super calls with default arguments not supported in this target, function: decrementUseCount");
}
if ((i & 1) != 0) {
z = false;
}
eventLoop.decrementUseCount(z);
}
public final void decrementUseCount(boolean z) {
long delta = this.useCount - delta(z);
this.useCount = delta;
if (delta <= 0 && this.shared) {
shutdown();
}
}
@Override // kotlinx.coroutines.CoroutineDispatcher
public final CoroutineDispatcher limitedParallelism(int i) {
LimitedDispatcherKt.checkParallelism(i);
return this;
}
}

View File

@@ -0,0 +1,485 @@
package kotlinx.coroutines;
import androidx.concurrent.futures.AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0;
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
import kotlin.Unit;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.internal.Intrinsics;
import kotlin.ranges.RangesKt___RangesKt;
import kotlinx.coroutines.Delay;
import kotlinx.coroutines.internal.LockFreeTaskQueueCore;
import kotlinx.coroutines.internal.Symbol;
import kotlinx.coroutines.internal.ThreadSafeHeap;
import kotlinx.coroutines.internal.ThreadSafeHeapNode;
/* loaded from: classes5.dex */
public abstract class EventLoopImplBase extends EventLoopImplPlatform implements Delay {
private volatile Object _delayed;
private volatile int _isCompleted = 0;
private volatile Object _queue;
public static final AtomicReferenceFieldUpdater _queue$FU = AtomicReferenceFieldUpdater.newUpdater(EventLoopImplBase.class, Object.class, "_queue");
public static final AtomicReferenceFieldUpdater _delayed$FU = AtomicReferenceFieldUpdater.newUpdater(EventLoopImplBase.class, Object.class, "_delayed");
public static final AtomicIntegerFieldUpdater _isCompleted$FU = AtomicIntegerFieldUpdater.newUpdater(EventLoopImplBase.class, "_isCompleted");
public static abstract class DelayedTask implements Runnable, Comparable, DisposableHandle, ThreadSafeHeapNode {
private volatile Object _heap;
public int index = -1;
public long nanoTime;
@Override // kotlinx.coroutines.internal.ThreadSafeHeapNode
public int getIndex() {
return this.index;
}
@Override // kotlinx.coroutines.internal.ThreadSafeHeapNode
public void setIndex(int i) {
this.index = i;
}
public final boolean timeToExecute(long j) {
return j - this.nanoTime >= 0;
}
@Override // kotlinx.coroutines.DisposableHandle
public final void dispose() {
Symbol symbol;
Symbol symbol2;
synchronized (this) {
try {
Object obj = this._heap;
symbol = EventLoop_commonKt.DISPOSED_TASK;
if (obj == symbol) {
return;
}
DelayedTaskQueue delayedTaskQueue = obj instanceof DelayedTaskQueue ? (DelayedTaskQueue) obj : null;
if (delayedTaskQueue != null) {
delayedTaskQueue.remove(this);
}
symbol2 = EventLoop_commonKt.DISPOSED_TASK;
this._heap = symbol2;
Unit unit = Unit.INSTANCE;
} catch (Throwable th) {
throw th;
}
}
}
public final int scheduleTask(long j, DelayedTaskQueue delayedTaskQueue, EventLoopImplBase eventLoopImplBase) {
Symbol symbol;
synchronized (this) {
Object obj = this._heap;
symbol = EventLoop_commonKt.DISPOSED_TASK;
if (obj == symbol) {
return 2;
}
synchronized (delayedTaskQueue) {
try {
DelayedTask delayedTask = (DelayedTask) delayedTaskQueue.firstImpl();
if (eventLoopImplBase.isCompleted()) {
return 1;
}
if (delayedTask == null) {
delayedTaskQueue.timeNow = j;
} else {
long j2 = delayedTask.nanoTime;
if (j2 - j < 0) {
j = j2;
}
if (j - delayedTaskQueue.timeNow > 0) {
delayedTaskQueue.timeNow = j;
}
}
long j3 = this.nanoTime;
long j4 = delayedTaskQueue.timeNow;
if (j3 - j4 < 0) {
this.nanoTime = j4;
}
delayedTaskQueue.addImpl(this);
return 0;
} catch (Throwable th) {
throw th;
}
}
}
}
public DelayedTask(long j) {
this.nanoTime = j;
}
@Override // kotlinx.coroutines.internal.ThreadSafeHeapNode
public ThreadSafeHeap getHeap() {
Object obj = this._heap;
if (obj instanceof ThreadSafeHeap) {
return (ThreadSafeHeap) obj;
}
return null;
}
@Override // kotlinx.coroutines.internal.ThreadSafeHeapNode
public void setHeap(ThreadSafeHeap threadSafeHeap) {
Symbol symbol;
Object obj = this._heap;
symbol = EventLoop_commonKt.DISPOSED_TASK;
if (obj == symbol) {
throw new IllegalArgumentException("Failed requirement.".toString());
}
this._heap = threadSafeHeap;
}
@Override // java.lang.Comparable
public int compareTo(DelayedTask delayedTask) {
long j = this.nanoTime - delayedTask.nanoTime;
if (j > 0) {
return 1;
}
return j < 0 ? -1 : 0;
}
public String toString() {
return "Delayed[nanos=" + this.nanoTime + ']';
}
}
public DisposableHandle invokeOnTimeout(long j, Runnable runnable, CoroutineContext coroutineContext) {
return Delay.DefaultImpls.invokeOnTimeout(this, j, runnable, coroutineContext);
}
/* JADX INFO: Access modifiers changed from: private */
public final boolean isCompleted() {
return _isCompleted$FU.get(this) != 0;
}
public final void setCompleted(boolean z) {
_isCompleted$FU.set(this, z ? 1 : 0);
}
public boolean isEmpty() {
Symbol symbol;
if (!isUnconfinedQueueEmpty()) {
return false;
}
DelayedTaskQueue delayedTaskQueue = (DelayedTaskQueue) _delayed$FU.get(this);
if (delayedTaskQueue != null && !delayedTaskQueue.isEmpty()) {
return false;
}
Object obj = _queue$FU.get(this);
if (obj != null) {
if (obj instanceof LockFreeTaskQueueCore) {
return ((LockFreeTaskQueueCore) obj).isEmpty();
}
symbol = EventLoop_commonKt.CLOSED_EMPTY;
if (obj != symbol) {
return false;
}
}
return true;
}
@Override // kotlinx.coroutines.EventLoop
public long getNextTime() {
DelayedTask delayedTask;
long coerceAtLeast;
Symbol symbol;
if (super.getNextTime() == 0) {
return 0L;
}
Object obj = _queue$FU.get(this);
if (obj != null) {
if (!(obj instanceof LockFreeTaskQueueCore)) {
symbol = EventLoop_commonKt.CLOSED_EMPTY;
return obj == symbol ? Long.MAX_VALUE : 0L;
}
if (!((LockFreeTaskQueueCore) obj).isEmpty()) {
return 0L;
}
}
DelayedTaskQueue delayedTaskQueue = (DelayedTaskQueue) _delayed$FU.get(this);
if (delayedTaskQueue == null || (delayedTask = (DelayedTask) delayedTaskQueue.peek()) == null) {
return Long.MAX_VALUE;
}
long j = delayedTask.nanoTime;
AbstractTimeSourceKt.getTimeSource();
coerceAtLeast = RangesKt___RangesKt.coerceAtLeast(j - System.nanoTime(), 0L);
return coerceAtLeast;
}
@Override // kotlinx.coroutines.EventLoop
public void shutdown() {
ThreadLocalEventLoop.INSTANCE.resetEventLoop$kotlinx_coroutines_core();
setCompleted(true);
closeQueue();
while (processNextEvent() <= 0) {
}
rescheduleAllDelayed();
}
@Override // kotlinx.coroutines.Delay
/* renamed from: scheduleResumeAfterDelay */
public void mo4149scheduleResumeAfterDelay(long j, CancellableContinuation cancellableContinuation) {
long delayToNanos = EventLoop_commonKt.delayToNanos(j);
if (delayToNanos < 4611686018427387903L) {
AbstractTimeSourceKt.getTimeSource();
long nanoTime = System.nanoTime();
DelayedResumeTask delayedResumeTask = new DelayedResumeTask(delayToNanos + nanoTime, cancellableContinuation);
schedule(nanoTime, delayedResumeTask);
CancellableContinuationKt.disposeOnCancellation(cancellableContinuation, delayedResumeTask);
}
}
public final DisposableHandle scheduleInvokeOnTimeout(long j, Runnable runnable) {
long delayToNanos = EventLoop_commonKt.delayToNanos(j);
if (delayToNanos < 4611686018427387903L) {
AbstractTimeSourceKt.getTimeSource();
long nanoTime = System.nanoTime();
DelayedRunnableTask delayedRunnableTask = new DelayedRunnableTask(delayToNanos + nanoTime, runnable);
schedule(nanoTime, delayedRunnableTask);
return delayedRunnableTask;
}
return NonDisposableHandle.INSTANCE;
}
@Override // kotlinx.coroutines.EventLoop
public long processNextEvent() {
ThreadSafeHeapNode threadSafeHeapNode;
if (processUnconfinedEvent()) {
return 0L;
}
DelayedTaskQueue delayedTaskQueue = (DelayedTaskQueue) _delayed$FU.get(this);
if (delayedTaskQueue != null && !delayedTaskQueue.isEmpty()) {
AbstractTimeSourceKt.getTimeSource();
long nanoTime = System.nanoTime();
do {
synchronized (delayedTaskQueue) {
ThreadSafeHeapNode firstImpl = delayedTaskQueue.firstImpl();
threadSafeHeapNode = null;
if (firstImpl != null) {
DelayedTask delayedTask = (DelayedTask) firstImpl;
if (delayedTask.timeToExecute(nanoTime) && enqueueImpl(delayedTask)) {
threadSafeHeapNode = delayedTaskQueue.removeAtImpl(0);
}
}
}
} while (((DelayedTask) threadSafeHeapNode) != null);
}
Runnable dequeue = dequeue();
if (dequeue != null) {
dequeue.run();
return 0L;
}
return getNextTime();
}
@Override // kotlinx.coroutines.CoroutineDispatcher
/* renamed from: dispatch */
public final void mo4148dispatch(CoroutineContext coroutineContext, Runnable runnable) {
enqueue(runnable);
}
public void enqueue(Runnable runnable) {
if (enqueueImpl(runnable)) {
unpark();
} else {
DefaultExecutor.INSTANCE.enqueue(runnable);
}
}
public final boolean enqueueImpl(Runnable runnable) {
Symbol symbol;
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater = _queue$FU;
while (true) {
Object obj = atomicReferenceFieldUpdater.get(this);
if (isCompleted()) {
return false;
}
if (obj == null) {
if (AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0.m(_queue$FU, this, null, runnable)) {
return true;
}
} else if (obj instanceof LockFreeTaskQueueCore) {
Intrinsics.checkNotNull(obj, "null cannot be cast to non-null type kotlinx.coroutines.internal.LockFreeTaskQueueCore<java.lang.Runnable{ kotlinx.coroutines.RunnableKt.Runnable }>{ kotlinx.coroutines.EventLoop_commonKt.Queue<java.lang.Runnable{ kotlinx.coroutines.RunnableKt.Runnable }> }");
LockFreeTaskQueueCore lockFreeTaskQueueCore = (LockFreeTaskQueueCore) obj;
int addLast = lockFreeTaskQueueCore.addLast(runnable);
if (addLast == 0) {
return true;
}
if (addLast == 1) {
AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0.m(_queue$FU, this, obj, lockFreeTaskQueueCore.next());
} else if (addLast == 2) {
return false;
}
} else {
symbol = EventLoop_commonKt.CLOSED_EMPTY;
if (obj == symbol) {
return false;
}
LockFreeTaskQueueCore lockFreeTaskQueueCore2 = new LockFreeTaskQueueCore(8, true);
Intrinsics.checkNotNull(obj, "null cannot be cast to non-null type java.lang.Runnable{ kotlinx.coroutines.RunnableKt.Runnable }");
lockFreeTaskQueueCore2.addLast((Runnable) obj);
lockFreeTaskQueueCore2.addLast(runnable);
if (AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0.m(_queue$FU, this, obj, lockFreeTaskQueueCore2)) {
return true;
}
}
}
}
public final Runnable dequeue() {
Symbol symbol;
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater = _queue$FU;
while (true) {
Object obj = atomicReferenceFieldUpdater.get(this);
if (obj == null) {
return null;
}
if (obj instanceof LockFreeTaskQueueCore) {
Intrinsics.checkNotNull(obj, "null cannot be cast to non-null type kotlinx.coroutines.internal.LockFreeTaskQueueCore<java.lang.Runnable{ kotlinx.coroutines.RunnableKt.Runnable }>{ kotlinx.coroutines.EventLoop_commonKt.Queue<java.lang.Runnable{ kotlinx.coroutines.RunnableKt.Runnable }> }");
LockFreeTaskQueueCore lockFreeTaskQueueCore = (LockFreeTaskQueueCore) obj;
Object removeFirstOrNull = lockFreeTaskQueueCore.removeFirstOrNull();
if (removeFirstOrNull != LockFreeTaskQueueCore.REMOVE_FROZEN) {
return (Runnable) removeFirstOrNull;
}
AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0.m(_queue$FU, this, obj, lockFreeTaskQueueCore.next());
} else {
symbol = EventLoop_commonKt.CLOSED_EMPTY;
if (obj == symbol) {
return null;
}
if (AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0.m(_queue$FU, this, obj, null)) {
Intrinsics.checkNotNull(obj, "null cannot be cast to non-null type java.lang.Runnable{ kotlinx.coroutines.RunnableKt.Runnable }");
return (Runnable) obj;
}
}
}
}
public final void closeQueue() {
Symbol symbol;
Symbol symbol2;
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater = _queue$FU;
while (true) {
Object obj = atomicReferenceFieldUpdater.get(this);
if (obj == null) {
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater2 = _queue$FU;
symbol = EventLoop_commonKt.CLOSED_EMPTY;
if (AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0.m(atomicReferenceFieldUpdater2, this, null, symbol)) {
return;
}
} else {
if (obj instanceof LockFreeTaskQueueCore) {
((LockFreeTaskQueueCore) obj).close();
return;
}
symbol2 = EventLoop_commonKt.CLOSED_EMPTY;
if (obj == symbol2) {
return;
}
LockFreeTaskQueueCore lockFreeTaskQueueCore = new LockFreeTaskQueueCore(8, true);
Intrinsics.checkNotNull(obj, "null cannot be cast to non-null type java.lang.Runnable{ kotlinx.coroutines.RunnableKt.Runnable }");
lockFreeTaskQueueCore.addLast((Runnable) obj);
if (AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0.m(_queue$FU, this, obj, lockFreeTaskQueueCore)) {
return;
}
}
}
}
public final void schedule(long j, DelayedTask delayedTask) {
int scheduleImpl = scheduleImpl(j, delayedTask);
if (scheduleImpl == 0) {
if (shouldUnpark(delayedTask)) {
unpark();
}
} else if (scheduleImpl == 1) {
reschedule(j, delayedTask);
} else if (scheduleImpl != 2) {
throw new IllegalStateException("unexpected result".toString());
}
}
public final boolean shouldUnpark(DelayedTask delayedTask) {
DelayedTaskQueue delayedTaskQueue = (DelayedTaskQueue) _delayed$FU.get(this);
return (delayedTaskQueue != null ? (DelayedTask) delayedTaskQueue.peek() : null) == delayedTask;
}
public final int scheduleImpl(long j, DelayedTask delayedTask) {
if (isCompleted()) {
return 1;
}
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater = _delayed$FU;
DelayedTaskQueue delayedTaskQueue = (DelayedTaskQueue) atomicReferenceFieldUpdater.get(this);
if (delayedTaskQueue == null) {
AbstractResolvableFuture$SafeAtomicHelper$$ExternalSyntheticBackportWithForwarding0.m(atomicReferenceFieldUpdater, this, null, new DelayedTaskQueue(j));
Object obj = atomicReferenceFieldUpdater.get(this);
Intrinsics.checkNotNull(obj);
delayedTaskQueue = (DelayedTaskQueue) obj;
}
return delayedTask.scheduleTask(j, delayedTaskQueue, this);
}
public final void resetAll() {
_queue$FU.set(this, null);
_delayed$FU.set(this, null);
}
public final void rescheduleAllDelayed() {
DelayedTask delayedTask;
AbstractTimeSourceKt.getTimeSource();
long nanoTime = System.nanoTime();
while (true) {
DelayedTaskQueue delayedTaskQueue = (DelayedTaskQueue) _delayed$FU.get(this);
if (delayedTaskQueue == null || (delayedTask = (DelayedTask) delayedTaskQueue.removeFirstOrNull()) == null) {
return;
} else {
reschedule(nanoTime, delayedTask);
}
}
}
public final class DelayedResumeTask extends DelayedTask {
public final CancellableContinuation cont;
public DelayedResumeTask(long j, CancellableContinuation cancellableContinuation) {
super(j);
this.cont = cancellableContinuation;
}
@Override // java.lang.Runnable
public void run() {
this.cont.resumeUndispatched(EventLoopImplBase.this, Unit.INSTANCE);
}
@Override // kotlinx.coroutines.EventLoopImplBase.DelayedTask
public String toString() {
return super.toString() + this.cont;
}
}
public static final class DelayedRunnableTask extends DelayedTask {
public final Runnable block;
public DelayedRunnableTask(long j, Runnable runnable) {
super(j);
this.block = runnable;
}
@Override // java.lang.Runnable
public void run() {
this.block.run();
}
@Override // kotlinx.coroutines.EventLoopImplBase.DelayedTask
public String toString() {
return super.toString() + this.block;
}
}
public static final class DelayedTaskQueue extends ThreadSafeHeap {
public long timeNow;
public DelayedTaskQueue(long j) {
this.timeNow = j;
}
}
}

View File

@@ -0,0 +1,21 @@
package kotlinx.coroutines;
import java.util.concurrent.locks.LockSupport;
import kotlinx.coroutines.EventLoopImplBase;
/* loaded from: classes5.dex */
public abstract class EventLoopImplPlatform extends EventLoop {
public abstract Thread getThread();
public final void unpark() {
Thread thread = getThread();
if (Thread.currentThread() != thread) {
AbstractTimeSourceKt.getTimeSource();
LockSupport.unpark(thread);
}
}
public void reschedule(long j, EventLoopImplBase.DelayedTask delayedTask) {
DefaultExecutor.INSTANCE.schedule(j, delayedTask);
}
}

View File

@@ -0,0 +1,8 @@
package kotlinx.coroutines;
/* loaded from: classes5.dex */
public abstract class EventLoopKt {
public static final EventLoop createEventLoop() {
return new BlockingEventLoop(Thread.currentThread());
}
}

View File

@@ -0,0 +1,19 @@
package kotlinx.coroutines;
import kotlinx.coroutines.internal.Symbol;
/* loaded from: classes5.dex */
public abstract class EventLoop_commonKt {
public static final Symbol DISPOSED_TASK = new Symbol("REMOVED_TASK");
public static final Symbol CLOSED_EMPTY = new Symbol("CLOSED_EMPTY");
public static final long delayToNanos(long j) {
if (j <= 0) {
return 0L;
}
if (j >= 9223372036854L) {
return Long.MAX_VALUE;
}
return 1000000 * j;
}
}

View File

@@ -0,0 +1,12 @@
package kotlinx.coroutines;
import java.util.concurrent.CancellationException;
/* loaded from: classes5.dex */
public abstract class ExceptionsKt {
public static final CancellationException CancellationException(String str, Throwable th) {
CancellationException cancellationException = new CancellationException(str);
cancellationException.initCause(th);
return cancellationException;
}
}

View File

@@ -0,0 +1,33 @@
package kotlinx.coroutines;
import java.io.Closeable;
import java.util.concurrent.Executor;
import kotlin.coroutines.AbstractCoroutineContextKey;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.DefaultConstructorMarker;
/* loaded from: classes5.dex */
public abstract class ExecutorCoroutineDispatcher extends CoroutineDispatcher implements Closeable {
public static final Key Key = new Key(null);
public abstract Executor getExecutor();
public static final class Key extends AbstractCoroutineContextKey {
public /* synthetic */ Key(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
public Key() {
super(CoroutineDispatcher.Key, new Function1() { // from class: kotlinx.coroutines.ExecutorCoroutineDispatcher.Key.1
@Override // kotlin.jvm.functions.Function1
public final ExecutorCoroutineDispatcher invoke(CoroutineContext.Element element) {
if (element instanceof ExecutorCoroutineDispatcher) {
return (ExecutorCoroutineDispatcher) element;
}
return null;
}
});
}
}
}

View File

@@ -0,0 +1,98 @@
package kotlinx.coroutines;
import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import kotlin.coroutines.CoroutineContext;
import kotlinx.coroutines.internal.ConcurrentKt;
/* loaded from: classes5.dex */
public final class ExecutorCoroutineDispatcherImpl extends ExecutorCoroutineDispatcher implements Delay {
public final Executor executor;
@Override // kotlinx.coroutines.ExecutorCoroutineDispatcher
public Executor getExecutor() {
return this.executor;
}
public ExecutorCoroutineDispatcherImpl(Executor executor) {
this.executor = executor;
ConcurrentKt.removeFutureOnCancel(getExecutor());
}
@Override // kotlinx.coroutines.CoroutineDispatcher
/* renamed from: dispatch */
public void mo4148dispatch(CoroutineContext coroutineContext, Runnable runnable) {
try {
Executor executor = getExecutor();
AbstractTimeSourceKt.getTimeSource();
executor.execute(runnable);
} catch (RejectedExecutionException e) {
AbstractTimeSourceKt.getTimeSource();
cancelJobOnRejection(coroutineContext, e);
Dispatchers.getIO().mo4148dispatch(coroutineContext, runnable);
}
}
@Override // kotlinx.coroutines.Delay
/* renamed from: scheduleResumeAfterDelay */
public void mo4149scheduleResumeAfterDelay(long j, CancellableContinuation cancellableContinuation) {
Executor executor = getExecutor();
ScheduledExecutorService scheduledExecutorService = executor instanceof ScheduledExecutorService ? (ScheduledExecutorService) executor : null;
ScheduledFuture scheduleBlock = scheduledExecutorService != null ? scheduleBlock(scheduledExecutorService, new ResumeUndispatchedRunnable(this, cancellableContinuation), cancellableContinuation.getContext(), j) : null;
if (scheduleBlock != null) {
JobKt.cancelFutureOnCancellation(cancellableContinuation, scheduleBlock);
} else {
DefaultExecutor.INSTANCE.mo4149scheduleResumeAfterDelay(j, cancellableContinuation);
}
}
@Override // kotlinx.coroutines.Delay
public DisposableHandle invokeOnTimeout(long j, Runnable runnable, CoroutineContext coroutineContext) {
Executor executor = getExecutor();
ScheduledExecutorService scheduledExecutorService = executor instanceof ScheduledExecutorService ? (ScheduledExecutorService) executor : null;
ScheduledFuture scheduleBlock = scheduledExecutorService != null ? scheduleBlock(scheduledExecutorService, runnable, coroutineContext, j) : null;
if (scheduleBlock != null) {
return new DisposableFutureHandle(scheduleBlock);
}
return DefaultExecutor.INSTANCE.invokeOnTimeout(j, runnable, coroutineContext);
}
public final ScheduledFuture scheduleBlock(ScheduledExecutorService scheduledExecutorService, Runnable runnable, CoroutineContext coroutineContext, long j) {
try {
return scheduledExecutorService.schedule(runnable, j, TimeUnit.MILLISECONDS);
} catch (RejectedExecutionException e) {
cancelJobOnRejection(coroutineContext, e);
return null;
}
}
public final void cancelJobOnRejection(CoroutineContext coroutineContext, RejectedExecutionException rejectedExecutionException) {
JobKt.cancel(coroutineContext, ExceptionsKt.CancellationException("The task was rejected", rejectedExecutionException));
}
@Override // java.io.Closeable, java.lang.AutoCloseable
public void close() {
Executor executor = getExecutor();
ExecutorService executorService = executor instanceof ExecutorService ? (ExecutorService) executor : null;
if (executorService != null) {
executorService.shutdown();
}
}
@Override // kotlinx.coroutines.CoroutineDispatcher
public String toString() {
return getExecutor().toString();
}
public boolean equals(Object obj) {
return (obj instanceof ExecutorCoroutineDispatcherImpl) && ((ExecutorCoroutineDispatcherImpl) obj).getExecutor() == getExecutor();
}
public int hashCode() {
return System.identityHashCode(getExecutor());
}
}

View File

@@ -0,0 +1,18 @@
package kotlinx.coroutines;
import java.util.concurrent.Executor;
/* loaded from: classes5.dex */
public abstract class ExecutorsKt {
public static final CoroutineDispatcher from(Executor executor) {
CoroutineDispatcher coroutineDispatcher;
DispatcherExecutor dispatcherExecutor = executor instanceof DispatcherExecutor ? (DispatcherExecutor) executor : null;
return (dispatcherExecutor == null || (coroutineDispatcher = dispatcherExecutor.dispatcher) == null) ? new ExecutorCoroutineDispatcherImpl(executor) : coroutineDispatcher;
}
public static final Executor asExecutor(CoroutineDispatcher coroutineDispatcher) {
Executor executor;
ExecutorCoroutineDispatcher executorCoroutineDispatcher = coroutineDispatcher instanceof ExecutorCoroutineDispatcher ? (ExecutorCoroutineDispatcher) coroutineDispatcher : null;
return (executorCoroutineDispatcher == null || (executor = executorCoroutineDispatcher.getExecutor()) == null) ? new DispatcherExecutor(coroutineDispatcher) : executor;
}
}

View File

@@ -0,0 +1,14 @@
package kotlinx.coroutines;
import kotlin.coroutines.CoroutineContext;
import kotlin.coroutines.EmptyCoroutineContext;
/* loaded from: classes5.dex */
public final class GlobalScope implements CoroutineScope {
public static final GlobalScope INSTANCE = new GlobalScope();
@Override // kotlinx.coroutines.CoroutineScope
public CoroutineContext getCoroutineContext() {
return EmptyCoroutineContext.INSTANCE;
}
}

View File

@@ -0,0 +1,24 @@
package kotlinx.coroutines;
/* loaded from: classes5.dex */
public final class InactiveNodeList implements Incomplete {
public final NodeList list;
@Override // kotlinx.coroutines.Incomplete
public NodeList getList() {
return this.list;
}
@Override // kotlinx.coroutines.Incomplete
public boolean isActive() {
return false;
}
public InactiveNodeList(NodeList nodeList) {
this.list = nodeList;
}
public String toString() {
return super.toString();
}
}

View File

@@ -0,0 +1,8 @@
package kotlinx.coroutines;
/* loaded from: classes5.dex */
public interface Incomplete {
NodeList getList();
boolean isActive();
}

View File

@@ -0,0 +1,10 @@
package kotlinx.coroutines;
/* loaded from: classes5.dex */
public final class IncompleteStateBox {
public final Incomplete state;
public IncompleteStateBox(Incomplete incomplete) {
this.state = incomplete;
}
}

View File

@@ -0,0 +1,28 @@
package kotlinx.coroutines;
import kotlin.Unit;
import kotlin.jvm.functions.Function1;
/* loaded from: classes5.dex */
public final class InvokeOnCancel extends CancelHandler {
public final Function1 handler;
@Override // kotlin.jvm.functions.Function1
public /* bridge */ /* synthetic */ Object invoke(Object obj) {
invoke((Throwable) obj);
return Unit.INSTANCE;
}
public InvokeOnCancel(Function1 function1) {
this.handler = function1;
}
@Override // kotlinx.coroutines.CancelHandlerBase
public void invoke(Throwable th) {
this.handler.invoke(th);
}
public String toString() {
return "InvokeOnCancel[" + DebugStringsKt.getClassSimpleName(this.handler) + '@' + DebugStringsKt.getHexAddress(this) + ']';
}
}

View File

@@ -0,0 +1,29 @@
package kotlinx.coroutines;
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
import kotlin.Unit;
import kotlin.jvm.functions.Function1;
/* loaded from: classes5.dex */
public final class InvokeOnCancelling extends JobCancellingNode {
public static final AtomicIntegerFieldUpdater _invoked$FU = AtomicIntegerFieldUpdater.newUpdater(InvokeOnCancelling.class, "_invoked");
private volatile int _invoked;
public final Function1 handler;
@Override // kotlin.jvm.functions.Function1
public /* bridge */ /* synthetic */ Object invoke(Object obj) {
invoke((Throwable) obj);
return Unit.INSTANCE;
}
public InvokeOnCancelling(Function1 function1) {
this.handler = function1;
}
@Override // kotlinx.coroutines.CompletionHandlerBase
public void invoke(Throwable th) {
if (_invoked$FU.compareAndSet(this, 0, 1)) {
this.handler.invoke(th);
}
}
}

View File

@@ -0,0 +1,24 @@
package kotlinx.coroutines;
import kotlin.Unit;
import kotlin.jvm.functions.Function1;
/* loaded from: classes5.dex */
public final class InvokeOnCompletion extends JobNode {
public final Function1 handler;
@Override // kotlin.jvm.functions.Function1
public /* bridge */ /* synthetic */ Object invoke(Object obj) {
invoke((Throwable) obj);
return Unit.INSTANCE;
}
public InvokeOnCompletion(Function1 function1) {
this.handler = function1;
}
@Override // kotlinx.coroutines.CompletionHandlerBase
public void invoke(Throwable th) {
this.handler.invoke(th);
}
}

View File

@@ -0,0 +1,79 @@
package kotlinx.coroutines;
import java.util.concurrent.CancellationException;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.functions.Function2;
/* loaded from: classes5.dex */
public interface Job extends CoroutineContext.Element {
public static final Key Key = Key.$$INSTANCE;
public static final class Key implements CoroutineContext.Key {
public static final /* synthetic */ Key $$INSTANCE = new Key();
}
ChildHandle attachChild(ChildJob childJob);
void cancel(CancellationException cancellationException);
CancellationException getCancellationException();
Job getParent();
DisposableHandle invokeOnCompletion(Function1 function1);
DisposableHandle invokeOnCompletion(boolean z, boolean z2, Function1 function1);
boolean isActive();
boolean isCancelled();
boolean isCompleted();
Object join(Continuation continuation);
boolean start();
public static final class DefaultImpls {
public static Object fold(Job job, Object obj, Function2 function2) {
return CoroutineContext.Element.DefaultImpls.fold(job, obj, function2);
}
public static CoroutineContext.Element get(Job job, CoroutineContext.Key key) {
return CoroutineContext.Element.DefaultImpls.get(job, key);
}
public static CoroutineContext minusKey(Job job, CoroutineContext.Key key) {
return CoroutineContext.Element.DefaultImpls.minusKey(job, key);
}
public static CoroutineContext plus(Job job, CoroutineContext coroutineContext) {
return CoroutineContext.Element.DefaultImpls.plus(job, coroutineContext);
}
public static /* synthetic */ void cancel$default(Job job, CancellationException cancellationException, int i, Object obj) {
if (obj != null) {
throw new UnsupportedOperationException("Super calls with default arguments not supported in this target, function: cancel");
}
if ((i & 1) != 0) {
cancellationException = null;
}
job.cancel(cancellationException);
}
public static /* synthetic */ DisposableHandle invokeOnCompletion$default(Job job, boolean z, boolean z2, Function1 function1, int i, Object obj) {
if (obj != null) {
throw new UnsupportedOperationException("Super calls with default arguments not supported in this target, function: invokeOnCompletion");
}
if ((i & 1) != 0) {
z = false;
}
if ((i & 2) != 0) {
z2 = true;
}
return job.invokeOnCompletion(z, z2, function1);
}
}
}

View File

@@ -0,0 +1,48 @@
package kotlinx.coroutines;
import java.util.concurrent.CancellationException;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes5.dex */
public final class JobCancellationException extends CancellationException {
public final transient Job job;
public JobCancellationException(String str, Throwable th, Job job) {
super(str);
this.job = job;
if (th != null) {
initCause(th);
}
}
@Override // java.lang.Throwable
public Throwable fillInStackTrace() {
setStackTrace(new StackTraceElement[0]);
return this;
}
@Override // java.lang.Throwable
public String toString() {
return super.toString() + "; job=" + this.job;
}
public boolean equals(Object obj) {
if (obj != this) {
if (obj instanceof JobCancellationException) {
JobCancellationException jobCancellationException = (JobCancellationException) obj;
if (!Intrinsics.areEqual(jobCancellationException.getMessage(), getMessage()) || !Intrinsics.areEqual(jobCancellationException.job, this.job) || !Intrinsics.areEqual(jobCancellationException.getCause(), getCause())) {
}
}
return false;
}
return true;
}
public int hashCode() {
String message = getMessage();
Intrinsics.checkNotNull(message);
int hashCode = ((message.hashCode() * 31) + this.job.hashCode()) * 31;
Throwable cause = getCause();
return hashCode + (cause != null ? cause.hashCode() : 0);
}
}

View File

@@ -0,0 +1,5 @@
package kotlinx.coroutines;
/* loaded from: classes5.dex */
public abstract class JobCancellingNode extends JobNode {
}

View File

@@ -0,0 +1,38 @@
package kotlinx.coroutines;
/* loaded from: classes5.dex */
public class JobImpl extends JobSupport implements CompletableJob {
public final boolean handlesException;
@Override // kotlinx.coroutines.JobSupport
public boolean getHandlesException$kotlinx_coroutines_core() {
return this.handlesException;
}
@Override // kotlinx.coroutines.JobSupport
public boolean getOnCancelComplete$kotlinx_coroutines_core() {
return true;
}
public JobImpl(Job job) {
super(true);
initParentJob(job);
this.handlesException = handlesException();
}
public final boolean handlesException() {
JobSupport job;
ChildHandle parentHandle$kotlinx_coroutines_core = getParentHandle$kotlinx_coroutines_core();
ChildHandleNode childHandleNode = parentHandle$kotlinx_coroutines_core instanceof ChildHandleNode ? (ChildHandleNode) parentHandle$kotlinx_coroutines_core : null;
if (childHandleNode != null && (job = childHandleNode.getJob()) != null) {
while (!job.getHandlesException$kotlinx_coroutines_core()) {
ChildHandle parentHandle$kotlinx_coroutines_core2 = job.getParentHandle$kotlinx_coroutines_core();
ChildHandleNode childHandleNode2 = parentHandle$kotlinx_coroutines_core2 instanceof ChildHandleNode ? (ChildHandleNode) parentHandle$kotlinx_coroutines_core2 : null;
if (childHandleNode2 != null && (job = childHandleNode2.getJob()) != null) {
}
}
return true;
}
return false;
}
}

View File

@@ -0,0 +1,37 @@
package kotlinx.coroutines;
import java.util.concurrent.CancellationException;
import java.util.concurrent.Future;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.CoroutineContext;
/* loaded from: classes5.dex */
public abstract class JobKt {
public static final CompletableJob Job(Job job) {
return JobKt__JobKt.Job(job);
}
public static final void cancel(CoroutineContext coroutineContext, CancellationException cancellationException) {
JobKt__JobKt.cancel(coroutineContext, cancellationException);
}
public static final Object cancelAndJoin(Job job, Continuation continuation) {
return JobKt__JobKt.cancelAndJoin(job, continuation);
}
public static final void cancelFutureOnCancellation(CancellableContinuation cancellableContinuation, Future future) {
JobKt__FutureKt.cancelFutureOnCancellation(cancellableContinuation, future);
}
public static final DisposableHandle disposeOnCompletion(Job job, DisposableHandle disposableHandle) {
return JobKt__JobKt.disposeOnCompletion(job, disposableHandle);
}
public static final void ensureActive(CoroutineContext coroutineContext) {
JobKt__JobKt.ensureActive(coroutineContext);
}
public static final void ensureActive(Job job) {
JobKt__JobKt.ensureActive(job);
}
}

View File

@@ -0,0 +1,10 @@
package kotlinx.coroutines;
import java.util.concurrent.Future;
/* loaded from: classes5.dex */
public abstract /* synthetic */ class JobKt__FutureKt {
public static final void cancelFutureOnCancellation(CancellableContinuation cancellableContinuation, Future future) {
cancellableContinuation.invokeOnCancellation(new CancelFutureOnCancel(future));
}
}

View File

@@ -0,0 +1,61 @@
package kotlinx.coroutines;
import java.util.concurrent.CancellationException;
import kotlin.Unit;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.CoroutineContext;
import kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsKt;
import kotlinx.coroutines.Job;
/* loaded from: classes5.dex */
public abstract /* synthetic */ class JobKt__JobKt {
public static final CompletableJob Job(Job job) {
return new JobImpl(job);
}
public static /* synthetic */ CompletableJob Job$default(Job job, int i, Object obj) {
if ((i & 1) != 0) {
job = null;
}
return JobKt.Job(job);
}
public static final DisposableHandle disposeOnCompletion(Job job, DisposableHandle disposableHandle) {
return job.invokeOnCompletion(new DisposeOnCompletion(disposableHandle));
}
public static final Object cancelAndJoin(Job job, Continuation continuation) {
Object coroutine_suspended;
Job.DefaultImpls.cancel$default(job, null, 1, null);
Object join = job.join(continuation);
coroutine_suspended = IntrinsicsKt__IntrinsicsKt.getCOROUTINE_SUSPENDED();
return join == coroutine_suspended ? join : Unit.INSTANCE;
}
public static /* synthetic */ void cancel$default(CoroutineContext coroutineContext, CancellationException cancellationException, int i, Object obj) {
if ((i & 1) != 0) {
cancellationException = null;
}
JobKt.cancel(coroutineContext, cancellationException);
}
public static final void cancel(CoroutineContext coroutineContext, CancellationException cancellationException) {
Job job = (Job) coroutineContext.get(Job.Key);
if (job != null) {
job.cancel(cancellationException);
}
}
public static final void ensureActive(Job job) {
if (!job.isActive()) {
throw job.getCancellationException();
}
}
public static final void ensureActive(CoroutineContext coroutineContext) {
Job job = (Job) coroutineContext.get(Job.Key);
if (job != null) {
JobKt.ensureActive(job);
}
}
}

View File

@@ -0,0 +1,41 @@
package kotlinx.coroutines;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes5.dex */
public abstract class JobNode extends CompletionHandlerBase implements DisposableHandle, Incomplete {
public JobSupport job;
@Override // kotlinx.coroutines.Incomplete
public NodeList getList() {
return null;
}
@Override // kotlinx.coroutines.Incomplete
public boolean isActive() {
return true;
}
public final void setJob(JobSupport jobSupport) {
this.job = jobSupport;
}
public final JobSupport getJob() {
JobSupport jobSupport = this.job;
if (jobSupport != null) {
return jobSupport;
}
Intrinsics.throwUninitializedPropertyAccessException("job");
return null;
}
@Override // kotlinx.coroutines.DisposableHandle
public void dispose() {
getJob().removeNode$kotlinx_coroutines_core(this);
}
@Override // kotlinx.coroutines.internal.LockFreeLinkedListNode
public String toString() {
return DebugStringsKt.getClassSimpleName(this) + '@' + DebugStringsKt.getHexAddress(this) + "[job@" + DebugStringsKt.getHexAddress(getJob()) + ']';
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,24 @@
package kotlinx.coroutines;
import kotlinx.coroutines.internal.Symbol;
/* loaded from: classes5.dex */
public abstract class JobSupportKt {
public static final Symbol COMPLETING_ALREADY = new Symbol("COMPLETING_ALREADY");
public static final Symbol COMPLETING_WAITING_CHILDREN = new Symbol("COMPLETING_WAITING_CHILDREN");
public static final Symbol COMPLETING_RETRY = new Symbol("COMPLETING_RETRY");
public static final Symbol TOO_LATE_TO_CANCEL = new Symbol("TOO_LATE_TO_CANCEL");
public static final Symbol SEALED = new Symbol("SEALED");
public static final Empty EMPTY_NEW = new Empty(false);
public static final Empty EMPTY_ACTIVE = new Empty(true);
public static final Object boxIncomplete(Object obj) {
return obj instanceof Incomplete ? new IncompleteStateBox((Incomplete) obj) : obj;
}
public static final Object unboxState(Object obj) {
Incomplete incomplete;
IncompleteStateBox incompleteStateBox = obj instanceof IncompleteStateBox ? (IncompleteStateBox) obj : null;
return (incompleteStateBox == null || (incomplete = incompleteStateBox.state) == null) ? obj : incomplete;
}
}

View File

@@ -0,0 +1,24 @@
package kotlinx.coroutines;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.CoroutineContext;
import kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsJvmKt;
import kotlin.jvm.functions.Function2;
import kotlinx.coroutines.intrinsics.CancellableKt;
/* loaded from: classes5.dex */
public final class LazyDeferredCoroutine extends DeferredCoroutine {
public final Continuation continuation;
public LazyDeferredCoroutine(CoroutineContext coroutineContext, Function2 function2) {
super(coroutineContext, false);
Continuation createCoroutineUnintercepted;
createCoroutineUnintercepted = IntrinsicsKt__IntrinsicsJvmKt.createCoroutineUnintercepted(function2, this, this);
this.continuation = createCoroutineUnintercepted;
}
@Override // kotlinx.coroutines.JobSupport
public void onStart() {
CancellableKt.startCoroutineCancellable(this.continuation, this);
}
}

View File

@@ -0,0 +1,24 @@
package kotlinx.coroutines;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.CoroutineContext;
import kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsJvmKt;
import kotlin.jvm.functions.Function2;
import kotlinx.coroutines.intrinsics.CancellableKt;
/* loaded from: classes5.dex */
public final class LazyStandaloneCoroutine extends StandaloneCoroutine {
public final Continuation continuation;
public LazyStandaloneCoroutine(CoroutineContext coroutineContext, Function2 function2) {
super(coroutineContext, false);
Continuation createCoroutineUnintercepted;
createCoroutineUnintercepted = IntrinsicsKt__IntrinsicsJvmKt.createCoroutineUnintercepted(function2, this, this);
this.continuation = createCoroutineUnintercepted;
}
@Override // kotlinx.coroutines.JobSupport
public void onStart() {
CancellableKt.startCoroutineCancellable(this.continuation, this);
}
}

View File

@@ -0,0 +1,31 @@
package kotlinx.coroutines;
import kotlinx.coroutines.internal.LimitedDispatcherKt;
/* loaded from: classes5.dex */
public abstract class MainCoroutineDispatcher extends CoroutineDispatcher {
public abstract MainCoroutineDispatcher getImmediate();
@Override // kotlinx.coroutines.CoroutineDispatcher
public CoroutineDispatcher limitedParallelism(int i) {
LimitedDispatcherKt.checkParallelism(i);
return this;
}
public final String toStringInternalImpl() {
MainCoroutineDispatcher mainCoroutineDispatcher;
MainCoroutineDispatcher main = Dispatchers.getMain();
if (this == main) {
return "Dispatchers.Main";
}
try {
mainCoroutineDispatcher = main.getImmediate();
} catch (UnsupportedOperationException unused) {
mainCoroutineDispatcher = null;
}
if (this == mainCoroutineDispatcher) {
return "Dispatchers.Main.immediate";
}
return null;
}
}

View File

@@ -0,0 +1,21 @@
package kotlinx.coroutines;
import kotlinx.coroutines.internal.LockFreeLinkedListHead;
/* loaded from: classes5.dex */
public final class NodeList extends LockFreeLinkedListHead implements Incomplete {
@Override // kotlinx.coroutines.Incomplete
public NodeList getList() {
return this;
}
@Override // kotlinx.coroutines.Incomplete
public boolean isActive() {
return true;
}
@Override // kotlinx.coroutines.internal.LockFreeLinkedListNode
public String toString() {
return super.toString();
}
}

View File

@@ -0,0 +1,68 @@
package kotlinx.coroutines;
import java.util.concurrent.CancellationException;
import kotlin.coroutines.AbstractCoroutineContextElement;
import kotlin.coroutines.Continuation;
import kotlin.jvm.functions.Function1;
/* loaded from: classes5.dex */
public final class NonCancellable extends AbstractCoroutineContextElement implements Job {
public static final NonCancellable INSTANCE = new NonCancellable();
@Override // kotlinx.coroutines.Job
public void cancel(CancellationException cancellationException) {
}
@Override // kotlinx.coroutines.Job
public Job getParent() {
return null;
}
@Override // kotlinx.coroutines.Job
public boolean isActive() {
return true;
}
@Override // kotlinx.coroutines.Job
public boolean isCancelled() {
return false;
}
@Override // kotlinx.coroutines.Job
public boolean start() {
return false;
}
public String toString() {
return "NonCancellable";
}
public NonCancellable() {
super(Job.Key);
}
@Override // kotlinx.coroutines.Job
public Object join(Continuation continuation) {
throw new UnsupportedOperationException("This job is always active");
}
@Override // kotlinx.coroutines.Job
public CancellationException getCancellationException() {
throw new IllegalStateException("This job is always active");
}
@Override // kotlinx.coroutines.Job
public DisposableHandle invokeOnCompletion(Function1 function1) {
return NonDisposableHandle.INSTANCE;
}
@Override // kotlinx.coroutines.Job
public DisposableHandle invokeOnCompletion(boolean z, boolean z2, Function1 function1) {
return NonDisposableHandle.INSTANCE;
}
@Override // kotlinx.coroutines.Job
public ChildHandle attachChild(ChildJob childJob) {
return NonDisposableHandle.INSTANCE;
}
}

View File

@@ -0,0 +1,24 @@
package kotlinx.coroutines;
/* loaded from: classes5.dex */
public final class NonDisposableHandle implements DisposableHandle, ChildHandle {
public static final NonDisposableHandle INSTANCE = new NonDisposableHandle();
@Override // kotlinx.coroutines.ChildHandle
public boolean childCancelled(Throwable th) {
return false;
}
@Override // kotlinx.coroutines.DisposableHandle
public void dispose() {
}
@Override // kotlinx.coroutines.ChildHandle
public Job getParent() {
return null;
}
public String toString() {
return "NonDisposableHandle";
}
}

View File

@@ -0,0 +1,5 @@
package kotlinx.coroutines;
/* loaded from: classes5.dex */
public interface NotCompleted {
}

View File

@@ -0,0 +1,8 @@
package kotlinx.coroutines;
import java.util.concurrent.CancellationException;
/* loaded from: classes5.dex */
public interface ParentJob extends Job {
CancellationException getChildJobCancellationCause();
}

View File

@@ -0,0 +1,34 @@
package kotlinx.coroutines;
import kotlin.Result;
import kotlin.ResultKt;
import kotlin.Unit;
/* loaded from: classes5.dex */
public final class ResumeAwaitOnCompletion extends JobNode {
public final CancellableContinuationImpl continuation;
@Override // kotlin.jvm.functions.Function1
public /* bridge */ /* synthetic */ Object invoke(Object obj) {
invoke((Throwable) obj);
return Unit.INSTANCE;
}
public ResumeAwaitOnCompletion(CancellableContinuationImpl cancellableContinuationImpl) {
this.continuation = cancellableContinuationImpl;
}
@Override // kotlinx.coroutines.CompletionHandlerBase
public void invoke(Throwable th) {
Object state$kotlinx_coroutines_core = getJob().getState$kotlinx_coroutines_core();
if (state$kotlinx_coroutines_core instanceof CompletedExceptionally) {
CancellableContinuationImpl cancellableContinuationImpl = this.continuation;
Result.Companion companion = Result.Companion;
cancellableContinuationImpl.resumeWith(Result.m4060constructorimpl(ResultKt.createFailure(((CompletedExceptionally) state$kotlinx_coroutines_core).cause)));
} else {
CancellableContinuationImpl cancellableContinuationImpl2 = this.continuation;
Result.Companion companion2 = Result.Companion;
cancellableContinuationImpl2.resumeWith(Result.m4060constructorimpl(JobSupportKt.unboxState(state$kotlinx_coroutines_core)));
}
}
}

View File

@@ -0,0 +1,27 @@
package kotlinx.coroutines;
import kotlin.Result;
import kotlin.Unit;
import kotlin.coroutines.Continuation;
/* loaded from: classes5.dex */
public final class ResumeOnCompletion extends JobNode {
public final Continuation continuation;
@Override // kotlin.jvm.functions.Function1
public /* bridge */ /* synthetic */ Object invoke(Object obj) {
invoke((Throwable) obj);
return Unit.INSTANCE;
}
public ResumeOnCompletion(Continuation continuation) {
this.continuation = continuation;
}
@Override // kotlinx.coroutines.CompletionHandlerBase
public void invoke(Throwable th) {
Continuation continuation = this.continuation;
Result.Companion companion = Result.Companion;
continuation.resumeWith(Result.m4060constructorimpl(Unit.INSTANCE));
}
}

View File

@@ -0,0 +1,19 @@
package kotlinx.coroutines;
import kotlin.Unit;
/* loaded from: classes5.dex */
public final class ResumeUndispatchedRunnable implements Runnable {
public final CancellableContinuation continuation;
public final CoroutineDispatcher dispatcher;
public ResumeUndispatchedRunnable(CoroutineDispatcher coroutineDispatcher, CancellableContinuation cancellableContinuation) {
this.dispatcher = coroutineDispatcher;
this.continuation = cancellableContinuation;
}
@Override // java.lang.Runnable
public void run() {
this.continuation.resumeUndispatched(this.dispatcher, Unit.INSTANCE);
}
}

View File

@@ -0,0 +1,16 @@
package kotlinx.coroutines;
import kotlin.coroutines.CoroutineContext;
/* loaded from: classes5.dex */
public class StandaloneCoroutine extends AbstractCoroutine {
public StandaloneCoroutine(CoroutineContext coroutineContext, boolean z) {
super(coroutineContext, true, z);
}
@Override // kotlinx.coroutines.JobSupport
public boolean handleJobException(Throwable th) {
CoroutineExceptionHandlerKt.handleCoroutineException(getContext(), th);
return true;
}
}

View File

@@ -0,0 +1,13 @@
package kotlinx.coroutines;
/* loaded from: classes5.dex */
public final class SupervisorJobImpl extends JobImpl {
@Override // kotlinx.coroutines.JobSupport
public boolean childCancelled(Throwable th) {
return false;
}
public SupervisorJobImpl(Job job) {
super(job);
}
}

View File

@@ -0,0 +1,15 @@
package kotlinx.coroutines;
/* loaded from: classes5.dex */
public abstract class SupervisorKt {
public static final CompletableJob SupervisorJob(Job job) {
return new SupervisorJobImpl(job);
}
public static /* synthetic */ CompletableJob SupervisorJob$default(Job job, int i, Object obj) {
if ((i & 1) != 0) {
job = null;
}
return SupervisorJob(job);
}
}

Some files were not shown because too many files have changed in this diff Show More