Step Record v1.1.5版本的 MD5 值为:5797275f89198878d2f00ee92d534382

以下内容为反编译后的 n.java 源代码,内容仅作参考


package com.applovin.impl.sdk;

import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.StrictMode;
import android.preference.PreferenceManager;
import android.text.TextUtils;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.StringRes;
import com.applovin.impl.mediation.MediationServiceImpl;
import com.applovin.impl.privacy.a.c;
import com.applovin.impl.privacy.a.d;
import com.applovin.impl.privacy.cmp.CmpServiceImpl;
import com.applovin.impl.sdk.array.ArrayService;
import com.applovin.impl.sdk.e.l;
import com.applovin.impl.sdk.e.q;
import com.applovin.impl.sdk.nativeAd.AppLovinNativeAdService;
import com.applovin.impl.sdk.network.PostbackServiceImpl;
import com.applovin.impl.sdk.network.d;
import com.applovin.impl.sdk.utils.AppLovinSdkExtraParameterKey;
import com.applovin.impl.sdk.utils.CollectionUtils;
import com.applovin.impl.sdk.utils.JsonUtils;
import com.applovin.impl.sdk.utils.StringUtils;
import com.applovin.impl.sdk.utils.u;
import com.applovin.mediation.MaxAdFormat;
import com.applovin.mediation.adapter.MaxAdapter;
import com.applovin.sdk.AppLovinMediationProvider;
import com.applovin.sdk.AppLovinSdk;
import com.applovin.sdk.AppLovinSdkConfiguration;
import com.applovin.sdk.AppLovinSdkSettings;
import com.applovin.sdk.AppLovinSdkUtils;
import com.applovin.sdk.AppLovinTargetingData;
import com.applovin.sdk.AppLovinUserSegment;
import com.chartboost.heliumsdk.impl.HKztS1S;
import com.chartboost.heliumsdk.impl.K1Hz1;
import com.chartboost.heliumsdk.impl.KKSKtzzSt;
import com.chartboost.heliumsdk.impl.KSS1StH;
import com.chartboost.heliumsdk.impl.KzttK1tK1;
import com.chartboost.heliumsdk.impl.Sz;
import com.chartboost.heliumsdk.impl.tHKKKKKt;
import com.chartboost.heliumsdk.impl.tHzK1K;
import com.chartboost.heliumsdk.impl.tStKzHtHt;
import com.chartboost.heliumsdk.impl.tStt1z;
import com.chartboost.heliumsdk.impl.ttSHtSH;
import com.chartboost.heliumsdk.impl.zS1HS;
import com.chartboost.heliumsdk.impl.ztStKHStz;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
import kotlinx.serialization.json.internal.AbstractJsonLexerKt;
import org.json.JSONException;
import org.json.JSONObject;

public class n {

    @Nullable
    public static n aAA;
    private static final boolean aAC;

    @Nullable
    private static volatile a aAD;
    public static n aAz;
    protected static Context hr;
    private String aAF;
    private WeakReference<Activity> aAG;
    private long aAH;
    private boolean aAI;
    private long aAJ;
    private boolean aAL;
    private AppLovinSdkSettings aAM;
    private AppLovinUserSegment aAN;
    private AppLovinTargetingData aAO;
    private String aAP;

    @Nullable
    private volatile AppLovinNativeAdService aAR;

    @Nullable
    private volatile EventServiceImpl aAT;

    @Nullable
    private volatile UserServiceImpl aAV;

    @Nullable
    private volatile CmpServiceImpl aAX;
    private volatile AppLovinSdk aAZ;

    @Nullable
    private volatile b aBA;

    @Nullable
    private volatile t aBC;

    @Nullable
    private volatile com.applovin.impl.sdk.d.c aBE;

    @Nullable
    private volatile SessionTracker aBG;

    @Nullable
    private volatile u aBI;

    @Nullable
    private volatile ae aBK;

    @Nullable
    private volatile com.applovin.impl.sdk.network.d aBM;

    @Nullable
    private volatile k aBO;

    @Nullable
    private volatile com.applovin.impl.sdk.utils.q aBQ;

    @Nullable
    private volatile i aBS;

    @Nullable
    private volatile com.applovin.impl.privacy.a.c aBU;

    @Nullable
    private volatile com.applovin.impl.privacy.b.b aBW;

    @Nullable
    private volatile com.applovin.impl.a.a.a aBY;

    @Nullable
    private volatile com.applovin.impl.sdk.e.q aBb;

    @Nullable
    private volatile com.applovin.impl.sdk.c.c aBd;

    @Nullable
    private volatile com.applovin.impl.sdk.network.b aBf;

    @Nullable
    private volatile com.applovin.impl.sdk.d.g aBh;

    @Nullable
    private volatile q aBj;

    @Nullable
    private volatile o aBl;

    @Nullable
    private volatile p aBn;

    @Nullable
    private volatile Boolean aBp;

    @Nullable
    private volatile aa aBq;

    @Nullable
    private volatile com.applovin.impl.sdk.c.e aBs;

    @Nullable
    private volatile m aBu;

    @Nullable
    private volatile com.applovin.impl.sdk.utils.t aBw;

    @Nullable
    private volatile d aBy;

    @Nullable
    private volatile y aCA;

    @Nullable
    private volatile com.applovin.impl.mediation.d aCC;

    @Nullable
    private volatile com.applovin.impl.mediation.debugger.ui.testmode.c aCE;
    private List<MaxAdFormat> aCG;

    @Nullable
    private String aCP;
    private AppLovinSdk.SdkInitializationListener aCQ;
    private AppLovinSdk.SdkInitializationListener aCR;
    private AppLovinSdkConfiguration aCS;

    @Nullable
    private volatile com.applovin.impl.sdk.a.f aCa;

    @Nullable
    private volatile w aCc;

    @Nullable
    private volatile ArrayService aCe;

    @Nullable
    private volatile r aCg;

    @Nullable
    private volatile PostbackServiceImpl aCi;

    @Nullable
    private volatile com.applovin.impl.sdk.network.f aCk;

    @Nullable
    private volatile f aCm;

    @Nullable
    private volatile com.applovin.impl.mediation.f aCo;

    @Nullable
    private volatile com.applovin.impl.mediation.e aCq;

    @Nullable
    private volatile MediationServiceImpl aCs;

    @Nullable
    private volatile com.applovin.impl.mediation.a.d aCu;

    @Nullable
    private volatile com.applovin.impl.mediation.h aCw;

    @Nullable
    private volatile com.applovin.impl.mediation.debugger.b aCy;

    @Nullable
    private volatile AppLovinAdServiceImpl age;

