Rabbit-R1/original r1/java/sources/androidx/savedstate/SavedStateRegistryController.java
2024-05-21 17:08:36 -04:00

82 lines
4.8 KiB
Java

package androidx.savedstate;
import android.os.Bundle;
import androidx.lifecycle.Lifecycle;
import kotlin.Metadata;
import kotlin.jvm.JvmStatic;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
/* compiled from: SavedStateRegistryController.kt */
@Metadata(d1 = {"\u00000\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0004\u0018\u0000 \u00122\u00020\u0001:\u0001\u0012B\u000f\b\u0002\u0012\u0006\u0010\u0002\u001a\u00020\u0003¢\u0006\u0002\u0010\u0004J\b\u0010\u000b\u001a\u00020\fH\u0007J\u0012\u0010\r\u001a\u00020\f2\b\u0010\u000e\u001a\u0004\u0018\u00010\u000fH\u0007J\u0010\u0010\u0010\u001a\u00020\f2\u0006\u0010\u0011\u001a\u00020\u000fH\u0007R\u000e\u0010\u0005\u001a\u00020\u0006X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0002\u001a\u00020\u0003X\u0082\u0004¢\u0006\u0002\n\u0000R\u0011\u0010\u0007\u001a\u00020\\u0006\b\n\u0000\u001a\u0004\b\t\u0010\\u0006\u0013"}, d2 = {"Landroidx/savedstate/SavedStateRegistryController;", "", "owner", "Landroidx/savedstate/SavedStateRegistryOwner;", "(Landroidx/savedstate/SavedStateRegistryOwner;)V", "attached", "", "savedStateRegistry", "Landroidx/savedstate/SavedStateRegistry;", "getSavedStateRegistry", "()Landroidx/savedstate/SavedStateRegistry;", "performAttach", "", "performRestore", "savedState", "Landroid/os/Bundle;", "performSave", "outBundle", "Companion", "savedstate_release"}, k = 1, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes2.dex */
public final class SavedStateRegistryController {
/* renamed from: Companion, reason: from kotlin metadata */
public static final Companion INSTANCE = new Companion(null);
private boolean attached;
private final SavedStateRegistryOwner owner;
private final SavedStateRegistry savedStateRegistry;
public /* synthetic */ SavedStateRegistryController(SavedStateRegistryOwner savedStateRegistryOwner, DefaultConstructorMarker defaultConstructorMarker) {
this(savedStateRegistryOwner);
}
@JvmStatic
public static final SavedStateRegistryController create(SavedStateRegistryOwner savedStateRegistryOwner) {
return INSTANCE.create(savedStateRegistryOwner);
}
public final SavedStateRegistry getSavedStateRegistry() {
return this.savedStateRegistry;
}
private SavedStateRegistryController(SavedStateRegistryOwner savedStateRegistryOwner) {
this.owner = savedStateRegistryOwner;
this.savedStateRegistry = new SavedStateRegistry();
}
public final void performAttach() {
Lifecycle lifecycle = this.owner.getLifecycle();
if (lifecycle.getState() != Lifecycle.State.INITIALIZED) {
throw new IllegalStateException("Restarter must be created only during owner's initialization stage".toString());
}
lifecycle.addObserver(new Recreator(this.owner));
this.savedStateRegistry.performAttach$savedstate_release(lifecycle);
this.attached = true;
}
public final void performRestore(Bundle savedState) {
if (!this.attached) {
performAttach();
}
Lifecycle lifecycle = this.owner.getLifecycle();
if (!(!lifecycle.getState().isAtLeast(Lifecycle.State.STARTED))) {
throw new IllegalStateException(("performRestore cannot be called when owner is " + lifecycle.getState()).toString());
}
this.savedStateRegistry.performRestore$savedstate_release(savedState);
}
public final void performSave(Bundle outBundle) {
Intrinsics.checkNotNullParameter(outBundle, "outBundle");
this.savedStateRegistry.performSave(outBundle);
}
/* compiled from: SavedStateRegistryController.kt */
@Metadata(d1 = {"\u0000\u0018\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\b\u0086\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u0010\u0010\u0003\u001a\u00020\u00042\u0006\u0010\u0005\u001a\u00020\u0006H\u0007¨\u0006\u0007"}, d2 = {"Landroidx/savedstate/SavedStateRegistryController$Companion;", "", "()V", "create", "Landroidx/savedstate/SavedStateRegistryController;", "owner", "Landroidx/savedstate/SavedStateRegistryOwner;", "savedstate_release"}, k = 1, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes2.dex */
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
@JvmStatic
public final SavedStateRegistryController create(SavedStateRegistryOwner owner) {
Intrinsics.checkNotNullParameter(owner, "owner");
return new SavedStateRegistryController(owner, null);
}
}
}