Rabbit-R1/android (non root)/java/sources/androidx/compose/ui/platform/WrappedComposition.java
2024-05-21 17:08:36 -04:00

257 lines
17 KiB
Java

package androidx.compose.ui.platform;
import android.view.View;
import androidx.compose.runtime.Composer;
import androidx.compose.runtime.ComposerKt;
import androidx.compose.runtime.Composition;
import androidx.compose.runtime.CompositionLocalKt;
import androidx.compose.runtime.EffectsKt;
import androidx.compose.runtime.ProvidedValue;
import androidx.compose.runtime.internal.ComposableLambdaKt;
import androidx.compose.runtime.tooling.CompositionData;
import androidx.compose.runtime.tooling.InspectionTablesKt;
import androidx.compose.ui.R;
import androidx.compose.ui.platform.AndroidComposeView;
import androidx.core.app.NotificationCompat;
import androidx.lifecycle.Lifecycle;
import androidx.lifecycle.LifecycleEventObserver;
import androidx.lifecycle.LifecycleOwner;
import io.sentry.protocol.TransactionInfo;
import java.util.Set;
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.Function1;
import kotlin.jvm.functions.Function2;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.TypeIntrinsics;
import kotlinx.coroutines.CoroutineScope;
/* JADX INFO: Access modifiers changed from: package-private */
/* compiled from: Wrapper.android.kt */
@Metadata(d1 = {"\u0000B\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\u0010\u0002\n\u0002\u0018\u0002\n\u0002\b\b\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0004\b\u0002\u0018\u00002\u00020\u00012\u00020\u0002B\u0015\u0012\u0006\u0010\u0003\u001a\u00020\u0004\u0012\u0006\u0010\u0005\u001a\u00020\u0001¢\u0006\u0002\u0010\u0006J\b\u0010\u0018\u001a\u00020\u0011H\u0016J\u0018\u0010\u0019\u001a\u00020\u00112\u0006\u0010\u001a\u001a\u00020\u001b2\u0006\u0010\u001c\u001a\u00020\u001dH\u0016J \u0010\u001e\u001a\u00020\u00112\u0011\u0010\u001f\u001a\r\u0012\u0004\u0012\u00020\u00110\u0010¢\u0006\u0002\b\u0012H\u0016¢\u0006\u0002\u0010 R\u0010\u0010\u0007\u001a\u0004\u0018\u00010\bX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\t\u001a\u00020\nX\u0082\u000e¢\u0006\u0002\n\u0000R\u0014\u0010\u000b\u001a\u00020\n8VX\u0096\u0004¢\u0006\u0006\u001a\u0004\b\f\u0010\rR\u0014\u0010\u000e\u001a\u00020\n8VX\u0096\u0004¢\u0006\u0006\u001a\u0004\b\u000e\u0010\rR\u001b\u0010\u000f\u001a\r\u0012\u0004\u0012\u00020\u00110\u0010¢\u0006\u0002\b\u0012X\u0082\u000e¢\u0006\u0004\n\u0002\u0010\u0013R\u0011\u0010\u0005\u001a\u00020\u0001¢\u0006\b\n\u0000\u001a\u0004\b\u0014\u0010\u0015R\u0011\u0010\u0003\u001a\u00020\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u0016\u0010\u0017¨\u0006!"}, d2 = {"Landroidx/compose/ui/platform/WrappedComposition;", "Landroidx/compose/runtime/Composition;", "Landroidx/lifecycle/LifecycleEventObserver;", "owner", "Landroidx/compose/ui/platform/AndroidComposeView;", "original", "(Landroidx/compose/ui/platform/AndroidComposeView;Landroidx/compose/runtime/Composition;)V", "addedToLifecycle", "Landroidx/lifecycle/Lifecycle;", "disposed", "", "hasInvalidations", "getHasInvalidations", "()Z", "isDisposed", "lastContent", "Lkotlin/Function0;", "", "Landroidx/compose/runtime/Composable;", "Lkotlin/jvm/functions/Function2;", "getOriginal", "()Landroidx/compose/runtime/Composition;", "getOwner", "()Landroidx/compose/ui/platform/AndroidComposeView;", "dispose", "onStateChanged", TransactionInfo.JsonKeys.SOURCE, "Landroidx/lifecycle/LifecycleOwner;", NotificationCompat.CATEGORY_EVENT, "Landroidx/lifecycle/Lifecycle$Event;", "setContent", "content", "(Lkotlin/jvm/functions/Function2;)V", "ui_release"}, k = 1, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
public final class WrappedComposition implements Composition, LifecycleEventObserver {
private Lifecycle addedToLifecycle;
private boolean disposed;
private Function2<? super Composer, ? super Integer, Unit> lastContent;
private final Composition original;
private final AndroidComposeView owner;
public final Composition getOriginal() {
return this.original;
}
public final AndroidComposeView getOwner() {
return this.owner;
}
public WrappedComposition(AndroidComposeView owner, Composition original) {
Intrinsics.checkNotNullParameter(owner, "owner");
Intrinsics.checkNotNullParameter(original, "original");
this.owner = owner;
this.original = original;
this.lastContent = ComposableSingletons$Wrapper_androidKt.INSTANCE.m4185getLambda1$ui_release();
}
@Override // androidx.compose.runtime.Composition
public void setContent(final Function2<? super Composer, ? super Integer, Unit> content) {
Intrinsics.checkNotNullParameter(content, "content");
this.owner.setOnViewTreeOwnersAvailable(new Function1<AndroidComposeView.ViewTreeOwners, Unit>() { // from class: androidx.compose.ui.platform.WrappedComposition$setContent$1
/* JADX INFO: Access modifiers changed from: package-private */
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
/* JADX WARN: Multi-variable type inference failed */
{
super(1);
}
@Override // kotlin.jvm.functions.Function1
public /* bridge */ /* synthetic */ Unit invoke(AndroidComposeView.ViewTreeOwners viewTreeOwners) {
invoke2(viewTreeOwners);
return Unit.INSTANCE;
}
/* renamed from: invoke, reason: avoid collision after fix types in other method */
public final void invoke2(AndroidComposeView.ViewTreeOwners it) {
boolean z;
Lifecycle lifecycle;
Intrinsics.checkNotNullParameter(it, "it");
z = WrappedComposition.this.disposed;
if (z) {
return;
}
Lifecycle lifecycle2 = it.getLifecycleOwner().getLifecycle();
WrappedComposition.this.lastContent = content;
lifecycle = WrappedComposition.this.addedToLifecycle;
if (lifecycle == null) {
WrappedComposition.this.addedToLifecycle = lifecycle2;
lifecycle2.addObserver(WrappedComposition.this);
} else if (lifecycle2.getState().isAtLeast(Lifecycle.State.CREATED)) {
Composition original = WrappedComposition.this.getOriginal();
final WrappedComposition wrappedComposition = WrappedComposition.this;
final Function2<Composer, Integer, Unit> function2 = content;
original.setContent(ComposableLambdaKt.composableLambdaInstance(-2000640158, true, new Function2<Composer, Integer, Unit>() { // from class: androidx.compose.ui.platform.WrappedComposition$setContent$1.1
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
/* JADX WARN: Multi-variable type inference failed */
{
super(2);
}
@Override // kotlin.jvm.functions.Function2
public /* bridge */ /* synthetic */ Unit invoke(Composer composer, Integer num) {
invoke(composer, num.intValue());
return Unit.INSTANCE;
}
public final void invoke(Composer composer, int i) {
ComposerKt.sourceInformation(composer, "C154@6099L56,156@6181L176:Wrapper.android.kt#itgzvw");
if ((i & 11) != 2 || !composer.getSkipping()) {
if (ComposerKt.isTraceInProgress()) {
ComposerKt.traceEventStart(-2000640158, i, -1, "androidx.compose.ui.platform.WrappedComposition.setContent.<anonymous>.<anonymous> (Wrapper.android.kt:141)");
}
Object tag = WrappedComposition.this.getOwner().getTag(R.id.inspection_slot_table_set);
Set<CompositionData> set = TypeIntrinsics.isMutableSet(tag) ? (Set) tag : null;
if (set == null) {
Object parent = WrappedComposition.this.getOwner().getParent();
View view = parent instanceof View ? (View) parent : null;
Object tag2 = view != null ? view.getTag(R.id.inspection_slot_table_set) : null;
set = TypeIntrinsics.isMutableSet(tag2) ? (Set) tag2 : null;
}
if (set != null) {
set.add(composer.getCompositionData());
composer.collectParameterInformation();
}
EffectsKt.LaunchedEffect(WrappedComposition.this.getOwner(), new C00441(WrappedComposition.this, null), composer, 72);
ProvidedValue[] providedValueArr = {InspectionTablesKt.getLocalInspectionTables().provides(set)};
final WrappedComposition wrappedComposition2 = WrappedComposition.this;
final Function2<Composer, Integer, Unit> function22 = function2;
CompositionLocalKt.CompositionLocalProvider((ProvidedValue<?>[]) providedValueArr, ComposableLambdaKt.composableLambda(composer, -1193460702, true, new Function2<Composer, Integer, Unit>() { // from class: androidx.compose.ui.platform.WrappedComposition.setContent.1.1.2
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
/* JADX WARN: Multi-variable type inference failed */
{
super(2);
}
@Override // kotlin.jvm.functions.Function2
public /* bridge */ /* synthetic */ Unit invoke(Composer composer2, Integer num) {
invoke(composer2, num.intValue());
return Unit.INSTANCE;
}
public final void invoke(Composer composer2, int i2) {
ComposerKt.sourceInformation(composer2, "C157@6284L47:Wrapper.android.kt#itgzvw");
if ((i2 & 11) == 2 && composer2.getSkipping()) {
composer2.skipToGroupEnd();
return;
}
if (ComposerKt.isTraceInProgress()) {
ComposerKt.traceEventStart(-1193460702, i2, -1, "androidx.compose.ui.platform.WrappedComposition.setContent.<anonymous>.<anonymous>.<anonymous> (Wrapper.android.kt:156)");
}
AndroidCompositionLocals_androidKt.ProvideAndroidCompositionLocals(WrappedComposition.this.getOwner(), function22, composer2, 8);
if (ComposerKt.isTraceInProgress()) {
ComposerKt.traceEventEnd();
}
}
}), composer, 56);
if (ComposerKt.isTraceInProgress()) {
ComposerKt.traceEventEnd();
return;
}
return;
}
composer.skipToGroupEnd();
}
/* JADX INFO: Access modifiers changed from: package-private */
/* compiled from: Wrapper.android.kt */
@Metadata(d1 = {"\u0000\n\n\u0000\n\u0002\u0010\u0002\n\u0002\u0018\u0002\u0010\u0000\u001a\u00020\u0001*\u00020\u0002H\u008a@"}, d2 = {"<anonymous>", "", "Lkotlinx/coroutines/CoroutineScope;"}, k = 3, mv = {1, 8, 0}, xi = 48)
@DebugMetadata(c = "androidx.compose.ui.platform.WrappedComposition$setContent$1$1$1", f = "Wrapper.android.kt", i = {}, l = {155}, m = "invokeSuspend", n = {}, s = {})
/* renamed from: androidx.compose.ui.platform.WrappedComposition$setContent$1$1$1, reason: invalid class name and collision with other inner class name */
/* loaded from: classes.dex */
public static final class C00441 extends SuspendLambda implements Function2<CoroutineScope, Continuation<? super Unit>, Object> {
int label;
final /* synthetic */ WrappedComposition this$0;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
C00441(WrappedComposition wrappedComposition, Continuation<? super C00441> continuation) {
super(2, continuation);
this.this$0 = wrappedComposition;
}
@Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
public final Continuation<Unit> create(Object obj, Continuation<?> continuation) {
return new C00441(this.this$0, continuation);
}
@Override // kotlin.jvm.functions.Function2
public final Object invoke(CoroutineScope coroutineScope, Continuation<? super Unit> continuation) {
return ((C00441) create(coroutineScope, continuation)).invokeSuspend(Unit.INSTANCE);
}
@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);
this.label = 1;
if (this.this$0.getOwner().boundsUpdatesEventLoop(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;
}
}
}));
}
}
});
}
@Override // androidx.compose.runtime.Composition
public void dispose() {
if (!this.disposed) {
this.disposed = true;
this.owner.getView().setTag(R.id.wrapped_composition_tag, null);
Lifecycle lifecycle = this.addedToLifecycle;
if (lifecycle != null) {
lifecycle.removeObserver(this);
}
}
this.original.dispose();
}
@Override // androidx.compose.runtime.Composition
public boolean getHasInvalidations() {
return this.original.getHasInvalidations();
}
@Override // androidx.compose.runtime.Composition
/* renamed from: isDisposed */
public boolean getDisposed() {
return this.original.getDisposed();
}
@Override // androidx.lifecycle.LifecycleEventObserver
public void onStateChanged(LifecycleOwner source, Lifecycle.Event event) {
Intrinsics.checkNotNullParameter(source, "source");
Intrinsics.checkNotNullParameter(event, "event");
if (event == Lifecycle.Event.ON_DESTROY) {
dispose();
} else {
if (event != Lifecycle.Event.ON_CREATE || this.disposed) {
return;
}
setContent(this.lastContent);
}
}
}