Rabbit-R1/android (non root)/java/sources/androidx/room/CoroutinesRoom$Companion$createFlow$1.java
2024-05-21 17:08:36 -04:00

282 lines
17 KiB
Java

package androidx.room;
import androidx.room.InvalidationTracker;
import java.util.Set;
import java.util.concurrent.Callable;
import kotlin.Metadata;
import kotlin.ResultKt;
import kotlin.Unit;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.intrinsics.IntrinsicsKt;
import kotlin.coroutines.jvm.internal.DebugMetadata;
import kotlin.coroutines.jvm.internal.SuspendLambda;
import kotlin.jvm.functions.Function2;
import kotlin.jvm.internal.Intrinsics;
import kotlinx.coroutines.BuildersKt__Builders_commonKt;
import kotlinx.coroutines.CoroutineDispatcher;
import kotlinx.coroutines.CoroutineScope;
import kotlinx.coroutines.CoroutineScopeKt;
import kotlinx.coroutines.channels.Channel;
import kotlinx.coroutines.channels.ChannelKt;
import kotlinx.coroutines.flow.FlowCollector;
import kotlinx.coroutines.flow.FlowKt;
/* JADX INFO: Add missing generic type declarations: [R] */
/* compiled from: CoroutinesRoom.kt */
@Metadata(d1 = {"\u0000\u0010\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\u0010\u0000\u001a\u00020\u0001\"\u0004\b\u0000\u0010\u0002*\r\u0012\t\u0012\u0007H\u0002¢\u0006\u0002\b\u00040\u0003H\u008a@"}, d2 = {"<anonymous>", "", "R", "Lkotlinx/coroutines/flow/FlowCollector;", "Lkotlin/jvm/JvmSuppressWildcards;"}, k = 3, mv = {1, 7, 1}, xi = 48)
@DebugMetadata(c = "androidx.room.CoroutinesRoom$Companion$createFlow$1", f = "CoroutinesRoom.kt", i = {}, l = {110}, m = "invokeSuspend", n = {}, s = {})
/* loaded from: classes2.dex */
final class CoroutinesRoom$Companion$createFlow$1<R> extends SuspendLambda implements Function2<FlowCollector<R>, Continuation<? super Unit>, Object> {
final /* synthetic */ Callable<R> $callable;
final /* synthetic */ RoomDatabase $db;
final /* synthetic */ boolean $inTransaction;
final /* synthetic */ String[] $tableNames;
private /* synthetic */ Object L$0;
int label;
/* JADX INFO: Access modifiers changed from: package-private */
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public CoroutinesRoom$Companion$createFlow$1(boolean z, RoomDatabase roomDatabase, String[] strArr, Callable<R> callable, Continuation<? super CoroutinesRoom$Companion$createFlow$1> continuation) {
super(2, continuation);
this.$inTransaction = z;
this.$db = roomDatabase;
this.$tableNames = strArr;
this.$callable = callable;
}
@Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
public final Continuation<Unit> create(Object obj, Continuation<?> continuation) {
CoroutinesRoom$Companion$createFlow$1 coroutinesRoom$Companion$createFlow$1 = new CoroutinesRoom$Companion$createFlow$1(this.$inTransaction, this.$db, this.$tableNames, this.$callable, continuation);
coroutinesRoom$Companion$createFlow$1.L$0 = obj;
return coroutinesRoom$Companion$createFlow$1;
}
@Override // kotlin.jvm.functions.Function2
public final Object invoke(FlowCollector<R> flowCollector, Continuation<? super Unit> continuation) {
return ((CoroutinesRoom$Companion$createFlow$1) create(flowCollector, continuation)).invokeSuspend(Unit.INSTANCE);
}
/* JADX INFO: Access modifiers changed from: package-private */
/* compiled from: CoroutinesRoom.kt */
@Metadata(d1 = {"\u0000\f\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\u0010\u0000\u001a\u00020\u0001\"\u0004\b\u0000\u0010\u0002*\u00020\u0003H\u008a@"}, d2 = {"<anonymous>", "", "R", "Lkotlinx/coroutines/CoroutineScope;"}, k = 3, mv = {1, 7, 1}, xi = 48)
@DebugMetadata(c = "androidx.room.CoroutinesRoom$Companion$createFlow$1$1", f = "CoroutinesRoom.kt", i = {}, l = {136}, m = "invokeSuspend", n = {}, s = {})
/* renamed from: androidx.room.CoroutinesRoom$Companion$createFlow$1$1, reason: invalid class name */
/* loaded from: classes2.dex */
public static final class AnonymousClass1 extends SuspendLambda implements Function2<CoroutineScope, Continuation<? super Unit>, Object> {
final /* synthetic */ FlowCollector<R> $$this$flow;
final /* synthetic */ Callable<R> $callable;
final /* synthetic */ RoomDatabase $db;
final /* synthetic */ boolean $inTransaction;
final /* synthetic */ String[] $tableNames;
private /* synthetic */ Object L$0;
int label;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
AnonymousClass1(boolean z, RoomDatabase roomDatabase, FlowCollector<R> flowCollector, String[] strArr, Callable<R> callable, Continuation<? super AnonymousClass1> continuation) {
super(2, continuation);
this.$inTransaction = z;
this.$db = roomDatabase;
this.$$this$flow = flowCollector;
this.$tableNames = strArr;
this.$callable = callable;
}
@Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
public final Continuation<Unit> create(Object obj, Continuation<?> continuation) {
AnonymousClass1 anonymousClass1 = new AnonymousClass1(this.$inTransaction, this.$db, this.$$this$flow, this.$tableNames, this.$callable, continuation);
anonymousClass1.L$0 = obj;
return anonymousClass1;
}
@Override // kotlin.jvm.functions.Function2
public final Object invoke(CoroutineScope coroutineScope, Continuation<? super Unit> continuation) {
return ((AnonymousClass1) create(coroutineScope, continuation)).invokeSuspend(Unit.INSTANCE);
}
/* JADX WARN: Type inference failed for: r7v0, types: [androidx.room.CoroutinesRoom$Companion$createFlow$1$1$observer$1] */
@Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
public final Object invokeSuspend(Object obj) {
CoroutineDispatcher transactionDispatcher;
Object coroutine_suspended = IntrinsicsKt.getCOROUTINE_SUSPENDED();
int i = this.label;
if (i == 0) {
ResultKt.throwOnFailure(obj);
CoroutineScope coroutineScope = (CoroutineScope) this.L$0;
final Channel Channel$default = ChannelKt.Channel$default(-1, null, null, 6, null);
final String[] strArr = this.$tableNames;
?? r7 = new InvalidationTracker.Observer(strArr) { // from class: androidx.room.CoroutinesRoom$Companion$createFlow$1$1$observer$1
@Override // androidx.room.InvalidationTracker.Observer
public void onInvalidated(Set<String> tables) {
Intrinsics.checkNotNullParameter(tables, "tables");
Channel$default.mo7202trySendJP2dKIU(Unit.INSTANCE);
}
};
Channel$default.mo7202trySendJP2dKIU(Unit.INSTANCE);
TransactionElement transactionElement = (TransactionElement) coroutineScope.getCoroutineContext().get(TransactionElement.INSTANCE);
if (transactionElement == null || (transactionDispatcher = transactionElement.getTransactionDispatcher()) == null) {
transactionDispatcher = this.$inTransaction ? CoroutinesRoomKt.getTransactionDispatcher(this.$db) : CoroutinesRoomKt.getQueryDispatcher(this.$db);
}
Channel Channel$default2 = ChannelKt.Channel$default(0, null, null, 7, null);
BuildersKt__Builders_commonKt.launch$default(coroutineScope, transactionDispatcher, null, new C00501(this.$db, r7, Channel$default, this.$callable, Channel$default2, null), 2, null);
this.label = 1;
if (FlowKt.emitAll(this.$$this$flow, Channel$default2, this) == coroutine_suspended) {
return coroutine_suspended;
}
} else {
if (i != 1) {
throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
}
ResultKt.throwOnFailure(obj);
}
return Unit.INSTANCE;
}
/* JADX INFO: Access modifiers changed from: package-private */
/* compiled from: CoroutinesRoom.kt */
@Metadata(d1 = {"\u0000\f\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\u0010\u0000\u001a\u00020\u0001\"\u0004\b\u0000\u0010\u0002*\u00020\u0003H\u008a@"}, d2 = {"<anonymous>", "", "R", "Lkotlinx/coroutines/CoroutineScope;"}, k = 3, mv = {1, 7, 1}, xi = 48)
@DebugMetadata(c = "androidx.room.CoroutinesRoom$Companion$createFlow$1$1$1", f = "CoroutinesRoom.kt", i = {}, l = {127, 129}, m = "invokeSuspend", n = {}, s = {})
/* renamed from: androidx.room.CoroutinesRoom$Companion$createFlow$1$1$1, reason: invalid class name and collision with other inner class name */
/* loaded from: classes2.dex */
public static final class C00501 extends SuspendLambda implements Function2<CoroutineScope, Continuation<? super Unit>, Object> {
final /* synthetic */ Callable<R> $callable;
final /* synthetic */ RoomDatabase $db;
final /* synthetic */ CoroutinesRoom$Companion$createFlow$1$1$observer$1 $observer;
final /* synthetic */ Channel<Unit> $observerChannel;
final /* synthetic */ Channel<R> $resultChannel;
Object L$0;
int label;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
C00501(RoomDatabase roomDatabase, CoroutinesRoom$Companion$createFlow$1$1$observer$1 coroutinesRoom$Companion$createFlow$1$1$observer$1, Channel<Unit> channel, Callable<R> callable, Channel<R> channel2, Continuation<? super C00501> continuation) {
super(2, continuation);
this.$db = roomDatabase;
this.$observer = coroutinesRoom$Companion$createFlow$1$1$observer$1;
this.$observerChannel = channel;
this.$callable = callable;
this.$resultChannel = channel2;
}
@Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
public final Continuation<Unit> create(Object obj, Continuation<?> continuation) {
return new C00501(this.$db, this.$observer, this.$observerChannel, this.$callable, this.$resultChannel, continuation);
}
@Override // kotlin.jvm.functions.Function2
public final Object invoke(CoroutineScope coroutineScope, Continuation<? super Unit> continuation) {
return ((C00501) create(coroutineScope, continuation)).invokeSuspend(Unit.INSTANCE);
}
/* JADX WARN: Removed duplicated region for block: B:11:0x004a A[RETURN] */
/* JADX WARN: Removed duplicated region for block: B:13:0x004b */
/* JADX WARN: Removed duplicated region for block: B:16:0x0056 A[Catch: all -> 0x007f, TRY_LEAVE, TryCatch #0 {all -> 0x007f, blocks: (B:7:0x0012, B:9:0x003d, B:14:0x004e, B:16:0x0056, B:25:0x0023, B:27:0x0037), top: B:2:0x0008 }] */
/* JADX WARN: Removed duplicated region for block: B:19:0x006f */
/* JADX WARN: Unsupported multi-entry loop pattern (BACK_EDGE: B:17:0x006c -> B:8:0x0015). Please report as a decompilation issue!!! */
@Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public final java.lang.Object invokeSuspend(java.lang.Object r8) {
/*
r7 = this;
java.lang.Object r0 = kotlin.coroutines.intrinsics.IntrinsicsKt.getCOROUTINE_SUSPENDED()
int r1 = r7.label
r2 = 2
r3 = 1
if (r1 == 0) goto L27
if (r1 == r3) goto L1f
if (r1 != r2) goto L17
java.lang.Object r1 = r7.L$0
kotlinx.coroutines.channels.ChannelIterator r1 = (kotlinx.coroutines.channels.ChannelIterator) r1
kotlin.ResultKt.throwOnFailure(r8) // Catch: java.lang.Throwable -> L7f
L15:
r8 = r1
goto L3d
L17:
java.lang.IllegalStateException r7 = new java.lang.IllegalStateException
java.lang.String r8 = "call to 'resume' before 'invoke' with coroutine"
r7.<init>(r8)
throw r7
L1f:
java.lang.Object r1 = r7.L$0
kotlinx.coroutines.channels.ChannelIterator r1 = (kotlinx.coroutines.channels.ChannelIterator) r1
kotlin.ResultKt.throwOnFailure(r8) // Catch: java.lang.Throwable -> L7f
goto L4e
L27:
kotlin.ResultKt.throwOnFailure(r8)
androidx.room.RoomDatabase r8 = r7.$db
androidx.room.InvalidationTracker r8 = r8.getInvalidationTracker()
androidx.room.CoroutinesRoom$Companion$createFlow$1$1$observer$1 r1 = r7.$observer
androidx.room.InvalidationTracker$Observer r1 = (androidx.room.InvalidationTracker.Observer) r1
r8.addObserver(r1)
kotlinx.coroutines.channels.Channel<kotlin.Unit> r8 = r7.$observerChannel // Catch: java.lang.Throwable -> L7f
kotlinx.coroutines.channels.ChannelIterator r8 = r8.iterator() // Catch: java.lang.Throwable -> L7f
L3d:
r1 = r7
kotlin.coroutines.Continuation r1 = (kotlin.coroutines.Continuation) r1 // Catch: java.lang.Throwable -> L7f
r7.L$0 = r8 // Catch: java.lang.Throwable -> L7f
r7.label = r3 // Catch: java.lang.Throwable -> L7f
java.lang.Object r1 = r8.hasNext(r1) // Catch: java.lang.Throwable -> L7f
if (r1 != r0) goto L4b
return r0
L4b:
r6 = r1
r1 = r8
r8 = r6
L4e:
java.lang.Boolean r8 = (java.lang.Boolean) r8 // Catch: java.lang.Throwable -> L7f
boolean r8 = r8.booleanValue() // Catch: java.lang.Throwable -> L7f
if (r8 == 0) goto L6f
r1.next() // Catch: java.lang.Throwable -> L7f
java.util.concurrent.Callable<R> r8 = r7.$callable // Catch: java.lang.Throwable -> L7f
java.lang.Object r8 = r8.call() // Catch: java.lang.Throwable -> L7f
kotlinx.coroutines.channels.Channel<R> r4 = r7.$resultChannel // Catch: java.lang.Throwable -> L7f
r5 = r7
kotlin.coroutines.Continuation r5 = (kotlin.coroutines.Continuation) r5 // Catch: java.lang.Throwable -> L7f
r7.L$0 = r1 // Catch: java.lang.Throwable -> L7f
r7.label = r2 // Catch: java.lang.Throwable -> L7f
java.lang.Object r8 = r4.send(r8, r5) // Catch: java.lang.Throwable -> L7f
if (r8 != r0) goto L15
return r0
L6f:
androidx.room.RoomDatabase r8 = r7.$db
androidx.room.InvalidationTracker r8 = r8.getInvalidationTracker()
androidx.room.CoroutinesRoom$Companion$createFlow$1$1$observer$1 r7 = r7.$observer
androidx.room.InvalidationTracker$Observer r7 = (androidx.room.InvalidationTracker.Observer) r7
r8.removeObserver(r7)
kotlin.Unit r7 = kotlin.Unit.INSTANCE
return r7
L7f:
r8 = move-exception
androidx.room.RoomDatabase r0 = r7.$db
androidx.room.InvalidationTracker r0 = r0.getInvalidationTracker()
androidx.room.CoroutinesRoom$Companion$createFlow$1$1$observer$1 r7 = r7.$observer
androidx.room.InvalidationTracker$Observer r7 = (androidx.room.InvalidationTracker.Observer) r7
r0.removeObserver(r7)
throw r8
*/
throw new UnsupportedOperationException("Method not decompiled: androidx.room.CoroutinesRoom$Companion$createFlow$1.AnonymousClass1.C00501.invokeSuspend(java.lang.Object):java.lang.Object");
}
}
}
@Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
public final Object invokeSuspend(Object obj) {
Object coroutine_suspended = IntrinsicsKt.getCOROUTINE_SUSPENDED();
int i = this.label;
if (i == 0) {
ResultKt.throwOnFailure(obj);
FlowCollector flowCollector = (FlowCollector) this.L$0;
this.label = 1;
if (CoroutineScopeKt.coroutineScope(new AnonymousClass1(this.$inTransaction, this.$db, flowCollector, this.$tableNames, this.$callable, null), this) == coroutine_suspended) {
return coroutine_suspended;
}
} else {
if (i != 1) {
throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
}
ResultKt.throwOnFailure(obj);
}
return Unit.INSTANCE;
}
}