99 lines
4.6 KiB
Java
99 lines
4.6 KiB
Java
package com.google.android.gms.common.internal;
|
|
|
|
import android.accounts.Account;
|
|
import android.content.Context;
|
|
import android.os.Handler;
|
|
import android.os.IInterface;
|
|
import android.os.Looper;
|
|
import com.google.android.gms.common.Feature;
|
|
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.Scope;
|
|
import com.google.android.gms.common.api.internal.ConnectionCallbacks;
|
|
import com.google.android.gms.common.api.internal.OnConnectionFailedListener;
|
|
import java.util.Collections;
|
|
import java.util.Iterator;
|
|
import java.util.Set;
|
|
import java.util.concurrent.Executor;
|
|
|
|
/* loaded from: classes.dex */
|
|
public abstract class GmsClient<T extends IInterface> extends BaseGmsClient<T> implements Api.Client, zaj {
|
|
private static volatile Executor zaa;
|
|
private final ClientSettings zab;
|
|
private final Set<Scope> zac;
|
|
private final Account zad;
|
|
|
|
protected GmsClient(Context context, Handler handler, int i, ClientSettings clientSettings) {
|
|
super(context, handler, GmsClientSupervisor.getInstance(context), GoogleApiAvailability.getInstance(), i, null, null);
|
|
this.zab = (ClientSettings) Preconditions.checkNotNull(clientSettings);
|
|
this.zad = clientSettings.getAccount();
|
|
this.zac = zaa(clientSettings.getAllRequestedScopes());
|
|
}
|
|
|
|
private final Set<Scope> zaa(Set<Scope> set) {
|
|
Set<Scope> validateScopes = validateScopes(set);
|
|
Iterator<Scope> it = validateScopes.iterator();
|
|
while (it.hasNext()) {
|
|
if (!set.contains(it.next())) {
|
|
throw new IllegalStateException("Expanding scopes is not permitted, use implied scopes instead");
|
|
}
|
|
}
|
|
return validateScopes;
|
|
}
|
|
|
|
@Override // com.google.android.gms.common.internal.BaseGmsClient
|
|
protected final Executor getBindServiceExecutor() {
|
|
return null;
|
|
}
|
|
|
|
@Override // com.google.android.gms.common.api.Api.Client
|
|
public Set<Scope> getScopesForConnectionlessNonSignIn() {
|
|
return requiresSignIn() ? this.zac : Collections.emptySet();
|
|
}
|
|
|
|
protected Set<Scope> validateScopes(Set<Scope> set) {
|
|
return set;
|
|
}
|
|
|
|
protected GmsClient(Context context, Looper looper, int i, ClientSettings clientSettings) {
|
|
this(context, looper, GmsClientSupervisor.getInstance(context), GoogleApiAvailability.getInstance(), i, clientSettings, null, null);
|
|
}
|
|
|
|
@Deprecated
|
|
public GmsClient(Context context, Looper looper, int i, ClientSettings clientSettings, GoogleApiClient.ConnectionCallbacks connectionCallbacks, GoogleApiClient.OnConnectionFailedListener onConnectionFailedListener) {
|
|
this(context, looper, i, clientSettings, (ConnectionCallbacks) connectionCallbacks, (OnConnectionFailedListener) onConnectionFailedListener);
|
|
}
|
|
|
|
public GmsClient(Context context, Looper looper, int i, ClientSettings clientSettings, ConnectionCallbacks connectionCallbacks, OnConnectionFailedListener onConnectionFailedListener) {
|
|
this(context, looper, GmsClientSupervisor.getInstance(context), GoogleApiAvailability.getInstance(), i, clientSettings, (ConnectionCallbacks) Preconditions.checkNotNull(connectionCallbacks), (OnConnectionFailedListener) Preconditions.checkNotNull(onConnectionFailedListener));
|
|
}
|
|
|
|
protected GmsClient(Context context, Looper looper, GmsClientSupervisor gmsClientSupervisor, GoogleApiAvailability googleApiAvailability, int i, ClientSettings clientSettings, ConnectionCallbacks connectionCallbacks, OnConnectionFailedListener onConnectionFailedListener) {
|
|
super(context, looper, gmsClientSupervisor, googleApiAvailability, i, connectionCallbacks == null ? null : new zah(connectionCallbacks), onConnectionFailedListener == null ? null : new zai(onConnectionFailedListener), clientSettings.zac());
|
|
this.zab = clientSettings;
|
|
this.zad = clientSettings.getAccount();
|
|
this.zac = zaa(clientSettings.getAllRequestedScopes());
|
|
}
|
|
|
|
@Override // com.google.android.gms.common.internal.BaseGmsClient
|
|
protected final Set<Scope> getScopes() {
|
|
return this.zac;
|
|
}
|
|
|
|
@Override // com.google.android.gms.common.api.Api.Client
|
|
public Feature[] getRequiredFeatures() {
|
|
return new Feature[0];
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: protected */
|
|
public final ClientSettings getClientSettings() {
|
|
return this.zab;
|
|
}
|
|
|
|
@Override // com.google.android.gms.common.internal.BaseGmsClient
|
|
public final Account getAccount() {
|
|
return this.zad;
|
|
}
|
|
}
|