package androidx.lifecycle; import androidx.core.app.NotificationCompat; import androidx.lifecycle.Lifecycle; import io.sentry.protocol.TransactionInfo; import java.util.concurrent.CancellationException; import kotlin.Metadata; import kotlin.coroutines.CoroutineContext; import kotlin.jvm.internal.Intrinsics; import kotlinx.coroutines.BuildersKt__Builders_commonKt; import kotlinx.coroutines.Dispatchers; import kotlinx.coroutines.JobKt__JobKt; /* compiled from: Lifecycle.kt */ @Metadata(d1 = {"\u00000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\b\u0000\u0018\u00002\u00020\u00012\u00020\u0002B\u0015\u0012\u0006\u0010\u0003\u001a\u00020\u0004\u0012\u0006\u0010\u0005\u001a\u00020\u0006¢\u0006\u0002\u0010\u0007J\u0018\u0010\f\u001a\u00020\r2\u0006\u0010\u000e\u001a\u00020\u000f2\u0006\u0010\u0010\u001a\u00020\u0011H\u0016J\u0006\u0010\u0012\u001a\u00020\rR\u0014\u0010\u0005\u001a\u00020\u0006X\u0096\u0004¢\u0006\b\n\u0000\u001a\u0004\b\b\u0010\tR\u0014\u0010\u0003\u001a\u00020\u0004X\u0090\u0004¢\u0006\b\n\u0000\u001a\u0004\b\n\u0010\u000b¨\u0006\u0013"}, d2 = {"Landroidx/lifecycle/LifecycleCoroutineScopeImpl;", "Landroidx/lifecycle/LifecycleCoroutineScope;", "Landroidx/lifecycle/LifecycleEventObserver;", "lifecycle", "Landroidx/lifecycle/Lifecycle;", "coroutineContext", "Lkotlin/coroutines/CoroutineContext;", "(Landroidx/lifecycle/Lifecycle;Lkotlin/coroutines/CoroutineContext;)V", "getCoroutineContext", "()Lkotlin/coroutines/CoroutineContext;", "getLifecycle$lifecycle_common", "()Landroidx/lifecycle/Lifecycle;", "onStateChanged", "", TransactionInfo.JsonKeys.SOURCE, "Landroidx/lifecycle/LifecycleOwner;", NotificationCompat.CATEGORY_EVENT, "Landroidx/lifecycle/Lifecycle$Event;", "register", "lifecycle-common"}, k = 1, mv = {1, 8, 0}, xi = 48) /* loaded from: classes2.dex */ public final class LifecycleCoroutineScopeImpl extends LifecycleCoroutineScope implements LifecycleEventObserver { private final CoroutineContext coroutineContext; private final Lifecycle lifecycle; @Override // kotlinx.coroutines.CoroutineScope public CoroutineContext getCoroutineContext() { return this.coroutineContext; } @Override // androidx.lifecycle.LifecycleCoroutineScope /* renamed from: getLifecycle$lifecycle_common, reason: from getter */ public Lifecycle getLifecycle() { return this.lifecycle; } public LifecycleCoroutineScopeImpl(Lifecycle lifecycle, CoroutineContext coroutineContext) { Intrinsics.checkNotNullParameter(lifecycle, "lifecycle"); Intrinsics.checkNotNullParameter(coroutineContext, "coroutineContext"); this.lifecycle = lifecycle; this.coroutineContext = coroutineContext; if (getLifecycle().getState() == Lifecycle.State.DESTROYED) { JobKt__JobKt.cancel$default(getCoroutineContext(), (CancellationException) null, 1, (Object) null); } } public final void register() { BuildersKt__Builders_commonKt.launch$default(this, Dispatchers.getMain().getImmediate(), null, new LifecycleCoroutineScopeImpl$register$1(this, null), 2, null); } @Override // androidx.lifecycle.LifecycleEventObserver public void onStateChanged(LifecycleOwner source, Lifecycle.Event event) { Intrinsics.checkNotNullParameter(source, "source"); Intrinsics.checkNotNullParameter(event, "event"); if (getLifecycle().getState().compareTo(Lifecycle.State.DESTROYED) <= 0) { getLifecycle().removeObserver(this); JobKt__JobKt.cancel$default(getCoroutineContext(), (CancellationException) null, 1, (Object) null); } } }