- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
40 lines
1.2 KiB
Java
40 lines
1.2 KiB
Java
package androidx.core.os;
|
|
|
|
import android.os.OutcomeReceiver;
|
|
import androidx.annotation.RequiresApi;
|
|
import java.lang.Throwable;
|
|
import java.util.concurrent.atomic.AtomicBoolean;
|
|
import kotlin.Result;
|
|
import kotlin.ResultKt;
|
|
import kotlin.coroutines.Continuation;
|
|
|
|
@RequiresApi(31)
|
|
/* loaded from: classes.dex */
|
|
final class ContinuationOutcomeReceiver<R, E extends Throwable> extends AtomicBoolean implements OutcomeReceiver {
|
|
private final Continuation continuation;
|
|
|
|
public ContinuationOutcomeReceiver(Continuation continuation) {
|
|
super(false);
|
|
this.continuation = continuation;
|
|
}
|
|
|
|
public void onResult(R r) {
|
|
if (compareAndSet(false, true)) {
|
|
this.continuation.resumeWith(Result.m4060constructorimpl(r));
|
|
}
|
|
}
|
|
|
|
public void onError(E e) {
|
|
if (compareAndSet(false, true)) {
|
|
Continuation continuation = this.continuation;
|
|
Result.Companion companion = Result.Companion;
|
|
continuation.resumeWith(Result.m4060constructorimpl(ResultKt.createFailure(e)));
|
|
}
|
|
}
|
|
|
|
@Override // java.util.concurrent.atomic.AtomicBoolean
|
|
public String toString() {
|
|
return "ContinuationOutcomeReceiver(outcomeReceived = " + get() + ')';
|
|
}
|
|
}
|