    @Nullable
    private volatile x logger;
    private static final Object aAE = new Object();
    private static final long aAB = System.currentTimeMillis();
    private final AtomicBoolean aAK = new AtomicBoolean();
    private final Object aAQ = new Object();
    private final Object aAS = new Object();
    private final Object aAU = new Object();
    private final Object aAW = new Object();
    private final Object aAY = new Object();
    private final Object aBa = new Object();
    private final Object aBc = new Object();
    private final Object aBe = new Object();
    private final Object aBg = new Object();
    private final Object aBi = new Object();
    private final Object aBk = new Object();
    private final Object aBm = new Object();
    private final Object aBo = new Object();
    private final Object aBr = new Object();
    private final Object aBt = new Object();
    private final Object aBv = new Object();
    private final Object aBx = new Object();
    private final Object aBz = new Object();
    private final Object aBB = new Object();
    private final Object aBD = new Object();
    private final Object aBF = new Object();
    private final Object aBH = new Object();
    private final Object aBJ = new Object();
    private final Object aBL = new Object();
    private final Object aBN = new Object();
    private final Object aBP = new Object();
    private final Object aBR = new Object();
    private final Object aBT = new Object();
    private final Object aBV = new Object();
    private final Object aBX = new Object();
    private final Object aBZ = new Object();
    private final Object aCb = new Object();
    private final Object aCd = new Object();
    private final Object aCf = new Object();
    private final Object aCh = new Object();
    private final Object aCj = new Object();
    private final Object aCl = new Object();
    private final Object aCn = new Object();
    private final Object aCp = new Object();
    private final Object aCr = new Object();
    private final Object aCt = new Object();
    private final Object aCv = new Object();
    private final Object aCx = new Object();
    private final Object aCz = new Object();
    private final Object aCB = new Object();
    private final Object aCD = new Object();
    private final Object aCF = new Object();
    private final Object aCH = new Object();
    private final AtomicBoolean aCI = new AtomicBoolean(true);
    private final AtomicBoolean aCJ = new AtomicBoolean();
    private boolean aCK = false;
    private boolean iV = false;
    private boolean aCL = false;
    private boolean aCM = false;
    private boolean aCN = false;
    private int aCO = 0;

    public class AnonymousClass1 implements c.a {
        public AnonymousClass1() {
        }

        @Override
        public void onFlowCompleted(@Nullable com.applovin.impl.privacy.a.a aVar) {
        }
    }

    public class AnonymousClass2 implements l.a {

        public class AnonymousClass1 implements c.a {
            public AnonymousClass1() {
            }

            @Override
            public void onFlowCompleted(@Nullable com.applovin.impl.privacy.a.a aVar) {
                n.this.cD("Initializing SDK in MAX environment...");
            }
        }

        public AnonymousClass2() {
        }

        @Override
        public void G(JSONObject jSONObject) {
            boolean z;
            if (jSONObject != null && jSONObject.length() > 0) {
                z = true;
            } else {
                z = false;
            }
            n.this.D(jSONObject);
            g.o(n.this);
            com.applovin.impl.sdk.utils.i.a(jSONObject, z, n.this);
            n.this.Cz().h(JsonUtils.getBoolean(jSONObject, "smd", Boolean.FALSE).booleanValue(), JsonUtils.getInt(jSONObject, "smd_delay_sec", 2));
            n nVar = n.this;
            nVar.aCG = nVar.F(jSONObject);
            if (z) {
                List<String> explode = CollectionUtils.explode(JsonUtils.getString(jSONObject, "eaaui", ""));
                n nVar2 = n.this;
                nVar2.aCS = new SdkConfigurationImpl(explode, nVar2);
            }
            n.this.CC().f(jSONObject);
            n.this.E(jSONObject);
            com.applovin.impl.sdk.utils.m.bj(((Boolean) n.this.a(com.applovin.impl.sdk.c.b.aQI)).booleanValue());
            com.applovin.impl.sdk.utils.m.bk(((Boolean) n.this.a(com.applovin.impl.sdk.c.b.aQJ)).booleanValue());
            if (n.this.Bo() || !n.this.Bp()) {
                n.this.cD("Initializing SDK in non-MAX environment...");
            } else if (n.this.Cj().zV() != d.a.UNIFIED) {
                n.this.cD("Initializing SDK in MAX environment...");
            } else {
                Activity CD = n.this.CD();
                if (!n.this.aCJ.compareAndSet(false, true)) {
                    n.this.cD("Initializing SDK in MAX environment...");
                } else {
                    n.this.Cj().zY();
                    n.this.Cj().a(CD, new c.a() {
                        public AnonymousClass1() {
                        }

                        @Override
                        public void onFlowCompleted(@Nullable com.applovin.impl.privacy.a.a aVar) {
                            n.this.cD("Initializing SDK in MAX environment...");
                        }
                    });
                }
            }
            if (((Boolean) n.this.a(com.applovin.impl.sdk.c.b.aNR)).booleanValue() && !z && com.applovin.impl.sdk.utils.i.Y(n.getApplicationContext())) {
                n.this.BL();
                if (x.Fk()) {
                    n.this.BL().g("AppLovinSdk", "SDK initialized with no internet connection - listening for connection");
                }
                n.this.Bu();
                return;
            }
            n.this.Bm();
        }
    }

    public class AnonymousClass3 implements l.a {
        public AnonymousClass3() {
        }

        @Override
        public void G(JSONObject jSONObject) {
            if (jSONObject != null && jSONObject.length() > 0) {
                n.this.D(jSONObject);
            }
            n.this.aAK.set(false);
            n.this.Bm();
        }
    }

    public class AnonymousClass4 implements d.a {
        final com.applovin.impl.sdk.network.d aCV;

        public AnonymousClass4(com.applovin.impl.sdk.network.d dVar) {
            r2 = dVar;
        }

        @Override
        public void CN() {
            n.this.BL();
            if (x.Fk()) {
                n.this.BL().g("AppLovinSdk", "Connected to internet - re-initializing SDK");
            }
            synchronized (n.this.aCH) {
                if (!n.this.aCK) {
                    n.this.Bk();
                }
            }
            r2.b(this);
        }

        @Override
        public void CO() {
        }
    }

    static {
        boolean z;
        try {
            AppLovinSdkUtils.runOnUiThread(new Runnable() {
                @Override
                public final void run() {
                    u.LE();
                }
            });
            z = true;
        } finally {
            z = false;
            try {
            } finally {
            }
        }
    }

    private Map<String, String> BH() {
        try {
            return JsonUtils.toStringMap(new JSONObject((String) a(com.applovin.impl.sdk.c.b.aOV)));
        } catch (JSONException unused) {
            return Collections.emptyMap();
        }
    }

    private boolean BR() {
        if (this.aBp == null) {
            this.aBp = (Boolean) a(com.applovin.impl.sdk.c.b.aOj);
        }
        return Boolean.TRUE.equals(this.aBp);
    }

