259 lines
7.8 KiB
Java
259 lines
7.8 KiB
Java
package c.i.a.f.n;
|
|
|
|
import androidx.annotation.NonNull;
|
|
import androidx.annotation.Nullable;
|
|
import com.airbnb.lottie.parser.AnimatableValueParser;
|
|
import com.google.android.gms.tasks.DuplicateTaskCompletionException;
|
|
import com.google.android.gms.tasks.RuntimeExecutionException;
|
|
import com.google.android.gms.tasks.Task;
|
|
import java.util.concurrent.CancellationException;
|
|
import java.util.concurrent.Executor;
|
|
/* compiled from: com.google.android.gms:play-services-tasks@@17.2.0 */
|
|
public final class b0<TResult> extends Task<TResult> {
|
|
public final Object a = new Object();
|
|
public final y<TResult> b = new y<>();
|
|
|
|
/* renamed from: c reason: collision with root package name */
|
|
public boolean f1220c;
|
|
public volatile boolean d;
|
|
@Nullable
|
|
public TResult e;
|
|
public Exception f;
|
|
|
|
@Override // com.google.android.gms.tasks.Task
|
|
@NonNull
|
|
public final Task<TResult> a(@NonNull Executor executor, @NonNull b bVar) {
|
|
y<TResult> yVar = this.b;
|
|
int i = c0.a;
|
|
yVar.b(new p(executor, bVar));
|
|
w();
|
|
return this;
|
|
}
|
|
|
|
@Override // com.google.android.gms.tasks.Task
|
|
@NonNull
|
|
public final Task<TResult> b(@NonNull c<TResult> cVar) {
|
|
c(g.a, cVar);
|
|
return this;
|
|
}
|
|
|
|
@Override // com.google.android.gms.tasks.Task
|
|
@NonNull
|
|
public final Task<TResult> c(@NonNull Executor executor, @NonNull c<TResult> cVar) {
|
|
y<TResult> yVar = this.b;
|
|
int i = c0.a;
|
|
yVar.b(new q(executor, cVar));
|
|
w();
|
|
return this;
|
|
}
|
|
|
|
@Override // com.google.android.gms.tasks.Task
|
|
@NonNull
|
|
public final Task<TResult> d(@NonNull d dVar) {
|
|
e(g.a, dVar);
|
|
return this;
|
|
}
|
|
|
|
@Override // com.google.android.gms.tasks.Task
|
|
@NonNull
|
|
public final Task<TResult> e(@NonNull Executor executor, @NonNull d dVar) {
|
|
y<TResult> yVar = this.b;
|
|
int i = c0.a;
|
|
yVar.b(new t(executor, dVar));
|
|
w();
|
|
return this;
|
|
}
|
|
|
|
@Override // com.google.android.gms.tasks.Task
|
|
@NonNull
|
|
public final Task<TResult> f(@NonNull e<? super TResult> eVar) {
|
|
g(g.a, eVar);
|
|
return this;
|
|
}
|
|
|
|
@Override // com.google.android.gms.tasks.Task
|
|
@NonNull
|
|
public final Task<TResult> g(@NonNull Executor executor, @NonNull e<? super TResult> eVar) {
|
|
y<TResult> yVar = this.b;
|
|
int i = c0.a;
|
|
yVar.b(new u(executor, eVar));
|
|
w();
|
|
return this;
|
|
}
|
|
|
|
@Override // com.google.android.gms.tasks.Task
|
|
@NonNull
|
|
public final <TContinuationResult> Task<TContinuationResult> h(@NonNull a<TResult, TContinuationResult> aVar) {
|
|
return i(g.a, aVar);
|
|
}
|
|
|
|
@Override // com.google.android.gms.tasks.Task
|
|
@NonNull
|
|
public final <TContinuationResult> Task<TContinuationResult> i(@NonNull Executor executor, @NonNull a<TResult, TContinuationResult> aVar) {
|
|
b0 b0Var = new b0();
|
|
y<TResult> yVar = this.b;
|
|
int i = c0.a;
|
|
yVar.b(new k(executor, aVar, b0Var));
|
|
w();
|
|
return b0Var;
|
|
}
|
|
|
|
@Override // com.google.android.gms.tasks.Task
|
|
@NonNull
|
|
public final <TContinuationResult> Task<TContinuationResult> j(@NonNull Executor executor, @NonNull a<TResult, Task<TContinuationResult>> aVar) {
|
|
b0 b0Var = new b0();
|
|
y<TResult> yVar = this.b;
|
|
int i = c0.a;
|
|
yVar.b(new l(executor, aVar, b0Var));
|
|
w();
|
|
return b0Var;
|
|
}
|
|
|
|
@Override // com.google.android.gms.tasks.Task
|
|
@Nullable
|
|
public final Exception k() {
|
|
Exception exc;
|
|
synchronized (this.a) {
|
|
exc = this.f;
|
|
}
|
|
return exc;
|
|
}
|
|
|
|
@Override // com.google.android.gms.tasks.Task
|
|
public final TResult l() {
|
|
TResult tresult;
|
|
synchronized (this.a) {
|
|
AnimatableValueParser.G(this.f1220c, "Task is not yet complete");
|
|
if (this.d) {
|
|
throw new CancellationException("Task is already canceled.");
|
|
} else if (this.f == null) {
|
|
tresult = this.e;
|
|
} else {
|
|
throw new RuntimeExecutionException(this.f);
|
|
}
|
|
}
|
|
return tresult;
|
|
}
|
|
|
|
@Override // com.google.android.gms.tasks.Task
|
|
public final <X extends Throwable> TResult m(@NonNull Class<X> cls) throws Throwable {
|
|
TResult tresult;
|
|
synchronized (this.a) {
|
|
AnimatableValueParser.G(this.f1220c, "Task is not yet complete");
|
|
if (this.d) {
|
|
throw new CancellationException("Task is already canceled.");
|
|
} else if (cls.isInstance(this.f)) {
|
|
throw cls.cast(this.f);
|
|
} else if (this.f == null) {
|
|
tresult = this.e;
|
|
} else {
|
|
throw new RuntimeExecutionException(this.f);
|
|
}
|
|
}
|
|
return tresult;
|
|
}
|
|
|
|
@Override // com.google.android.gms.tasks.Task
|
|
public final boolean n() {
|
|
return this.d;
|
|
}
|
|
|
|
@Override // com.google.android.gms.tasks.Task
|
|
public final boolean o() {
|
|
boolean z2;
|
|
synchronized (this.a) {
|
|
z2 = this.f1220c;
|
|
}
|
|
return z2;
|
|
}
|
|
|
|
@Override // com.google.android.gms.tasks.Task
|
|
public final boolean p() {
|
|
boolean z2;
|
|
synchronized (this.a) {
|
|
z2 = this.f1220c && !this.d && this.f == null;
|
|
}
|
|
return z2;
|
|
}
|
|
|
|
@Override // com.google.android.gms.tasks.Task
|
|
@NonNull
|
|
public final <TContinuationResult> Task<TContinuationResult> q(@NonNull f<TResult, TContinuationResult> fVar) {
|
|
return r(g.a, fVar);
|
|
}
|
|
|
|
@Override // com.google.android.gms.tasks.Task
|
|
@NonNull
|
|
public final <TContinuationResult> Task<TContinuationResult> r(Executor executor, f<TResult, TContinuationResult> fVar) {
|
|
b0 b0Var = new b0();
|
|
y<TResult> yVar = this.b;
|
|
int i = c0.a;
|
|
yVar.b(new x(executor, fVar, b0Var));
|
|
w();
|
|
return b0Var;
|
|
}
|
|
|
|
public final void s(@NonNull Exception exc) {
|
|
AnimatableValueParser.z(exc, "Exception must not be null");
|
|
synchronized (this.a) {
|
|
v();
|
|
this.f1220c = true;
|
|
this.f = exc;
|
|
}
|
|
this.b.a(this);
|
|
}
|
|
|
|
public final void t(@Nullable TResult tresult) {
|
|
synchronized (this.a) {
|
|
v();
|
|
this.f1220c = true;
|
|
this.e = tresult;
|
|
}
|
|
this.b.a(this);
|
|
}
|
|
|
|
public final boolean u() {
|
|
synchronized (this.a) {
|
|
if (this.f1220c) {
|
|
return false;
|
|
}
|
|
this.f1220c = true;
|
|
this.d = true;
|
|
this.b.a(this);
|
|
return true;
|
|
}
|
|
}
|
|
|
|
public final void v() {
|
|
String str;
|
|
if (this.f1220c) {
|
|
int i = DuplicateTaskCompletionException.i;
|
|
if (o()) {
|
|
Exception k = k();
|
|
if (k != null) {
|
|
str = "failure";
|
|
} else if (p()) {
|
|
String valueOf = String.valueOf(l());
|
|
StringBuilder sb = new StringBuilder(valueOf.length() + 7);
|
|
sb.append("result ");
|
|
sb.append(valueOf);
|
|
str = sb.toString();
|
|
} else {
|
|
str = n() ? "cancellation" : "unknown issue";
|
|
}
|
|
String valueOf2 = String.valueOf(str);
|
|
throw new DuplicateTaskCompletionException(valueOf2.length() != 0 ? "Complete with: ".concat(valueOf2) : new String("Complete with: "), k);
|
|
}
|
|
throw new IllegalStateException("DuplicateTaskCompletionException can only be created from completed Task.");
|
|
}
|
|
}
|
|
|
|
public final void w() {
|
|
synchronized (this.a) {
|
|
if (this.f1220c) {
|
|
this.b.a(this);
|
|
}
|
|
}
|
|
}
|
|
}
|