Initial commit

This commit is contained in:
2025-05-13 19:24:51 +02:00
commit a950f49678
10604 changed files with 932663 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
package com.google.android.gms.tasks;
/* loaded from: classes.dex */
public interface Continuation<TResult, TContinuationResult> {
TContinuationResult a(Task<TResult> task) throws Exception;
}

View File

@@ -0,0 +1,6 @@
package com.google.android.gms.tasks;
/* loaded from: classes.dex */
public interface OnCanceledListener {
void a();
}

View File

@@ -0,0 +1,6 @@
package com.google.android.gms.tasks;
/* loaded from: classes.dex */
public interface OnCompleteListener<TResult> {
void a(Task<TResult> task);
}

View File

@@ -0,0 +1,6 @@
package com.google.android.gms.tasks;
/* loaded from: classes.dex */
public interface OnFailureListener {
void a(Exception exc);
}

View File

@@ -0,0 +1,6 @@
package com.google.android.gms.tasks;
/* loaded from: classes.dex */
public interface OnSuccessListener<TResult> {
void onSuccess(TResult tresult);
}

View File

@@ -0,0 +1,8 @@
package com.google.android.gms.tasks;
/* loaded from: classes.dex */
public class RuntimeExecutionException extends RuntimeException {
public RuntimeExecutionException(Throwable th) {
super(th);
}
}

View File

@@ -0,0 +1,38 @@
package com.google.android.gms.tasks;
import java.util.concurrent.Executor;
/* loaded from: classes.dex */
public abstract class Task<TResult> {
public Task<TResult> a(Executor executor, OnCompleteListener<TResult> onCompleteListener) {
throw new UnsupportedOperationException("addOnCompleteListener is not implemented");
}
public abstract Task<TResult> a(Executor executor, OnFailureListener onFailureListener);
public abstract Task<TResult> a(Executor executor, OnSuccessListener<? super TResult> onSuccessListener);
public abstract Exception a();
public abstract <X extends Throwable> TResult a(Class<X> cls) throws Throwable;
public <TContinuationResult> Task<TContinuationResult> b(Executor executor, Continuation<TResult, Task<TContinuationResult>> continuation) {
throw new UnsupportedOperationException("continueWithTask is not implemented");
}
public abstract TResult b();
public abstract boolean c();
public abstract boolean d();
public abstract boolean e();
public Task<TResult> a(Executor executor, OnCanceledListener onCanceledListener) {
throw new UnsupportedOperationException("addOnCanceledListener is not implemented");
}
public <TContinuationResult> Task<TContinuationResult> a(Executor executor, Continuation<TResult, TContinuationResult> continuation) {
throw new UnsupportedOperationException("continueWith is not implemented");
}
}

View File

@@ -0,0 +1,26 @@
package com.google.android.gms.tasks;
/* loaded from: classes.dex */
public class TaskCompletionSource<TResult> {
private final zzu<TResult> a = new zzu<>();
public void a(TResult tresult) {
this.a.a((zzu<TResult>) tresult);
}
public boolean b(TResult tresult) {
return this.a.b((zzu<TResult>) tresult);
}
public void a(Exception exc) {
this.a.a(exc);
}
public boolean b(Exception exc) {
return this.a.b(exc);
}
public Task<TResult> a() {
return this.a;
}
}

View File

@@ -0,0 +1,24 @@
package com.google.android.gms.tasks;
import android.os.Handler;
import android.os.Looper;
import java.util.concurrent.Executor;
/* loaded from: classes.dex */
public final class TaskExecutors {
static final Executor a;
private static final class zza implements Executor {
private final Handler a = new Handler(Looper.getMainLooper());
@Override // java.util.concurrent.Executor
public final void execute(Runnable runnable) {
this.a.post(runnable);
}
}
static {
new zza();
a = new zzt();
}
}

View File

