Rabbit-R1/original r1/java/sources/androidx/activity/compose/BackHandlerKt.java
2024-05-21 17:08:36 -04:00

152 lines
8.7 KiB
Java

package androidx.activity.compose;
import androidx.activity.OnBackPressedCallback;
import androidx.activity.OnBackPressedDispatcher;
import androidx.activity.OnBackPressedDispatcherOwner;
import androidx.compose.runtime.Composer;
import androidx.compose.runtime.ComposerKt;
import androidx.compose.runtime.DisposableEffectResult;
import androidx.compose.runtime.DisposableEffectScope;
import androidx.compose.runtime.EffectsKt;
import androidx.compose.runtime.ProvidableCompositionLocal;
import androidx.compose.runtime.ScopeUpdateScope;
import androidx.compose.runtime.SnapshotStateKt;
import androidx.compose.runtime.State;
import androidx.compose.ui.platform.AndroidCompositionLocals_androidKt;
import androidx.lifecycle.LifecycleOwner;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.functions.Function2;
/* compiled from: BackHandler.kt */
@Metadata(d1 = {"\u0000\u0016\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\u001a%\u0010\u0000\u001a\u00020\u00012\b\b\u0002\u0010\u0002\u001a\u00020\u00032\f\u0010\u0004\u001a\b\u0012\u0004\u0012\u00020\u00010\u0005H\u0007¢\u0006\u0002\u0010\u0006¨\u0006\u0007²\u0006\u0010\u0010\b\u001a\b\u0012\u0004\u0012\u00020\u00010\u0005X\u008a\u0084\u0002"}, d2 = {"BackHandler", "", "enabled", "", "onBack", "Lkotlin/Function0;", "(ZLkotlin/jvm/functions/Function0;Landroidx/compose/runtime/Composer;II)V", "activity-compose_release", "currentOnBack"}, k = 2, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
public final class BackHandlerKt {
public static final void BackHandler(final boolean z, final Function0<Unit> function0, Composer composer, final int i, final int i2) {
int i3;
Composer startRestartGroup = composer.startRestartGroup(-361453782);
ComposerKt.sourceInformation(startRestartGroup, "C(BackHandler)83@3458L28,85@3588L171,93@3860L48,93@3849L59,*96@3981L7,99@4160L7,100@4172L302:BackHandler.kt#q1dkbc");
int i4 = i2 & 1;
if (i4 != 0) {
i3 = i | 6;
} else if ((i & 14) == 0) {
i3 = (startRestartGroup.changed(z) ? 4 : 2) | i;
} else {
i3 = i;
}
if ((i2 & 2) != 0) {
i3 |= 48;
} else if ((i & 112) == 0) {
i3 |= startRestartGroup.changed(function0) ? 32 : 16;
}
if ((i3 & 91) != 18 || !startRestartGroup.getSkipping()) {
if (i4 != 0) {
z = true;
}
final State rememberUpdatedState = SnapshotStateKt.rememberUpdatedState(function0, startRestartGroup, (i3 >> 3) & 14);
startRestartGroup.startReplaceableGroup(-3687241);
ComposerKt.sourceInformation(startRestartGroup, "C(remember):Composables.kt#9igjgp");
Object rememberedValue = startRestartGroup.rememberedValue();
if (rememberedValue == Composer.INSTANCE.getEmpty()) {
rememberedValue = new OnBackPressedCallback(z) { // from class: androidx.activity.compose.BackHandlerKt$BackHandler$backCallback$1$1
@Override // androidx.activity.OnBackPressedCallback
public void handleOnBackPressed() {
Function0 BackHandler$lambda$0;
BackHandler$lambda$0 = BackHandlerKt.BackHandler$lambda$0(rememberUpdatedState);
BackHandler$lambda$0.invoke();
}
};
startRestartGroup.updateRememberedValue(rememberedValue);
}
startRestartGroup.endReplaceableGroup();
final BackHandlerKt$BackHandler$backCallback$1$1 backHandlerKt$BackHandler$backCallback$1$1 = (BackHandlerKt$BackHandler$backCallback$1$1) rememberedValue;
Boolean valueOf = Boolean.valueOf(z);
startRestartGroup.startReplaceableGroup(-3686552);
ComposerKt.sourceInformation(startRestartGroup, "C(remember)P(1,2):Composables.kt#9igjgp");
boolean changed = startRestartGroup.changed(valueOf) | startRestartGroup.changed(backHandlerKt$BackHandler$backCallback$1$1);
Object rememberedValue2 = startRestartGroup.rememberedValue();
if (changed || rememberedValue2 == Composer.INSTANCE.getEmpty()) {
rememberedValue2 = (Function0) new Function0<Unit>() { // from class: androidx.activity.compose.BackHandlerKt$BackHandler$1$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() {
setEnabled(z);
}
};
startRestartGroup.updateRememberedValue(rememberedValue2);
}
startRestartGroup.endReplaceableGroup();
EffectsKt.SideEffect((Function0) rememberedValue2, startRestartGroup, 0);
OnBackPressedDispatcherOwner current = LocalOnBackPressedDispatcherOwner.INSTANCE.getCurrent(startRestartGroup, 6);
if (current == null) {
throw new IllegalStateException("No OnBackPressedDispatcherOwner was provided via LocalOnBackPressedDispatcherOwner".toString());
}
final OnBackPressedDispatcher onBackPressedDispatcher = current.getOnBackPressedDispatcher();
ProvidableCompositionLocal<LifecycleOwner> localLifecycleOwner = AndroidCompositionLocals_androidKt.getLocalLifecycleOwner();
ComposerKt.sourceInformationMarkerStart(startRestartGroup, 103361330, "C:CompositionLocal.kt#9igjgp");
Object consume = startRestartGroup.consume(localLifecycleOwner);
ComposerKt.sourceInformationMarkerEnd(startRestartGroup);
final LifecycleOwner lifecycleOwner = (LifecycleOwner) consume;
EffectsKt.DisposableEffect(lifecycleOwner, onBackPressedDispatcher, new Function1<DisposableEffectScope, DisposableEffectResult>() { // from class: androidx.activity.compose.BackHandlerKt$BackHandler$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(1);
}
@Override // kotlin.jvm.functions.Function1
public final DisposableEffectResult invoke(DisposableEffectScope disposableEffectScope) {
OnBackPressedDispatcher.this.addCallback(lifecycleOwner, backHandlerKt$BackHandler$backCallback$1$1);
final BackHandlerKt$BackHandler$backCallback$1$1 backHandlerKt$BackHandler$backCallback$1$12 = backHandlerKt$BackHandler$backCallback$1$1;
return new DisposableEffectResult() { // from class: androidx.activity.compose.BackHandlerKt$BackHandler$2$invoke$$inlined$onDispose$1
@Override // androidx.compose.runtime.DisposableEffectResult
public void dispose() {
remove();
}
};
}
}, startRestartGroup, 72);
} else {
startRestartGroup.skipToGroupEnd();
}
ScopeUpdateScope endRestartGroup = startRestartGroup.endRestartGroup();
if (endRestartGroup == null) {
return;
}
endRestartGroup.updateScope(new Function2<Composer, Integer, Unit>() { // from class: androidx.activity.compose.BackHandlerKt$BackHandler$3
/* JADX INFO: Access modifiers changed from: package-private */
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
{
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 i5) {
BackHandlerKt.BackHandler(z, function0, composer2, i | 1, i2);
}
});
}
/* JADX INFO: Access modifiers changed from: private */
public static final Function0<Unit> BackHandler$lambda$0(State<? extends Function0<Unit>> state) {
return state.getValue();
}
}