package com.google.android.gms.internal.ads;

import android.content.Context;
import android.content.SharedPreferences;
import android.os.RemoteException;
import com.google.android.gms.dynamite.descriptors.com.google.android.gms.ads.dynamite.ModuleDescriptor;
import java.lang.ref.WeakReference;
import java.util.Arrays;
import java.util.concurrent.Executor;

/* JADX INFO: loaded from: classes2.dex */
public abstract class h70 implements h90 {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public static a80 f12049a;

    public static a80 a(Context context, wv wvVar, int i10) {
        SharedPreferences sharedPreferences;
        synchronized (h70.class) {
            try {
                a80 a80Var = f12049a;
                if (a80Var != null) {
                    return a80Var;
                }
                m7.n nVar = m7.n.C;
                nVar.f30472k.getClass();
                long jCurrentTimeMillis = System.currentTimeMillis();
                ao.a(context);
                int i11 = 0;
                if (((Boolean) hp.f12221e.j()).booleanValue() && (sharedPreferences = context.getSharedPreferences("admob", 0)) != null) {
                    sharedPreferences.edit().putInt("init_without_write", ni.G(context, "init_without_write") + 1).commit();
                }
                pb1 pb1VarA = pb1.a(context);
                boolean zE = p7.r0.e(pb1VarA.f15359a);
                q7.a aVar = new q7.a(true, ModuleDescriptor.MODULE_VERSION, i10, zE);
                if (((Boolean) pp.f15482c.j()).booleanValue()) {
                    n7.p1 p1Var = pb1VarA.f15360b;
                    n7.e3 liteSdkVersion = null;
                    if (p1Var != null) {
                        try {
                            liteSdkVersion = p1Var.getLiteSdkVersion();
                        } catch (RemoteException unused) {
                        }
                    }
                    if (liteSdkVersion != null) {
                        aVar = new q7.a(true, ModuleDescriptor.MODULE_VERSION, liteSdkVersion.f30939b, zE);
                    }
                }
                pb1VarA.b(wvVar);
                oa1 oa1Var = new oa1();
                i70 i70Var = new i70();
                i70Var.f12400b = aVar;
                i70Var.f12402d = new WeakReference(context);
                i70Var.f12401c = context.getApplicationContext() != null ? context.getApplicationContext() : context;
                i70Var.f12399a = jCurrentTimeMillis;
                oa1Var.f14984b = new j70(i70Var);
                oa1Var.f14985c = new w80();
                a80 a80VarA = oa1Var.a();
                tn tnVar = ao.Ye;
                n7.y yVar = n7.y.f31093e;
                if (((Boolean) yVar.f31096c.b(tnVar)).booleanValue()) {
                    x20 x20Var = nVar.f30466e;
                    a30 a30Var = b30.f9359a;
                    vj1.i(a30Var);
                    x20Var.a(a30Var, (cr0) a80VarA.f8543l.zzb(), context);
                    nVar.f30466e.b();
                }
                ((ft0) a80VarA.f8549o.zzb()).zza();
                ((c70) a80VarA.f8547n.zzb()).a(context, aVar);
                nVar.f30469h.zze(context, aVar, (cr0) a80VarA.f8543l.zzb());
                nVar.f30471j.a(context);
                nVar.f30464c.y(context);
                nVar.f30464c.z(context);
                hb.a.O0(context);
                nVar.f30468g.a(context);
                nVar.f30487z.a(context);
                if (((Boolean) yVar.f31096c.b(ao.f9108uf)).booleanValue()) {
                    String str = (String) yVar.f31096c.b(ao.f9125vf);
                    if (!str.isEmpty()) {
                        if (Arrays.asList(str.split(",")).contains(context.getPackageName())) {
                            ((hq0) a80VarA.W.zzb()).a(nVar.f30468g);
                        }
                    }
                } else if (((Boolean) yVar.f31096c.b(ao.f9092tf)).booleanValue()) {
                    ((hq0) a80VarA.W.zzb()).a(nVar.f30468g);
                }
                ((p7.e0) a80VarA.V.zzb()).a();
                v10.a(context);
                if (((Boolean) yVar.f31096c.b(ao.W6)).booleanValue()) {
                    if (!((Boolean) yVar.f31096c.b(ao.V0)).booleanValue()) {
                        eb ebVar = new eb(context, aVar, new il(new n5.s(context, 5)), new pv0(new mv0(context), (dv1) a80VarA.f8531f.zzb()));
                        try {
                            ((pv0) ebVar.f10743d).a(new e.t0(ebVar, nVar.f30469h.g().C()));
                        } catch (Exception e10) {
                            q7.j.b("Error in offline signals database startup: ".concat(String.valueOf(e10.getMessage())));
                        }
                    }
                }
                if (((Boolean) n7.y.f31093e.f31096c.b(ao.f8992nf)).booleanValue()) {
                    Context context2 = a80VarA.f8523b.f12750b;
                    vj1.i(context2);
                    a30 a30Var2 = b30.f9359a;
                    vj1.i(a30Var2);
                    a30Var2.execute(new z80(new vu0(a80VarA, context2, a30Var2, i11), 18));
                }
                f12049a = a80VarA;
                return a80VarA;
            } catch (Throwable th) {
                throw th;
            }
        }
    }

    public abstract Executor b();

    public abstract nd1 c();
}
