discord-jadx/app/src/main/java/c/i/a/f/e/h/b.java

235 lines
8.9 KiB
Java

package c.i.a.f.e.h;
import android.accounts.Account;
import android.app.Activity;
import android.content.Context;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
import androidx.annotation.MainThread;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.collection.ArraySet;
import c.i.a.f.e.h.a;
import c.i.a.f.e.h.a.d;
import c.i.a.f.e.h.j.c0;
import c.i.a.f.e.h.j.g;
import c.i.a.f.e.h.j.k;
import c.i.a.f.e.h.j.m0;
import c.i.a.f.e.h.j.n;
import c.i.a.f.e.h.j.n0;
import c.i.a.f.e.h.j.o0;
import c.i.a.f.e.h.j.p;
import c.i.a.f.e.h.j.y;
import c.i.a.f.e.h.j.y0;
import c.i.a.f.e.k.c;
import c.i.a.f.e.o.c;
import com.airbnb.lottie.parser.AnimatableValueParser;
import com.google.android.gms.auth.api.signin.GoogleSignInAccount;
import com.google.android.gms.common.api.GoogleApiActivity;
import com.google.android.gms.common.api.Scope;
import com.google.android.gms.common.api.internal.BasePendingResult;
import com.google.android.gms.tasks.Task;
import com.google.android.gms.tasks.TaskCompletionSource;
import java.lang.reflect.InvocationTargetException;
import java.util.Collections;
import java.util.ConcurrentModificationException;
import java.util.Objects;
import java.util.Set;
import org.checkerframework.checker.initialization.qual.NotOnlyInitialized;
/* compiled from: com.google.android.gms:play-services-base@@17.3.0 */
public class b<O extends a.d> {
public final Context a;
public final a<O> b;
/* renamed from: c reason: collision with root package name */
public final O f1031c;
public final c.i.a.f.e.h.j.b<O> d;
public final Looper e;
public final int f;
@NotOnlyInitialized
public final c g;
public final n h;
public final g i;
/* compiled from: com.google.android.gms:play-services-base@@17.3.0 */
public static class a {
public static final a a = new a(new c.i.a.f.e.h.j.a(), null, Looper.getMainLooper());
public final n b;
/* renamed from: c reason: collision with root package name */
public final Looper f1032c;
public a(n nVar, Account account, Looper looper) {
this.b = nVar;
this.f1032c = looper;
}
}
@MainThread
public b(@NonNull Activity activity, a<O> aVar, O o, a aVar2) {
AnimatableValueParser.z(activity, "Null activity is not permitted.");
AnimatableValueParser.z(aVar, "Api must not be null.");
AnimatableValueParser.z(aVar2, "Settings must not be null; use Settings.DEFAULT_SETTINGS instead.");
Context applicationContext = activity.getApplicationContext();
this.a = applicationContext;
e(activity);
this.b = aVar;
this.f1031c = o;
this.e = aVar2.f1032c;
c.i.a.f.e.h.j.b<O> bVar = new c.i.a.f.e.h.j.b<>(aVar, o);
this.d = bVar;
this.g = new y(this);
g a2 = g.a(applicationContext);
this.i = a2;
this.f = a2.q.getAndIncrement();
this.h = aVar2.b;
if (!(activity instanceof GoogleApiActivity)) {
try {
y0.o(activity, a2, bVar);
} catch (IllegalStateException | ConcurrentModificationException unused) {
}
}
Handler handler = this.i.w;
handler.sendMessage(handler.obtainMessage(7, this));
}
/* JADX WARNING: Illegal instructions before constructor call */
@Deprecated
public b(@NonNull Activity activity, a<O> aVar, O o, n nVar) {
this(activity, (a<a.d>) aVar, (a.d) null, new a(nVar, null, r5));
AnimatableValueParser.z(nVar, "StatusExceptionMapper must not be null.");
Looper mainLooper = activity.getMainLooper();
AnimatableValueParser.z(mainLooper, "Looper must not be null.");
}
public b(@NonNull Context context, a<O> aVar, O o, a aVar2) {
AnimatableValueParser.z(context, "Null context is not permitted.");
AnimatableValueParser.z(aVar, "Api must not be null.");
AnimatableValueParser.z(aVar2, "Settings must not be null; use Settings.DEFAULT_SETTINGS instead.");
Context applicationContext = context.getApplicationContext();
this.a = applicationContext;
e(context);
this.b = aVar;
this.f1031c = o;
this.e = aVar2.f1032c;
this.d = new c.i.a.f.e.h.j.b<>(aVar, o);
this.g = new y(this);
g a2 = g.a(applicationContext);
this.i = a2;
this.f = a2.q.getAndIncrement();
this.h = aVar2.b;
Handler handler = a2.w;
handler.sendMessage(handler.obtainMessage(7, this));
}
/* JADX INFO: this call moved to the top of the method (can break code semantics) */
@Deprecated
public b(@NonNull Context context, a<O> aVar, O o, n nVar) {
this(context, aVar, o, new a(nVar, null, Looper.getMainLooper()));
AnimatableValueParser.z(nVar, "StatusExceptionMapper must not be null.");
}
/* JADX WARNING: Removed duplicated region for block: B:42:0x0093 */
/* JADX WARNING: Removed duplicated region for block: B:48:? A[RETURN, SYNTHETIC] */
@Nullable
public static String e(Object obj) {
int i = Build.VERSION.SDK_INT;
boolean z2 = true;
if (i >= 29) {
if (i < 30 || !Build.VERSION.CODENAME.equals("REL")) {
String str = Build.VERSION.CODENAME;
if (str.length() == 1 && str.charAt(0) >= 'R' && str.charAt(0) <= 'Z') {
Boolean bool = c.e;
if (bool != null) {
z2 = bool.booleanValue();
} else {
try {
if (!"google".equals(Build.BRAND) || Build.ID.startsWith("RPP1") || Build.ID.startsWith("RPP2") || Integer.parseInt(Build.VERSION.INCREMENTAL) < 6301457) {
z2 = false;
}
c.e = Boolean.valueOf(z2);
} catch (NumberFormatException unused) {
c.e = Boolean.TRUE;
}
if (!c.e.booleanValue()) {
Log.w("PlatformVersion", "Build version must be at least 6301457 to support R in gmscore");
}
z2 = c.e.booleanValue();
}
}
}
if (z2) {
return null;
}
try {
return (String) Context.class.getMethod("getAttributionTag", new Class[0]).invoke(obj, new Object[0]);
} catch (IllegalAccessException | NoSuchMethodException | InvocationTargetException unused2) {
return null;
}
}
z2 = false;
if (z2) {
}
}
public c.a a() {
GoogleSignInAccount K;
GoogleSignInAccount K2;
c.a aVar = new c.a();
O o = this.f1031c;
Account account = null;
if (!(o instanceof a.d.b) || (K2 = ((a.d.b) o).K()) == null) {
O o2 = this.f1031c;
if (o2 instanceof a.d.AbstractC0101a) {
account = ((a.d.AbstractC0101a) o2).S();
}
} else if (K2.l != null) {
account = new Account(K2.l, "com.google");
}
aVar.a = account;
O o3 = this.f1031c;
Set<Scope> emptySet = (!(o3 instanceof a.d.b) || (K = ((a.d.b) o3).K()) == null) ? Collections.emptySet() : K.v0();
if (aVar.b == null) {
aVar.b = new ArraySet<>();
}
aVar.b.addAll(emptySet);
aVar.d = this.a.getClass().getName();
aVar.f1050c = this.a.getPackageName();
return aVar;
}
public Task<Boolean> b(@NonNull k.a<?> aVar) {
AnimatableValueParser.z(aVar, "Listener key cannot be null.");
g gVar = this.i;
Objects.requireNonNull(gVar);
TaskCompletionSource taskCompletionSource = new TaskCompletionSource();
n0 n0Var = new n0(aVar, taskCompletionSource);
Handler handler = gVar.w;
handler.sendMessage(handler.obtainMessage(13, new c0(n0Var, gVar.r.get(), this)));
return taskCompletionSource.a;
}
public <TResult, A extends a.b> Task<TResult> c(p<A, TResult> pVar) {
TaskCompletionSource taskCompletionSource = new TaskCompletionSource();
g gVar = this.i;
n nVar = this.h;
Objects.requireNonNull(gVar);
o0 o0Var = new o0(1, pVar, taskCompletionSource, nVar);
Handler handler = gVar.w;
handler.sendMessage(handler.obtainMessage(4, new c0(o0Var, gVar.r.get(), this)));
return taskCompletionSource.a;
}
public final <A extends a.b, T extends c.i.a.f.e.h.j.d<? extends h, A>> T d(int i, @NonNull T t) {
t.k = t.k || BasePendingResult.a.get().booleanValue();
g gVar = this.i;
Objects.requireNonNull(gVar);
m0 m0Var = new m0(i, t);
Handler handler = gVar.w;
handler.sendMessage(handler.obtainMessage(4, new c0(m0Var, gVar.r.get(), this)));
return t;
}
}