package e8;

import android.content.Context;
import android.content.pm.PackageManager;
import android.os.IBinder;
import android.os.IInterface;
import android.os.Parcel;
import android.os.RemoteException;
import android.os.StrictMode;
import androidx.annotation.Nullable;
import com.google.android.gms.common.internal.r0;
import com.google.android.gms.common.internal.s0;
import com.google.android.gms.common.internal.t0;
import com.google.android.gms.dynamite.DynamiteModule$LoadingException;
import java.security.MessageDigest;
import java.util.concurrent.Callable;

/* JADX INFO: loaded from: classes2.dex */
public abstract class s {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public static final m f25548a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public static final m f25549b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public static volatile t0 f25550c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public static final Object f25551d;

    @Nullable
    private static Context zzj;

    static {
        new m(n.O("0\u0082\u0005È0\u0082\u0003° \u0003\u0002\u0001\u0002\u0002\u0014\u007f¢fú§p\u0085xb±"), 0);
        new m(n.O("0\u0082\u0006\u00040\u0082\u0003ì \u0003\u0002\u0001\u0002\u0002\u0014QÕÛ\u0004÷XçB\u0086<"), 1);
        new m(n.O("0\u0082\u0005È0\u0082\u0003° \u0003\u0002\u0001\u0002\u0002\u0014\u0010\u008ae\bsù/\u008eQí"), 2);
        new m(n.O("0\u0082\u0006\u00040\u0082\u0003ì \u0003\u0002\u0001\u0002\u0002\u0014\u0003£²\u00ad×árÊkì"), 3);
        f25548a = new m(n.O("0\u0082\u0004C0\u0082\u0003+ \u0003\u0002\u0001\u0002\u0002\t\u0000Âà\u0087FdJ0\u008d0"), 4);
        f25549b = new m(n.O("0\u0082\u0004¨0\u0082\u0003\u0090 \u0003\u0002\u0001\u0002\u0002\t\u0000Õ\u0085¸l}ÓNõ0"), 5);
        f25551d = new Object();
    }

    public static synchronized void a(Context context) {
        if (zzj == null) {
            if (context != null) {
                zzj = context.getApplicationContext();
            }
        }
    }

    public static void b() {
        t0 r0Var;
        if (f25550c != null) {
            return;
        }
        com.google.android.gms.common.internal.w.checkNotNull(zzj);
        synchronized (f25551d) {
            try {
                if (f25550c == null) {
                    IBinder iBinderB = l8.c.c(zzj, l8.c.f30169d, "com.google.android.gms.googlecertificates").b("com.google.android.gms.common.GoogleCertificatesImpl");
                    int i10 = s0.f8398b;
                    if (iBinderB == null) {
                        r0Var = null;
                    } else {
                        IInterface iInterfaceQueryLocalInterface = iBinderB.queryLocalInterface("com.google.android.gms.common.internal.IGoogleCertificatesApi");
                        r0Var = iInterfaceQueryLocalInterface instanceof t0 ? (t0) iInterfaceQueryLocalInterface : new r0(iBinderB, "com.google.android.gms.common.internal.IGoogleCertificatesApi", 2);
                    }
                    f25550c = r0Var;
                }
            } catch (Throwable th) {
                throw th;
            }
        }
    }