@@ -0,0 +1,99 @@
package com.google.android.gms.tasks;
import com.google.android.gms.common.internal.Preconditions;
import java.util.concurrent.CancellationException;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
/* loaded from: classes.dex */
public final class Tasks {
private static final class zza implements zzb {
private final CountDownLatch a;
private zza() {
this.a = new CountDownLatch(1);
}
@Override // com.google.android.gms.tasks.OnFailureListener
public final void a(Exception exc) {
this.a.countDown();
}
public final void b() throws InterruptedException {
this.a.await();
}
@Override // com.google.android.gms.tasks.OnSuccessListener
public final void onSuccess(Object obj) {
this.a.countDown();
}
@Override // com.google.android.gms.tasks.OnCanceledListener
public final void a() {
this.a.countDown();
}
/* synthetic */ zza(zzv zzvVar) {
this();
}
public final boolean a(long j, TimeUnit timeUnit) throws InterruptedException {
return this.a.await(j, timeUnit);
}
}
interface zzb extends OnCanceledListener, OnFailureListener, OnSuccessListener<Object> {
}
public static <TResult> Task<TResult> a(TResult tresult) {
zzu zzuVar = new zzu();
zzuVar.a((zzu) tresult);
return zzuVar;
}
private static <TResult> TResult b(Task<TResult> task) throws ExecutionException {
if (task.e()) {
return task.b();
}
if (task.c()) {
throw new CancellationException("Task is already canceled");
}
throw new ExecutionException(task.a());
}
public static <TResult> TResult a(Task<TResult> task) throws ExecutionException, InterruptedException {
Preconditions.a();
Preconditions.a(task, "Task must not be null");
if (task.d()) {
return (TResult) b(task);
}
zza zzaVar = new zza(null);
a(task, zzaVar);
zzaVar.b();
return (TResult) b(task);
}
public static <TResult> TResult a(Task<TResult> task, long j, TimeUnit timeUnit) throws ExecutionException, InterruptedException, TimeoutException {
Preconditions.a();
Preconditions.a(task, "Task must not be null");
Preconditions.a(timeUnit, "TimeUnit must not be null");
if (task.d()) {
return (TResult) b(task);
}
zza zzaVar = new zza(null);
a(task, zzaVar);
if (zzaVar.a(j, timeUnit)) {
return (TResult) b(task);
}
throw new TimeoutException("Timed out waiting for Task");
}
private static void a(Task<?> task, zzb zzbVar) {
task.a(TaskExecutors.a, (OnSuccessListener<? super Object>) zzbVar);
task.a(TaskExecutors.a, (OnFailureListener) zzbVar);
task.a(TaskExecutors.a, (OnCanceledListener) zzbVar);
}
}

View File

@@ -0,0 +1,21 @@
package com.google.android.gms.tasks;
import java.util.concurrent.Executor;
/* loaded from: classes.dex */
final class zzc<TResult, TContinuationResult> implements zzq<TResult> {
private final Executor a;
private final Continuation<TResult, TContinuationResult> b;
private final zzu<TContinuationResult> c;
public zzc(Executor executor, Continuation<TResult, TContinuationResult> continuation, zzu<TContinuationResult> zzuVar) {
this.a = executor;
this.b = continuation;
this.c = zzuVar;
}
@Override // com.google.android.gms.tasks.zzq
public final void a(Task<TResult> task) {
this.a.execute(new zzd(this, task));
}
}

View File

@@ -0,0 +1,44 @@
package com.google.android.gms.tasks;
/* loaded from: classes.dex */
final class zzd implements Runnable {
private final /* synthetic */ Task a;
private final /* synthetic */ zzc b;
zzd(zzc zzcVar, Task task) {
this.b = zzcVar;
this.a = task;
}
@Override // java.lang.Runnable
public final void run() {
zzu zzuVar;
zzu zzuVar2;
zzu zzuVar3;
Continuation continuation;
zzu zzuVar4;
zzu zzuVar5;
if (this.a.c()) {
zzuVar5 = this.b.c;
zzuVar5.f();
return;
}
try {
continuation = this.b.b;
Object a = continuation.a(this.a);
zzuVar4 = this.b.c;
zzuVar4.a((zzu) a);
} catch (RuntimeExecutionException e) {
if (e.getCause() instanceof Exception) {
zzuVar3 = this.b.c;
zzuVar3.a((Exception) e.getCause());
} else {
zzuVar2 = this.b.c;
zzuVar2.a((Exception) e);
}
} catch (Exception e2) {
zzuVar = this.b.c;
zzuVar.a(e2);
}
}
}

View File