    private void Bh() {
        this.aBs = new com.applovin.impl.sdk.c.e(this);
        this.aBd = new com.applovin.impl.sdk.c.c(this);
        this.logger = new x(this);
        this.aBC = new t(this);
        this.aBy = new d(this);
        this.aBA = new b(this);
        this.aAT = new EventServiceImpl(this);
        this.aAV = new UserServiceImpl(this);
        this.aBE = new com.applovin.impl.sdk.d.c(this);
        this.aBb = new com.applovin.impl.sdk.e.q(this);
        this.aBf = new com.applovin.impl.sdk.network.b(this);
        this.aBh = new com.applovin.impl.sdk.d.g(this);
        this.aCa = new com.applovin.impl.sdk.a.f(this);
        this.aBQ = new com.applovin.impl.sdk.utils.q(this);
        if (((Boolean) a(com.applovin.impl.sdk.c.b.aOj)).booleanValue()) {
            this.aBj = new q(this);
            this.aBn = new p(this);
        } else {
            this.aBl = new o(this);
        }
        if (com.applovin.impl.sdk.utils.h.Le()) {
            this.aBq = new aa(this);
        }
        this.age = new AppLovinAdServiceImpl(this);
        this.aAR = new AppLovinNativeAdService(this);
        this.aBG = new SessionTracker(this);
        this.aBI = new u(this);
        this.aBK = new ae(this);
        this.aCi = new PostbackServiceImpl(this);
        this.aCm = new f(this);
        this.aCo = new com.applovin.impl.mediation.f(this);
        this.aCq = new com.applovin.impl.mediation.e(this);
        this.aCs = new MediationServiceImpl(this);
        this.aCu = new com.applovin.impl.mediation.a.d(this);
        this.aCA = new y(this);
        this.aCy = new com.applovin.impl.mediation.debugger.b(this);
        this.aCw = new com.applovin.impl.mediation.h();
        this.aCC = new com.applovin.impl.mediation.d(this);
        this.aBu = new m(this);
        this.aBS = new i(this);
        this.aCE = new com.applovin.impl.mediation.debugger.ui.testmode.c(this);
        this.aBU = new com.applovin.impl.privacy.a.c(this);
        this.aBW = new com.applovin.impl.privacy.b.b(this);
        this.aBY = new com.applovin.impl.a.a.a(this);
        this.aCc = new w(this);
        this.aCe = new ArrayService(this);
        this.aCg = new r(this);
        this.aCk = new com.applovin.impl.sdk.network.f(this);
        this.aBO = new k(this);
        this.aBw = new com.applovin.impl.sdk.utils.t(this);
    }

    public void Bi() {
        Context context = hr;
        x BL = BL();
        com.applovin.impl.sdk.c.e BV = BV();
        com.applovin.impl.sdk.e.q BM = BM();
        com.applovin.impl.privacy.a.c Cj = Cj();
        E(context);
        Cc();
        Ct();
        Cp();
        Cv().a(MaxAdapter.InitializationStatus.INITIALIZING);
        if (this.aAM.isExceptionHandlerEnabled() && ((Boolean) a(com.applovin.impl.sdk.c.b.aKw)).booleanValue()) {
            AppLovinExceptionHandler.shared().addSdk(this);
            AppLovinExceptionHandler.shared().enable();
        }
        if (((Boolean) a(com.applovin.impl.sdk.c.b.aNR)).booleanValue()) {
            this.aBM = new com.applovin.impl.sdk.network.d(context);
        }
        if (TextUtils.isEmpty(this.aAF)) {
            x.H("AppLovinSdk", "Unable to find AppLovin SDK key. Please add  meta-data android:name=\"applovin.sdk.key\" android:value=\"YOUR_SDK_KEY_HERE\" into AndroidManifest.xml.");
            x.H("AppLovinSdk", "Called with an invalid SDK key from: " + Log.getStackTraceString(new Throwable("")));
        }
        if (this.aAF.length() != 86 && com.applovin.impl.sdk.utils.u.b(context, this)) {
            x.H("AppLovinSdk", "Please double-check that you entered your SDK key correctly (" + this.aAF + ") : " + Log.getStackTraceString(new Throwable("")));
        }
        if (com.applovin.impl.sdk.utils.u.LB()) {
            x.H("AppLovinSdk", "Failed to find class for name: com.applovin.sdk.AppLovinSdk. Please ensure proguard rules have not been omitted from the build.");
        }
        if (!com.applovin.impl.sdk.utils.u.O(this)) {
            x.H("AppLovinSdk", "Detected non-Android core JSON library. Please double-check that none of your third party libraries include custom implementation of org.json.JSONObject.");
        }
        if (com.applovin.impl.sdk.utils.u.ac(context)) {
            this.aAM.setVerboseLogging(true);
        }
        BN().a(com.applovin.impl.sdk.c.b.aKm, Boolean.valueOf(this.aAM.isVerboseLoggingEnabled()));
        SharedPreferences defaultSharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
        com.applovin.impl.sdk.c.d<String> dVar = com.applovin.impl.sdk.c.d.aRc;
        if (TextUtils.isEmpty((String) BV.b((com.applovin.impl.sdk.c.d<com.applovin.impl.sdk.c.d<String>>) dVar, (com.applovin.impl.sdk.c.d<String>) null, defaultSharedPreferences))) {
            this.aCL = true;
            BV.a((com.applovin.impl.sdk.c.d<com.applovin.impl.sdk.c.d<String>>) dVar, (com.applovin.impl.sdk.c.d<String>) Boolean.toString(true), defaultSharedPreferences);
        } else {
            BV.a((com.applovin.impl.sdk.c.d<com.applovin.impl.sdk.c.d<String>>) dVar, (com.applovin.impl.sdk.c.d<String>) Boolean.toString(false), defaultSharedPreferences);
        }
        com.applovin.impl.sdk.c.d<Boolean> dVar2 = com.applovin.impl.sdk.c.d.aRd;
        if (((Boolean) BV.b(dVar2, Boolean.FALSE)).booleanValue()) {
            if (x.Fk()) {
                BL.f("AppLovinSdk", "Initializing SDK for non-maiden launch");
            }
            this.aCM = true;
        } else {
            if (x.Fk()) {
                BL.f("AppLovinSdk", "Initializing SDK for maiden launch");
            }
            BV.a(dVar2, Boolean.TRUE);
            BV.a(com.applovin.impl.sdk.c.d.aRo, Boolean.valueOf(Cj.isEnabled()));
        }
        com.applovin.impl.sdk.c.d<String> dVar3 = com.applovin.impl.sdk.c.d.aRe;
        String str = (String) BV.b(dVar3, null);
        if (StringUtils.isValidString(str)) {
            if (AppLovinSdk.VERSION_CODE > com.applovin.impl.sdk.utils.u.dK(str)) {
                BV.a(dVar3, AppLovinSdk.VERSION);
            }
        } else {
            BV.a(dVar3, AppLovinSdk.VERSION);
        }
        boolean Y = com.applovin.impl.sdk.utils.i.Y(getApplicationContext());
        int parseInt = StringUtils.parseInt(this.aAM.getExtraParameters().get(AppLovinSdkExtraParameterKey.INITIALIZATION_DELAY_MILLIS), ((Integer) a(com.applovin.impl.sdk.c.b.aOU)).intValue());
        com.applovin.impl.sdk.e.ab abVar = new com.applovin.impl.sdk.e.ab(this, true, "scheduleAdLoadIntegrationError", new ztStKHStz(this, 13));
        q.b bVar = q.b.MAIN;
        long j = parseInt;
        BM.a(abVar, bVar, j);
        BM.a(new com.applovin.impl.sdk.e.ab(this, true, "sdkInit", new KKSKtzzSt(0, this, BL, Cj, Y)), bVar, j);
    }

