package androidx.lifecycle; import androidx.lifecycle.Lifecycle; import c.q.a.k.a; import d0.z.d.m; import kotlin.coroutines.CoroutineContext; import kotlinx.coroutines.CoroutineDispatcher; import s.a.a.n; import s.a.j0; /* compiled from: Lifecycle.kt */ public final class LifecycleCoroutineScopeImpl extends LifecycleCoroutineScope implements LifecycleEventObserver { private final CoroutineContext coroutineContext; private final Lifecycle lifecycle; public LifecycleCoroutineScopeImpl(Lifecycle lifecycle, CoroutineContext coroutineContext) { m.checkNotNullParameter(lifecycle, "lifecycle"); m.checkNotNullParameter(coroutineContext, "coroutineContext"); this.lifecycle = lifecycle; this.coroutineContext = coroutineContext; if (getLifecycle$lifecycle_runtime_ktx_release().getCurrentState() == Lifecycle.State.DESTROYED) { a.j(getCoroutineContext(), null, 1, null); } } @Override // androidx.lifecycle.LifecycleCoroutineScope, kotlinx.coroutines.CoroutineScope public CoroutineContext getCoroutineContext() { return this.coroutineContext; } @Override // androidx.lifecycle.LifecycleCoroutineScope public Lifecycle getLifecycle$lifecycle_runtime_ktx_release() { return this.lifecycle; } @Override // androidx.lifecycle.LifecycleEventObserver public void onStateChanged(LifecycleOwner lifecycleOwner, Lifecycle.Event event) { m.checkNotNullParameter(lifecycleOwner, "source"); m.checkNotNullParameter(event, "event"); if (getLifecycle$lifecycle_runtime_ktx_release().getCurrentState().compareTo(Lifecycle.State.DESTROYED) <= 0) { getLifecycle$lifecycle_runtime_ktx_release().removeObserver(this); a.j(getCoroutineContext(), null, 1, null); } } public final void register() { CoroutineDispatcher coroutineDispatcher = j0.a; a.G(this, n.b.H(), null, new LifecycleCoroutineScopeImpl$register$1(this, null), 2, null); } }