@@ -0,0 +1,36 @@
package com.google.android.gms.tasks;
import java.util.concurrent.Executor;
/* loaded from: classes.dex */
final class zze<TResult, TContinuationResult> implements OnCanceledListener, OnFailureListener, OnSuccessListener<TContinuationResult>, zzq<TResult> {
private final Executor a;
private final Continuation<TResult, Task<TContinuationResult>> b;
private final zzu<TContinuationResult> c;
public zze(Executor executor, Continuation<TResult, Task<TContinuationResult>> continuation, zzu<TContinuationResult> zzuVar) {
this.a = executor;
this.b = continuation;
this.c = zzuVar;
}
@Override // com.google.android.gms.tasks.zzq
public final void a(Task<TResult> task) {
this.a.execute(new zzf(this, task));
}
@Override // com.google.android.gms.tasks.OnSuccessListener
public final void onSuccess(TContinuationResult tcontinuationresult) {
this.c.a((zzu<TContinuationResult>) tcontinuationresult);
}
@Override // com.google.android.gms.tasks.OnFailureListener
public final void a(Exception exc) {
this.c.a(exc);
}
@Override // com.google.android.gms.tasks.OnCanceledListener
public final void a() {
this.c.f();
}
}

View File

@@ -0,0 +1,42 @@
package com.google.android.gms.tasks;
/* loaded from: classes.dex */
final class zzf implements Runnable {
private final /* synthetic */ Task a;
private final /* synthetic */ zze b;
zzf(zze zzeVar, Task task) {
this.b = zzeVar;
this.a = task;
}
@Override // java.lang.Runnable
public final void run() {
zzu zzuVar;
zzu zzuVar2;
zzu zzuVar3;
Continuation continuation;
try {
continuation = this.b.b;
Task task = (Task) continuation.a(this.a);
if (task == null) {
this.b.a(new NullPointerException("Continuation returned null"));
return;
}
task.a(TaskExecutors.a, (OnSuccessListener) this.b);
task.a(TaskExecutors.a, (OnFailureListener) this.b);
task.a(TaskExecutors.a, (OnCanceledListener) this.b);
} catch (RuntimeExecutionException e) {
if (e.getCause() instanceof Exception) {
zzuVar3 = this.b.c;
zzuVar3.a((Exception) e.getCause());
} else {
zzuVar2 = this.b.c;
zzuVar2.a((Exception) e);
}
} catch (Exception e2) {
zzuVar = this.b.c;
zzuVar.a(e2);
}
}
}

View File

@@ -0,0 +1,27 @@
package com.google.android.gms.tasks;
import java.util.concurrent.Executor;
/* loaded from: classes.dex */
final class zzg<TResult> implements zzq<TResult> {
private final Executor a;
private final Object b = new Object();
private OnCanceledListener c;
public zzg(Executor executor, OnCanceledListener onCanceledListener) {
this.a = executor;
this.c = onCanceledListener;
}
@Override // com.google.android.gms.tasks.zzq
public final void a(Task task) {
if (task.c()) {
synchronized (this.b) {
if (this.c == null) {
return;
}
this.a.execute(new zzh(this));
}
}
}
}

View File

@@ -0,0 +1,25 @@
package com.google.android.gms.tasks;
/* loaded from: classes.dex */
final class zzh implements Runnable {
private final /* synthetic */ zzg a;
zzh(zzg zzgVar) {
this.a = zzgVar;
}
@Override // java.lang.Runnable
public final void run() {
Object obj;
OnCanceledListener onCanceledListener;
OnCanceledListener onCanceledListener2;
obj = this.a.b;
synchronized (obj) {
onCanceledListener = this.a.c;
if (onCanceledListener != null) {
onCanceledListener2 = this.a.c;
onCanceledListener2.a();
}
}
}
}

View File

@@ -0,0 +1,25 @@
package com.google.android.gms.tasks;
import java.util.concurrent.Executor;
/* loaded from: classes.dex */
final class zzi<TResult> implements zzq<TResult> {
private final Executor a;
private final Object b = new Object();
private OnCompleteListener<TResult> c;
public zzi(Executor executor, OnCompleteListener<TResult> onCompleteListener) {
this.a = executor;
this.c = onCompleteListener;
}
@Override // com.google.android.gms.tasks.zzq
public final void a(Task<TResult> task) {
synchronized (this.b) {
if (this.c == null) {
return;
}
this.a.execute(new zzj(this, task));
}
}
}

View File

@@ -0,0 +1,27 @@
package com.google.android.gms.tasks;
/* loaded from: classes.dex */
final class zzj implements Runnable {
private final /* synthetic */ Task a;
private final /* synthetic */ zzi b;
zzj(zzi zziVar, Task task) {
this.b = zziVar;
this.a = task;
}
@Override // java.lang.Runnable
public final void run() {
Object obj;
OnCompleteListener onCompleteListener;
OnCompleteListener onCompleteListener2;
obj = this.b.b;
synchronized (obj) {
onCompleteListener = this.b.c;
if (onCompleteListener != null) {
onCompleteListener2 = this.b.c;
onCompleteListener2.a(this.a);
}
}
}
}