    private void Bl() {
        com.applovin.impl.sdk.e.q BM = BM();
        int i = this.aCO + 1;
        this.aCO = i;
        BM.a(new com.applovin.impl.sdk.e.l(i, this, new l.a() {

            public class AnonymousClass1 implements c.a {
                public AnonymousClass1() {
                }

                @Override
                public void onFlowCompleted(@Nullable com.applovin.impl.privacy.a.a aVar) {
                    n.this.cD("Initializing SDK in MAX environment...");
                }
            }

            public AnonymousClass2() {
            }

            @Override
            public void G(JSONObject jSONObject) {
                boolean z;
                if (jSONObject != null && jSONObject.length() > 0) {
                    z = true;
                } else {
                    z = false;
                }
                n.this.D(jSONObject);
                g.o(n.this);
                com.applovin.impl.sdk.utils.i.a(jSONObject, z, n.this);
                n.this.Cz().h(JsonUtils.getBoolean(jSONObject, "smd", Boolean.FALSE).booleanValue(), JsonUtils.getInt(jSONObject, "smd_delay_sec", 2));
                n nVar = n.this;
                nVar.aCG = nVar.F(jSONObject);
                if (z) {
                    List<String> explode = CollectionUtils.explode(JsonUtils.getString(jSONObject, "eaaui", ""));
                    n nVar2 = n.this;
                    nVar2.aCS = new SdkConfigurationImpl(explode, nVar2);
                }
                n.this.CC().f(jSONObject);
                n.this.E(jSONObject);
                com.applovin.impl.sdk.utils.m.bj(((Boolean) n.this.a(com.applovin.impl.sdk.c.b.aQI)).booleanValue());
                com.applovin.impl.sdk.utils.m.bk(((Boolean) n.this.a(com.applovin.impl.sdk.c.b.aQJ)).booleanValue());
                if (n.this.Bo() || !n.this.Bp()) {
                    n.this.cD("Initializing SDK in non-MAX environment...");
                } else if (n.this.Cj().zV() != d.a.UNIFIED) {
                    n.this.cD("Initializing SDK in MAX environment...");
                } else {
                    Activity CD = n.this.CD();
                    if (!n.this.aCJ.compareAndSet(false, true)) {
                        n.this.cD("Initializing SDK in MAX environment...");
                    } else {
                        n.this.Cj().zY();
                        n.this.Cj().a(CD, new c.a() {
                            public AnonymousClass1() {
                            }

                            @Override
                            public void onFlowCompleted(@Nullable com.applovin.impl.privacy.a.a aVar) {
                                n.this.cD("Initializing SDK in MAX environment...");
                            }
                        });
                    }
                }
                if (((Boolean) n.this.a(com.applovin.impl.sdk.c.b.aNR)).booleanValue() && !z && com.applovin.impl.sdk.utils.i.Y(n.getApplicationContext())) {
                    n.this.BL();
                    if (x.Fk()) {
                        n.this.BL().g("AppLovinSdk", "SDK initialized with no internet connection - listening for connection");
                    }
                    n.this.Bu();
                    return;
                }
                n.this.Bm();
            }
        }), q.b.MAIN);
    }

    public void Bm() {
        Long l = (Long) a(com.applovin.impl.sdk.c.b.aOa);
        if (l.longValue() < 0 || !this.aAK.compareAndSet(false, true)) {
            return;
        }
        com.applovin.impl.sdk.utils.w.a(l.longValue(), false, this, new KzttK1tK1(1, this));
    }

    public void Bu() {
        com.applovin.impl.sdk.network.d G = G(hr);
        G.a(new d.a() {
            final com.applovin.impl.sdk.network.d aCV;

            public AnonymousClass4(com.applovin.impl.sdk.network.d G2) {
                r2 = G2;
            }

            @Override
            public void CN() {
                n.this.BL();
                if (x.Fk()) {
                    n.this.BL().g("AppLovinSdk", "Connected to internet - re-initializing SDK");
                }
                synchronized (n.this.aCH) {
                    if (!n.this.aCK) {
                        n.this.Bk();
                    }
                }
                r2.b(this);
            }

            @Override
            public void CO() {
            }
        });
    }

    public static long CE() {
        return aAB;
    }

    public static boolean CF() {
        return aAC;
    }

    public void CJ() {
        b(com.applovin.impl.sdk.c.d.aRI);
    }

    public void CK() {
        com.applovin.impl.sdk.e.q BM = BM();
        int i = this.aCO + 1;
        this.aCO = i;
        BM.a(new com.applovin.impl.sdk.e.l(i, this, new l.a() {
            public AnonymousClass3() {
            }

            @Override
            public void G(JSONObject jSONObject) {
                if (jSONObject != null && jSONObject.length() > 0) {
                    n.this.D(jSONObject);
                }
                n.this.aAK.set(false);
                n.this.Bm();
            }
        }), q.b.MAIN);
    }

    public void CL() {
        if (BM().isInitialized()) {
            return;
        }
        BL();
        if (x.Fk()) {
            BL().f("AppLovinSdk", "Timing out adapters init...");
        }
        BM().KK();
        Bt();
    }

    public void CM() {
        if (Bp() && !Bo()) {
            v.w(this);
        }
    }

    public void D(JSONObject jSONObject) {
        this.aAJ = System.currentTimeMillis();
        com.applovin.impl.sdk.utils.i.j(jSONObject, this);
        com.applovin.impl.sdk.utils.i.i(jSONObject, this);
        com.applovin.impl.sdk.utils.i.k(jSONObject, this);
        com.applovin.impl.mediation.e.b.d(jSONObject, this);
        com.applovin.impl.mediation.e.b.e(jSONObject, this);
        com.applovin.impl.mediation.e.b.f(jSONObject, this);
        com.applovin.impl.mediation.e.b.z(jSONObject);
    }

    public void E(JSONObject jSONObject) {
        Iterator it = JsonUtils.getList(jSONObject, "error_messages", Collections.emptyList()).iterator();
        while (it.hasNext()) {
            x.H("AppLovinSdk", (String) it.next());
        }
    }

    public List<MaxAdFormat> F(JSONObject jSONObject) {
        List asList = Arrays.asList(JsonUtils.getString(jSONObject, "eaf", "").split(","));
        ArrayList arrayList = new ArrayList(asList.size());
        Iterator it = asList.iterator();
        while (it.hasNext()) {
            MaxAdFormat formatFromString = MaxAdFormat.formatFromString((String) it.next());
            if (formatFromString != null) {
                arrayList.add(formatFromString);
            }
        }
        return arrayList;
    }

    public void cD(String str) {
        BL();
        if (x.Fk()) {
            BL().f("AppLovinSdk", str);
        }
        BM().b(new com.applovin.impl.sdk.e.p(this));
    }

    public void cF(String str) {
        BX().cE(str);
    }

    public void cG(String str) {
        BN().a(com.applovin.impl.sdk.c.b.aOy, str);
    }

    public static String cl(String str) {
        return b(str, (List<String>) null);
    }

    public static Context getApplicationContext() {
        return hr;
    }

    public static String gy(@StringRes int i) {
        return c(i, (List<String>) null);
    }

    public AppLovinTargetingDataImpl BA() {
        return (AppLovinTargetingDataImpl) this.aAO;
    }

    public AppLovinAdServiceImpl BB() {
        if (this.age == null) {
            synchronized (this.aAQ) {
                if (this.age == null) {
                    this.age = new AppLovinAdServiceImpl(this);
                }
            }
        }
        return this.age;
    }

    public AppLovinNativeAdService BC() {
        if (this.aAR == null) {
            synchronized (this.aAS) {
                if (this.aAR == null) {
                    this.aAR = new AppLovinNativeAdService(this);
                }
            }
        }
        return this.aAR;
    }

    public EventServiceImpl BD() {
        if (this.aAT == null) {
            synchronized (this.aAU) {
                if (this.aAT == null) {
                    this.aAT = new EventServiceImpl(this);
                }
            }
        }
        return this.aAT;
    }