    public static y c(n5.a aVar) {
        y yVarC;
        u uVar;
        StrictMode.ThreadPolicy threadPolicyAllowThreadDiskReads = StrictMode.allowThreadDiskReads();
        try {
            com.google.android.gms.common.internal.w.checkNotNull(zzj);
            try {
                b();
                com.google.android.gms.common.internal.w.checkNotNull(zzj);
                t tVar = new t((String) aVar.f30852c, aVar.f30850a, false, new k8.b(zzj), false, true, false);
                try {
                    if (aVar.f30851b) {
                        r0 r0Var = (r0) f25550c;
                        Parcel parcelO = r0Var.O();
                        int i10 = com.google.android.gms.internal.common.f.f20082a;
                        parcelO.writeInt(1);
                        tVar.writeToParcel(parcelO, 0);
                        Parcel parcelM = r0Var.M(6, parcelO);
                        uVar = (u) com.google.android.gms.internal.common.f.a(parcelM, u.CREATOR);
                        parcelM.recycle();
                    } else {
                        r0 r0Var2 = (r0) f25550c;
                        Parcel parcelO2 = r0Var2.O();
                        int i11 = com.google.android.gms.internal.common.f.f20082a;
                        parcelO2.writeInt(1);
                        tVar.writeToParcel(parcelO2, 0);
                        Parcel parcelM2 = r0Var2.M(8, parcelO2);
                        uVar = (u) com.google.android.gms.internal.common.f.a(parcelM2, u.CREATOR);
                        parcelM2.recycle();
                    }
                    if (uVar.f25559a) {
                        com.bumptech.glide.g.F(uVar.f25562d);
                        yVarC = new y(true, null, null);
                    } else {
                        String str = uVar.f25560b;
                        PackageManager.NameNotFoundException nameNotFoundException = hb.a.J0(uVar.f25561c) == 4 ? new PackageManager.NameNotFoundException() : null;
                        if (str == null) {
                            str = "error checking package certificate";
                        }
                        com.bumptech.glide.g.F(uVar.f25562d);
                        hb.a.J0(uVar.f25561c);
                        yVarC = new y(false, str, nameNotFoundException);
                    }
                } catch (RemoteException e10) {
                    yVarC = y.c("module call", e10);
                }
            } catch (DynamiteModule$LoadingException e11) {
                yVarC = y.c("module init: ".concat(String.valueOf(e11.getMessage())), e11);
            }
            StrictMode.setThreadPolicy(threadPolicyAllowThreadDiskReads);
            return yVarC;
        } catch (Throwable th) {
            StrictMode.setThreadPolicy(threadPolicyAllowThreadDiskReads);
            throw th;
        }
    }

    /* JADX WARN: Type inference failed for: r8v4, types: [e8.p] */
    public static y d(final String str, final n nVar, final boolean z10, boolean z11) {
        try {
            b();
            com.google.android.gms.common.internal.w.checkNotNull(zzj);
            v vVar = new v(str, nVar, z10, z11);
            try {
                t0 t0Var = f25550c;
                k8.b bVar = new k8.b(zzj.getPackageManager());
                r0 r0Var = (r0) t0Var;
                Parcel parcelO = r0Var.O();
                int i10 = com.google.android.gms.internal.common.f.f20082a;
                boolean z12 = true;
                parcelO.writeInt(1);
                vVar.writeToParcel(parcelO, 0);
                com.google.android.gms.internal.common.f.b(parcelO, bVar);
                Parcel parcelM = r0Var.M(5, parcelO);
                if (parcelM.readInt() == 0) {
                    z12 = false;
                }
                parcelM.recycle();
                return z12 ? y.f25570c : new x(new Callable() { // from class: e8.p
                    @Override // java.util.concurrent.Callable
                    public final /* synthetic */ Object call() {
                        boolean z13 = z10;
                        String str2 = str;
                        n nVar2 = nVar;
                        String str3 = (z13 || !s.d(str2, nVar2, true, false).f25571a) ? "not allowed" : "debug cert rejected";
                        MessageDigest messageDigestZza = i8.a.zza("SHA-256");
                        com.google.android.gms.common.internal.w.checkNotNull(messageDigestZza);
                        return String.format("%s: pkg=%s, sha256=%s, atk=%s, ver=%s", str3, str2, i8.f.a(messageDigestZza.digest(nVar2.M())), Boolean.valueOf(z13), "12451000.false");
                    }
                });
            } catch (RemoteException e10) {
                return y.c("module call", e10);
            }
        } catch (DynamiteModule$LoadingException e11) {
            return y.c("module init: ".concat(String.valueOf(e11.getMessage())), e11);
        }
    }
}