View File

@@ -0,0 +1,28 @@
package com.google.android.gms.tasks;
import java.util.concurrent.Executor;
/* loaded from: classes.dex */
final class zzk<TResult> implements zzq<TResult> {
private final Executor a;
private final Object b = new Object();
private OnFailureListener c;
public zzk(Executor executor, OnFailureListener onFailureListener) {
this.a = executor;
this.c = onFailureListener;
}
@Override // com.google.android.gms.tasks.zzq
public final void a(Task<TResult> task) {
if (task.e() || task.c()) {
return;
}
synchronized (this.b) {
if (this.c == null) {
return;
}
this.a.execute(new zzl(this, task));
}
}
}

View File

@@ -0,0 +1,27 @@
package com.google.android.gms.tasks;
/* loaded from: classes.dex */
final class zzl implements Runnable {
private final /* synthetic */ Task a;
private final /* synthetic */ zzk b;
zzl(zzk zzkVar, Task task) {
this.b = zzkVar;
this.a = task;
}
@Override // java.lang.Runnable
public final void run() {
Object obj;
OnFailureListener onFailureListener;
OnFailureListener onFailureListener2;
obj = this.b.b;
synchronized (obj) {
onFailureListener = this.b.c;
if (onFailureListener != null) {
onFailureListener2 = this.b.c;
onFailureListener2.a(this.a.a());
}
}
}
}

View File

@@ -0,0 +1,27 @@
package com.google.android.gms.tasks;
import java.util.concurrent.Executor;
/* loaded from: classes.dex */
final class zzm<TResult> implements zzq<TResult> {
private final Executor a;
private final Object b = new Object();
private OnSuccessListener<? super TResult> c;
public zzm(Executor executor, OnSuccessListener<? super TResult> onSuccessListener) {
this.a = executor;
this.c = onSuccessListener;
}
@Override // com.google.android.gms.tasks.zzq
public final void a(Task<TResult> task) {
if (task.e()) {
synchronized (this.b) {
if (this.c == null) {
return;
}
this.a.execute(new zzn(this, task));
}
}
}
}

View File

@@ -0,0 +1,27 @@
package com.google.android.gms.tasks;
/* loaded from: classes.dex */
final class zzn implements Runnable {
private final /* synthetic */ Task a;
private final /* synthetic */ zzm b;
zzn(zzm zzmVar, Task task) {
this.b = zzmVar;
this.a = task;
}
@Override // java.lang.Runnable
public final void run() {
Object obj;
OnSuccessListener onSuccessListener;
OnSuccessListener onSuccessListener2;
obj = this.b.b;
synchronized (obj) {
onSuccessListener = this.b.c;
if (onSuccessListener != null) {
onSuccessListener2 = this.b.c;
onSuccessListener2.onSuccess(this.a.b());
}
}
}
}

View File

@@ -0,0 +1,6 @@
package com.google.android.gms.tasks;
/* loaded from: classes.dex */
interface zzq<TResult> {
void a(Task<TResult> task);
}

View File

@@ -0,0 +1,42 @@
package com.google.android.gms.tasks;
import java.util.ArrayDeque;
import java.util.Queue;
/* loaded from: classes.dex */
final class zzr<TResult> {
private final Object a = new Object();
private Queue<zzq<TResult>> b;
private boolean c;
zzr() {
}
public final void a(zzq<TResult> zzqVar) {
synchronized (this.a) {
if (this.b == null) {
this.b = new ArrayDeque();
}
this.b.add(zzqVar);
}
}
public final void a(Task<TResult> task) {
zzq<TResult> poll;
synchronized (this.a) {
if (this.b != null && !this.c) {
this.c = true;
while (true) {
synchronized (this.a) {
poll = this.b.poll();
if (poll == null) {
this.c = false;
return;
}
}
poll.a(task);
}
}
}
}
}

View File

@@ -0,0 +1,14 @@
package com.google.android.gms.tasks;
import java.util.concurrent.Executor;
/* loaded from: classes.dex */
final class zzt implements Executor {
zzt() {
}
@Override // java.util.concurrent.Executor
public final void execute(Runnable runnable) {
runnable.run();
}
}

View File