    public UserServiceImpl BE() {
        if (this.aAV == null) {
            synchronized (this.aAW) {
                if (this.aAV == null) {
                    this.aAV = new UserServiceImpl(this);
                }
            }
        }
        return this.aAV;
    }

    public void BF() {
        if (!StringUtils.isValidString(this.aCP)) {
            this.aCP = AppLovinMediationProvider.MAX;
            BL();
            if (x.Fk()) {
                BL().f("AppLovinSdk", "Detected mediation provider: MAX");
            }
        }
    }

    @Nullable
    public String BG() {
        boolean z;
        if (StringUtils.isValidString(this.aCP)) {
            return null;
        }
        ArrayList arrayList = new ArrayList();
        Map<String, String> BH = BH();
        List<String> b = b(com.applovin.impl.sdk.c.b.aOX);
        Boolean bool = (Boolean) a(com.applovin.impl.sdk.c.b.aOY);
        if (BH.isEmpty() && !bool.booleanValue()) {
            return null;
        }
        try {
            StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace();
            Integer num = (Integer) a(com.applovin.impl.sdk.c.b.aOW);
            for (StackTraceElement stackTraceElement : stackTrace) {
                if (num.intValue() <= 0) {
                    break;
                }
                String className = stackTraceElement.getClassName();
                Iterator<String> it = b.iterator();
                while (true) {
                    if (it.hasNext()) {
                        if (className.startsWith(it.next())) {
                            z = true;
                            break;
                        }
                    } else {
                        z = false;
                        break;
                    }
                }
                if (!z) {
                    for (Map.Entry<String, String> entry : BH.entrySet()) {
                        if (className.startsWith(entry.getKey())) {
                            this.aCP = entry.getValue();
                            BL();
                            if (x.Fk()) {
                                BL().f("AppLovinSdk", "Detected mediation provider: " + this.aCP);
                            }
                            return null;
                        }
                    }
                    if (bool.booleanValue()) {
                        arrayList.add(className);
                    }
                    num = Integer.valueOf(num.intValue() - 1);
                }
            }
        } catch (Throwable th) {
            Cq().d("AppLovinSdk", "detectMediationProvider", th);
        }
        this.aCP = "unknown";
        BL();
        if (x.Fk()) {
            BL().h("AppLovinSdk", "Unable to detect mediation provider");
        }
        if (arrayList.isEmpty()) {
            return null;
        }
        return StringUtils.join(",", arrayList);
    }

    public Activity BI() {
        WeakReference<Activity> weakReference = this.aAG;
        if (weakReference != null) {
            return weakReference.get();
        }
        return null;
    }

    public boolean BJ() {
        return this.aCM;
    }

    public a BK() {
        return E(hr);
    }

    public x BL() {
        if (this.logger == null) {
            synchronized (this.aBa) {
                if (this.logger == null) {
                    this.logger = new x(this);
                }
            }
        }
        return this.logger;
    }

    public com.applovin.impl.sdk.e.q BM() {
        if (this.aBb == null) {
            synchronized (this.aBc) {
                if (this.aBb == null) {
                    this.aBb = new com.applovin.impl.sdk.e.q(this);
                }
            }
        }
        return this.aBb;
    }

    public com.applovin.impl.sdk.c.c BN() {
        if (this.aBd == null) {
            synchronized (this.aBe) {
                if (this.aBd == null) {
                    this.aBd = new com.applovin.impl.sdk.c.c(this);
                }
            }
        }
        return this.aBd;
    }

    public com.applovin.impl.sdk.network.b BO() {
        if (this.aBf == null) {
            synchronized (this.aBg) {
                if (this.aBf == null) {
                    this.aBf = new com.applovin.impl.sdk.network.b(this);
                }
            }
        }
        return this.aBf;
    }

    public com.applovin.impl.sdk.d.g BP() {
        if (this.aBh == null) {
            synchronized (this.aBi) {
                if (this.aBh == null) {
                    this.aBh = new com.applovin.impl.sdk.d.g(this);
                }
            }
        }
        return this.aBh;
    }

    public o BQ() {
        if (this.aBl == null) {
            synchronized (this.aBm) {
                if (this.aBl == null) {
                    this.aBl = new o(this);
                }
            }
        }
        return this.aBl;
    }

    @Nullable
    public q BS() {
        if (BR() && this.aBj == null) {
            synchronized (this.aBk) {
                if (this.aBj == null) {
                    this.aBj = new q(this);
                }
            }
        }
        return this.aBj;
    }

    @Nullable
    public p BT() {
        if (BR() && this.aBn == null) {
            synchronized (this.aBo) {
                if (this.aBn == null) {
                    this.aBn = new p(this);
                }
            }
        }
        return this.aBn;
    }

    @Nullable
    public aa BU() {
        if (this.aBq == null && com.applovin.impl.sdk.utils.h.Le()) {
            synchronized (this.aBr) {
                if (this.aBq == null) {
                    this.aBq = new aa(this);
                }
            }
        }
        return this.aBq;
    }

    public com.applovin.impl.sdk.c.e BV() {
        if (this.aBs == null) {
            synchronized (this.aBt) {
                if (this.aBs == null) {
                    this.aBs = new com.applovin.impl.sdk.c.e(this);
                }
            }
        }
        return this.aBs;
    }

    public m BW() {
        if (this.aBu == null) {
            synchronized (this.aBv) {
                if (this.aBu == null) {
                    this.aBu = new m(this);
                }
            }
        }
        return this.aBu;
    }

    public com.applovin.impl.sdk.utils.t BX() {
        if (this.aBw == null) {
            synchronized (this.aBx) {
                if (this.aBw == null) {
                    this.aBw = new com.applovin.impl.sdk.utils.t(this);
                }
            }
        }
        return this.aBw;
    }

    public d BY() {
        if (this.aBy == null) {
            synchronized (this.aBz) {
                if (this.aBy == null) {
                    this.aBy = new d(this);
                }
            }
        }
        return this.aBy;
    }

    public b BZ() {
        if (this.aBA == null) {
            synchronized (this.aBB) {
                if (this.aBA == null) {
                    this.aBA = new b(this);
                }
            }
        }
        return this.aBA;
    }

    public void Bj() {
        synchronized (this.aCH) {
            if (!this.aCK && !this.iV) {
                Bk();
            }
        }
    }

    public void Bk() {
        synchronized (this.aCH) {
            this.aCK = true;
            BM().KJ();
            Bl();
        }
    }

    public boolean Bn() {
        boolean z;
        synchronized (this.aCH) {
            z = this.aCK;
        }
        return z;
    }

    public boolean Bo() {
        return this.aAI;
    }

    public boolean Bp() {
        return StringUtils.containsIgnoreCase(getMediationProvider(), AppLovinMediationProvider.MAX);
    }

    public boolean Bq() {
        return com.applovin.impl.sdk.utils.u.dI("com.unity3d.player.UnityPlayerActivity");
    }

    public void Br() {
        String str = (String) BV().b(com.applovin.impl.sdk.c.d.aRe, null);
        if (StringUtils.isValidString(str)) {
            if (AppLovinSdk.VERSION_CODE < com.applovin.impl.sdk.utils.u.dK(str)) {
                x.H("AppLovinSdk", "Current version (" + AppLovinSdk.VERSION + ") is older than earlier installed version (" + str + "), which may cause compatibility issues.");
            }
        }
    }

