739 lines
29 KiB
Java
739 lines
29 KiB
Java
package com.google.android.gms.common.api.internal;
|
|
|
|
import android.app.Activity;
|
|
import android.content.Context;
|
|
import android.os.Bundle;
|
|
import android.os.Looper;
|
|
import android.util.Log;
|
|
import androidx.fragment.app.FragmentActivity;
|
|
import com.google.android.gms.common.ConnectionResult;
|
|
import com.google.android.gms.common.GoogleApiAvailability;
|
|
import com.google.android.gms.common.api.Api;
|
|
import com.google.android.gms.common.api.GoogleApiClient;
|
|
import com.google.android.gms.common.api.PendingResult;
|
|
import com.google.android.gms.common.api.Result;
|
|
import com.google.android.gms.common.api.Scope;
|
|
import com.google.android.gms.common.api.Status;
|
|
import com.google.android.gms.common.api.internal.BaseImplementation;
|
|
import com.google.android.gms.common.internal.ClientSettings;
|
|
import com.google.android.gms.common.internal.Preconditions;
|
|
import com.google.android.gms.common.internal.service.Common;
|
|
import com.google.android.gms.common.util.ClientLibraryUtils;
|
|
import com.google.android.gms.signin.SignInOptions;
|
|
import com.huawei.hms.framework.network.grs.GrsBaseInfo;
|
|
import java.io.FileDescriptor;
|
|
import java.io.PrintWriter;
|
|
import java.io.StringWriter;
|
|
import java.util.ArrayList;
|
|
import java.util.HashSet;
|
|
import java.util.Iterator;
|
|
import java.util.LinkedList;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Queue;
|
|
import java.util.Set;
|
|
import java.util.concurrent.TimeUnit;
|
|
import java.util.concurrent.atomic.AtomicReference;
|
|
import java.util.concurrent.locks.Lock;
|
|
|
|
/* loaded from: classes.dex */
|
|
public final class zabe extends GoogleApiClient implements zabz {
|
|
zabx zab;
|
|
final Map<Api.AnyClientKey<?>, Api.Client> zac;
|
|
Set<Scope> zad;
|
|
final ClientSettings zae;
|
|
final Map<Api<?>, Boolean> zaf;
|
|
final Api.AbstractClientBuilder<? extends com.google.android.gms.signin.zae, SignInOptions> zag;
|
|
Set<zada> zah;
|
|
final zadc zai;
|
|
private final Lock zaj;
|
|
private final com.google.android.gms.common.internal.zak zak;
|
|
private final int zam;
|
|
private final Context zan;
|
|
private final Looper zao;
|
|
private volatile boolean zap;
|
|
private long zaq;
|
|
private long zar;
|
|
private final zabc zas;
|
|
private final GoogleApiAvailability zat;
|
|
private final ListenerHolders zau;
|
|
private final ArrayList<zat> zav;
|
|
private Integer zaw;
|
|
private final com.google.android.gms.common.internal.zaj zax;
|
|
private zaca zal = null;
|
|
final Queue<BaseImplementation.ApiMethodImpl<?, ?>> zaa = new LinkedList();
|
|
|
|
public zabe(Context context, Lock lock, Looper looper, ClientSettings clientSettings, GoogleApiAvailability googleApiAvailability, Api.AbstractClientBuilder<? extends com.google.android.gms.signin.zae, SignInOptions> abstractClientBuilder, Map<Api<?>, Boolean> map, List<GoogleApiClient.ConnectionCallbacks> list, List<GoogleApiClient.OnConnectionFailedListener> list2, Map<Api.AnyClientKey<?>, Api.Client> map2, int i, int i2, ArrayList<zat> arrayList) {
|
|
this.zaq = true != ClientLibraryUtils.isPackageSide() ? 120000L : 10000L;
|
|
this.zar = 5000L;
|
|
this.zad = new HashSet();
|
|
this.zau = new ListenerHolders();
|
|
this.zaw = null;
|
|
this.zah = null;
|
|
zaay zaayVar = new zaay(this);
|
|
this.zax = zaayVar;
|
|
this.zan = context;
|
|
this.zaj = lock;
|
|
this.zak = new com.google.android.gms.common.internal.zak(looper, zaayVar);
|
|
this.zao = looper;
|
|
this.zas = new zabc(this, looper);
|
|
this.zat = googleApiAvailability;
|
|
this.zam = i;
|
|
if (i >= 0) {
|
|
this.zaw = Integer.valueOf(i2);
|
|
}
|
|
this.zaf = map;
|
|
this.zac = map2;
|
|
this.zav = arrayList;
|
|
this.zai = new zadc();
|
|
Iterator<GoogleApiClient.ConnectionCallbacks> it = list.iterator();
|
|
while (it.hasNext()) {
|
|
this.zak.zaf(it.next());
|
|
}
|
|
Iterator<GoogleApiClient.OnConnectionFailedListener> it2 = list2.iterator();
|
|
while (it2.hasNext()) {
|
|
this.zak.zag(it2.next());
|
|
}
|
|
this.zae = clientSettings;
|
|
this.zag = abstractClientBuilder;
|
|
}
|
|
|
|
public static int zad(Iterable<Api.Client> iterable, boolean z) {
|
|
boolean z2 = false;
|
|
boolean z3 = false;
|
|
for (Api.Client client : iterable) {
|
|
z2 |= client.requiresSignIn();
|
|
z3 |= client.providesSignIn();
|
|
}
|
|
if (z2) {
|
|
return (z3 && z) ? 2 : 1;
|
|
}
|
|
return 3;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public static /* synthetic */ void zai(zabe zabeVar) {
|
|
zabeVar.zaj.lock();
|
|
try {
|
|
if (zabeVar.zap) {
|
|
zabeVar.zan();
|
|
}
|
|
} finally {
|
|
zabeVar.zaj.unlock();
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public static /* synthetic */ void zaj(zabe zabeVar) {
|
|
zabeVar.zaj.lock();
|
|
try {
|
|
if (zabeVar.zak()) {
|
|
zabeVar.zan();
|
|
}
|
|
} finally {
|
|
zabeVar.zaj.unlock();
|
|
}
|
|
}
|
|
|
|
private final void zal(int i) {
|
|
Integer num = this.zaw;
|
|
if (num == null) {
|
|
this.zaw = Integer.valueOf(i);
|
|
} else if (num.intValue() != i) {
|
|
String zag = zag(i);
|
|
String zag2 = zag(this.zaw.intValue());
|
|
StringBuilder sb = new StringBuilder(zag.length() + 51 + zag2.length());
|
|
sb.append("Cannot use sign-in mode: ");
|
|
sb.append(zag);
|
|
sb.append(". Mode was already set to ");
|
|
sb.append(zag2);
|
|
throw new IllegalStateException(sb.toString());
|
|
}
|
|
if (this.zal != null) {
|
|
return;
|
|
}
|
|
boolean z = false;
|
|
boolean z2 = false;
|
|
for (Api.Client client : this.zac.values()) {
|
|
z |= client.requiresSignIn();
|
|
z2 |= client.providesSignIn();
|
|
}
|
|
int intValue = this.zaw.intValue();
|
|
if (intValue == 1) {
|
|
if (!z) {
|
|
throw new IllegalStateException("SIGN_IN_MODE_REQUIRED cannot be used on a GoogleApiClient that does not contain any authenticated APIs. Use connect() instead.");
|
|
}
|
|
if (z2) {
|
|
throw new IllegalStateException("Cannot use SIGN_IN_MODE_REQUIRED with GOOGLE_SIGN_IN_API. Use connect(SIGN_IN_MODE_OPTIONAL) instead.");
|
|
}
|
|
} else if (intValue == 2 && z) {
|
|
this.zal = zaaa.zag(this.zan, this, this.zaj, this.zao, this.zat, this.zac, this.zae, this.zaf, this.zag, this.zav);
|
|
return;
|
|
}
|
|
this.zal = new zabi(this.zan, this, this.zaj, this.zao, this.zat, this.zac, this.zae, this.zaf, this.zag, this.zav, this);
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public final void zam(GoogleApiClient googleApiClient, StatusPendingResult statusPendingResult, boolean z) {
|
|
Common.zaa.zaa(googleApiClient).setResultCallback(new zabb(this, statusPendingResult, z, googleApiClient));
|
|
}
|
|
|
|
private final void zan() {
|
|
this.zak.zab();
|
|
((zaca) Preconditions.checkNotNull(this.zal)).zaq();
|
|
}
|
|
|
|
@Override // com.google.android.gms.common.api.GoogleApiClient
|
|
public final ConnectionResult blockingConnect() {
|
|
Preconditions.checkState(Looper.myLooper() != Looper.getMainLooper(), "blockingConnect must not be called on the UI thread");
|
|
this.zaj.lock();
|
|
try {
|
|
if (this.zam >= 0) {
|
|
Preconditions.checkState(this.zaw != null, "Sign-in mode should have been set explicitly by auto-manage.");
|
|
} else {
|
|
Integer num = this.zaw;
|
|
if (num != null) {
|
|
if (num.intValue() == 2) {
|
|
throw new IllegalStateException("Cannot call blockingConnect() when sign-in mode is set to SIGN_IN_MODE_OPTIONAL. Call connect(SIGN_IN_MODE_OPTIONAL) instead.");
|
|
}
|
|
} else {
|
|
this.zaw = Integer.valueOf(zad(this.zac.values(), false));
|
|
}
|
|
}
|
|
zal(((Integer) Preconditions.checkNotNull(this.zaw)).intValue());
|
|
this.zak.zab();
|
|
return ((zaca) Preconditions.checkNotNull(this.zal)).zab();
|
|
} finally {
|
|
this.zaj.unlock();
|
|
}
|
|
}
|
|
|
|
@Override // com.google.android.gms.common.api.GoogleApiClient
|
|
public final PendingResult<Status> clearDefaultAccountAndReconnect() {
|
|
Preconditions.checkState(isConnected(), "GoogleApiClient is not connected yet.");
|
|
Integer num = this.zaw;
|
|
Preconditions.checkState(num == null || num.intValue() != 2, "Cannot use clearDefaultAccountAndReconnect with GOOGLE_SIGN_IN_API");
|
|
StatusPendingResult statusPendingResult = new StatusPendingResult(this);
|
|
if (this.zac.containsKey(Common.CLIENT_KEY)) {
|
|
zam(this, statusPendingResult, false);
|
|
} else {
|
|
AtomicReference atomicReference = new AtomicReference();
|
|
zaaz zaazVar = new zaaz(this, atomicReference, statusPendingResult);
|
|
zaba zabaVar = new zaba(this, statusPendingResult);
|
|
GoogleApiClient.Builder builder = new GoogleApiClient.Builder(this.zan);
|
|
builder.addApi(Common.API);
|
|
builder.addConnectionCallbacks(zaazVar);
|
|
builder.addOnConnectionFailedListener(zabaVar);
|
|
builder.setHandler(this.zas);
|
|
GoogleApiClient build = builder.build();
|
|
atomicReference.set(build);
|
|
build.connect();
|
|
}
|
|
return statusPendingResult;
|
|
}
|
|
|
|
@Override // com.google.android.gms.common.api.GoogleApiClient
|
|
public final void connect() {
|
|
this.zaj.lock();
|
|
try {
|
|
boolean z = true;
|
|
int i = 2;
|
|
if (this.zam >= 0) {
|
|
Preconditions.checkState(this.zaw != null, "Sign-in mode should have been set explicitly by auto-manage.");
|
|
} else {
|
|
Integer num = this.zaw;
|
|
if (num != null) {
|
|
if (num.intValue() == 2) {
|
|
throw new IllegalStateException("Cannot call connect() when SignInMode is set to SIGN_IN_MODE_OPTIONAL. Call connect(SIGN_IN_MODE_OPTIONAL) instead.");
|
|
}
|
|
} else {
|
|
this.zaw = Integer.valueOf(zad(this.zac.values(), false));
|
|
}
|
|
}
|
|
int intValue = ((Integer) Preconditions.checkNotNull(this.zaw)).intValue();
|
|
this.zaj.lock();
|
|
if (intValue == 3 || intValue == 1) {
|
|
i = intValue;
|
|
} else if (intValue != 2) {
|
|
z = false;
|
|
StringBuilder sb = new StringBuilder(33);
|
|
sb.append("Illegal sign-in mode: ");
|
|
sb.append(intValue);
|
|
Preconditions.checkArgument(z, sb.toString());
|
|
zal(intValue);
|
|
zan();
|
|
this.zaj.unlock();
|
|
}
|
|
intValue = i;
|
|
StringBuilder sb2 = new StringBuilder(33);
|
|
sb2.append("Illegal sign-in mode: ");
|
|
sb2.append(intValue);
|
|
Preconditions.checkArgument(z, sb2.toString());
|
|
zal(intValue);
|
|
zan();
|
|
this.zaj.unlock();
|
|
} catch (Throwable th) {
|
|
throw th;
|
|
} finally {
|
|
this.zaj.unlock();
|
|
}
|
|
}
|
|
|
|
@Override // com.google.android.gms.common.api.GoogleApiClient
|
|
public final void disconnect() {
|
|
Lock lock;
|
|
this.zaj.lock();
|
|
try {
|
|
this.zai.zab();
|
|
zaca zacaVar = this.zal;
|
|
if (zacaVar != null) {
|
|
zacaVar.zar();
|
|
}
|
|
this.zau.zab();
|
|
for (BaseImplementation.ApiMethodImpl<?, ?> apiMethodImpl : this.zaa) {
|
|
apiMethodImpl.zan(null);
|
|
apiMethodImpl.cancel();
|
|
}
|
|
this.zaa.clear();
|
|
if (this.zal == null) {
|
|
lock = this.zaj;
|
|
} else {
|
|
zak();
|
|
this.zak.zaa();
|
|
lock = this.zaj;
|
|
}
|
|
lock.unlock();
|
|
} catch (Throwable th) {
|
|
this.zaj.unlock();
|
|
throw th;
|
|
}
|
|
}
|
|
|
|
@Override // com.google.android.gms.common.api.GoogleApiClient
|
|
public final void dump(String str, FileDescriptor fileDescriptor, PrintWriter printWriter, String[] strArr) {
|
|
printWriter.append((CharSequence) str).append("mContext=").println(this.zan);
|
|
printWriter.append((CharSequence) str).append("mResuming=").print(this.zap);
|
|
printWriter.append(" mWorkQueue.size()=").print(this.zaa.size());
|
|
printWriter.append(" mUnconsumedApiCalls.size()=").println(this.zai.zab.size());
|
|
zaca zacaVar = this.zal;
|
|
if (zacaVar != null) {
|
|
zacaVar.zas(str, fileDescriptor, printWriter, strArr);
|
|
}
|
|
}
|
|
|
|
@Override // com.google.android.gms.common.api.GoogleApiClient
|
|
public final <A extends Api.AnyClient, R extends Result, T extends BaseImplementation.ApiMethodImpl<R, A>> T enqueue(T t) {
|
|
Lock lock;
|
|
Api<?> api = t.getApi();
|
|
boolean containsKey = this.zac.containsKey(t.getClientKey());
|
|
String zad = api != null ? api.zad() : "the API";
|
|
StringBuilder sb = new StringBuilder(String.valueOf(zad).length() + 65);
|
|
sb.append("GoogleApiClient is not configured to use ");
|
|
sb.append(zad);
|
|
sb.append(" required for this call.");
|
|
Preconditions.checkArgument(containsKey, sb.toString());
|
|
this.zaj.lock();
|
|
try {
|
|
zaca zacaVar = this.zal;
|
|
if (zacaVar != null) {
|
|
t = (T) zacaVar.zae(t);
|
|
lock = this.zaj;
|
|
} else {
|
|
this.zaa.add(t);
|
|
lock = this.zaj;
|
|
}
|
|
lock.unlock();
|
|
return t;
|
|
} catch (Throwable th) {
|
|
this.zaj.unlock();
|
|
throw th;
|
|
}
|
|
}
|
|
|
|
@Override // com.google.android.gms.common.api.GoogleApiClient
|
|
public final <A extends Api.AnyClient, T extends BaseImplementation.ApiMethodImpl<? extends Result, A>> T execute(T t) {
|
|
Lock lock;
|
|
Api<?> api = t.getApi();
|
|
boolean containsKey = this.zac.containsKey(t.getClientKey());
|
|
String zad = api != null ? api.zad() : "the API";
|
|
StringBuilder sb = new StringBuilder(String.valueOf(zad).length() + 65);
|
|
sb.append("GoogleApiClient is not configured to use ");
|
|
sb.append(zad);
|
|
sb.append(" required for this call.");
|
|
Preconditions.checkArgument(containsKey, sb.toString());
|
|
this.zaj.lock();
|
|
try {
|
|
zaca zacaVar = this.zal;
|
|
if (zacaVar != null) {
|
|
if (this.zap) {
|
|
this.zaa.add(t);
|
|
while (!this.zaa.isEmpty()) {
|
|
BaseImplementation.ApiMethodImpl<?, ?> remove = this.zaa.remove();
|
|
this.zai.zaa(remove);
|
|
remove.setFailedResult(Status.RESULT_INTERNAL_ERROR);
|
|
}
|
|
lock = this.zaj;
|
|
} else {
|
|
t = (T) zacaVar.zaf(t);
|
|
lock = this.zaj;
|
|
}
|
|
lock.unlock();
|
|
return t;
|
|
}
|
|
throw new IllegalStateException("GoogleApiClient is not connected yet.");
|
|
} catch (Throwable th) {
|
|
this.zaj.unlock();
|
|
throw th;
|
|
}
|
|
}
|
|
|
|
@Override // com.google.android.gms.common.api.GoogleApiClient
|
|
public final <C extends Api.Client> C getClient(Api.AnyClientKey<C> anyClientKey) {
|
|
C c = (C) this.zac.get(anyClientKey);
|
|
Preconditions.checkNotNull(c, "Appropriate Api was not requested.");
|
|
return c;
|
|
}
|
|
|
|
@Override // com.google.android.gms.common.api.GoogleApiClient
|
|
public final ConnectionResult getConnectionResult(Api<?> api) {
|
|
ConnectionResult connectionResult;
|
|
Lock lock;
|
|
this.zaj.lock();
|
|
try {
|
|
if (!isConnected() && !this.zap) {
|
|
throw new IllegalStateException("Cannot invoke getConnectionResult unless GoogleApiClient is connected");
|
|
}
|
|
if (this.zac.containsKey(api.zab())) {
|
|
ConnectionResult zad = ((zaca) Preconditions.checkNotNull(this.zal)).zad(api);
|
|
if (zad != null) {
|
|
return zad;
|
|
}
|
|
if (this.zap) {
|
|
connectionResult = ConnectionResult.RESULT_SUCCESS;
|
|
lock = this.zaj;
|
|
} else {
|
|
Log.w("GoogleApiClientImpl", zaf());
|
|
Log.wtf("GoogleApiClientImpl", String.valueOf(api.zad()).concat(" requested in getConnectionResult is not connected but is not present in the failed connections map"), new Exception());
|
|
connectionResult = new ConnectionResult(8, null);
|
|
lock = this.zaj;
|
|
}
|
|
lock.unlock();
|
|
return connectionResult;
|
|
}
|
|
throw new IllegalArgumentException(String.valueOf(api.zad()).concat(" was never registered with GoogleApiClient"));
|
|
} finally {
|
|
this.zaj.unlock();
|
|
}
|
|
}
|
|
|
|
@Override // com.google.android.gms.common.api.GoogleApiClient
|
|
public final boolean hasApi(Api<?> api) {
|
|
return this.zac.containsKey(api.zab());
|
|
}
|
|
|
|
@Override // com.google.android.gms.common.api.GoogleApiClient
|
|
public final boolean hasConnectedApi(Api<?> api) {
|
|
Api.Client client;
|
|
return isConnected() && (client = this.zac.get(api.zab())) != null && client.isConnected();
|
|
}
|
|
|
|
@Override // com.google.android.gms.common.api.GoogleApiClient
|
|
public final boolean isConnected() {
|
|
zaca zacaVar = this.zal;
|
|
return zacaVar != null && zacaVar.zaw();
|
|
}
|
|
|
|
@Override // com.google.android.gms.common.api.GoogleApiClient
|
|
public final boolean isConnecting() {
|
|
zaca zacaVar = this.zal;
|
|
return zacaVar != null && zacaVar.zax();
|
|
}
|
|
|
|
@Override // com.google.android.gms.common.api.GoogleApiClient
|
|
public final boolean isConnectionCallbacksRegistered(GoogleApiClient.ConnectionCallbacks connectionCallbacks) {
|
|
return this.zak.zaj(connectionCallbacks);
|
|
}
|
|
|
|
@Override // com.google.android.gms.common.api.GoogleApiClient
|
|
public final boolean isConnectionFailedListenerRegistered(GoogleApiClient.OnConnectionFailedListener onConnectionFailedListener) {
|
|
return this.zak.zak(onConnectionFailedListener);
|
|
}
|
|
|
|
@Override // com.google.android.gms.common.api.GoogleApiClient
|
|
public final boolean maybeSignIn(SignInConnectionListener signInConnectionListener) {
|
|
zaca zacaVar = this.zal;
|
|
return zacaVar != null && zacaVar.zay(signInConnectionListener);
|
|
}
|
|
|
|
@Override // com.google.android.gms.common.api.GoogleApiClient
|
|
public final void maybeSignOut() {
|
|
zaca zacaVar = this.zal;
|
|
if (zacaVar != null) {
|
|
zacaVar.zau();
|
|
}
|
|
}
|
|
|
|
@Override // com.google.android.gms.common.api.GoogleApiClient
|
|
public final void reconnect() {
|
|
disconnect();
|
|
connect();
|
|
}
|
|
|
|
@Override // com.google.android.gms.common.api.GoogleApiClient
|
|
public final void registerConnectionCallbacks(GoogleApiClient.ConnectionCallbacks connectionCallbacks) {
|
|
this.zak.zaf(connectionCallbacks);
|
|
}
|
|
|
|
@Override // com.google.android.gms.common.api.GoogleApiClient
|
|
public final void registerConnectionFailedListener(GoogleApiClient.OnConnectionFailedListener onConnectionFailedListener) {
|
|
this.zak.zag(onConnectionFailedListener);
|
|
}
|
|
|
|
@Override // com.google.android.gms.common.api.GoogleApiClient
|
|
public final <L> ListenerHolder<L> registerListener(L l) {
|
|
this.zaj.lock();
|
|
try {
|
|
return this.zau.zaa(l, this.zao, "NO_TYPE");
|
|
} finally {
|
|
this.zaj.unlock();
|
|
}
|
|
}
|
|
|
|
@Override // com.google.android.gms.common.api.GoogleApiClient
|
|
public final void stopAutoManage(FragmentActivity fragmentActivity) {
|
|
LifecycleActivity lifecycleActivity = new LifecycleActivity((Activity) fragmentActivity);
|
|
if (this.zam >= 0) {
|
|
zak.zaa(lifecycleActivity).zae(this.zam);
|
|
return;
|
|
}
|
|
throw new IllegalStateException("Called stopAutoManage but automatic lifecycle management is not enabled.");
|
|
}
|
|
|
|
@Override // com.google.android.gms.common.api.GoogleApiClient
|
|
public final void unregisterConnectionCallbacks(GoogleApiClient.ConnectionCallbacks connectionCallbacks) {
|
|
this.zak.zah(connectionCallbacks);
|
|
}
|
|
|
|
@Override // com.google.android.gms.common.api.GoogleApiClient
|
|
public final void unregisterConnectionFailedListener(GoogleApiClient.OnConnectionFailedListener onConnectionFailedListener) {
|
|
this.zak.zai(onConnectionFailedListener);
|
|
}
|
|
|
|
@Override // com.google.android.gms.common.api.internal.zabz
|
|
public final void zaa(ConnectionResult connectionResult) {
|
|
if (!this.zat.isPlayServicesPossiblyUpdating(this.zan, connectionResult.getErrorCode())) {
|
|
zak();
|
|
}
|
|
if (this.zap) {
|
|
return;
|
|
}
|
|
this.zak.zac(connectionResult);
|
|
this.zak.zaa();
|
|
}
|
|
|
|
@Override // com.google.android.gms.common.api.internal.zabz
|
|
public final void zab(Bundle bundle) {
|
|
while (!this.zaa.isEmpty()) {
|
|
execute(this.zaa.remove());
|
|
}
|
|
this.zak.zad(bundle);
|
|
}
|
|
|
|
@Override // com.google.android.gms.common.api.internal.zabz
|
|
public final void zac(int i, boolean z) {
|
|
if (i == 1) {
|
|
if (!z && !this.zap) {
|
|
this.zap = true;
|
|
if (this.zab == null && !ClientLibraryUtils.isPackageSide()) {
|
|
try {
|
|
this.zab = this.zat.zac(this.zan.getApplicationContext(), new zabd(this));
|
|
} catch (SecurityException unused) {
|
|
}
|
|
}
|
|
zabc zabcVar = this.zas;
|
|
zabcVar.sendMessageDelayed(zabcVar.obtainMessage(1), this.zaq);
|
|
zabc zabcVar2 = this.zas;
|
|
zabcVar2.sendMessageDelayed(zabcVar2.obtainMessage(2), this.zar);
|
|
}
|
|
i = 1;
|
|
}
|
|
for (BasePendingResult basePendingResult : (BasePendingResult[]) this.zai.zab.toArray(new BasePendingResult[0])) {
|
|
basePendingResult.forceFailureUnlessReady(zadc.zaa);
|
|
}
|
|
this.zak.zae(i);
|
|
this.zak.zaa();
|
|
if (i == 2) {
|
|
zan();
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public final String zaf() {
|
|
StringWriter stringWriter = new StringWriter();
|
|
dump("", null, new PrintWriter(stringWriter), null);
|
|
return stringWriter.toString();
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public final boolean zak() {
|
|
if (!this.zap) {
|
|
return false;
|
|
}
|
|
this.zap = false;
|
|
this.zas.removeMessages(2);
|
|
this.zas.removeMessages(1);
|
|
zabx zabxVar = this.zab;
|
|
if (zabxVar != null) {
|
|
zabxVar.zab();
|
|
this.zab = null;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
@Override // com.google.android.gms.common.api.GoogleApiClient
|
|
public final void zao(zada zadaVar) {
|
|
this.zaj.lock();
|
|
try {
|
|
if (this.zah == null) {
|
|
this.zah = new HashSet();
|
|
}
|
|
this.zah.add(zadaVar);
|
|
} finally {
|
|
this.zaj.unlock();
|
|
}
|
|
}
|
|
|
|
/* JADX WARN: Code restructure failed: missing block: B:23:0x0041, code lost:
|
|
|
|
if ((!r3) == false) goto L18;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:28:0x0057, code lost:
|
|
|
|
r3 = move-exception;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:30:0x005d, code lost:
|
|
|
|
throw r3;
|
|
*/
|
|
@Override // com.google.android.gms.common.api.GoogleApiClient
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct add '--show-bad-code' argument
|
|
*/
|
|
public final void zap(com.google.android.gms.common.api.internal.zada r3) {
|
|
/*
|
|
r2 = this;
|
|
java.util.concurrent.locks.Lock r0 = r2.zaj
|
|
r0.lock()
|
|
java.util.Set<com.google.android.gms.common.api.internal.zada> r0 = r2.zah // Catch: java.lang.Throwable -> L57
|
|
java.lang.String r1 = "GoogleApiClientImpl"
|
|
if (r0 != 0) goto L16
|
|
java.lang.Exception r3 = new java.lang.Exception // Catch: java.lang.Throwable -> L57
|
|
r3.<init>() // Catch: java.lang.Throwable -> L57
|
|
java.lang.String r0 = "Attempted to remove pending transform when no transforms are registered."
|
|
android.util.Log.wtf(r1, r0, r3) // Catch: java.lang.Throwable -> L57
|
|
goto L4a
|
|
L16:
|
|
boolean r3 = r0.remove(r3) // Catch: java.lang.Throwable -> L57
|
|
if (r3 != 0) goto L27
|
|
java.lang.Exception r3 = new java.lang.Exception // Catch: java.lang.Throwable -> L57
|
|
r3.<init>() // Catch: java.lang.Throwable -> L57
|
|
java.lang.String r0 = "Failed to remove pending transform - this may lead to memory leaks!"
|
|
android.util.Log.wtf(r1, r0, r3) // Catch: java.lang.Throwable -> L57
|
|
goto L4a
|
|
L27:
|
|
java.util.concurrent.locks.Lock r3 = r2.zaj // Catch: java.lang.Throwable -> L57
|
|
r3.lock() // Catch: java.lang.Throwable -> L57
|
|
java.util.Set<com.google.android.gms.common.api.internal.zada> r3 = r2.zah // Catch: java.lang.Throwable -> L50
|
|
if (r3 != 0) goto L36
|
|
java.util.concurrent.locks.Lock r3 = r2.zaj // Catch: java.lang.Throwable -> L57
|
|
r3.unlock() // Catch: java.lang.Throwable -> L57
|
|
goto L43
|
|
L36:
|
|
boolean r3 = r3.isEmpty() // Catch: java.lang.Throwable -> L50
|
|
java.util.concurrent.locks.Lock r0 = r2.zaj // Catch: java.lang.Throwable -> L57
|
|
r0.unlock() // Catch: java.lang.Throwable -> L57
|
|
r3 = r3 ^ 1
|
|
if (r3 != 0) goto L4a
|
|
L43:
|
|
com.google.android.gms.common.api.internal.zaca r3 = r2.zal // Catch: java.lang.Throwable -> L57
|
|
if (r3 == 0) goto L4a
|
|
r3.zat() // Catch: java.lang.Throwable -> L57
|
|
L4a:
|
|
java.util.concurrent.locks.Lock r3 = r2.zaj
|
|
r3.unlock()
|
|
return
|
|
L50:
|
|
r3 = move-exception
|
|
java.util.concurrent.locks.Lock r0 = r2.zaj // Catch: java.lang.Throwable -> L57
|
|
r0.unlock() // Catch: java.lang.Throwable -> L57
|
|
throw r3 // Catch: java.lang.Throwable -> L57
|
|
L57:
|
|
r3 = move-exception
|
|
java.util.concurrent.locks.Lock r0 = r2.zaj
|
|
r0.unlock()
|
|
throw r3
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: com.google.android.gms.common.api.internal.zabe.zap(com.google.android.gms.common.api.internal.zada):void");
|
|
}
|
|
|
|
@Override // com.google.android.gms.common.api.GoogleApiClient
|
|
public final ConnectionResult blockingConnect(long j, TimeUnit timeUnit) {
|
|
Preconditions.checkState(Looper.myLooper() != Looper.getMainLooper(), "blockingConnect must not be called on the UI thread");
|
|
Preconditions.checkNotNull(timeUnit, "TimeUnit must not be null");
|
|
this.zaj.lock();
|
|
try {
|
|
Integer num = this.zaw;
|
|
if (num != null) {
|
|
if (num.intValue() == 2) {
|
|
throw new IllegalStateException("Cannot call blockingConnect() when sign-in mode is set to SIGN_IN_MODE_OPTIONAL. Call connect(SIGN_IN_MODE_OPTIONAL) instead.");
|
|
}
|
|
} else {
|
|
this.zaw = Integer.valueOf(zad(this.zac.values(), false));
|
|
}
|
|
zal(((Integer) Preconditions.checkNotNull(this.zaw)).intValue());
|
|
this.zak.zab();
|
|
return ((zaca) Preconditions.checkNotNull(this.zal)).zac(j, timeUnit);
|
|
} finally {
|
|
this.zaj.unlock();
|
|
}
|
|
}
|
|
|
|
@Override // com.google.android.gms.common.api.GoogleApiClient
|
|
public final void connect(int i) {
|
|
this.zaj.lock();
|
|
boolean z = true;
|
|
if (i != 3 && i != 1) {
|
|
if (i == 2) {
|
|
i = 2;
|
|
} else {
|
|
z = false;
|
|
}
|
|
}
|
|
try {
|
|
StringBuilder sb = new StringBuilder(33);
|
|
sb.append("Illegal sign-in mode: ");
|
|
sb.append(i);
|
|
Preconditions.checkArgument(z, sb.toString());
|
|
zal(i);
|
|
zan();
|
|
} finally {
|
|
this.zaj.unlock();
|
|
}
|
|
}
|
|
|
|
@Override // com.google.android.gms.common.api.GoogleApiClient
|
|
public final Looper getLooper() {
|
|
return this.zao;
|
|
}
|
|
|
|
@Override // com.google.android.gms.common.api.GoogleApiClient
|
|
public final Context getContext() {
|
|
return this.zan;
|
|
}
|
|
|
|
static String zag(int i) {
|
|
return i != 1 ? i != 2 ? i != 3 ? GrsBaseInfo.CountryCodeSource.UNKNOWN : "SIGN_IN_MODE_NONE" : "SIGN_IN_MODE_OPTIONAL" : "SIGN_IN_MODE_REQUIRED";
|
|
}
|
|
}
|