package androidx.savedstate; import android.os.Bundle; import androidx.annotation.MainThread; import androidx.lifecycle.Lifecycle; import kotlin.jvm.internal.DefaultConstructorMarker; import kotlin.jvm.internal.Intrinsics; /* loaded from: classes.dex */ public final class SavedStateRegistryController { public static final Companion Companion = new Companion(null); private boolean attached; private final SavedStateRegistryOwner owner; private final SavedStateRegistry savedStateRegistry; public /* synthetic */ SavedStateRegistryController(SavedStateRegistryOwner savedStateRegistryOwner, DefaultConstructorMarker defaultConstructorMarker) { this(savedStateRegistryOwner); } public static final SavedStateRegistryController create(SavedStateRegistryOwner savedStateRegistryOwner) { return Companion.create(savedStateRegistryOwner); } public final SavedStateRegistry getSavedStateRegistry() { return this.savedStateRegistry; } private SavedStateRegistryController(SavedStateRegistryOwner savedStateRegistryOwner) { this.owner = savedStateRegistryOwner; this.savedStateRegistry = new SavedStateRegistry(); } @MainThread public final void performAttach() { Lifecycle lifecycle = this.owner.getLifecycle(); if (lifecycle.getCurrentState() != 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; } @MainThread public final void performRestore(Bundle bundle) { if (!this.attached) { performAttach(); } Lifecycle lifecycle = this.owner.getLifecycle(); if (!(!lifecycle.getCurrentState().isAtLeast(Lifecycle.State.STARTED))) { throw new IllegalStateException(("performRestore cannot be called when owner is " + lifecycle.getCurrentState()).toString()); } this.savedStateRegistry.performRestore$savedstate_release(bundle); } @MainThread public final void performSave(Bundle outBundle) { Intrinsics.checkNotNullParameter(outBundle, "outBundle"); this.savedStateRegistry.performSave(outBundle); } public static final class Companion { public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) { this(); } private Companion() { } public final SavedStateRegistryController create(SavedStateRegistryOwner owner) { Intrinsics.checkNotNullParameter(owner, "owner"); return new SavedStateRegistryController(owner, null); } } }