    public void Bs() {
        Cf().Bb();
    }

    public void Bt() {
        AppLovinSdk.SdkInitializationListener sdkInitializationListener;
        if ((!Cj().zW() || Cj().zV() != d.a.UNIFIED) && (sdkInitializationListener = this.aCQ) != null) {
            if (isEnabled()) {
                this.aCQ = null;
                this.aCR = null;
                Cv().a(MaxAdapter.InitializationStatus.INITIALIZED_SUCCESS);
            } else {
                if (this.aCR == sdkInitializationListener) {
                    return;
                }
                Cv().a(MaxAdapter.InitializationStatus.INITIALIZED_FAILURE);
                if (((Boolean) a(com.applovin.impl.sdk.c.b.aKs)).booleanValue()) {
                    this.aCQ = null;
                } else {
                    this.aCR = sdkInitializationListener;
                }
            }
            AppLovinSdkUtils.runOnUiThreadDelayed(new tStKzHtHt(5, this, sdkInitializationListener), Math.max(0L, ((Long) a(com.applovin.impl.sdk.c.b.aKt)).longValue()));
        }
    }

    public void Bv() {
        x.H("AppLovinSdk", "Resetting SDK state...");
        com.applovin.impl.sdk.d.g BP = BP();
        com.applovin.impl.sdk.d.f fVar = com.applovin.impl.sdk.d.f.aSV;
        long b = BP.b(fVar);
        BN().JF();
        BN().JD();
        BP().JU();
        BP().b(fVar, b + 1);
        if (this.aCI.compareAndSet(true, false)) {
            Bk();
        } else {
            this.aCI.set(true);
        }
    }

    public long Bw() {
        if (this.aAJ == 0) {
            return -1L;
        }
        return System.currentTimeMillis() - this.aAJ;
    }

    public String Bx() {
        return BX().Bx();
    }

    public String By() {
        return BX().By();
    }

    public String Bz() {
        return BX().Lt();
    }

    public y CA() {
        if (this.aCA == null) {
            synchronized (this.aCB) {
                if (this.aCA == null) {
                    this.aCA = new y(this);
                }
            }
        }
        return this.aCA;
    }

    public com.applovin.impl.mediation.d CB() {
        if (this.aCC == null) {
            synchronized (this.aCD) {
                if (this.aCC == null) {
                    this.aCC = new com.applovin.impl.mediation.d(this);
                }
            }
        }
        return this.aCC;
    }

    public com.applovin.impl.mediation.debugger.ui.testmode.c CC() {
        if (this.aCE == null) {
            synchronized (this.aCF) {
                if (this.aCE == null) {
                    this.aCE = new com.applovin.impl.mediation.debugger.ui.testmode.c(this);
                }
            }
        }
        return this.aCE;
    }

    public Activity CD() {
        Activity Ax = E(getApplicationContext()).Ax();
        if (Ax != null) {
            return Ax;
        }
        return BI();
    }

    public long CG() {
        return this.aAH;
    }

    public boolean CH() {
        return this.aCL;
    }

    @Nullable
    public String CI() {
        return this.aCP;
    }

    public t Ca() {
        if (this.aBC == null) {
            synchronized (this.aBD) {
                if (this.aBC == null) {
                    this.aBC = new t(this);
                }
            }
        }
        return this.aBC;
    }

    public com.applovin.impl.sdk.d.c Cb() {
        if (this.aBE == null) {
            synchronized (this.aBF) {
                if (this.aBE == null) {
                    this.aBE = new com.applovin.impl.sdk.d.c(this);
                }
            }
        }
        return this.aBE;
    }

    public SessionTracker Cc() {
        if (this.aBG == null) {
            synchronized (this.aBH) {
                if (this.aBG == null) {
                    this.aBG = new SessionTracker(this);
                }
            }
        }
        return this.aBG;
    }

    public u Cd() {
        if (this.aBI == null) {
            synchronized (this.aBJ) {
                if (this.aBI == null) {
                    this.aBI = new u(this);
                }
            }
        }
        return this.aBI;
    }

    public ae Ce() {
        if (this.aBK == null) {
            synchronized (this.aBL) {
                if (this.aBK == null) {
                    this.aBK = new ae(this);
                }
            }
        }
        return this.aBK;
    }

    public k Cf() {
        if (this.aBO == null) {
            synchronized (this.aBP) {
                if (this.aBO == null) {
                    this.aBO = new k(this);
                }
            }
        }
        return this.aBO;
    }

    public com.applovin.impl.sdk.utils.q Cg() {
        if (this.aBQ == null) {
            synchronized (this.aBR) {
                if (this.aBQ == null) {
                    this.aBQ = new com.applovin.impl.sdk.utils.q(this);
                }
            }
        }
        return this.aBQ;
    }

    public i Ch() {
        if (this.aBS == null) {
            synchronized (this.aBT) {
                if (this.aBS == null) {
                    this.aBS = new i(this);
                }
            }
        }
        return this.aBS;
    }

    public AppLovinSdkSettings.TermsAndPrivacyPolicyFlowSettings Ci() {
        return getSettings().getBackingConsentFlowSettings();
    }

    public com.applovin.impl.privacy.a.c Cj() {
        if (this.aBU == null) {
            synchronized (this.aBV) {
                if (this.aBU == null) {
                    this.aBU = new com.applovin.impl.privacy.a.c(this);
                }
            }
        }
        return this.aBU;
    }

    public com.applovin.impl.privacy.b.b Ck() {
        if (this.aBW == null) {
            synchronized (this.aBX) {
                if (this.aBW == null) {
                    this.aBW = new com.applovin.impl.privacy.b.b(this);
                }
            }
        }
        return this.aBW;
    }

    public CmpServiceImpl Cl() {
        if (this.aAX == null) {
            synchronized (this.aAY) {
                if (this.aAX == null) {
                    this.aAX = new CmpServiceImpl(this);
                }
            }
        }
        return this.aAX;
    }

    public com.applovin.impl.a.a.a Cm() {
        if (this.aBY == null) {
            synchronized (this.aBZ) {
                if (this.aBY == null) {
                    this.aBY = new com.applovin.impl.a.a.a(this);
                }
            }
        }
        return this.aBY;
    }

    public com.applovin.impl.sdk.a.f Cn() {
        if (this.aCa == null) {
            synchronized (this.aCb) {
                if (this.aCa == null) {
                    this.aCa = new com.applovin.impl.sdk.a.f(this);
                }
            }
        }
        return this.aCa;
    }

    public w Co() {
        if (this.aCc == null) {
            synchronized (this.aCd) {
                if (this.aCc == null) {
                    this.aCc = new w(this);
                }
            }
        }
        return this.aCc;
    }

    public ArrayService Cp() {
        if (this.aCe == null) {
            synchronized (this.aCf) {
                if (this.aCe == null) {
                    this.aCe = new ArrayService(this);
                }
            }
        }
        return this.aCe;
    }

    public r Cq() {
        if (this.aCg == null) {
            synchronized (this.aCh) {
                if (this.aCg == null) {
                    this.aCg = new r(this);
                }
            }
        }
        return this.aCg;
    }

