package com.google.android.gms.common.internal; import android.accounts.Account; import android.content.Context; import android.view.View; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.collection.ArraySet; import com.google.android.gms.common.annotation.KeepForSdk; 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.signin.SignInOptions; import java.util.Collection; import java.util.Collections; import java.util.HashSet; import java.util.Iterator; import java.util.Map; import java.util.Set; @KeepForSdk /* loaded from: classes2.dex */ public final class ClientSettings { private final Account zaa; private final Set zab; private final Set zac; private final Map zad; private final int zae; private final View zaf; private final String zag; private final String zah; private final SignInOptions zai; private Integer zaj; @KeepForSdk public static final class Builder { private Account zaa; private ArraySet zab; private String zac; private String zad; private final SignInOptions zae = SignInOptions.zaa; @NonNull @KeepForSdk public ClientSettings build() { return new ClientSettings(this.zaa, this.zab, null, 0, null, this.zac, this.zad, this.zae, false); } @NonNull @KeepForSdk public Builder setRealClientPackageName(@NonNull String str) { this.zac = str; return this; } @NonNull public final Builder zaa(@NonNull Collection collection) { if (this.zab == null) { this.zab = new ArraySet(); } this.zab.addAll(collection); return this; } @NonNull public final Builder zab(Account account) { this.zaa = account; return this; } @NonNull public final Builder zac(@NonNull String str) { this.zad = str; return this; } } @KeepForSdk public ClientSettings(@NonNull Account account, @NonNull Set set, @NonNull Map, zab> map, int i, View view, @NonNull String str, @NonNull String str2, SignInOptions signInOptions) { this(account, set, map, i, view, str, str2, signInOptions, false); } @NonNull @KeepForSdk public static ClientSettings createDefault(@NonNull Context context) { return new GoogleApiClient.Builder(context).zaa(); } @Nullable @KeepForSdk public Account getAccount() { return this.zaa; } @Nullable @KeepForSdk @Deprecated public String getAccountName() { Account account = this.zaa; if (account != null) { return account.name; } return null; } @NonNull @KeepForSdk public Account getAccountOrDefault() { Account account = this.zaa; return account != null ? account : new Account("<>", "com.google"); } @NonNull @KeepForSdk public Set getAllRequestedScopes() { return this.zac; } @NonNull @KeepForSdk public Set getApplicableScopes(@NonNull Api api) { zab zabVar = (zab) this.zad.get(api); if (zabVar == null || zabVar.zaa.isEmpty()) { return this.zab; } HashSet hashSet = new HashSet(this.zab); hashSet.addAll(zabVar.zaa); return hashSet; } @KeepForSdk public int getGravityForPopups() { return this.zae; } @NonNull @KeepForSdk public String getRealClientPackageName() { return this.zag; } @NonNull @KeepForSdk public Set getRequiredScopes() { return this.zab; } @Nullable @KeepForSdk public View getViewForPopups() { return this.zaf; } @NonNull public final SignInOptions zaa() { return this.zai; } @Nullable public final Integer zab() { return this.zaj; } @Nullable public final String zac() { return this.zah; } @NonNull public final Map zad() { return this.zad; } public final void zae(@NonNull Integer num) { this.zaj = num; } public ClientSettings(Account account, @NonNull Set set, @NonNull Map map, int i, View view, @NonNull String str, @NonNull String str2, SignInOptions signInOptions, boolean z) { this.zaa = account; Set emptySet = set == null ? Collections.emptySet() : Collections.unmodifiableSet(set); this.zab = emptySet; map = map == null ? Collections.emptyMap() : map; this.zad = map; this.zaf = view; this.zae = i; this.zag = str; this.zah = str2; this.zai = signInOptions == null ? SignInOptions.zaa : signInOptions; HashSet hashSet = new HashSet(emptySet); Iterator it = map.values().iterator(); while (it.hasNext()) { hashSet.addAll(((zab) it.next()).zaa); } this.zac = Collections.unmodifiableSet(hashSet); } }