@@ -0,0 +1,203 @@
package com.google.android.gms.tasks;
import com.google.android.gms.common.internal.Preconditions;
import java.util.concurrent.CancellationException;
import java.util.concurrent.Executor;
/* loaded from: classes.dex */
final class zzu<TResult> extends Task<TResult> {
private final Object a = new Object();
private final zzr<TResult> b = new zzr<>();
private boolean c;
private volatile boolean d;
private TResult e;
private Exception f;
zzu() {
}
private final void g() {
Preconditions.b(this.c, "Task is not yet complete");
}
private final void h() {
Preconditions.b(!this.c, "Task is already complete");
}
private final void i() {
if (this.d) {
throw new CancellationException("Task is already canceled.");
}
}
private final void j() {
synchronized (this.a) {
if (this.c) {
this.b.a(this);
}
}
}
@Override // com.google.android.gms.tasks.Task
public final <X extends Throwable> TResult a(Class<X> cls) throws Throwable {
TResult tresult;
synchronized (this.a) {
g();
i();
if (cls.isInstance(this.f)) {
throw cls.cast(this.f);
}
if (this.f != null) {
throw new RuntimeExecutionException(this.f);
}
tresult = this.e;
}
return tresult;
}
@Override // com.google.android.gms.tasks.Task
public final TResult b() {
TResult tresult;
synchronized (this.a) {
g();
i();
if (this.f != null) {
throw new RuntimeExecutionException(this.f);
}
tresult = this.e;
}
return tresult;
}
@Override // com.google.android.gms.tasks.Task
public final boolean c() {
return this.d;
}
@Override // com.google.android.gms.tasks.Task
public final boolean d() {
boolean z;
synchronized (this.a) {
z = this.c;
}
return z;
}
@Override // com.google.android.gms.tasks.Task
public final boolean e() {
boolean z;
synchronized (this.a) {
z = this.c && !this.d && this.f == null;
}
return z;
}
public final boolean f() {
synchronized (this.a) {
if (this.c) {
return false;
}
this.c = true;
this.d = true;
this.b.a(this);
return true;
}
}
@Override // com.google.android.gms.tasks.Task
public final <TContinuationResult> Task<TContinuationResult> b(Executor executor, Continuation<TResult, Task<TContinuationResult>> continuation) {
zzu zzuVar = new zzu();
this.b.a(new zze(executor, continuation, zzuVar));
j();
return zzuVar;
}
@Override // com.google.android.gms.tasks.Task
public final Exception a() {
Exception exc;
synchronized (this.a) {
exc = this.f;
}
return exc;
}
public final boolean b(TResult tresult) {
synchronized (this.a) {
if (this.c) {
return false;
}
this.c = true;
this.e = tresult;
this.b.a(this);
return true;
}
}
@Override // com.google.android.gms.tasks.Task
public final Task<TResult> a(Executor executor, OnSuccessListener<? super TResult> onSuccessListener) {
this.b.a(new zzm(executor, onSuccessListener));
j();
return this;
}
@Override // com.google.android.gms.tasks.Task
public final Task<TResult> a(Executor executor, OnFailureListener onFailureListener) {
this.b.a(new zzk(executor, onFailureListener));
j();
return this;
}
@Override // com.google.android.gms.tasks.Task
public final Task<TResult> a(Executor executor, OnCompleteListener<TResult> onCompleteListener) {
this.b.a(new zzi(executor, onCompleteListener));
j();
return this;
}
@Override // com.google.android.gms.tasks.Task
public final <TContinuationResult> Task<TContinuationResult> a(Executor executor, Continuation<TResult, TContinuationResult> continuation) {
zzu zzuVar = new zzu();
this.b.a(new zzc(executor, continuation, zzuVar));
j();
return zzuVar;
}
public final boolean b(Exception exc) {
Preconditions.a(exc, "Exception must not be null");
synchronized (this.a) {
if (this.c) {
return false;
}
this.c = true;
this.f = exc;
this.b.a(this);
return true;
}
}
@Override // com.google.android.gms.tasks.Task
public final Task<TResult> a(Executor executor, OnCanceledListener onCanceledListener) {
this.b.a(new zzg(executor, onCanceledListener));
j();
return this;
}
public final void a(TResult tresult) {
synchronized (this.a) {
h();
this.c = true;
this.e = tresult;
}
this.b.a(this);
}
public final void a(Exception exc) {
Preconditions.a(exc, "Exception must not be null");
synchronized (this.a) {
h();
this.c = true;
this.f = exc;
}
this.b.a(this);
}
}

View File

@@ -0,0 +1,5 @@
package com.google.android.gms.tasks;
/* loaded from: classes.dex */
final class zzv implements Runnable {
}