    public PostbackServiceImpl Cr() {
        if (this.aCi == null) {
            synchronized (this.aCj) {
                if (this.aCi == null) {
                    this.aCi = new PostbackServiceImpl(this);
                }
            }
        }
        return this.aCi;
    }

    public com.applovin.impl.sdk.network.f Cs() {
        if (this.aCk == null) {
            synchronized (this.aCl) {
                if (this.aCk == null) {
                    this.aCk = new com.applovin.impl.sdk.network.f(this);
                }
            }
        }
        return this.aCk;
    }

    public f Ct() {
        if (this.aCm == null) {
            synchronized (this.aCn) {
                if (this.aCm == null) {
                    this.aCm = new f(this);
                }
            }
        }
        return this.aCm;
    }

    public com.applovin.impl.mediation.f Cu() {
        if (this.aCo == null) {
            synchronized (this.aCp) {
                if (this.aCo == null) {
                    this.aCo = new com.applovin.impl.mediation.f(this);
                }
            }
        }
        return this.aCo;
    }

    public com.applovin.impl.mediation.e Cv() {
        if (this.aCq == null) {
            synchronized (this.aCr) {
                if (this.aCq == null) {
                    this.aCq = new com.applovin.impl.mediation.e(this);
                }
            }
        }
        return this.aCq;
    }

    public MediationServiceImpl Cw() {
        if (this.aCs == null) {
            synchronized (this.aCt) {
                if (this.aCs == null) {
                    this.aCs = new MediationServiceImpl(this);
                }
            }
        }
        return this.aCs;
    }

    public com.applovin.impl.mediation.a.d Cx() {
        if (this.aCu == null) {
            synchronized (this.aCv) {
                if (this.aCu == null) {
                    this.aCu = new com.applovin.impl.mediation.a.d(this);
                }
            }
        }
        return this.aCu;
    }

    public com.applovin.impl.mediation.h Cy() {
        if (this.aCw == null) {
            synchronized (this.aCx) {
                if (this.aCw == null) {
                    this.aCw = new com.applovin.impl.mediation.h();
                }
            }
        }
        return this.aCw;
    }

    public com.applovin.impl.mediation.debugger.b Cz() {
        if (this.aCy == null) {
            synchronized (this.aCz) {
                if (this.aCy == null) {
                    this.aCy = new com.applovin.impl.mediation.debugger.b(this);
                }
            }
        }
        return this.aCy;
    }

    public com.applovin.impl.sdk.network.d G(Context context) {
        if (this.aBM == null) {
            synchronized (this.aBN) {
                if (this.aBM == null) {
                    this.aBM = new com.applovin.impl.sdk.network.d(context);
                }
            }
        }
        return this.aBM;
    }

    public void aK(boolean z) {
        synchronized (this.aCH) {
            this.aCK = false;
            this.iV = z;
        }
        if (!z) {
            return;
        }
        List<String> b = b(com.applovin.impl.sdk.c.a.aJa);
        if (b.isEmpty()) {
            BM().KK();
            Bt();
            return;
        }
        Long l = (Long) a(com.applovin.impl.sdk.c.a.aJb);
        com.applovin.impl.sdk.e.ab abVar = new com.applovin.impl.sdk.e.ab(this, true, "timeoutInitAdapters", new tHzK1K(1, this));
        BL();
        if (x.Fk()) {
            BL().f("AppLovinSdk", "Waiting for required adapters to init: " + b + " - timing out in " + l + "ms...");
        }
        BM().a(abVar, q.b.MEDIATION_TIMEOUT, l.longValue(), true);
    }

    public void bN(long j) {
        BW().bL(j);
    }

    public void cE(String str) {
        BL();
        if (x.Fk()) {
            ttSHtSH.HKS("Setting user id: ", str, BL(), "AppLovinSdk");
        }
        if (StringUtils.isValidString(str) && str.length() > com.applovin.impl.sdk.utils.u.gV(8)) {
            x.H("AppLovinSdk", "Provided user id longer than supported (" + str.length() + " bytes, " + com.applovin.impl.sdk.utils.u.gV(8) + " maximum)");
        }
        if (com.applovin.impl.sdk.utils.u.Lv() && this.aAL) {
            com.applovin.impl.sdk.utils.u.k(new tHKKKKKt(7, this, str));
        } else {
            BX().cE(str);
        }
    }

    public void e(com.applovin.impl.mediation.b.f fVar) {
        if (BM().isInitialized()) {
            return;
        }
        List<String> b = b(com.applovin.impl.sdk.c.a.aJa);
        if (b.size() > 0 && Cv().tV().keySet().containsAll(b)) {
            BL();
            if (x.Fk()) {
                BL().f("AppLovinSdk", "All required adapters initialized");
            }
            BM().KK();
            Bt();
        }
    }

    public boolean g(MaxAdFormat maxAdFormat) {
        List<MaxAdFormat> list = this.aCG;
        return (list == null || list.size() <= 0 || this.aCG.contains(maxAdFormat)) ? false : true;
    }

    public AppLovinSdkConfiguration getConfiguration() {
        return this.aCS;
    }

    public String getMediationProvider() {
        String str = (String) a(com.applovin.impl.sdk.c.d.aRI);
        if (StringUtils.isValidString(str)) {
            return str;
        }
        return this.aAP;
    }

    public String getSdkKey() {
        return this.aAF;
    }

    public AppLovinSdkSettings getSettings() {
        return this.aAM;
    }

    public AppLovinUserSegment getUserSegment() {
        return this.aAN;
    }

    public AppLovinSdk getWrappingSdk() {
        return this.aAZ;
    }

    public void initializeSdk(AppLovinSdk.SdkInitializationListener sdkInitializationListener) {
        if (isEnabled()) {
            if (sdkInitializationListener != null) {
                AppLovinSdkUtils.runOnUiThread(new zS1HS(1, this, sdkInitializationListener));
                return;
            }
            return;
        }
        this.aCQ = sdkInitializationListener;
    }

    public boolean isEnabled() {
        boolean z;
        synchronized (this.aCH) {
            z = this.iV;
        }
        return z;
    }

    public void setMediationProvider(String str) {
        BL();
        if (x.Fk()) {
            Sz.Ht("setMediationProvider(mediationProvider=", str, ")", BL(), "AppLovinSdk");
        }
        if (str != null && (str.isEmpty() || str.length() > 64 || !StringUtils.isAlphaNumeric(str))) {
            x.H("AppLovinSdk", "Mediation provider set to invalid value: " + str + ". Please use a valid mediation provider (e.g., AppLovinMediationProvider.MAX)");
            return;
        }
        this.aAP = str;
        if (com.applovin.impl.sdk.utils.u.Lv() && this.aAL) {
            com.applovin.impl.sdk.utils.u.k(new HKztS1S(this, 10));
        } else {
            b(com.applovin.impl.sdk.c.d.aRI);
        }
    }

    public void setPluginVersion(String str) {
        x.D("AppLovinSdk", "Setting plugin version: " + str);
        if (com.applovin.impl.sdk.utils.u.Lv() && this.aAL) {
            com.applovin.impl.sdk.utils.u.k(new KSS1StH(4, this, str));
        } else {
            BN().a(com.applovin.impl.sdk.c.b.aOy, str);
        }
    }

    public void showCreativeDebugger() {
        Cm().showCreativeDebugger();
    }

