package M2;

import P2.t;
import P2.u;
import P2.v;
import P2.w;
import android.content.Context;
import android.os.IBinder;
import android.os.IInterface;
import android.os.Parcel;
import android.os.RemoteException;
import android.util.Log;
import com.google.android.gms.internal.measurement.X1;

/* JADX INFO: loaded from: classes.dex */
public abstract class p {

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

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

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

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

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public static Context f4193e;

    static {
        new l(0, m.L("0\u0082\u0005È0\u0082\u0003° \u0003\u0002\u0001\u0002\u0002\u0014\u0010\u008ae\bsù/\u008eQí"));
        new l(1, m.L("0\u0082\u0006\u00040\u0082\u0003ì \u0003\u0002\u0001\u0002\u0002\u0014\u0003£²\u00ad×árÊkì"));
        f4189a = new l(2, m.L("0\u0082\u0004C0\u0082\u0003+ \u0003\u0002\u0001\u0002\u0002\t\u0000Âà\u0087FdJ0\u008d0"));
        f4190b = new l(3, m.L("0\u0082\u0004¨0\u0082\u0003\u0090 \u0003\u0002\u0001\u0002\u0002\t\u0000Õ\u0085¸l}ÓNõ0"));
        f4192d = new Object();
    }

    public static synchronized void a(Context context) {
        if (f4193e != null) {
            Log.w("GoogleCertificates", "GoogleCertificates has been initialized already");
        } else if (context != null) {
            f4193e = context.getApplicationContext();
        }
    }

    public static s b(String str, n nVar, boolean z8, boolean z9) {
        try {
            c();
            w.f(f4193e);
            try {
                v vVar = f4191c;
                V2.b bVar = new V2.b(f4193e.getPackageManager());
                t tVar = (t) vVar;
                Parcel parcelD = tVar.d();
                int i = Z2.b.f7422a;
                boolean z10 = true;
                parcelD.writeInt(1);
                int iU = X1.U(parcelD, 20293);
                X1.R(parcelD, 1, str);
                X1.P(parcelD, 2, nVar);
                X1.Z(parcelD, 3, 4);
                parcelD.writeInt(z8 ? 1 : 0);
                X1.Z(parcelD, 4, 4);
                parcelD.writeInt(z9 ? 1 : 0);
                X1.Y(parcelD, iU);
                Z2.b.c(parcelD, bVar);
                Parcel parcelC = tVar.c(parcelD, 5);
                if (parcelC.readInt() == 0) {
                    z10 = false;
                }
                parcelC.recycle();
                return z10 ? s.f4199d : new r(new k(z8, str, nVar));
            } catch (RemoteException e8) {
                Log.e("GoogleCertificates", "Failed to get Google certificates from remote", e8);
                return new s(false, "module call", e8);
            }
        } catch (W2.b e9) {
            Log.e("GoogleCertificates", "Failed to get Google certificates from remote", e9);
            return new s(false, "module init: ".concat(String.valueOf(e9.getMessage())), e9);
        }
    }

    public static void c() {
        v tVar;
        if (f4191c != null) {
            return;
        }
        w.f(f4193e);
        synchronized (f4192d) {
            try {
                if (f4191c == null) {
                    IBinder iBinderB = W2.e.c(f4193e, W2.e.f7077c, "com.google.android.gms.googlecertificates").b("com.google.android.gms.common.GoogleCertificatesImpl");
                    int i = u.f5439f;
                    if (iBinderB == null) {
                        tVar = null;
                    } else {
                        IInterface iInterfaceQueryLocalInterface = iBinderB.queryLocalInterface("com.google.android.gms.common.internal.IGoogleCertificatesApi");
                        tVar = iInterfaceQueryLocalInterface instanceof v ? (v) iInterfaceQueryLocalInterface : new t(iBinderB, "com.google.android.gms.common.internal.IGoogleCertificatesApi", 0);
                    }
                    f4191c = tVar;
                }
            } catch (Throwable th) {
                throw th;
            }
        }
    }
}
