2021-07-24 02:37:17 +00:00
|
|
|
package androidx.lifecycle;
|
|
|
|
|
|
|
|
import androidx.lifecycle.Lifecycle;
|
2021-11-02 06:38:17 +00:00
|
|
|
import d0.w.f;
|
|
|
|
import d0.w.h.b;
|
|
|
|
import d0.w.h.c;
|
|
|
|
import d0.w.i.a.g;
|
|
|
|
import d0.z.d.m;
|
2021-07-24 02:37:17 +00:00
|
|
|
import kotlin.coroutines.Continuation;
|
|
|
|
import kotlin.jvm.functions.Function0;
|
|
|
|
import kotlinx.coroutines.CoroutineDispatcher;
|
2021-11-02 06:38:17 +00:00
|
|
|
import s.a.a.n;
|
2021-12-02 18:53:44 +00:00
|
|
|
import s.a.k0;
|
|
|
|
import s.a.l;
|
|
|
|
import s.a.l1;
|
2021-07-24 02:37:17 +00:00
|
|
|
/* compiled from: WithLifecycleState.kt */
|
|
|
|
public final class WithLifecycleStateKt {
|
|
|
|
public static final <R> Object suspendWithStateAtLeastUnchecked(Lifecycle lifecycle, Lifecycle.State state, boolean z2, CoroutineDispatcher coroutineDispatcher, Function0<? extends R> function0, Continuation<? super R> continuation) {
|
2021-12-02 18:53:44 +00:00
|
|
|
l lVar = new l(b.intercepted(continuation), 1);
|
|
|
|
lVar.A();
|
|
|
|
WithLifecycleStateKt$suspendWithStateAtLeastUnchecked$$inlined$suspendCancellableCoroutine$lambda$1 withLifecycleStateKt$suspendWithStateAtLeastUnchecked$$inlined$suspendCancellableCoroutine$lambda$1 = new WithLifecycleStateKt$suspendWithStateAtLeastUnchecked$$inlined$suspendCancellableCoroutine$lambda$1(lVar, lifecycle, state, function0, z2, coroutineDispatcher);
|
2021-07-24 02:37:17 +00:00
|
|
|
if (z2) {
|
2021-12-02 18:53:44 +00:00
|
|
|
coroutineDispatcher.dispatch(f.j, new WithLifecycleStateKt$suspendWithStateAtLeastUnchecked$$inlined$suspendCancellableCoroutine$lambda$2(withLifecycleStateKt$suspendWithStateAtLeastUnchecked$$inlined$suspendCancellableCoroutine$lambda$1, lifecycle, state, function0, z2, coroutineDispatcher));
|
2021-07-24 02:37:17 +00:00
|
|
|
} else {
|
|
|
|
lifecycle.addObserver(withLifecycleStateKt$suspendWithStateAtLeastUnchecked$$inlined$suspendCancellableCoroutine$lambda$1);
|
|
|
|
}
|
2021-12-02 18:53:44 +00:00
|
|
|
lVar.f(new WithLifecycleStateKt$suspendWithStateAtLeastUnchecked$$inlined$suspendCancellableCoroutine$lambda$3(withLifecycleStateKt$suspendWithStateAtLeastUnchecked$$inlined$suspendCancellableCoroutine$lambda$1, lifecycle, state, function0, z2, coroutineDispatcher));
|
|
|
|
Object u = lVar.u();
|
2021-07-24 02:37:17 +00:00
|
|
|
if (u == c.getCOROUTINE_SUSPENDED()) {
|
|
|
|
g.probeCoroutineSuspended(continuation);
|
|
|
|
}
|
|
|
|
return u;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final <R> Object withCreated(Lifecycle lifecycle, Function0<? extends R> function0, Continuation<? super R> continuation) {
|
|
|
|
Lifecycle.State state = Lifecycle.State.CREATED;
|
2021-12-02 18:53:44 +00:00
|
|
|
CoroutineDispatcher coroutineDispatcher = k0.a;
|
2021-12-20 07:27:17 +00:00
|
|
|
l1 H = n.f3788b.H();
|
2021-07-24 02:37:17 +00:00
|
|
|
boolean isDispatchNeeded = H.isDispatchNeeded(continuation.getContext());
|
|
|
|
if (!isDispatchNeeded) {
|
|
|
|
if (lifecycle.getCurrentState() == Lifecycle.State.DESTROYED) {
|
|
|
|
throw new LifecycleDestroyedException();
|
|
|
|
} else if (lifecycle.getCurrentState().compareTo(state) >= 0) {
|
2021-11-02 06:38:17 +00:00
|
|
|
return function0.mo1invoke();
|
2021-07-24 02:37:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return suspendWithStateAtLeastUnchecked(lifecycle, state, isDispatchNeeded, H, new WithLifecycleStateKt$withStateAtLeastUnchecked$2(function0), continuation);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final <R> Object withCreated(LifecycleOwner lifecycleOwner, Function0<? extends R> function0, Continuation<? super R> continuation) {
|
|
|
|
Lifecycle lifecycle = lifecycleOwner.getLifecycle();
|
|
|
|
m.checkNotNullExpressionValue(lifecycle, "lifecycle");
|
|
|
|
Lifecycle.State state = Lifecycle.State.CREATED;
|
2021-12-02 18:53:44 +00:00
|
|
|
CoroutineDispatcher coroutineDispatcher = k0.a;
|
2021-12-20 07:27:17 +00:00
|
|
|
l1 H = n.f3788b.H();
|
2021-07-24 02:37:17 +00:00
|
|
|
boolean isDispatchNeeded = H.isDispatchNeeded(continuation.getContext());
|
|
|
|
if (!isDispatchNeeded) {
|
|
|
|
if (lifecycle.getCurrentState() == Lifecycle.State.DESTROYED) {
|
|
|
|
throw new LifecycleDestroyedException();
|
|
|
|
} else if (lifecycle.getCurrentState().compareTo(state) >= 0) {
|
2021-11-02 06:38:17 +00:00
|
|
|
return function0.mo1invoke();
|
2021-07-24 02:37:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return suspendWithStateAtLeastUnchecked(lifecycle, state, isDispatchNeeded, H, new WithLifecycleStateKt$withStateAtLeastUnchecked$2(function0), continuation);
|
|
|
|
}
|
|
|
|
|
|
|
|
private static final Object withCreated$$forInline(Lifecycle lifecycle, Function0 function0, Continuation continuation) {
|
|
|
|
Lifecycle.State state = Lifecycle.State.CREATED;
|
2021-12-02 18:53:44 +00:00
|
|
|
CoroutineDispatcher coroutineDispatcher = k0.a;
|
2021-12-20 07:27:17 +00:00
|
|
|
n.f3788b.H();
|
2021-12-02 18:53:44 +00:00
|
|
|
d0.z.d.l.mark(3);
|
2021-07-24 02:37:17 +00:00
|
|
|
throw null;
|
|
|
|
}
|
|
|
|
|
|
|
|
private static final Object withCreated$$forInline(LifecycleOwner lifecycleOwner, Function0 function0, Continuation continuation) {
|
|
|
|
m.checkNotNullExpressionValue(lifecycleOwner.getLifecycle(), "lifecycle");
|
|
|
|
Lifecycle.State state = Lifecycle.State.CREATED;
|
2021-12-02 18:53:44 +00:00
|
|
|
CoroutineDispatcher coroutineDispatcher = k0.a;
|
2021-12-20 07:27:17 +00:00
|
|
|
n.f3788b.H();
|
2021-12-02 18:53:44 +00:00
|
|
|
d0.z.d.l.mark(3);
|
2021-07-24 02:37:17 +00:00
|
|
|
throw null;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final <R> Object withResumed(Lifecycle lifecycle, Function0<? extends R> function0, Continuation<? super R> continuation) {
|
|
|
|
Lifecycle.State state = Lifecycle.State.RESUMED;
|
2021-12-02 18:53:44 +00:00
|
|
|
CoroutineDispatcher coroutineDispatcher = k0.a;
|
2021-12-20 07:27:17 +00:00
|
|
|
l1 H = n.f3788b.H();
|
2021-07-24 02:37:17 +00:00
|
|
|
boolean isDispatchNeeded = H.isDispatchNeeded(continuation.getContext());
|
|
|
|
if (!isDispatchNeeded) {
|
|
|
|
if (lifecycle.getCurrentState() == Lifecycle.State.DESTROYED) {
|
|
|
|
throw new LifecycleDestroyedException();
|
|
|
|
} else if (lifecycle.getCurrentState().compareTo(state) >= 0) {
|
2021-11-02 06:38:17 +00:00
|
|
|
return function0.mo1invoke();
|
2021-07-24 02:37:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return suspendWithStateAtLeastUnchecked(lifecycle, state, isDispatchNeeded, H, new WithLifecycleStateKt$withStateAtLeastUnchecked$2(function0), continuation);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final <R> Object withResumed(LifecycleOwner lifecycleOwner, Function0<? extends R> function0, Continuation<? super R> continuation) {
|
|
|
|
Lifecycle lifecycle = lifecycleOwner.getLifecycle();
|
|
|
|
m.checkNotNullExpressionValue(lifecycle, "lifecycle");
|
|
|
|
Lifecycle.State state = Lifecycle.State.RESUMED;
|
2021-12-02 18:53:44 +00:00
|
|
|
CoroutineDispatcher coroutineDispatcher = k0.a;
|
2021-12-20 07:27:17 +00:00
|
|
|
l1 H = n.f3788b.H();
|
2021-07-24 02:37:17 +00:00
|
|
|
boolean isDispatchNeeded = H.isDispatchNeeded(continuation.getContext());
|
|
|
|
if (!isDispatchNeeded) {
|
|
|
|
if (lifecycle.getCurrentState() == Lifecycle.State.DESTROYED) {
|
|
|
|
throw new LifecycleDestroyedException();
|
|
|
|
} else if (lifecycle.getCurrentState().compareTo(state) >= 0) {
|
2021-11-02 06:38:17 +00:00
|
|
|
return function0.mo1invoke();
|
2021-07-24 02:37:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return suspendWithStateAtLeastUnchecked(lifecycle, state, isDispatchNeeded, H, new WithLifecycleStateKt$withStateAtLeastUnchecked$2(function0), continuation);
|
|
|
|
}
|
|
|
|
|
|
|
|
private static final Object withResumed$$forInline(Lifecycle lifecycle, Function0 function0, Continuation continuation) {
|
|
|
|
Lifecycle.State state = Lifecycle.State.RESUMED;
|
2021-12-02 18:53:44 +00:00
|
|
|
CoroutineDispatcher coroutineDispatcher = k0.a;
|
2021-12-20 07:27:17 +00:00
|
|
|
n.f3788b.H();
|
2021-12-02 18:53:44 +00:00
|
|
|
d0.z.d.l.mark(3);
|
2021-07-24 02:37:17 +00:00
|
|
|
throw null;
|
|
|
|
}
|
|
|
|
|
|
|
|
private static final Object withResumed$$forInline(LifecycleOwner lifecycleOwner, Function0 function0, Continuation continuation) {
|
|
|
|
m.checkNotNullExpressionValue(lifecycleOwner.getLifecycle(), "lifecycle");
|
|
|
|
Lifecycle.State state = Lifecycle.State.RESUMED;
|
2021-12-02 18:53:44 +00:00
|
|
|
CoroutineDispatcher coroutineDispatcher = k0.a;
|
2021-12-20 07:27:17 +00:00
|
|
|
n.f3788b.H();
|
2021-12-02 18:53:44 +00:00
|
|
|
d0.z.d.l.mark(3);
|
2021-07-24 02:37:17 +00:00
|
|
|
throw null;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final <R> Object withStarted(Lifecycle lifecycle, Function0<? extends R> function0, Continuation<? super R> continuation) {
|
|
|
|
Lifecycle.State state = Lifecycle.State.STARTED;
|
2021-12-02 18:53:44 +00:00
|
|
|
CoroutineDispatcher coroutineDispatcher = k0.a;
|
2021-12-20 07:27:17 +00:00
|
|
|
l1 H = n.f3788b.H();
|
2021-07-24 02:37:17 +00:00
|
|
|
boolean isDispatchNeeded = H.isDispatchNeeded(continuation.getContext());
|
|
|
|
if (!isDispatchNeeded) {
|
|
|
|
if (lifecycle.getCurrentState() == Lifecycle.State.DESTROYED) {
|
|
|
|
throw new LifecycleDestroyedException();
|
|
|
|
} else if (lifecycle.getCurrentState().compareTo(state) >= 0) {
|
2021-11-02 06:38:17 +00:00
|
|
|
return function0.mo1invoke();
|
2021-07-24 02:37:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return suspendWithStateAtLeastUnchecked(lifecycle, state, isDispatchNeeded, H, new WithLifecycleStateKt$withStateAtLeastUnchecked$2(function0), continuation);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final <R> Object withStarted(LifecycleOwner lifecycleOwner, Function0<? extends R> function0, Continuation<? super R> continuation) {
|
|
|
|
Lifecycle lifecycle = lifecycleOwner.getLifecycle();
|
|
|
|
m.checkNotNullExpressionValue(lifecycle, "lifecycle");
|
|
|
|
Lifecycle.State state = Lifecycle.State.STARTED;
|
2021-12-02 18:53:44 +00:00
|
|
|
CoroutineDispatcher coroutineDispatcher = k0.a;
|
2021-12-20 07:27:17 +00:00
|
|
|
l1 H = n.f3788b.H();
|
2021-07-24 02:37:17 +00:00
|
|
|
boolean isDispatchNeeded = H.isDispatchNeeded(continuation.getContext());
|
|
|
|
if (!isDispatchNeeded) {
|
|
|
|
if (lifecycle.getCurrentState() == Lifecycle.State.DESTROYED) {
|
|
|
|
throw new LifecycleDestroyedException();
|
|
|
|
} else if (lifecycle.getCurrentState().compareTo(state) >= 0) {
|
2021-11-02 06:38:17 +00:00
|
|
|
return function0.mo1invoke();
|
2021-07-24 02:37:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return suspendWithStateAtLeastUnchecked(lifecycle, state, isDispatchNeeded, H, new WithLifecycleStateKt$withStateAtLeastUnchecked$2(function0), continuation);
|
|
|
|
}
|
|
|
|
|
|
|
|
private static final Object withStarted$$forInline(Lifecycle lifecycle, Function0 function0, Continuation continuation) {
|
|
|
|
Lifecycle.State state = Lifecycle.State.STARTED;
|
2021-12-02 18:53:44 +00:00
|
|
|
CoroutineDispatcher coroutineDispatcher = k0.a;
|
2021-12-20 07:27:17 +00:00
|
|
|
n.f3788b.H();
|
2021-12-02 18:53:44 +00:00
|
|
|
d0.z.d.l.mark(3);
|
2021-07-24 02:37:17 +00:00
|
|
|
throw null;
|
|
|
|
}
|
|
|
|
|
|
|
|
private static final Object withStarted$$forInline(LifecycleOwner lifecycleOwner, Function0 function0, Continuation continuation) {
|
|
|
|
m.checkNotNullExpressionValue(lifecycleOwner.getLifecycle(), "lifecycle");
|
|
|
|
Lifecycle.State state = Lifecycle.State.STARTED;
|
2021-12-02 18:53:44 +00:00
|
|
|
CoroutineDispatcher coroutineDispatcher = k0.a;
|
2021-12-20 07:27:17 +00:00
|
|
|
n.f3788b.H();
|
2021-12-02 18:53:44 +00:00
|
|
|
d0.z.d.l.mark(3);
|
2021-07-24 02:37:17 +00:00
|
|
|
throw null;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final <R> Object withStateAtLeast(Lifecycle lifecycle, Lifecycle.State state, Function0<? extends R> function0, Continuation<? super R> continuation) {
|
|
|
|
if (state.compareTo(Lifecycle.State.CREATED) >= 0) {
|
2021-12-02 18:53:44 +00:00
|
|
|
CoroutineDispatcher coroutineDispatcher = k0.a;
|
2021-12-20 07:27:17 +00:00
|
|
|
l1 H = n.f3788b.H();
|
2021-07-24 02:37:17 +00:00
|
|
|
boolean isDispatchNeeded = H.isDispatchNeeded(continuation.getContext());
|
|
|
|
if (!isDispatchNeeded) {
|
|
|
|
if (lifecycle.getCurrentState() == Lifecycle.State.DESTROYED) {
|
|
|
|
throw new LifecycleDestroyedException();
|
|
|
|
} else if (lifecycle.getCurrentState().compareTo(state) >= 0) {
|
2021-11-02 06:38:17 +00:00
|
|
|
return function0.mo1invoke();
|
2021-07-24 02:37:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return suspendWithStateAtLeastUnchecked(lifecycle, state, isDispatchNeeded, H, new WithLifecycleStateKt$withStateAtLeastUnchecked$2(function0), continuation);
|
|
|
|
}
|
|
|
|
throw new IllegalArgumentException(("target state must be CREATED or greater, found " + state).toString());
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final <R> Object withStateAtLeast(LifecycleOwner lifecycleOwner, Lifecycle.State state, Function0<? extends R> function0, Continuation<? super R> continuation) {
|
|
|
|
Lifecycle lifecycle = lifecycleOwner.getLifecycle();
|
|
|
|
m.checkNotNullExpressionValue(lifecycle, "lifecycle");
|
|
|
|
if (state.compareTo(Lifecycle.State.CREATED) >= 0) {
|
2021-12-02 18:53:44 +00:00
|
|
|
CoroutineDispatcher coroutineDispatcher = k0.a;
|
2021-12-20 07:27:17 +00:00
|
|
|
l1 H = n.f3788b.H();
|
2021-07-24 02:37:17 +00:00
|
|
|
boolean isDispatchNeeded = H.isDispatchNeeded(continuation.getContext());
|
|
|
|
if (!isDispatchNeeded) {
|
|
|
|
if (lifecycle.getCurrentState() == Lifecycle.State.DESTROYED) {
|
|
|
|
throw new LifecycleDestroyedException();
|
|
|
|
} else if (lifecycle.getCurrentState().compareTo(state) >= 0) {
|
2021-11-02 06:38:17 +00:00
|
|
|
return function0.mo1invoke();
|
2021-07-24 02:37:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return suspendWithStateAtLeastUnchecked(lifecycle, state, isDispatchNeeded, H, new WithLifecycleStateKt$withStateAtLeastUnchecked$2(function0), continuation);
|
|
|
|
}
|
|
|
|
throw new IllegalArgumentException(("target state must be CREATED or greater, found " + state).toString());
|
|
|
|
}
|
|
|
|
|
|
|
|
private static final Object withStateAtLeast$$forInline(Lifecycle lifecycle, Lifecycle.State state, Function0 function0, Continuation continuation) {
|
|
|
|
if (!(state.compareTo(Lifecycle.State.CREATED) >= 0)) {
|
|
|
|
throw new IllegalArgumentException(("target state must be CREATED or greater, found " + state).toString());
|
|
|
|
}
|
2021-12-02 18:53:44 +00:00
|
|
|
CoroutineDispatcher coroutineDispatcher = k0.a;
|
2021-12-20 07:27:17 +00:00
|
|
|
n.f3788b.H();
|
2021-12-02 18:53:44 +00:00
|
|
|
d0.z.d.l.mark(3);
|
2021-07-24 02:37:17 +00:00
|
|
|
throw null;
|
|
|
|
}
|
|
|
|
|
|
|
|
private static final Object withStateAtLeast$$forInline(LifecycleOwner lifecycleOwner, Lifecycle.State state, Function0 function0, Continuation continuation) {
|
|
|
|
m.checkNotNullExpressionValue(lifecycleOwner.getLifecycle(), "lifecycle");
|
|
|
|
if (!(state.compareTo(Lifecycle.State.CREATED) >= 0)) {
|
|
|
|
throw new IllegalArgumentException(("target state must be CREATED or greater, found " + state).toString());
|
|
|
|
}
|
2021-12-02 18:53:44 +00:00
|
|
|
CoroutineDispatcher coroutineDispatcher = k0.a;
|
2021-12-20 07:27:17 +00:00
|
|
|
n.f3788b.H();
|
2021-12-02 18:53:44 +00:00
|
|
|
d0.z.d.l.mark(3);
|
2021-07-24 02:37:17 +00:00
|
|
|
throw null;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final <R> Object withStateAtLeastUnchecked(Lifecycle lifecycle, Lifecycle.State state, Function0<? extends R> function0, Continuation<? super R> continuation) {
|
2021-12-02 18:53:44 +00:00
|
|
|
CoroutineDispatcher coroutineDispatcher = k0.a;
|
2021-12-20 07:27:17 +00:00
|
|
|
l1 H = n.f3788b.H();
|
2021-07-24 02:37:17 +00:00
|
|
|
boolean isDispatchNeeded = H.isDispatchNeeded(continuation.getContext());
|
|
|
|
if (!isDispatchNeeded) {
|
|
|
|
if (lifecycle.getCurrentState() == Lifecycle.State.DESTROYED) {
|
|
|
|
throw new LifecycleDestroyedException();
|
|
|
|
} else if (lifecycle.getCurrentState().compareTo(state) >= 0) {
|
2021-11-02 06:38:17 +00:00
|
|
|
return function0.mo1invoke();
|
2021-07-24 02:37:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return suspendWithStateAtLeastUnchecked(lifecycle, state, isDispatchNeeded, H, new WithLifecycleStateKt$withStateAtLeastUnchecked$2(function0), continuation);
|
|
|
|
}
|
|
|
|
|
|
|
|
private static final Object withStateAtLeastUnchecked$$forInline(Lifecycle lifecycle, Lifecycle.State state, Function0 function0, Continuation continuation) {
|
2021-12-02 18:53:44 +00:00
|
|
|
CoroutineDispatcher coroutineDispatcher = k0.a;
|
2021-12-20 07:27:17 +00:00
|
|
|
n.f3788b.H();
|
2021-12-02 18:53:44 +00:00
|
|
|
d0.z.d.l.mark(3);
|
2021-07-24 02:37:17 +00:00
|
|
|
throw null;
|
|
|
|
}
|
|
|
|
}
|