    public void showMediationDebugger() {
        showMediationDebugger(null);
    }

    @NonNull
    public String toString() {
        StringBuilder sb = new StringBuilder("CoreSdk{sdkKey='");
        sb.append(this.aAF);
        sb.append("', enabled=");
        sb.append(this.iV);
        sb.append(", isFirstSession=");
        return tStt1z.HtSH(sb, this.aCL, AbstractJsonLexerKt.END_OBJ);
    }

    public void b(AppLovinSdk.SdkInitializationListener sdkInitializationListener) {
        sdkInitializationListener.onSdkInitialized(this.aCS);
    }

    public List<MaxAdFormat> c(com.applovin.impl.sdk.c.b<String> bVar) {
        return BN().c(bVar);
    }

    public void showMediationDebugger(@Nullable Map<String, List<?>> map) {
        Cz().showMediationDebugger(map);
    }

    public static String c(@StringRes int i, List<String> list) {
        String string = getApplicationContext().getResources().getString(i);
        return list != null ? String.format(string, list.toArray()) : string;
    }

    public List<String> b(com.applovin.impl.sdk.c.b<String> bVar) {
        return BN().b(bVar);
    }

    public static a E(Context context) {
        if (aAD == null) {
            synchronized (aAE) {
                if (aAD == null) {
                    aAD = new a(context);
                }
            }
        }
        return aAD;
    }

    public <T> T b(com.applovin.impl.sdk.c.d<T> dVar, @Nullable T t) {
        return (T) BV().b(dVar, t);
    }

    public void a(AppLovinSdk appLovinSdk) {
        this.aAZ = appLovinSdk;
    }

    public <T> T b(com.applovin.impl.sdk.c.d<T> dVar, @Nullable T t, SharedPreferences sharedPreferences) {
        return (T) BV().b((com.applovin.impl.sdk.c.d<com.applovin.impl.sdk.c.d<T>>) dVar, (com.applovin.impl.sdk.c.d<T>) t, sharedPreferences);
    }

    public static void F(Context context) {
        if (context == null) {
            return;
        }
        hr = context.getApplicationContext();
    }

    public void a(String str, AppLovinSdkSettings appLovinSdkSettings, Context context) {
        this.aAF = str;
        this.aAH = System.currentTimeMillis();
        this.aCK = true;
        this.aAM = appLovinSdkSettings;
        this.aAN = new h();
        this.aAO = new AppLovinTargetingDataImpl();
        this.aCS = new SdkConfigurationImpl(null, this);
        hr = context.getApplicationContext();
        if (CF()) {
            if (context instanceof Activity) {
                this.aAG = new WeakReference<>((Activity) context);
            }
            if ("HSrCHRtOan6wp2kwOIGJC1RDtuSrF2mWVbio2aBcMHX9KF3iTJ1lLSzCKP1ZSo5yNolPNw1kCTtWpxELFF4ah1".equalsIgnoreCase(str)) {
                this.aAI = true;
                aAA = this;
            } else if (aAz == null) {
                aAz = this;
            } else {
                x.H("AppLovinSdk", "Multiple SDK instances detected");
            }
            StrictMode.ThreadPolicy allowThreadDiskReads = StrictMode.allowThreadDiskReads();
            boolean z = context.getSharedPreferences("com.applovin.sdk.1", 0).getBoolean("com.applovin.sdk." + com.applovin.impl.sdk.utils.u.dH(str) + ".lisvib", false);
            this.aAL = z;
            if (!z) {
                Bh();
                Bi();
            } else {
                com.applovin.impl.sdk.utils.u.k(new K1Hz1(this, 5));
            }
            StrictMode.setThreadPolicy(allowThreadDiskReads);
            return;
        }
        throw new RuntimeException("As of version 12.0.0, the AppLovin MAX SDK requires Java 8. For more information visit our docs: https://dash.applovin.com/documentation/mediation/android/getting-started/integration");
    }

    public <T> void b(com.applovin.impl.sdk.c.d<T> dVar) {
        BV().b(dVar);
    }

    public static String b(String str, List<String> list) {
        if (TextUtils.isEmpty(str)) {
            return "";
        }
        Context applicationContext = getApplicationContext();
        return c(applicationContext.getResources().getIdentifier(str, com.anythink.expressad.foundation.h.k.g, applicationContext.getPackageName()), list);
    }

    public void a(boolean z, x xVar, com.applovin.impl.privacy.a.c cVar) {
        synchronized (this.aCH) {
            if (!((Boolean) a(com.applovin.impl.sdk.c.b.aNS)).booleanValue() || z) {
                Bk();
            }
            if (((Boolean) a(com.applovin.impl.sdk.c.b.aNR)).booleanValue() && !z) {
                if (x.Fk()) {
                    xVar.g("AppLovinSdk", "SDK initialized with no internet connection - listening for connection");
                }
                Bu();
            }
            if (cVar.zV() == d.a.TERMS) {
                if (Bp()) {
                    if (x.Fk()) {
                        xVar.f("AppLovinSdk", "MAX mediation detected... Generating consent flow...");
                    }
                    cVar.zY();
                    cVar.a(CD(), new c.a() {
                        public AnonymousClass1() {
                        }

                        @Override
                        public void onFlowCompleted(@Nullable com.applovin.impl.privacy.a.a aVar) {
                        }
                    });
                } else if (x.Fk()) {
                    xVar.f("AppLovinSdk", "non-MAX mediation detected, mediation provider is: " + this.aAP);
                }
            }
        }
    }

    public void a(AppLovinSdk.SdkInitializationListener sdkInitializationListener) {
        BL();
        if (x.Fk()) {
            BL().f("AppLovinSdk", "Calling back publisher's initialization completion handler...");
        }
        sdkInitializationListener.onSdkInitialized(this.aCS);
    }

    public <T> T a(com.applovin.impl.sdk.c.b<T> bVar) {
        return (T) BN().a(bVar);
    }

    public boolean a(com.applovin.impl.sdk.c.b<String> bVar, MaxAdFormat maxAdFormat) {
        return c(bVar).contains(maxAdFormat);
    }

    public <T> void a(com.applovin.impl.sdk.c.d<T> dVar, @Nullable T t) {
        BV().a(dVar, t);
    }

    public <T> void a(com.applovin.impl.sdk.c.d<T> dVar, @Nullable T t, SharedPreferences sharedPreferences) {
        BV().a((com.applovin.impl.sdk.c.d<com.applovin.impl.sdk.c.d<T>>) dVar, (com.applovin.impl.sdk.c.d<T>) t, sharedPreferences);
    }

    public <T> void a(String str, @Nullable T t, SharedPreferences.Editor editor) {
        BV().a(str, (String) t, editor);
    }

    public <T> T a(com.applovin.impl.sdk.c.d<T> dVar) {
        return (T) b((com.applovin.impl.sdk.c.d<com.applovin.impl.sdk.c.d<T>>) dVar, (com.applovin.impl.sdk.c.d<T>) null);
    }

    public <T> T a(String str, @Nullable T t, Class<?> cls, SharedPreferences sharedPreferences) {
        return (T) com.applovin.impl.sdk.c.e.a(str, t, cls, sharedPreferences);
    }

    public void a(SharedPreferences sharedPreferences) {
        BV().a(sharedPreferences);
    }
}