what-the-bank/sources/com/google/android/libraries/places/internal/zzfj.java

51 lines
1.7 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package com.google.android.libraries.places.internal;
import android.os.Handler;
import android.os.HandlerThread;
import com.google.android.gms.common.api.ApiException;
import com.google.android.gms.common.api.Status;
import com.google.android.gms.tasks.TaskCompletionSource;
import java.util.HashMap;
import java.util.Map;
/* loaded from: classes2.dex */
public final class zzfj {
private final zzff zza;
private final Map zzb = new HashMap();
public zzfj(zzff zzffVar) {
this.zza = zzffVar;
}
public final boolean zza(final TaskCompletionSource taskCompletionSource, long j, String str) {
if (this.zzb.containsKey(taskCompletionSource)) {
return false;
}
HandlerThread handlerThread = new HandlerThread("timeoutHandlerThread");
handlerThread.start();
this.zzb.put(taskCompletionSource, handlerThread);
final String str2 = "Location timeout.";
return new Handler(handlerThread.getLooper()).postDelayed(new Runnable(taskCompletionSource, str2) { // from class: com.google.android.libraries.places.internal.zzfg
public final TaskCompletionSource zza;
public final String zzb = "Location timeout.";
@Override // java.lang.Runnable
public final void run() {
this.zza.trySetException(new ApiException(new Status(15, this.zzb)));
}
{
this.zza = taskCompletionSource;
}
}, j);
}
public final boolean zzb(TaskCompletionSource taskCompletionSource) {
HandlerThread handlerThread = (HandlerThread) this.zzb.remove(taskCompletionSource);
if (handlerThread == null) {
return false;
}
return handlerThread.quit();
}
}