Primer paso de la investigacion. Se aportan el .apk, las carpetas con el apk extraido y el apk descompilado. El archivo API_DOCUMENTATION.md es un archivo donde se anotaran los descubrimientos del funcionamiento de la API, y los .py son scripts para probar la funcionalidad de la API con los métodos que vayamos encontrando. Finalmente, los archivos .js son scripts de Frida para extraer informacion de la APP durante la ejecucion.

This commit is contained in:
2025-12-04 13:59:54 +01:00
parent f2fd1c3bf5
commit e0133d2ca2
10432 changed files with 1019085 additions and 1 deletions

View File

@@ -0,0 +1,603 @@
package kotlinx.coroutines;
import com.google.firebase.analytics.FirebaseAnalytics;
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
import kotlin.Deprecated;
import kotlin.DeprecationLevel;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.JvmField;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.SourceDebugExtension;
import kotlin.time.DurationKt;
import kotlinx.coroutines.Delay;
import kotlinx.coroutines.internal.LockFreeTaskQueueCore;
import kotlinx.coroutines.internal.Symbol;
import kotlinx.coroutines.internal.ThreadSafeHeap;
import kotlinx.coroutines.internal.ThreadSafeHeapNode;
@Metadata(d1 = {"\u0000l\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0006\n\u0002\u0010\t\n\u0002\b\u0003\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\n\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0007\b \u0018\u00002\u00020\u00012\u00020\u0002:\u00043456B\u0005¢\u0006\u0002\u0010\u0003J\b\u0010\u0016\u001a\u00020\u0017H\u0002J\u0010\u0010\u0018\u001a\n\u0018\u00010\u0019j\u0004\u0018\u0001`\u001aH\u0002J\u001a\u0010\u001b\u001a\u00020\u00172\u0006\u0010\u001c\u001a\u00020\u001d2\n\u0010\u001e\u001a\u00060\u0019j\u0002`\u001aJ\u0014\u0010\u001f\u001a\u00020\u00172\n\u0010 \u001a\u00060\u0019j\u0002`\u001aH\u0016J\u0014\u0010!\u001a\u00020\f2\n\u0010 \u001a\u00060\u0019j\u0002`\u001aH\u0002J\b\u0010\"\u001a\u00020\u0013H\u0016J\b\u0010#\u001a\u00020\u0017H\u0002J\b\u0010$\u001a\u00020\u0017H\u0004J\u0016\u0010%\u001a\u00020\u00172\u0006\u0010&\u001a\u00020\u00132\u0006\u0010'\u001a\u00020(J\u0018\u0010)\u001a\u00020*2\u0006\u0010&\u001a\u00020\u00132\u0006\u0010'\u001a\u00020(H\u0002J\u001c\u0010+\u001a\u00020,2\u0006\u0010-\u001a\u00020\u00132\n\u0010\u001e\u001a\u00060\u0019j\u0002`\u001aH\u0004J\u001e\u0010.\u001a\u00020\u00172\u0006\u0010-\u001a\u00020\u00132\f\u0010/\u001a\b\u0012\u0004\u0012\u00020\u001700H\u0016J\u0010\u00101\u001a\u00020\f2\u0006\u0010 \u001a\u00020(H\u0002J\b\u00102\u001a\u00020\u0017H\u0016R\u0011\u0010\u0004\u001a\n\u0012\u0006\u0012\u0004\u0018\u00010\u00060\u0005X\u0082\u0004R\t\u0010\u0007\u001a\u00020\bX\u0082\u0004R\u0011\u0010\t\u001a\n\u0012\u0006\u0012\u0004\u0018\u00010\n0\u0005X\u0082\u0004R$\u0010\r\u001a\u00020\f2\u0006\u0010\u000b\u001a\u00020\f8B@BX\u0082\u000e¢\u0006\f\u001a\u0004\b\r\u0010\u000e\"\u0004\b\u000f\u0010\u0010R\u0014\u0010\u0011\u001a\u00020\f8TX\u0094\u0004¢\u0006\u0006\u001a\u0004\b\u0011\u0010\u000eR\u0014\u0010\u0012\u001a\u00020\u00138TX\u0094\u0004¢\u0006\u0006\u001a\u0004\b\u0014\u0010\u0015¨\u00067"}, d2 = {"Lkotlinx/coroutines/EventLoopImplBase;", "Lkotlinx/coroutines/EventLoopImplPlatform;", "Lkotlinx/coroutines/Delay;", "()V", "_delayed", "Lkotlinx/atomicfu/AtomicRef;", "Lkotlinx/coroutines/EventLoopImplBase$DelayedTaskQueue;", "_isCompleted", "Lkotlinx/atomicfu/AtomicBoolean;", "_queue", "", "value", "", "isCompleted", "()Z", "setCompleted", "(Z)V", "isEmpty", "nextTime", "", "getNextTime", "()J", "closeQueue", "", "dequeue", "Ljava/lang/Runnable;", "Lkotlinx/coroutines/Runnable;", "dispatch", "context", "Lkotlin/coroutines/CoroutineContext;", "block", "enqueue", "task", "enqueueImpl", "processNextEvent", "rescheduleAllDelayed", "resetAll", "schedule", "now", "delayedTask", "Lkotlinx/coroutines/EventLoopImplBase$DelayedTask;", "scheduleImpl", "", "scheduleInvokeOnTimeout", "Lkotlinx/coroutines/DisposableHandle;", "timeMillis", "scheduleResumeAfterDelay", "continuation", "Lkotlinx/coroutines/CancellableContinuation;", "shouldUnpark", "shutdown", "DelayedResumeTask", "DelayedRunnableTask", "DelayedTask", "DelayedTaskQueue", "kotlinx-coroutines-core"}, k = 1, mv = {1, 9, 0}, xi = 48)
@SourceDebugExtension({"SMAP\nEventLoop.common.kt\nKotlin\n*S Kotlin\n*F\n+ 1 EventLoop.common.kt\nkotlinx/coroutines/EventLoopImplBase\n+ 2 ThreadSafeHeap.kt\nkotlinx/coroutines/internal/ThreadSafeHeap\n+ 3 Synchronized.common.kt\nkotlinx/coroutines/internal/Synchronized_commonKt\n+ 4 Synchronized.kt\nkotlinx/coroutines/internal/SynchronizedKt\n+ 5 EventLoop.kt\nkotlinx/coroutines/EventLoopKt\n+ 6 fake.kt\nkotlin/jvm/internal/FakeKt\n*L\n1#1,544:1\n60#2:545\n61#2,7:551\n28#3,4:546\n20#4:550\n57#5:558\n1#6:559\n*S KotlinDebug\n*F\n+ 1 EventLoop.common.kt\nkotlinx/coroutines/EventLoopImplBase\n*L\n270#1:545\n270#1:551,7\n270#1:546,4\n270#1:550\n281#1:558\n*E\n"})
/* loaded from: classes3.dex */
public abstract class EventLoopImplBase extends EventLoopImplPlatform implements Delay {
private volatile /* synthetic */ Object _delayed$volatile;
private volatile /* synthetic */ int _isCompleted$volatile = 0;
private volatile /* synthetic */ Object _queue$volatile;
private static final /* synthetic */ AtomicReferenceFieldUpdater _queue$volatile$FU = AtomicReferenceFieldUpdater.newUpdater(EventLoopImplBase.class, Object.class, "_queue$volatile");
private static final /* synthetic */ AtomicReferenceFieldUpdater _delayed$volatile$FU = AtomicReferenceFieldUpdater.newUpdater(EventLoopImplBase.class, Object.class, "_delayed$volatile");
private static final /* synthetic */ AtomicIntegerFieldUpdater _isCompleted$volatile$FU = AtomicIntegerFieldUpdater.newUpdater(EventLoopImplBase.class, "_isCompleted$volatile");
@Metadata(d1 = {"\u0000\"\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\t\n\u0000\n\u0002\u0018\u0002\n\u0002\u0010\u0002\n\u0002\b\u0003\n\u0002\u0010\u000e\n\u0000\b\u0082\u0004\u0018\u00002\u00020\u0001B\u001b\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\f\u0010\u0004\u001a\b\u0012\u0004\u0012\u00020\u00060\u0005¢\u0006\u0002\u0010\u0007J\b\u0010\b\u001a\u00020\u0006H\u0016J\b\u0010\t\u001a\u00020\nH\u0016R\u0014\u0010\u0004\u001a\b\u0012\u0004\u0012\u00020\u00060\u0005X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\u000b"}, d2 = {"Lkotlinx/coroutines/EventLoopImplBase$DelayedResumeTask;", "Lkotlinx/coroutines/EventLoopImplBase$DelayedTask;", "nanoTime", "", "cont", "Lkotlinx/coroutines/CancellableContinuation;", "", "(Lkotlinx/coroutines/EventLoopImplBase;JLkotlinx/coroutines/CancellableContinuation;)V", "run", "toString", "", "kotlinx-coroutines-core"}, k = 1, mv = {1, 9, 0}, xi = 48)
@SourceDebugExtension({"SMAP\nEventLoop.common.kt\nKotlin\n*S Kotlin\n*F\n+ 1 EventLoop.common.kt\nkotlinx/coroutines/EventLoopImplBase$DelayedResumeTask\n+ 2 fake.kt\nkotlin/jvm/internal/FakeKt\n*L\n1#1,544:1\n1#2:545\n*E\n"})
/* loaded from: classes3.dex */
public final class DelayedResumeTask extends DelayedTask {
private final CancellableContinuation<Unit> cont;
/* JADX WARN: Multi-variable type inference failed */
public DelayedResumeTask(long j4, CancellableContinuation<? super Unit> cancellableContinuation) {
super(j4);
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;
}
}
@Metadata(d1 = {"\u0000(\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\t\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0000\n\u0002\u0010\u000e\n\u0000\b\u0002\u0018\u00002\u00020\u0001B\u0019\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\n\u0010\u0004\u001a\u00060\u0005j\u0002`\u0006¢\u0006\u0002\u0010\u0007J\b\u0010\b\u001a\u00020\tH\u0016J\b\u0010\n\u001a\u00020\u000bH\u0016R\u0012\u0010\u0004\u001a\u00060\u0005j\u0002`\u0006X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\f"}, d2 = {"Lkotlinx/coroutines/EventLoopImplBase$DelayedRunnableTask;", "Lkotlinx/coroutines/EventLoopImplBase$DelayedTask;", "nanoTime", "", "block", "Ljava/lang/Runnable;", "Lkotlinx/coroutines/Runnable;", "(JLjava/lang/Runnable;)V", "run", "", "toString", "", "kotlinx-coroutines-core"}, k = 1, mv = {1, 9, 0}, xi = 48)
/* loaded from: classes3.dex */
public static final class DelayedRunnableTask extends DelayedTask {
private final Runnable block;
public DelayedRunnableTask(long j4, Runnable runnable) {
super(j4);
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;
}
}
@Metadata(d1 = {"\u0000Z\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u000f\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\t\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0010\b\n\u0002\b\u0007\n\u0002\u0010\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0000\n\u0002\u0010\u000e\n\u0000\b \u0018\u00002\u00060\u0001j\u0002`\u00022\b\u0012\u0004\u0012\u00020\u00000\u00032\u00020\u00042\u00020\u00052\u00060\u0006j\u0002`\u0007B\r\u0012\u0006\u0010\b\u001a\u00020\t¢\u0006\u0002\u0010\nJ\u0011\u0010\u0019\u001a\u00020\u00142\u0006\u0010\u001a\u001a\u00020\u0000H\u0096\u0002J\u0006\u0010\u001b\u001a\u00020\u001cJ\u001e\u0010\u001d\u001a\u00020\u00142\u0006\u0010\u001e\u001a\u00020\t2\u0006\u0010\u001f\u001a\u00020 2\u0006\u0010!\u001a\u00020\"J\u000e\u0010#\u001a\u00020$2\u0006\u0010\u001e\u001a\u00020\tJ\b\u0010%\u001a\u00020&H\u0016R\u0010\u0010\u000b\u001a\u0004\u0018\u00010\u0006X\u0082\u000e¢\u0006\u0002\n\u0000R0\u0010\u000e\u001a\b\u0012\u0002\b\u0003\u0018\u00010\r2\f\u0010\f\u001a\b\u0012\u0002\b\u0003\u0018\u00010\r8V@VX\u0096\u000e¢\u0006\f\u001a\u0004\b\u000f\u0010\u0010\"\u0004\b\u0011\u0010\u0012R\u001a\u0010\u0013\u001a\u00020\u0014X\u0096\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u0015\u0010\u0016\"\u0004\b\u0017\u0010\u0018R\u0012\u0010\b\u001a\u00020\t8\u0006@\u0006X\u0087\u000e¢\u0006\u0002\n\u0000¨\u0006'"}, d2 = {"Lkotlinx/coroutines/EventLoopImplBase$DelayedTask;", "Ljava/lang/Runnable;", "Lkotlinx/coroutines/Runnable;", "", "Lkotlinx/coroutines/DisposableHandle;", "Lkotlinx/coroutines/internal/ThreadSafeHeapNode;", "", "Lkotlinx/coroutines/internal/SynchronizedObject;", "nanoTime", "", "(J)V", "_heap", "value", "Lkotlinx/coroutines/internal/ThreadSafeHeap;", "heap", "getHeap", "()Lkotlinx/coroutines/internal/ThreadSafeHeap;", "setHeap", "(Lkotlinx/coroutines/internal/ThreadSafeHeap;)V", FirebaseAnalytics.Param.INDEX, "", "getIndex", "()I", "setIndex", "(I)V", "compareTo", "other", "dispose", "", "scheduleTask", "now", "delayed", "Lkotlinx/coroutines/EventLoopImplBase$DelayedTaskQueue;", "eventLoop", "Lkotlinx/coroutines/EventLoopImplBase;", "timeToExecute", "", "toString", "", "kotlinx-coroutines-core"}, k = 1, mv = {1, 9, 0}, xi = 48)
@SourceDebugExtension({"SMAP\nEventLoop.common.kt\nKotlin\n*S Kotlin\n*F\n+ 1 EventLoop.common.kt\nkotlinx/coroutines/EventLoopImplBase$DelayedTask\n+ 2 Synchronized.common.kt\nkotlinx/coroutines/internal/Synchronized_commonKt\n+ 3 Synchronized.kt\nkotlinx/coroutines/internal/SynchronizedKt\n+ 4 ThreadSafeHeap.kt\nkotlinx/coroutines/internal/ThreadSafeHeap\n*L\n1#1,544:1\n28#2,4:545\n28#2,4:551\n28#2,4:563\n20#3:549\n20#3:555\n20#3:567\n72#4:550\n73#4,7:556\n*S KotlinDebug\n*F\n+ 1 EventLoop.common.kt\nkotlinx/coroutines/EventLoopImplBase$DelayedTask\n*L\n438#1:545,4\n440#1:551,4\n480#1:563,4\n438#1:549\n440#1:555\n480#1:567\n440#1:550\n440#1:556,7\n*E\n"})
/* loaded from: classes3.dex */
public static abstract class DelayedTask implements Runnable, Comparable<DelayedTask>, DisposableHandle, ThreadSafeHeapNode {
private volatile Object _heap;
private int index = -1;
@JvmField
public long nanoTime;
public DelayedTask(long j4) {
this.nanoTime = j4;
}
@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;
}
}
}
@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 int getIndex() {
return this.index;
}
public final int scheduleTask(long now, DelayedTaskQueue delayed, EventLoopImplBase eventLoop) {
Symbol symbol;
synchronized (this) {
Object obj = this._heap;
symbol = EventLoop_commonKt.DISPOSED_TASK;
if (obj == symbol) {
return 2;
}
synchronized (delayed) {
try {
DelayedTask firstImpl = delayed.firstImpl();
if (eventLoop.isCompleted()) {
return 1;
}
if (firstImpl == null) {
delayed.timeNow = now;
} else {
long j4 = firstImpl.nanoTime;
if (j4 - now < 0) {
now = j4;
}
if (now - delayed.timeNow > 0) {
delayed.timeNow = now;
}
}
long j5 = this.nanoTime;
long j6 = delayed.timeNow;
if (j5 - j6 < 0) {
this.nanoTime = j6;
}
delayed.addImpl(this);
return 0;
} catch (Throwable th) {
throw th;
}
}
}
}
@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.");
}
this._heap = threadSafeHeap;
}
@Override // kotlinx.coroutines.internal.ThreadSafeHeapNode
public void setIndex(int i) {
this.index = i;
}
public final boolean timeToExecute(long now) {
return now - this.nanoTime >= 0;
}
public String toString() {
return "Delayed[nanos=" + this.nanoTime + ']';
}
@Override // java.lang.Comparable
public int compareTo(DelayedTask other) {
long j4 = this.nanoTime - other.nanoTime;
if (j4 > 0) {
return 1;
}
return j4 < 0 ? -1 : 0;
}
}
@Metadata(d1 = {"\u0000\u0016\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\t\n\u0002\b\u0002\b\u0000\u0018\u00002\b\u0012\u0004\u0012\u00020\u00020\u0001B\r\u0012\u0006\u0010\u0003\u001a\u00020\u0004¢\u0006\u0002\u0010\u0005R\u0012\u0010\u0003\u001a\u00020\u00048\u0006@\u0006X\u0087\u000e¢\u0006\u0002\n\u0000¨\u0006\u0006"}, d2 = {"Lkotlinx/coroutines/EventLoopImplBase$DelayedTaskQueue;", "Lkotlinx/coroutines/internal/ThreadSafeHeap;", "Lkotlinx/coroutines/EventLoopImplBase$DelayedTask;", "timeNow", "", "(J)V", "kotlinx-coroutines-core"}, k = 1, mv = {1, 9, 0}, xi = 48)
/* loaded from: classes3.dex */
public static final class DelayedTaskQueue extends ThreadSafeHeap<DelayedTask> {
@JvmField
public long timeNow;
public DelayedTaskQueue(long j4) {
this.timeNow = j4;
}
}
private final void closeQueue() {
Symbol symbol;
Symbol symbol2;
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater = _queue$volatile$FU;
while (true) {
Object obj = atomicReferenceFieldUpdater.get(this);
if (obj == null) {
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater2 = _queue$volatile$FU;
symbol = EventLoop_commonKt.CLOSED_EMPTY;
while (!atomicReferenceFieldUpdater2.compareAndSet(this, null, symbol)) {
if (atomicReferenceFieldUpdater2.get(this) != null) {
break;
}
}
return;
}
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);
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater3 = _queue$volatile$FU;
while (!atomicReferenceFieldUpdater3.compareAndSet(this, obj, lockFreeTaskQueueCore)) {
if (atomicReferenceFieldUpdater3.get(this) != obj) {
break;
}
}
return;
}
}
private final Runnable dequeue() {
Symbol symbol;
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater = _queue$volatile$FU;
while (true) {
Object obj = atomicReferenceFieldUpdater.get(this);
if (obj == null) {
return null;
}
if (!(obj instanceof LockFreeTaskQueueCore)) {
symbol = EventLoop_commonKt.CLOSED_EMPTY;
if (obj == symbol) {
return null;
}
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater2 = _queue$volatile$FU;
while (!atomicReferenceFieldUpdater2.compareAndSet(this, obj, null)) {
if (atomicReferenceFieldUpdater2.get(this) != obj) {
break;
}
}
Intrinsics.checkNotNull(obj, "null cannot be cast to non-null type java.lang.Runnable{ kotlinx.coroutines.RunnableKt.Runnable }");
return (Runnable) obj;
}
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;
}
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater3 = _queue$volatile$FU;
LockFreeTaskQueueCore next = lockFreeTaskQueueCore.next();
while (!atomicReferenceFieldUpdater3.compareAndSet(this, obj, next) && atomicReferenceFieldUpdater3.get(this) == obj) {
}
}
}
private final boolean enqueueImpl(Runnable task) {
Symbol symbol;
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater = _queue$volatile$FU;
while (true) {
Object obj = atomicReferenceFieldUpdater.get(this);
if (isCompleted()) {
return false;
}
if (obj == null) {
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater2 = _queue$volatile$FU;
while (!atomicReferenceFieldUpdater2.compareAndSet(this, null, task)) {
if (atomicReferenceFieldUpdater2.get(this) != null) {
break;
}
}
return true;
}
if (!(obj instanceof LockFreeTaskQueueCore)) {
symbol = EventLoop_commonKt.CLOSED_EMPTY;
if (obj == symbol) {
return false;
}
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);
lockFreeTaskQueueCore.addLast(task);
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater3 = _queue$volatile$FU;
while (!atomicReferenceFieldUpdater3.compareAndSet(this, obj, lockFreeTaskQueueCore)) {
if (atomicReferenceFieldUpdater3.get(this) != obj) {
break;
}
}
return true;
}
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 lockFreeTaskQueueCore2 = (LockFreeTaskQueueCore) obj;
int addLast = lockFreeTaskQueueCore2.addLast(task);
if (addLast == 0) {
return true;
}
if (addLast == 1) {
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater4 = _queue$volatile$FU;
LockFreeTaskQueueCore next = lockFreeTaskQueueCore2.next();
while (!atomicReferenceFieldUpdater4.compareAndSet(this, obj, next) && atomicReferenceFieldUpdater4.get(this) == obj) {
}
} else if (addLast == 2) {
return false;
}
}
}
private final /* synthetic */ Object get_delayed$volatile() {
return this._delayed$volatile;
}
private final /* synthetic */ int get_isCompleted$volatile() {
return this._isCompleted$volatile;
}
private final /* synthetic */ Object get_queue$volatile() {
return this._queue$volatile;
}
/* JADX INFO: Access modifiers changed from: private */
public final boolean isCompleted() {
return _isCompleted$volatile$FU.get(this) != 0;
}
private final /* synthetic */ void loop$atomicfu(Object obj, AtomicReferenceFieldUpdater atomicReferenceFieldUpdater, Function1<Object, Unit> function1) {
while (true) {
function1.invoke(atomicReferenceFieldUpdater.get(obj));
}
}
private final void rescheduleAllDelayed() {
DelayedTask removeFirstOrNull;
AbstractTimeSource timeSource = AbstractTimeSourceKt.getTimeSource();
long nanoTime = timeSource != null ? timeSource.nanoTime() : System.nanoTime();
while (true) {
DelayedTaskQueue delayedTaskQueue = (DelayedTaskQueue) _delayed$volatile$FU.get(this);
if (delayedTaskQueue == null || (removeFirstOrNull = delayedTaskQueue.removeFirstOrNull()) == null) {
return;
} else {
reschedule(nanoTime, removeFirstOrNull);
}
}
}
private final int scheduleImpl(long now, DelayedTask delayedTask) {
if (isCompleted()) {
return 1;
}
DelayedTaskQueue delayedTaskQueue = (DelayedTaskQueue) _delayed$volatile$FU.get(this);
if (delayedTaskQueue == null) {
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater = _delayed$volatile$FU;
DelayedTaskQueue delayedTaskQueue2 = new DelayedTaskQueue(now);
while (!atomicReferenceFieldUpdater.compareAndSet(this, null, delayedTaskQueue2) && atomicReferenceFieldUpdater.get(this) == null) {
}
Object obj = _delayed$volatile$FU.get(this);
Intrinsics.checkNotNull(obj);
delayedTaskQueue = (DelayedTaskQueue) obj;
}
return delayedTask.scheduleTask(now, delayedTaskQueue, this);
}
private final void setCompleted(boolean z3) {
_isCompleted$volatile$FU.set(this, z3 ? 1 : 0);
}
private final /* synthetic */ void set_delayed$volatile(Object obj) {
this._delayed$volatile = obj;
}
private final /* synthetic */ void set_isCompleted$volatile(int i) {
this._isCompleted$volatile = i;
}
private final /* synthetic */ void set_queue$volatile(Object obj) {
this._queue$volatile = obj;
}
private final boolean shouldUnpark(DelayedTask task) {
DelayedTaskQueue delayedTaskQueue = (DelayedTaskQueue) _delayed$volatile$FU.get(this);
return (delayedTaskQueue != null ? delayedTaskQueue.peek() : null) == task;
}
@Override // kotlinx.coroutines.Delay
@Deprecated(level = DeprecationLevel.ERROR, message = "Deprecated without replacement as an internal method never intended for public use")
public Object delay(long j4, Continuation<? super Unit> continuation) {
return Delay.DefaultImpls.delay(this, j4, continuation);
}
@Override // kotlinx.coroutines.CoroutineDispatcher
/* renamed from: dispatch */
public final void mo1685dispatch(CoroutineContext context, Runnable block) {
enqueue(block);
}
public void enqueue(Runnable task) {
if (enqueueImpl(task)) {
unpark();
} else {
DefaultExecutor.INSTANCE.enqueue(task);
}
}
/* JADX WARN: Code restructure failed: missing block: B:8:0x001f, code lost:
if (((kotlinx.coroutines.internal.LockFreeTaskQueueCore) r0).isEmpty() == false) goto L15;
*/
@Override // kotlinx.coroutines.EventLoop
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public long getNextTime() {
/*
r4 = this;
long r0 = super.getNextTime()
r2 = 0
int r0 = (r0 > r2 ? 1 : (r0 == r2 ? 0 : -1))
if (r0 != 0) goto Lb
goto L29
Lb:
java.util.concurrent.atomic.AtomicReferenceFieldUpdater r0 = get_queue$volatile$FU()
java.lang.Object r0 = r0.get(r4)
if (r0 == 0) goto L2a
boolean r1 = r0 instanceof kotlinx.coroutines.internal.LockFreeTaskQueueCore
if (r1 == 0) goto L22
kotlinx.coroutines.internal.LockFreeTaskQueueCore r0 = (kotlinx.coroutines.internal.LockFreeTaskQueueCore) r0
boolean r0 = r0.isEmpty()
if (r0 != 0) goto L2a
goto L29
L22:
kotlinx.coroutines.internal.Symbol r4 = kotlinx.coroutines.EventLoop_commonKt.access$getCLOSED_EMPTY$p()
if (r0 != r4) goto L29
goto L56
L29:
return r2
L2a:
java.util.concurrent.atomic.AtomicReferenceFieldUpdater r0 = get_delayed$volatile$FU()
java.lang.Object r4 = r0.get(r4)
kotlinx.coroutines.EventLoopImplBase$DelayedTaskQueue r4 = (kotlinx.coroutines.EventLoopImplBase.DelayedTaskQueue) r4
if (r4 == 0) goto L56
kotlinx.coroutines.internal.ThreadSafeHeapNode r4 = r4.peek()
kotlinx.coroutines.EventLoopImplBase$DelayedTask r4 = (kotlinx.coroutines.EventLoopImplBase.DelayedTask) r4
if (r4 != 0) goto L3f
goto L56
L3f:
long r0 = r4.nanoTime
kotlinx.coroutines.AbstractTimeSource r4 = kotlinx.coroutines.AbstractTimeSourceKt.getTimeSource()
if (r4 == 0) goto L4c
long r2 = r4.nanoTime()
goto L50
L4c:
long r2 = java.lang.System.nanoTime()
L50:
long r0 = r0 - r2
long r0 = kotlin.ranges.RangesKt.a(r0)
return r0
L56:
r0 = 9223372036854775807(0x7fffffffffffffff, double:NaN)
return r0
*/
throw new UnsupportedOperationException("Method not decompiled: kotlinx.coroutines.EventLoopImplBase.getNextTime():long");
}
public DisposableHandle invokeOnTimeout(long j4, Runnable runnable, CoroutineContext coroutineContext) {
return Delay.DefaultImpls.invokeOnTimeout(this, j4, runnable, coroutineContext);
}
@Override // kotlinx.coroutines.EventLoop
public boolean isEmpty() {
Symbol symbol;
if (!isUnconfinedQueueEmpty()) {
return false;
}
DelayedTaskQueue delayedTaskQueue = (DelayedTaskQueue) _delayed$volatile$FU.get(this);
if (delayedTaskQueue != null && !delayedTaskQueue.isEmpty()) {
return false;
}
Object obj = _queue$volatile$FU.get(this);
if (obj == null) {
return true;
}
if (obj instanceof LockFreeTaskQueueCore) {
return ((LockFreeTaskQueueCore) obj).isEmpty();
}
symbol = EventLoop_commonKt.CLOSED_EMPTY;
return obj == symbol;
}
@Override // kotlinx.coroutines.EventLoop
public long processNextEvent() {
DelayedTask delayedTask;
if (processUnconfinedEvent()) {
return 0L;
}
DelayedTaskQueue delayedTaskQueue = (DelayedTaskQueue) _delayed$volatile$FU.get(this);
if (delayedTaskQueue != null && !delayedTaskQueue.isEmpty()) {
AbstractTimeSource timeSource = AbstractTimeSourceKt.getTimeSource();
long nanoTime = timeSource != null ? timeSource.nanoTime() : System.nanoTime();
do {
synchronized (delayedTaskQueue) {
try {
DelayedTask firstImpl = delayedTaskQueue.firstImpl();
if (firstImpl != null) {
DelayedTask delayedTask2 = firstImpl;
delayedTask = delayedTask2.timeToExecute(nanoTime) ? enqueueImpl(delayedTask2) : false ? delayedTaskQueue.removeAtImpl(0) : null;
}
} catch (Throwable th) {
throw th;
}
}
} while (delayedTask != null);
}
Runnable dequeue = dequeue();
if (dequeue == null) {
return getNextTime();
}
dequeue.run();
return 0L;
}
public final void resetAll() {
_queue$volatile$FU.set(this, null);
_delayed$volatile$FU.set(this, null);
}
public final void schedule(long now, DelayedTask delayedTask) {
int scheduleImpl = scheduleImpl(now, delayedTask);
if (scheduleImpl == 0) {
if (shouldUnpark(delayedTask)) {
unpark();
}
} else if (scheduleImpl == 1) {
reschedule(now, delayedTask);
} else if (scheduleImpl != 2) {
throw new IllegalStateException("unexpected result");
}
}
public final DisposableHandle scheduleInvokeOnTimeout(long timeMillis, Runnable block) {
long delayToNanos = EventLoop_commonKt.delayToNanos(timeMillis);
if (delayToNanos >= DurationKt.MAX_MILLIS) {
return NonDisposableHandle.INSTANCE;
}
AbstractTimeSource timeSource = AbstractTimeSourceKt.getTimeSource();
long nanoTime = timeSource != null ? timeSource.nanoTime() : System.nanoTime();
DelayedRunnableTask delayedRunnableTask = new DelayedRunnableTask(delayToNanos + nanoTime, block);
schedule(nanoTime, delayedRunnableTask);
return delayedRunnableTask;
}
@Override // kotlinx.coroutines.Delay
/* renamed from: scheduleResumeAfterDelay */
public void mo1686scheduleResumeAfterDelay(long timeMillis, CancellableContinuation<? super Unit> continuation) {
long delayToNanos = EventLoop_commonKt.delayToNanos(timeMillis);
if (delayToNanos < DurationKt.MAX_MILLIS) {
AbstractTimeSource timeSource = AbstractTimeSourceKt.getTimeSource();
long nanoTime = timeSource != null ? timeSource.nanoTime() : System.nanoTime();
DelayedResumeTask delayedResumeTask = new DelayedResumeTask(delayToNanos + nanoTime, continuation);
schedule(nanoTime, delayedResumeTask);
CancellableContinuationKt.disposeOnCancellation(continuation, delayedResumeTask);
}
}
@Override // kotlinx.coroutines.EventLoop
public void shutdown() {
ThreadLocalEventLoop.INSTANCE.resetEventLoop$kotlinx_coroutines_core();
setCompleted(true);
closeQueue();
do {
} while (processNextEvent() <= 0);
rescheduleAllDelayed();
}
}