package androidx.compose.ui.platform; import android.view.View; import androidx.customview.poolingcontainer.PoolingContainer; import androidx.customview.poolingcontainer.PoolingContainerListener; import androidx.lifecycle.Lifecycle; import androidx.lifecycle.LifecycleOwner; import androidx.lifecycle.ViewTreeLifecycleOwner; import kotlin.Metadata; import kotlin.Unit; import kotlin.jvm.functions.Function0; import kotlin.jvm.internal.Intrinsics; import kotlin.jvm.internal.Ref; /* compiled from: ViewCompositionStrategy.android.kt */ @Metadata(d1 = {"\u0000\u001c\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0018\u0002\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0006\bf\u0018\u0000 \u00072\u00020\u0001:\u0005\u0007\b\t\n\u000bJ\u0016\u0010\u0002\u001a\b\u0012\u0004\u0012\u00020\u00040\u00032\u0006\u0010\u0005\u001a\u00020\u0006H&ø\u0001\u0000\u0082\u0002\u0006\n\u0004\b!0\u0001¨\u0006\fÀ\u0006\u0001"}, d2 = {"Landroidx/compose/ui/platform/ViewCompositionStrategy;", "", "installFor", "Lkotlin/Function0;", "", "view", "Landroidx/compose/ui/platform/AbstractComposeView;", "Companion", "DisposeOnDetachedFromWindow", "DisposeOnDetachedFromWindowOrReleasedFromPool", "DisposeOnLifecycleDestroyed", "DisposeOnViewTreeLifecycleDestroyed", "ui_release"}, k = 1, mv = {1, 8, 0}, xi = 48) /* loaded from: classes.dex */ public interface ViewCompositionStrategy { /* renamed from: Companion, reason: from kotlin metadata */ public static final Companion INSTANCE = Companion.$$INSTANCE; Function0 installFor(AbstractComposeView view); /* compiled from: ViewCompositionStrategy.android.kt */ @Metadata(d1 = {"\u0000\u0014\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\b\u0086\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002R\u0011\u0010\u0003\u001a\u00020\u00048F¢\u0006\u0006\u001a\u0004\b\u0005\u0010\u0006¨\u0006\u0007"}, d2 = {"Landroidx/compose/ui/platform/ViewCompositionStrategy$Companion;", "", "()V", "Default", "Landroidx/compose/ui/platform/ViewCompositionStrategy;", "getDefault", "()Landroidx/compose/ui/platform/ViewCompositionStrategy;", "ui_release"}, k = 1, mv = {1, 8, 0}, xi = 48) /* loaded from: classes.dex */ public static final class Companion { static final /* synthetic */ Companion $$INSTANCE = new Companion(); private Companion() { } public final ViewCompositionStrategy getDefault() { return DisposeOnDetachedFromWindowOrReleasedFromPool.INSTANCE; } } /* compiled from: ViewCompositionStrategy.android.kt */ @Metadata(d1 = {"\u0000\u001c\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\bÇ\u0002\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u0016\u0010\u0003\u001a\b\u0012\u0004\u0012\u00020\u00050\u00042\u0006\u0010\u0006\u001a\u00020\u0007H\u0016¨\u0006\b"}, d2 = {"Landroidx/compose/ui/platform/ViewCompositionStrategy$DisposeOnDetachedFromWindowOrReleasedFromPool;", "Landroidx/compose/ui/platform/ViewCompositionStrategy;", "()V", "installFor", "Lkotlin/Function0;", "", "view", "Landroidx/compose/ui/platform/AbstractComposeView;", "ui_release"}, k = 1, mv = {1, 8, 0}, xi = 48) /* loaded from: classes.dex */ public static final class DisposeOnDetachedFromWindowOrReleasedFromPool implements ViewCompositionStrategy { public static final int $stable = 0; public static final DisposeOnDetachedFromWindowOrReleasedFromPool INSTANCE = new DisposeOnDetachedFromWindowOrReleasedFromPool(); private DisposeOnDetachedFromWindowOrReleasedFromPool() { } /* JADX WARN: Type inference failed for: r2v2, types: [androidx.compose.ui.platform.ViewCompositionStrategy$DisposeOnDetachedFromWindowOrReleasedFromPool$installFor$listener$1] */ @Override // androidx.compose.ui.platform.ViewCompositionStrategy public Function0 installFor(final AbstractComposeView view) { Intrinsics.checkNotNullParameter(view, "view"); final ?? r2 = new View.OnAttachStateChangeListener() { // from class: androidx.compose.ui.platform.ViewCompositionStrategy$DisposeOnDetachedFromWindowOrReleasedFromPool$installFor$listener$1 @Override // android.view.View.OnAttachStateChangeListener public void onViewAttachedToWindow(View v) { Intrinsics.checkNotNullParameter(v, "v"); } @Override // android.view.View.OnAttachStateChangeListener public void onViewDetachedFromWindow(View v) { Intrinsics.checkNotNullParameter(v, "v"); if (PoolingContainer.isWithinPoolingContainer(AbstractComposeView.this)) { return; } AbstractComposeView.this.disposeComposition(); } }; view.addOnAttachStateChangeListener((View.OnAttachStateChangeListener) r2); final PoolingContainerListener poolingContainerListener = new PoolingContainerListener() { // from class: androidx.compose.ui.platform.ViewCompositionStrategy$DisposeOnDetachedFromWindowOrReleasedFromPool$installFor$poolingContainerListener$1 @Override // androidx.customview.poolingcontainer.PoolingContainerListener public final void onRelease() { AbstractComposeView.this.disposeComposition(); } }; PoolingContainer.addPoolingContainerListener(view, poolingContainerListener); return new Function0() { // from class: androidx.compose.ui.platform.ViewCompositionStrategy$DisposeOnDetachedFromWindowOrReleasedFromPool$installFor$1 /* JADX INFO: Access modifiers changed from: package-private */ /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ { super(0); } @Override // kotlin.jvm.functions.Function0 public /* bridge */ /* synthetic */ Unit invoke() { invoke2(); return Unit.INSTANCE; } /* renamed from: invoke, reason: avoid collision after fix types in other method */ public final void invoke2() { AbstractComposeView.this.removeOnAttachStateChangeListener(r2); PoolingContainer.removePoolingContainerListener(AbstractComposeView.this, poolingContainerListener); } }; } } /* compiled from: ViewCompositionStrategy.android.kt */ @Metadata(d1 = {"\u0000\u001c\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\bÇ\u0002\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u0016\u0010\u0003\u001a\b\u0012\u0004\u0012\u00020\u00050\u00042\u0006\u0010\u0006\u001a\u00020\u0007H\u0016¨\u0006\b"}, d2 = {"Landroidx/compose/ui/platform/ViewCompositionStrategy$DisposeOnDetachedFromWindow;", "Landroidx/compose/ui/platform/ViewCompositionStrategy;", "()V", "installFor", "Lkotlin/Function0;", "", "view", "Landroidx/compose/ui/platform/AbstractComposeView;", "ui_release"}, k = 1, mv = {1, 8, 0}, xi = 48) /* loaded from: classes.dex */ public static final class DisposeOnDetachedFromWindow implements ViewCompositionStrategy { public static final int $stable = 0; public static final DisposeOnDetachedFromWindow INSTANCE = new DisposeOnDetachedFromWindow(); private DisposeOnDetachedFromWindow() { } /* JADX WARN: Type inference failed for: r1v2, types: [androidx.compose.ui.platform.ViewCompositionStrategy$DisposeOnDetachedFromWindow$installFor$listener$1] */ @Override // androidx.compose.ui.platform.ViewCompositionStrategy public Function0 installFor(final AbstractComposeView view) { Intrinsics.checkNotNullParameter(view, "view"); final ?? r1 = new View.OnAttachStateChangeListener() { // from class: androidx.compose.ui.platform.ViewCompositionStrategy$DisposeOnDetachedFromWindow$installFor$listener$1 @Override // android.view.View.OnAttachStateChangeListener public void onViewAttachedToWindow(View v) { Intrinsics.checkNotNullParameter(v, "v"); } @Override // android.view.View.OnAttachStateChangeListener public void onViewDetachedFromWindow(View v) { Intrinsics.checkNotNullParameter(v, "v"); AbstractComposeView.this.disposeComposition(); } }; view.addOnAttachStateChangeListener((View.OnAttachStateChangeListener) r1); return new Function0() { // from class: androidx.compose.ui.platform.ViewCompositionStrategy$DisposeOnDetachedFromWindow$installFor$1 /* JADX INFO: Access modifiers changed from: package-private */ /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ { super(0); } @Override // kotlin.jvm.functions.Function0 public /* bridge */ /* synthetic */ Unit invoke() { invoke2(); return Unit.INSTANCE; } /* renamed from: invoke, reason: avoid collision after fix types in other method */ public final void invoke2() { AbstractComposeView.this.removeOnAttachStateChangeListener(r1); } }; } } /* compiled from: ViewCompositionStrategy.android.kt */ @Metadata(d1 = {"\u0000*\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\b\u0007\u0018\u00002\u00020\u0001B\u000f\b\u0016\u0012\u0006\u0010\u0002\u001a\u00020\u0003¢\u0006\u0002\u0010\u0004B\r\u0012\u0006\u0010\u0005\u001a\u00020\u0006¢\u0006\u0002\u0010\u0007J\u0016\u0010\b\u001a\b\u0012\u0004\u0012\u00020\n0\t2\u0006\u0010\u000b\u001a\u00020\fH\u0016R\u000e\u0010\u0005\u001a\u00020\u0006X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\r"}, d2 = {"Landroidx/compose/ui/platform/ViewCompositionStrategy$DisposeOnLifecycleDestroyed;", "Landroidx/compose/ui/platform/ViewCompositionStrategy;", "lifecycleOwner", "Landroidx/lifecycle/LifecycleOwner;", "(Landroidx/lifecycle/LifecycleOwner;)V", "lifecycle", "Landroidx/lifecycle/Lifecycle;", "(Landroidx/lifecycle/Lifecycle;)V", "installFor", "Lkotlin/Function0;", "", "view", "Landroidx/compose/ui/platform/AbstractComposeView;", "ui_release"}, k = 1, mv = {1, 8, 0}, xi = 48) /* loaded from: classes.dex */ public static final class DisposeOnLifecycleDestroyed implements ViewCompositionStrategy { public static final int $stable = 8; private final Lifecycle lifecycle; public DisposeOnLifecycleDestroyed(Lifecycle lifecycle) { Intrinsics.checkNotNullParameter(lifecycle, "lifecycle"); this.lifecycle = lifecycle; } /* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */ public DisposeOnLifecycleDestroyed(LifecycleOwner lifecycleOwner) { this(lifecycleOwner.getLifecycle()); Intrinsics.checkNotNullParameter(lifecycleOwner, "lifecycleOwner"); } @Override // androidx.compose.ui.platform.ViewCompositionStrategy public Function0 installFor(AbstractComposeView view) { Intrinsics.checkNotNullParameter(view, "view"); return ViewCompositionStrategy_androidKt.access$installForLifecycle(view, this.lifecycle); } } /* compiled from: ViewCompositionStrategy.android.kt */ @Metadata(d1 = {"\u0000\u001c\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\bÇ\u0002\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u0016\u0010\u0003\u001a\b\u0012\u0004\u0012\u00020\u00050\u00042\u0006\u0010\u0006\u001a\u00020\u0007H\u0016¨\u0006\b"}, d2 = {"Landroidx/compose/ui/platform/ViewCompositionStrategy$DisposeOnViewTreeLifecycleDestroyed;", "Landroidx/compose/ui/platform/ViewCompositionStrategy;", "()V", "installFor", "Lkotlin/Function0;", "", "view", "Landroidx/compose/ui/platform/AbstractComposeView;", "ui_release"}, k = 1, mv = {1, 8, 0}, xi = 48) /* loaded from: classes.dex */ public static final class DisposeOnViewTreeLifecycleDestroyed implements ViewCompositionStrategy { public static final int $stable = 0; public static final DisposeOnViewTreeLifecycleDestroyed INSTANCE = new DisposeOnViewTreeLifecycleDestroyed(); private DisposeOnViewTreeLifecycleDestroyed() { } /* JADX WARN: Type inference failed for: r0v0, types: [androidx.compose.ui.platform.ViewCompositionStrategy$DisposeOnViewTreeLifecycleDestroyed$installFor$listener$1] */ /* JADX WARN: Type inference failed for: r1v2, types: [T, androidx.compose.ui.platform.ViewCompositionStrategy$DisposeOnViewTreeLifecycleDestroyed$installFor$1] */ @Override // androidx.compose.ui.platform.ViewCompositionStrategy public Function0 installFor(final AbstractComposeView view) { Intrinsics.checkNotNullParameter(view, "view"); if (view.isAttachedToWindow()) { LifecycleOwner lifecycleOwner = ViewTreeLifecycleOwner.get(view); if (lifecycleOwner == null) { throw new IllegalStateException(("View tree for " + view + " has no ViewTreeLifecycleOwner").toString()); } return ViewCompositionStrategy_androidKt.access$installForLifecycle(view, lifecycleOwner.getLifecycle()); } final Ref.ObjectRef objectRef = new Ref.ObjectRef(); final ?? r0 = new View.OnAttachStateChangeListener() { // from class: androidx.compose.ui.platform.ViewCompositionStrategy$DisposeOnViewTreeLifecycleDestroyed$installFor$listener$1 @Override // android.view.View.OnAttachStateChangeListener public void onViewDetachedFromWindow(View v) { Intrinsics.checkNotNullParameter(v, "v"); } /* JADX WARN: Type inference failed for: r3v8, types: [T, kotlin.jvm.functions.Function0] */ @Override // android.view.View.OnAttachStateChangeListener public void onViewAttachedToWindow(View v) { ?? installForLifecycle; Intrinsics.checkNotNullParameter(v, "v"); LifecycleOwner lifecycleOwner2 = ViewTreeLifecycleOwner.get(AbstractComposeView.this); AbstractComposeView abstractComposeView = AbstractComposeView.this; if (lifecycleOwner2 != null) { Ref.ObjectRef> objectRef2 = objectRef; installForLifecycle = ViewCompositionStrategy_androidKt.installForLifecycle(abstractComposeView, lifecycleOwner2.getLifecycle()); objectRef2.element = installForLifecycle; AbstractComposeView.this.removeOnAttachStateChangeListener(this); return; } throw new IllegalStateException(("View tree for " + abstractComposeView + " has no ViewTreeLifecycleOwner").toString()); } }; view.addOnAttachStateChangeListener((View.OnAttachStateChangeListener) r0); objectRef.element = new Function0() { // from class: androidx.compose.ui.platform.ViewCompositionStrategy$DisposeOnViewTreeLifecycleDestroyed$installFor$1 /* JADX INFO: Access modifiers changed from: package-private */ /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ { super(0); } @Override // kotlin.jvm.functions.Function0 public /* bridge */ /* synthetic */ Unit invoke() { invoke2(); return Unit.INSTANCE; } /* renamed from: invoke, reason: avoid collision after fix types in other method */ public final void invoke2() { AbstractComposeView.this.removeOnAttachStateChangeListener(r0); } }; return new Function0() { // from class: androidx.compose.ui.platform.ViewCompositionStrategy$DisposeOnViewTreeLifecycleDestroyed$installFor$2 /* JADX INFO: Access modifiers changed from: package-private */ /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ { super(0); } @Override // kotlin.jvm.functions.Function0 public /* bridge */ /* synthetic */ Unit invoke() { invoke2(); return Unit.INSTANCE; } /* renamed from: invoke, reason: avoid collision after fix types in other method */ public final void invoke2() { objectRef.element.invoke(); } }; } } }