126 lines
6.1 KiB
Java
126 lines
6.1 KiB
Java
|
package com.google.android.gms.internal.location;
|
||
|
|
||
|
import android.app.PendingIntent;
|
||
|
import android.location.Location;
|
||
|
import android.os.Looper;
|
||
|
import com.google.android.gms.common.api.GoogleApiClient;
|
||
|
import com.google.android.gms.common.api.PendingResult;
|
||
|
import com.google.android.gms.common.api.Status;
|
||
|
import com.google.android.gms.common.internal.Preconditions;
|
||
|
import com.google.android.gms.location.FusedLocationProviderApi;
|
||
|
import com.google.android.gms.location.LastLocationRequest;
|
||
|
import com.google.android.gms.location.LocationAvailability;
|
||
|
import com.google.android.gms.location.LocationCallback;
|
||
|
import com.google.android.gms.location.LocationListener;
|
||
|
import com.google.android.gms.location.LocationRequest;
|
||
|
import com.google.android.gms.location.LocationServices;
|
||
|
import java.util.concurrent.CountDownLatch;
|
||
|
import java.util.concurrent.TimeUnit;
|
||
|
import java.util.concurrent.atomic.AtomicReference;
|
||
|
|
||
|
/* loaded from: classes2.dex */
|
||
|
public final class zzz implements FusedLocationProviderApi {
|
||
|
@Override // com.google.android.gms.location.FusedLocationProviderApi
|
||
|
public final PendingResult<Status> flushLocations(GoogleApiClient googleApiClient) {
|
||
|
return googleApiClient.execute(new zzp(this, googleApiClient));
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.gms.location.FusedLocationProviderApi
|
||
|
public final Location getLastLocation(GoogleApiClient googleApiClient) {
|
||
|
zzbe zza = LocationServices.zza(googleApiClient);
|
||
|
try {
|
||
|
AtomicReference atomicReference = new AtomicReference();
|
||
|
boolean z = true;
|
||
|
CountDownLatch countDownLatch = new CountDownLatch(1);
|
||
|
zza.zzu(new LastLocationRequest.Builder().build(), new zzq(this, atomicReference, countDownLatch));
|
||
|
boolean z2 = false;
|
||
|
try {
|
||
|
long nanos = TimeUnit.SECONDS.toNanos(30L);
|
||
|
long nanoTime = System.nanoTime();
|
||
|
long j = nanos;
|
||
|
while (true) {
|
||
|
try {
|
||
|
try {
|
||
|
countDownLatch.await(j, TimeUnit.NANOSECONDS);
|
||
|
break;
|
||
|
} catch (InterruptedException unused) {
|
||
|
j = (nanoTime + nanos) - System.nanoTime();
|
||
|
z2 = true;
|
||
|
}
|
||
|
} catch (Throwable th) {
|
||
|
th = th;
|
||
|
if (z) {
|
||
|
Thread.currentThread().interrupt();
|
||
|
}
|
||
|
throw th;
|
||
|
}
|
||
|
}
|
||
|
if (z2) {
|
||
|
Thread.currentThread().interrupt();
|
||
|
}
|
||
|
return (Location) atomicReference.get();
|
||
|
} catch (Throwable th2) {
|
||
|
th = th2;
|
||
|
z = z2;
|
||
|
}
|
||
|
} catch (Exception unused2) {
|
||
|
return null;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.gms.location.FusedLocationProviderApi
|
||
|
public final LocationAvailability getLocationAvailability(GoogleApiClient googleApiClient) {
|
||
|
try {
|
||
|
return LocationServices.zza(googleApiClient).zzp();
|
||
|
} catch (Exception unused) {
|
||
|
return null;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.gms.location.FusedLocationProviderApi
|
||
|
public final PendingResult<Status> removeLocationUpdates(GoogleApiClient googleApiClient, PendingIntent pendingIntent) {
|
||
|
return googleApiClient.execute(new zzl(this, googleApiClient, pendingIntent));
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.gms.location.FusedLocationProviderApi
|
||
|
public final PendingResult<Status> requestLocationUpdates(GoogleApiClient googleApiClient, LocationRequest locationRequest, PendingIntent pendingIntent) {
|
||
|
return googleApiClient.execute(new zzu(this, googleApiClient, locationRequest, pendingIntent));
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.gms.location.FusedLocationProviderApi
|
||
|
public final PendingResult<Status> setMockLocation(GoogleApiClient googleApiClient, Location location) {
|
||
|
return googleApiClient.execute(new zzo(this, googleApiClient, location));
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.gms.location.FusedLocationProviderApi
|
||
|
public final PendingResult<Status> setMockMode(GoogleApiClient googleApiClient, boolean z) {
|
||
|
return googleApiClient.execute(new zzn(this, googleApiClient, z));
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.gms.location.FusedLocationProviderApi
|
||
|
public final PendingResult<Status> removeLocationUpdates(GoogleApiClient googleApiClient, LocationCallback locationCallback) {
|
||
|
return googleApiClient.execute(new zzm(this, googleApiClient, locationCallback));
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.gms.location.FusedLocationProviderApi
|
||
|
public final PendingResult<Status> requestLocationUpdates(GoogleApiClient googleApiClient, LocationRequest locationRequest, LocationCallback locationCallback, Looper looper) {
|
||
|
return googleApiClient.execute(new zzt(this, googleApiClient, locationRequest, locationCallback, looper));
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.gms.location.FusedLocationProviderApi
|
||
|
public final PendingResult<Status> removeLocationUpdates(GoogleApiClient googleApiClient, LocationListener locationListener) {
|
||
|
return googleApiClient.execute(new zzv(this, googleApiClient, locationListener));
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.gms.location.FusedLocationProviderApi
|
||
|
public final PendingResult<Status> requestLocationUpdates(GoogleApiClient googleApiClient, LocationRequest locationRequest, LocationListener locationListener) {
|
||
|
Preconditions.checkNotNull(Looper.myLooper(), "Calling thread must be a prepared Looper thread.");
|
||
|
return googleApiClient.execute(new zzr(this, googleApiClient, locationRequest, locationListener));
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.gms.location.FusedLocationProviderApi
|
||
|
public final PendingResult<Status> requestLocationUpdates(GoogleApiClient googleApiClient, LocationRequest locationRequest, LocationListener locationListener, Looper looper) {
|
||
|
return googleApiClient.execute(new zzs(this, googleApiClient, locationRequest, locationListener, looper));
|
||
|
}
|
||
|
}
|