package androidx.lifecycle; import androidx.core.app.NotificationCompat; import androidx.lifecycle.Lifecycle; import androidx.savedstate.SavedStateRegistry; import io.sentry.protocol.TransactionInfo; import kotlin.Metadata; import kotlin.jvm.internal.Intrinsics; /* compiled from: SavedStateHandleController.kt */ @Metadata(d1 = {"\u0000@\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0010\u000b\n\u0002\b\u0003\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\b\u0000\u0018\u00002\u00020\u0001B\u0015\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0005¢\u0006\u0002\u0010\u0006J\u0016\u0010\r\u001a\u00020\u000e2\u0006\u0010\u000f\u001a\u00020\u00102\u0006\u0010\u0011\u001a\u00020\u0012J\u0018\u0010\u0013\u001a\u00020\u000e2\u0006\u0010\u0014\u001a\u00020\u00152\u0006\u0010\u0016\u001a\u00020\u0017H\u0016R\u0011\u0010\u0004\u001a\u00020\u0005¢\u0006\b\n\u0000\u001a\u0004\b\u0007\u0010\bR\u001e\u0010\u000b\u001a\u00020\n2\u0006\u0010\t\u001a\u00020\n@BX\u0086\u000e¢\u0006\b\n\u0000\u001a\u0004\b\u000b\u0010\fR\u000e\u0010\u0002\u001a\u00020\u0003X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\u0018"}, d2 = {"Landroidx/lifecycle/SavedStateHandleController;", "Landroidx/lifecycle/LifecycleEventObserver;", "key", "", "handle", "Landroidx/lifecycle/SavedStateHandle;", "(Ljava/lang/String;Landroidx/lifecycle/SavedStateHandle;)V", "getHandle", "()Landroidx/lifecycle/SavedStateHandle;", "", "", "isAttached", "()Z", "attachToLifecycle", "", "registry", "Landroidx/savedstate/SavedStateRegistry;", "lifecycle", "Landroidx/lifecycle/Lifecycle;", "onStateChanged", TransactionInfo.JsonKeys.SOURCE, "Landroidx/lifecycle/LifecycleOwner;", NotificationCompat.CATEGORY_EVENT, "Landroidx/lifecycle/Lifecycle$Event;", "lifecycle-viewmodel-savedstate_release"}, k = 1, mv = {1, 8, 0}, xi = 48) /* loaded from: classes2.dex */ public final class SavedStateHandleController implements LifecycleEventObserver { private final SavedStateHandle handle; private boolean isAttached; private final String key; public final SavedStateHandle getHandle() { return this.handle; } /* renamed from: isAttached, reason: from getter */ public final boolean getIsAttached() { return this.isAttached; } public SavedStateHandleController(String key, SavedStateHandle handle) { Intrinsics.checkNotNullParameter(key, "key"); Intrinsics.checkNotNullParameter(handle, "handle"); this.key = key; this.handle = handle; } public final void attachToLifecycle(SavedStateRegistry registry, Lifecycle lifecycle) { Intrinsics.checkNotNullParameter(registry, "registry"); Intrinsics.checkNotNullParameter(lifecycle, "lifecycle"); if (!(!this.isAttached)) { throw new IllegalStateException("Already attached to lifecycleOwner".toString()); } this.isAttached = true; lifecycle.addObserver(this); registry.registerSavedStateProvider(this.key, this.handle.getSavedStateProvider()); } @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) { this.isAttached = false; source.getLifecycle().removeObserver(this); } } }