what-the-bank/sources/com/google/android/gms/common/api/AvailabilityException.java

68 lines
2.8 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package com.google.android.gms.common.api;
import android.text.TextUtils;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.api.Api;
import com.google.android.gms.common.api.internal.ApiKey;
import com.google.android.gms.common.internal.Preconditions;
import java.util.ArrayList;
import o.nyh;
/* loaded from: classes.dex */
public class AvailabilityException extends Exception {
private final nyh<ApiKey<?>, ConnectionResult> zaa;
public AvailabilityException(nyh<ApiKey<?>, ConnectionResult> nyhVar) {
this.zaa = nyhVar;
}
public ConnectionResult getConnectionResult(GoogleApi<? extends Api.ApiOptions> googleApi) {
ApiKey<? extends Api.ApiOptions> apiKey = googleApi.getApiKey();
boolean z = this.zaa.get(apiKey) != null;
String zab = apiKey.zab();
StringBuilder sb = new StringBuilder(String.valueOf(zab).length() + 58);
sb.append("The given API (");
sb.append(zab);
sb.append(") was not part of the availability request.");
Preconditions.checkArgument(z, sb.toString());
return (ConnectionResult) Preconditions.checkNotNull(this.zaa.get(apiKey));
}
@Override // java.lang.Throwable
public String getMessage() {
ArrayList arrayList = new ArrayList();
boolean z = true;
for (ApiKey<?> apiKey : this.zaa.keySet()) {
ConnectionResult connectionResult = (ConnectionResult) Preconditions.checkNotNull(this.zaa.get(apiKey));
z &= !connectionResult.isSuccess();
String zab = apiKey.zab();
String valueOf = String.valueOf(connectionResult);
StringBuilder sb = new StringBuilder(String.valueOf(zab).length() + 2 + String.valueOf(valueOf).length());
sb.append(zab);
sb.append(": ");
sb.append(valueOf);
arrayList.add(sb.toString());
}
StringBuilder sb2 = new StringBuilder();
if (z) {
sb2.append("None of the queried APIs are available. ");
} else {
sb2.append("Some of the queried APIs are unavailable. ");
}
sb2.append(TextUtils.join("; ", arrayList));
return sb2.toString();
}
public ConnectionResult getConnectionResult(HasApiKey<? extends Api.ApiOptions> hasApiKey) {
ApiKey<? extends Api.ApiOptions> apiKey = hasApiKey.getApiKey();
boolean z = this.zaa.get(apiKey) != null;
String zab = apiKey.zab();
StringBuilder sb = new StringBuilder(String.valueOf(zab).length() + 58);
sb.append("The given API (");
sb.append(zab);
sb.append(") was not part of the availability request.");
Preconditions.checkArgument(z, sb.toString());
return (ConnectionResult) Preconditions.checkNotNull(this.zaa.get(apiKey));
}
}