package com.applovin.impl.sdk; import android.app.Activity; import android.content.Context; import android.content.SharedPreferences; import android.preference.PreferenceManager; import android.text.TextUtils; import android.util.Log; import com.applovin.impl.af; import com.applovin.impl.bg; import com.applovin.impl.ca; import com.applovin.impl.d4; import com.applovin.impl.d5; import com.applovin.impl.da; import com.applovin.impl.dd; import com.applovin.impl.e4; import com.applovin.impl.gc; import com.applovin.impl.h4; import com.applovin.impl.hr; import com.applovin.impl.i4; import com.applovin.impl.jm; import com.applovin.impl.jn; import com.applovin.impl.la; import com.applovin.impl.ma; import com.applovin.impl.mediation.MaxSegmentCollectionImpl; import com.applovin.impl.mediation.MediationServiceImpl; import com.applovin.impl.oj; import com.applovin.impl.pb; import com.applovin.impl.pe; import com.applovin.impl.privacy.cmp.CmpServiceImpl; import com.applovin.impl.qe; import com.applovin.impl.qg; import com.applovin.impl.qn; import com.applovin.impl.qr; import com.applovin.impl.sdk.array.ArrayService; import com.applovin.impl.sdk.nativeAd.AppLovinNativeAdService; import com.applovin.impl.sdk.network.PostbackServiceImpl; 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.sj; import com.applovin.impl.sm; import com.applovin.impl.tj; import com.applovin.impl.tm; import com.applovin.impl.u0; import com.applovin.impl.ue; import com.applovin.impl.uj; import com.applovin.impl.v; import com.applovin.impl.ve; import com.applovin.impl.vj; import com.applovin.impl.wh; import com.applovin.impl.wn; import com.applovin.impl.wp; import com.applovin.impl.y4; import com.applovin.impl.ye; import com.applovin.impl.yl; import com.applovin.impl.yp; import com.applovin.impl.ze; import com.applovin.mediation.MaxAdFormat; import com.applovin.mediation.MaxSegmentCollection; import com.applovin.mediation.adapter.MaxAdapter; import com.applovin.sdk.AppLovinSdk; import com.applovin.sdk.AppLovinSdkConfiguration; import com.applovin.sdk.AppLovinSdkInitializationConfiguration; import com.applovin.sdk.AppLovinSdkSettings; import com.applovin.sdk.AppLovinSdkUtils; import com.applovin.sdk.AppLovinTermsAndPrivacyPolicyFlowSettings; 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 java.util.concurrent.atomic.AtomicReference; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; /* loaded from: classes2.dex */ public class j { public static j v0; protected static Context w0; private static final boolean y0; private static volatile com.applovin.impl.q z0; private String a; private WeakReference b; private long d; private List d0; private AppLovinSdkSettings f; private MaxSegmentCollection g; private String h; private boolean h0; private String m0; private volatile AppLovinSdk n; private AppLovinSdkInitializationConfiguration n0; private AppLovinSdk.SdkInitializationListener q0; private AppLovinSdk.SdkInitializationListener r0; private static final Object A0 = new Object(); private static final long x0 = System.currentTimeMillis(); private final AtomicBoolean e = new AtomicBoolean(); private final AtomicReference i = new AtomicReference(); private final AtomicReference j = new AtomicReference(); private final AtomicReference k = new AtomicReference(); private final AtomicReference l = new AtomicReference(); private final AtomicReference m = new AtomicReference(); private final n o = new n(this); private final ma p = new ma(this); private final AtomicReference q = new AtomicReference(); private final AtomicReference r = new AtomicReference(); private final AtomicReference s = new AtomicReference(); private final AtomicReference t = new AtomicReference(); private final AtomicReference u = new AtomicReference(); private final AtomicReference v = new AtomicReference(); private final AtomicReference w = new AtomicReference(); private final AtomicReference x = new AtomicReference(); private final AtomicReference y = new AtomicReference(); private final AtomicReference z = new AtomicReference(); private final AtomicReference A = new AtomicReference(); private final AtomicReference B = new AtomicReference(); private final AtomicReference C = new AtomicReference(); private final AtomicReference D = new AtomicReference(); private final AtomicReference E = new AtomicReference(); private final AtomicReference F = new AtomicReference(); private final AtomicReference G = new AtomicReference(); private final AtomicReference H = new AtomicReference(); private final AtomicReference I = new AtomicReference(); private final AtomicReference J = new AtomicReference(); private final AtomicReference K = new AtomicReference(); private final AtomicReference L = new AtomicReference(); private final AtomicReference M = new AtomicReference(); private final AtomicReference N = new AtomicReference(); private final AtomicReference O = new AtomicReference(); private final AtomicReference P = new AtomicReference(); private final AtomicReference Q = new AtomicReference(); private final AtomicReference R = new AtomicReference(); private final AtomicReference S = new AtomicReference(); private final AtomicReference T = new AtomicReference(); private final AtomicReference U = new AtomicReference(); private final AtomicReference V = new AtomicReference(); private final AtomicReference W = new AtomicReference(); private final AtomicReference X = new AtomicReference(); private final AtomicReference Y = new AtomicReference(); private final AtomicReference Z = new AtomicReference(); private final AtomicReference a0 = new AtomicReference(); private final AtomicReference b0 = new AtomicReference(); private final AtomicReference c0 = new AtomicReference(); private final Object e0 = new Object(); private final AtomicBoolean f0 = new AtomicBoolean(true); private final AtomicBoolean g0 = new AtomicBoolean(); private boolean i0 = false; private boolean j0 = false; private boolean k0 = false; private int l0 = 0; private final Object o0 = new Object(); private AppLovinSdkConfiguration p0 = new SdkConfigurationImpl(null, this); private final AtomicBoolean s0 = new AtomicBoolean(false); private final yl t0 = new jn(this, true, "scheduleAdLoadIntegrationError", new Runnable() { // from class: com.applovin.impl.sdk.j$$ExternalSyntheticLambda5 @Override // java.lang.Runnable public final void run() { j.this.E0(); } }); private final yl u0 = new jn(this, true, "sdkInit", new Runnable() { // from class: com.applovin.impl.sdk.j$$ExternalSyntheticLambda6 @Override // java.lang.Runnable public final void run() { j.this.F0(); } }); private final long c = System.currentTimeMillis(); public class a implements h4.c { public a() { } @Override // com.applovin.impl.h4.c public void a(h4.b bVar) { } } public class c implements jm.b { public c() { } @Override // com.applovin.impl.jm.b public void a(JSONObject jSONObject) { if (jSONObject != null && jSONObject.length() > 0) { j.this.c(jSONObject); } j.this.e.set(false); j.this.L0(); } } static { try { AppLovinSdkUtils.runOnUiThread(new Runnable() { // from class: com.applovin.impl.sdk.j$$ExternalSyntheticLambda9 @Override // java.lang.Runnable public final void run() { yp.c(); } }); y0 = true; } catch (Throwable unused) { y0 = false; } } public j(Context context) { this.h0 = false; this.f = new AppLovinSdkSettings(context); this.h0 = true; if (!y0()) { throw new RuntimeException("As of version 12.0.0, the AppLovin MAX SDK requires Java 8. For more information visit our docs: https://developers.applovin.com/en/android/overview/integration"); } w0 = context.getApplicationContext(); if (context instanceof Activity) { this.b = new WeakReference((Activity) context); } if (v0 == null) { v0 = this; } else { n.h("AppLovinSdk", "Multiple SDK instances detected"); } } /* JADX INFO: Access modifiers changed from: private */ public /* synthetic */ void C0() { if (j0().d()) { return; } J(); if (n.a()) { J().a("AppLovinSdk", "Timing out adapters init..."); } j0().e(); J0(); } /* JADX INFO: Access modifiers changed from: private */ public /* synthetic */ void D0() { tm j0 = j0(); int i = this.l0 + 1; this.l0 = i; j0.a((yl) new jm(i, this, new c()), tm.b.CORE); } /* JADX INFO: Access modifiers changed from: private */ public /* synthetic */ void E0() { if (A0()) { pb.b(this); } } /* JADX INFO: Access modifiers changed from: private */ public /* synthetic */ void F0() { synchronized (this.e0) { try { boolean a2 = e4.a(l()); if (!((Boolean) a(sj.w3)).booleanValue() || a2) { P0(); } if (((Boolean) a(sj.v3)).booleanValue() && !a2) { J(); if (n.a()) { J().d("AppLovinSdk", "SDK initialized with no internet connection - listening for connection"); } Q0(); } if (u().e() == i4.a.TERMS) { if (A0()) { J(); if (n.a()) { J().a("AppLovinSdk", "MAX mediation detected... Generating consent flow..."); } u().a(); u().b(n0(), new a()); } else { J(); if (n.a()) { J().a("AppLovinSdk", "non-MAX mediation detected, mediation provider is: " + this.h); } } } } catch (Throwable th) { throw th; } } } /* JADX INFO: Access modifiers changed from: private */ public /* synthetic */ void G0() { if (w0()) { return; } this.t0.run(); } /* JADX INFO: Access modifiers changed from: private */ public /* synthetic */ void H0() { if (w0()) { return; } this.s0.set(true); this.u0.run(); } /* JADX INFO: Access modifiers changed from: private */ public /* synthetic */ void I0() { c(uj.H); } private q K0() { if (!wh.f(w0)) { return null; } try { return new q(this); } catch (Throwable th) { n.b("AppLovinSdk", "Failed to initialize Privacy Sandbox Service", th); return null; } } /* JADX INFO: Access modifiers changed from: private */ public void L0() { Long l = (Long) a(sj.E3); if (l.longValue() >= 0 && this.e.compareAndSet(false, true)) { hr.a(l.longValue(), false, this, new Runnable() { // from class: com.applovin.impl.sdk.j$$ExternalSyntheticLambda3 @Override // java.lang.Runnable public final void run() { j.this.D0(); } }); } } /* JADX INFO: Access modifiers changed from: private */ public void O0() { N0(); if (this.f.isExceptionHandlerEnabled() && ((Boolean) a(sj.u)).booleanValue()) { AppLovinExceptionHandler.shared().addSdk(this); AppLovinExceptionHandler.shared().enable(); } int parseInt = StringUtils.parseInt(this.f.getExtraParameters().get("initialization_delay_ms"), ((Integer) a(sj.x4)).intValue()); tm j0 = j0(); jn jnVar = new jn(this, true, "scheduleAdLoadIntegrationErrorAuto", new Runnable() { // from class: com.applovin.impl.sdk.j$$ExternalSyntheticLambda0 @Override // java.lang.Runnable public final void run() { j.this.G0(); } }); tm.b bVar = tm.b.CORE; long j = parseInt; j0.a(jnVar, bVar, j); j0().a(new jn(this, true, "scheduleSdkInit", new Runnable() { // from class: com.applovin.impl.sdk.j$$ExternalSyntheticLambda1 @Override // java.lang.Runnable public final void run() { j.this.H0(); } }), bVar, j); } private Map P() { try { return JsonUtils.toStringMap(new JSONObject((String) a(sj.y4))); } catch (JSONException unused) { return Collections.emptyMap(); } } /* JADX INFO: Access modifiers changed from: private */ public void Q0() { bg V = V(); V.a(new d(V)); } public static long k() { return x0; } public static Context l() { return w0; } public static boolean y0() { return y0; } public EventServiceImpl A() { Object obj = this.k.get(); if (obj == null) { synchronized (this.k) { try { obj = this.k.get(); if (obj == null) { obj = new EventServiceImpl(this); this.k.set(obj); } } finally { } } } if (obj == this.k) { obj = null; } return (EventServiceImpl) obj; } public boolean A0() { return StringUtils.containsIgnoreCase(O(), "max"); } public l B() { Object obj = this.C.get(); if (obj == null) { synchronized (this.C) { try { obj = this.C.get(); if (obj == null) { obj = new l(this); this.C.set(obj); } } finally { } } } if (obj == this.C) { obj = null; } return (l) obj; } public boolean B0() { return yp.a("com.unity3d.player.UnityPlayerActivity"); } public m C() { Object obj = this.E.get(); if (obj == null) { synchronized (this.E) { try { obj = this.E.get(); if (obj == null) { obj = new m(this); this.E.set(obj); } } finally { } } } if (obj == this.E) { obj = null; } return (m) obj; } public ma E() { return this.p; } public Activity G() { WeakReference weakReference = this.b; if (weakReference != null) { return (Activity) weakReference.get(); } return null; } public AppLovinSdkInitializationConfiguration H() { return this.n0; } public long I() { return this.c; } public n J() { return this.o; } public void J0() { final AppLovinSdk.SdkInitializationListener sdkInitializationListener; if ((u().j() && u().e() == i4.a.UNIFIED) || (sdkInitializationListener = this.q0) == null) { return; } if (u0()) { this.q0 = null; this.r0 = null; L().a(MaxAdapter.InitializationStatus.INITIALIZED_SUCCESS); } else { if (this.r0 == sdkInitializationListener) { return; } L().a(MaxAdapter.InitializationStatus.INITIALIZED_FAILURE); if (((Boolean) a(sj.r)).booleanValue()) { this.q0 = null; } else { this.r0 = sdkInitializationListener; } } AppLovinSdkUtils.runOnUiThreadDelayed(new Runnable() { // from class: com.applovin.impl.sdk.j$$ExternalSyntheticLambda8 @Override // java.lang.Runnable public final void run() { j.this.d(sdkInitializationListener); } }, Math.max(0L, ((Long) a(sj.s)).longValue())); } public com.applovin.impl.mediation.d K() { Object obj = this.b0.get(); if (obj == null) { synchronized (this.b0) { try { obj = this.b0.get(); if (obj == null) { obj = new com.applovin.impl.mediation.d(this); this.b0.set(obj); } } finally { } } } if (obj == this.b0) { obj = null; } return (com.applovin.impl.mediation.d) obj; } public com.applovin.impl.mediation.e L() { Object obj = this.V.get(); if (obj == null) { synchronized (this.V) { try { obj = this.V.get(); if (obj == null) { obj = new com.applovin.impl.mediation.e(this); this.V.set(obj); } } finally { } } } if (obj == this.V) { obj = null; } return (com.applovin.impl.mediation.e) obj; } public com.applovin.impl.mediation.f M() { Object obj = this.U.get(); if (obj == null) { synchronized (this.U) { try { obj = this.U.get(); if (obj == null) { obj = new com.applovin.impl.mediation.f(this); this.U.set(obj); } } finally { } } } if (obj == this.U) { obj = null; } return (com.applovin.impl.mediation.f) obj; } public void M0() { p().a(); } public String O() { String str = (String) a(uj.H); return StringUtils.isValidString(str) ? str : this.h; } public void P0() { synchronized (this.e0) { this.h0 = true; j0().f(); d(); } } public MediationServiceImpl Q() { Object obj = this.W.get(); if (obj == null) { synchronized (this.W) { try { obj = this.W.get(); if (obj == null) { obj = new MediationServiceImpl(this); this.W.set(obj); } } finally { } } } if (obj == this.W) { obj = null; } return (MediationServiceImpl) obj; } public void R0() { n.h("AppLovinSdk", "Resetting SDK state..."); da D = D(); ca caVar = ca.l; long b2 = D.b(caVar); h0().a(); h0().e(); D().a(); D().b(caVar, b2 + 1); if (this.f0.compareAndSet(true, false)) { P0(); } else { this.f0.set(true); } } public void S0() { if (StringUtils.isValidString(this.m0)) { return; } this.m0 = "max"; J(); if (n.a()) { J().a("AppLovinSdk", "Detected mediation provider: MAX"); } } public o T() { Object obj = this.a0.get(); if (obj == null) { synchronized (this.a0) { try { obj = this.a0.get(); if (obj == null) { obj = new o(this); this.a0.set(obj); } } finally { } } } if (obj == this.a0) { obj = null; } return (o) obj; } public void T0() { w().n(); } public AppLovinNativeAdService U() { Object obj = this.j.get(); if (obj == null) { synchronized (this.j) { try { obj = this.j.get(); if (obj == null) { obj = new AppLovinNativeAdService(this); this.j.set(obj); } } finally { } } } if (obj == this.j) { obj = null; } return (AppLovinNativeAdService) obj; } public void U0() { a((Map) null); } public com.applovin.impl.sdk.network.b X() { Object obj = this.S.get(); if (obj == null) { synchronized (this.S) { try { obj = this.S.get(); if (obj == null) { obj = new com.applovin.impl.sdk.network.b(this); this.S.set(obj); } } finally { } } } if (obj == this.S) { obj = null; } return (com.applovin.impl.sdk.network.b) obj; } public PostbackServiceImpl Y() { Object obj = this.R.get(); if (obj == null) { synchronized (this.R) { try { obj = this.R.get(); if (obj == null) { obj = new PostbackServiceImpl(this); this.R.set(obj); } } finally { } } } if (obj == this.R) { obj = null; } return (PostbackServiceImpl) obj; } public q Z() { Object obj = this.w.get(); if (obj == null) { synchronized (this.w) { try { obj = this.w.get(); if (obj == null) { obj = K0(); if (obj == null) { obj = this.w; } this.w.set(obj); } } finally { } } } if (obj == this.w) { obj = null; } return (q) obj; } public void a(AppLovinSdk appLovinSdk) { this.n = appLovinSdk; } public String a0() { return q0().a(); } public String b0() { return this.a; } public MaxSegmentCollectionImpl c0() { return (MaxSegmentCollectionImpl) this.g; } public Map d0() { MaxSegmentCollectionImpl c0 = c0(); if (c0 == null) { return null; } return c0.getJsonData(); } public SessionTracker f0() { Object obj = this.D.get(); if (obj == null) { synchronized (this.D) { try { obj = this.D.get(); if (obj == null) { obj = new SessionTracker(this); this.D.set(obj); } } finally { } } } if (obj == this.D) { obj = null; } return (SessionTracker) obj; } public com.applovin.impl.sdk.c g() { Object obj = this.A.get(); if (obj == null) { synchronized (this.A) { try { obj = this.A.get(); if (obj == null) { obj = new com.applovin.impl.sdk.c(this); this.A.set(obj); } } finally { } } } if (obj == this.A) { obj = null; } return (com.applovin.impl.sdk.c) obj; } public AppLovinSdkSettings g0() { return this.f; } public AppLovinAdServiceImpl i() { Object obj = this.i.get(); if (obj == null) { synchronized (this.i) { try { obj = this.i.get(); if (obj == null) { obj = new AppLovinAdServiceImpl(this); this.i.set(obj); } } finally { } } } if (obj == this.i) { obj = null; } return (AppLovinAdServiceImpl) obj; } public e j() { Object obj = this.F.get(); if (obj == null) { synchronized (this.F) { try { obj = this.F.get(); if (obj == null) { obj = new e(this); this.F.set(obj); } } finally { } } } if (obj == this.F) { obj = null; } return (e) obj; } public ArrayService m() { Object obj = this.P.get(); if (obj == null) { synchronized (this.P) { try { obj = this.P.get(); if (obj == null) { obj = new ArrayService(this); this.P.set(obj); } } finally { } } } if (obj == this.P) { obj = null; } return (ArrayService) obj; } public f n() { Object obj = this.K.get(); if (obj == null) { synchronized (this.K) { try { obj = this.K.get(); if (obj == null) { obj = new f(this); this.K.set(obj); } } finally { } } } if (obj == this.K) { obj = null; } return (f) obj; } public Activity n0() { Activity b2 = a(l()).b(); return b2 != null ? b2 : G(); } public CmpServiceImpl o() { Object obj = this.m.get(); if (obj == null) { synchronized (this.m) { try { obj = this.m.get(); if (obj == null) { obj = new CmpServiceImpl(this); this.m.set(obj); } } finally { } } } if (obj == this.m) { obj = null; } return (CmpServiceImpl) obj; } public String o0() { return q0().c(); } public g p() { Object obj = this.I.get(); if (obj == null) { synchronized (this.I) { try { obj = this.I.get(); if (obj == null) { obj = new g(this); this.I.set(obj); } } finally { } } } if (obj == this.I) { obj = null; } return (g) obj; } public UserServiceImpl p0() { Object obj = this.l.get(); if (obj == null) { synchronized (this.l) { try { obj = this.l.get(); if (obj == null) { obj = new UserServiceImpl(this); this.l.set(obj); } } finally { } } } if (obj == this.l) { obj = null; } return (UserServiceImpl) obj; } public String q() { return q0().b(); } public AppLovinSdkConfiguration r() { return this.p0; } public AppLovinSdk s0() { return this.n; } public i t() { Object obj = this.y.get(); if (obj == null) { synchronized (this.y) { try { obj = this.y.get(); if (obj == null) { obj = new i(this); this.y.set(obj); } } finally { } } } if (obj == this.y) { obj = null; } return (i) obj; } public boolean t0() { return this.k0; } public String toString() { return "CoreSdk{sdkKey='" + this.a + "', enabled=" + this.i0 + ", isFirstSession=" + this.j0 + '}'; } public boolean u0() { boolean z; synchronized (this.e0) { z = this.i0; } return z; } public AppLovinTermsAndPrivacyPolicyFlowSettings v() { return g0().getBackingConsentFlowSettings(); } public boolean v0() { return this.j0; } public boolean w0() { boolean z; synchronized (this.o0) { z = this.n0 != null; } return z; } public boolean x0() { boolean z; synchronized (this.e0) { z = this.h0; } return z; } public k y() { Object obj = this.v.get(); if (obj == null) { synchronized (this.v) { try { obj = this.v.get(); if (obj == null) { obj = new k(this); this.v.set(obj); } } finally { } } } if (obj == this.v) { obj = null; } return (k) obj; } public String z() { return this.m0; } public AtomicBoolean z0() { return this.s0; } private void N0() { Context context = w0; n J = J(); vj i0 = i0(); h4 u = u(); a(context); f0(); h(); m(); V(); L().a(MaxAdapter.InitializationStatus.INITIALIZING); NativeCrashReporter.a(this); if (TextUtils.isEmpty(this.a)) { n.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."); n.h("AppLovinSdk", "Called with an invalid SDK key from: " + Log.getStackTraceString(new Throwable(""))); } if (this.a.length() != 86 && yp.c(this)) { n.h("AppLovinSdk", "Please double-check that you entered your SDK key correctly (" + this.a + ") : " + Log.getStackTraceString(new Throwable(""))); } if ("HSrCHRtOan6wp2kwOIGJC1RDtuSrF2mWVbio2aBcMHX9KF3iTJ1lLSzCKP1ZSo5yNolPNw1kCTtWpxELFF4ah1".equalsIgnoreCase(this.a)) { n.h("AppLovinSdk", "Cross Promo SDK has been deprecated and is no longer supported"); if (yp.c(this)) { throw new RuntimeException("Cross Promo SDK has been deprecated and is no longer supported"); } return; } if (yp.i()) { n.h("AppLovinSdk", "Failed to find class for name: com.applovin.sdk.AppLovinSdk. Please ensure proguard rules have not been omitted from the build."); } if (!yp.b(this)) { n.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 (yp.k(context)) { this.f.setVerboseLogging(true); } h0().a(sj.l, Boolean.valueOf(this.f.isVerboseLoggingEnabled())); if (yp.c(this)) { ArrayList arrayList = new ArrayList(); JSONArray a2 = af.a(this); for (int i = 0; i < a2.length(); i++) { JSONObject jSONObject = JsonUtils.getJSONObject(a2, i, (JSONObject) null); if (!JsonUtils.getBoolean(jSONObject, "is_supported", Boolean.TRUE).booleanValue()) { arrayList.add(JsonUtils.getString(jSONObject, "name", "unknown")); } } if (!arrayList.isEmpty()) { throw new IllegalArgumentException("Please update to the latest adapter versions. Incompatible adapter(s) found: " + arrayList); } } SharedPreferences defaultSharedPreferences = PreferenceManager.getDefaultSharedPreferences(context); uj ujVar = uj.c; if (TextUtils.isEmpty((String) i0.a(ujVar, (Object) null, defaultSharedPreferences))) { this.j0 = true; i0.b(ujVar, Boolean.toString(true), defaultSharedPreferences); } else { i0.b(ujVar, Boolean.toString(false), defaultSharedPreferences); } uj ujVar2 = uj.d; if (((Boolean) i0.a(ujVar2, Boolean.FALSE)).booleanValue()) { if (n.a()) { J.a("AppLovinSdk", "Initializing SDK for non-maiden launch"); } this.k0 = true; } else { if (n.a()) { J.a("AppLovinSdk", "Initializing SDK for maiden launch"); } i0.b(ujVar2, Boolean.TRUE); i0.b(uj.o, Boolean.valueOf(u.k())); } uj ujVar3 = uj.e; String str = (String) i0.a(ujVar3, null); if (StringUtils.isValidString(str)) { if (AppLovinSdk.VERSION_CODE > yp.e(str)) { i0.b(ujVar3, AppLovinSdk.VERSION); } } else { i0.b(ujVar3, AppLovinSdk.VERSION); } E().a(la.e, (Object) null, (Map) null, 0L); } private void d() { tm j0 = j0(); int i = this.l0 + 1; this.l0 = i; j0.a((yl) new jm(i, this, new b()), tm.b.CORE); } public com.applovin.impl.q e() { return a(w0); } public com.applovin.impl.sdk.a f() { Object obj = this.B.get(); if (obj == null) { synchronized (this.B) { try { obj = this.B.get(); if (obj == null) { obj = new com.applovin.impl.sdk.a(this); this.B.set(obj); } } finally { } } } if (obj == this.B) { obj = null; } return (com.applovin.impl.sdk.a) obj; } public void g(final String str) { J(); if (n.a()) { J().a("AppLovinSdk", "Setting user id: " + str); } if (StringUtils.isValidString(str) && str.length() > yp.b(8)) { n.h("AppLovinSdk", "Provided user id longer than supported (" + str.length() + " bytes, " + yp.b(8) + " maximum)"); } if (yp.h()) { yp.a(new Runnable() { // from class: com.applovin.impl.sdk.j$$ExternalSyntheticLambda7 @Override // java.lang.Runnable public final void run() { j.this.c(str); } }); } else { q0().a(str); } } public long m0() { if (this.d == 0) { return -1L; } return System.currentTimeMillis() - this.d; } /* JADX INFO: Access modifiers changed from: private */ public void d(String str) { J(); if (n.a()) { J().a("AppLovinSdk", str); } j0().a(new sm(this)); } public void e(String str) { J(); if (n.a()) { J().a("AppLovinSdk", "setMediationProvider(mediationProvider=" + str + ")"); } if (str != null && (str.isEmpty() || str.length() > 64 || !StringUtils.isAlphaNumeric(str))) { n.h("AppLovinSdk", "Mediation provider set to invalid value: " + str + ". Please use a valid mediation provider (e.g., AppLovinMediationProvider.MAX)"); return; } this.h = str; if (yp.h()) { yp.a(new Runnable() { // from class: com.applovin.impl.sdk.j$$ExternalSyntheticLambda13 @Override // java.lang.Runnable public final void run() { j.this.I0(); } }); } else { c(uj.H); } } public void f(final String str) { n.g("AppLovinSdk", "Setting plugin version: " + str); if (yp.h()) { yp.a(new Runnable() { // from class: com.applovin.impl.sdk.j$$ExternalSyntheticLambda4 @Override // java.lang.Runnable public final void run() { j.this.b(str); } }); } else { h0().a(sj.a4, str); } } /* JADX INFO: Access modifiers changed from: private */ public /* synthetic */ void d(AppLovinSdk.SdkInitializationListener sdkInitializationListener) { J(); if (n.a()) { J().a("AppLovinSdk", "Calling back publisher's initialization completion handler..."); } sdkInitializationListener.onSdkInitialized(this.p0); } public tm j0() { Object obj = this.q.get(); if (obj == null) { synchronized (this.q) { try { obj = this.q.get(); if (obj == null) { obj = new tm(this); this.q.set(obj); } } finally { } } } if (obj == this.q) { obj = null; } return (tm) obj; } public tj h0() { Object obj = this.r.get(); if (obj == null) { synchronized (this.r) { try { obj = this.r.get(); if (obj == null) { obj = new tj(this); this.r.set(obj); } } finally { } } } if (obj == this.r) { obj = null; } return (tj) obj; } public d4 s() { Object obj = this.s.get(); if (obj == null) { synchronized (this.s) { try { obj = this.s.get(); if (obj == null) { obj = new d4(this); this.s.set(obj); } } finally { } } } if (obj == this.s) { obj = null; } return (d4) obj; } public da D() { Object obj = this.t.get(); if (obj == null) { synchronized (this.t) { try { obj = this.t.get(); if (obj == null) { obj = new da(this); this.t.set(obj); } } finally { } } } if (obj == this.t) { obj = null; } return (da) obj; } public ye R() { Object obj = this.u.get(); if (obj == null) { synchronized (this.u) { try { obj = this.u.get(); if (obj == null) { obj = new ye(this); this.u.set(obj); } } finally { } } } if (obj == this.u) { obj = null; } return (ye) obj; } public vj i0() { Object obj = this.x.get(); if (obj == null) { synchronized (this.x) { try { obj = this.x.get(); if (obj == null) { obj = new vj(this); this.x.set(obj); } } finally { } } } if (obj == this.x) { obj = null; } return (vj) obj; } public wp q0() { Object obj = this.z.get(); if (obj == null) { synchronized (this.z) { try { obj = this.z.get(); if (obj == null) { obj = new wp(this); this.z.set(obj); } } finally { } } } if (obj == this.z) { obj = null; } return (wp) obj; } public qr r0() { Object obj = this.G.get(); if (obj == null) { synchronized (this.G) { try { obj = this.G.get(); if (obj == null) { obj = new qr(this); this.G.set(obj); } } finally { } } } if (obj == this.G) { obj = null; } return (qr) obj; } public bg V() { Object obj = this.H.get(); if (obj == null) { synchronized (this.H) { try { obj = this.H.get(); if (obj == null) { obj = new bg(l()); this.H.set(obj); } } finally { } } } if (obj == this.H) { obj = null; } return (bg) obj; } public oj e0() { Object obj = this.J.get(); if (obj == null) { synchronized (this.J) { try { obj = this.J.get(); if (obj == null) { obj = new oj(this); this.J.set(obj); } } finally { } } } if (obj == this.J) { obj = null; } return (oj) obj; } public h4 u() { Object obj = this.L.get(); if (obj == null) { synchronized (this.L) { try { obj = this.L.get(); if (obj == null) { obj = new h4(this); this.L.set(obj); } } finally { } } } if (obj == this.L) { obj = null; } return (h4) obj; } public qn k0() { Object obj = this.M.get(); if (obj == null) { synchronized (this.M) { try { obj = this.M.get(); if (obj == null) { obj = new qn(this); this.M.set(obj); } } finally { } } } if (obj == this.M) { obj = null; } return (qn) obj; } public y4 w() { Object obj = this.N.get(); if (obj == null) { synchronized (this.N) { try { obj = this.N.get(); if (obj == null) { obj = new y4(this); this.N.set(obj); } } finally { } } } if (obj == this.N) { obj = null; } return (y4) obj; } public qg W() { Object obj = this.O.get(); if (obj == null) { synchronized (this.O) { try { obj = this.O.get(); if (obj == null) { obj = new qg(this); this.O.set(obj); } } finally { } } } if (obj == this.O) { obj = null; } return (qg) obj; } public d5 x() { Object obj = this.Q.get(); if (obj == null) { synchronized (this.Q) { try { obj = this.Q.get(); if (obj == null) { obj = new d5(this); this.Q.set(obj); } } finally { } } } if (obj == this.Q) { obj = null; } return (d5) obj; } public v h() { Object obj = this.T.get(); if (obj == null) { synchronized (this.T) { try { obj = this.T.get(); if (obj == null) { obj = new v(this); this.T.set(obj); } } finally { } } } if (obj == this.T) { obj = null; } return (v) obj; } public dd F() { Object obj = this.X.get(); if (obj == null) { synchronized (this.X) { try { obj = this.X.get(); if (obj == null) { obj = new dd(this); this.X.set(obj); } } finally { } } } if (obj == this.X) { obj = null; } return (dd) obj; } public ze S() { Object obj = this.Y.get(); if (obj == null) { synchronized (this.Y) { try { obj = this.Y.get(); if (obj == null) { obj = new ze(); this.Y.set(obj); } } finally { } } } if (obj == this.Y) { obj = null; } return (ze) obj; } public ue N() { Object obj = this.Z.get(); if (obj == null) { synchronized (this.Z) { try { obj = this.Z.get(); if (obj == null) { obj = new ue(this); this.Z.set(obj); } } finally { } } } if (obj == this.Z) { obj = null; } return (ue) obj; } public wn l0() { Object obj = this.c0.get(); if (obj == null) { synchronized (this.c0) { try { obj = this.c0.get(); if (obj == null) { obj = new wn(this); this.c0.set(obj); } } finally { } } } if (obj == this.c0) { obj = null; } return (wn) obj; } public class b implements jm.b { public b() { } @Override // com.applovin.impl.jm.b public void a(JSONObject jSONObject) { boolean z = jSONObject != null && jSONObject.length() > 0; j.this.c(jSONObject); u0.b(j.this); e4.a(jSONObject, z, j.this); j.this.N().a(JsonUtils.getBoolean(jSONObject, "smd", Boolean.FALSE).booleanValue(), JsonUtils.getInt(jSONObject, "smd_delay_sec", 2)); j.this.E().a(); j jVar = j.this; jVar.d0 = jVar.a(jSONObject); if (z) { List explode = CollectionUtils.explode(JsonUtils.getString(jSONObject, "eaaui", "")); j jVar2 = j.this; jVar2.p0 = new SdkConfigurationImpl(explode, jVar2); } j.this.l0().a(jSONObject); j.this.b(jSONObject); gc.b(((Boolean) j.this.a(sj.o6)).booleanValue()); gc.a(((Boolean) j.this.a(sj.p6)).booleanValue()); if (!j.this.A0()) { j.this.d("Initializing SDK in non-MAX environment..."); } else if (j.this.u().e() == i4.a.UNIFIED) { Activity n0 = j.this.n0(); if (j.this.g0.compareAndSet(false, true)) { j.this.u().a(); j.this.u().b(n0, new a()); } else { j.this.d("Initializing SDK in MAX environment..."); } } else { j.this.d("Initializing SDK in MAX environment..."); } if (!((Boolean) j.this.a(sj.v3)).booleanValue() || z || !e4.a(j.l())) { j.this.L0(); return; } j.this.J(); if (n.a()) { j.this.J().d("AppLovinSdk", "SDK initialized with no internet connection - listening for connection"); } j.this.Q0(); } public class a implements h4.c { public a() { } @Override // com.applovin.impl.h4.c public void a(h4.b bVar) { j.this.J(); if (n.a()) { j.this.J().a("AppLovinSdk", "Unified flow completed with status: " + bVar); } if (bVar.b()) { j.this.J(); if (n.a()) { j.this.J().a("AppLovinSdk", "Re-initializing SDK with the updated privacy settings..."); } j.this.P0(); j.this.M0(); return; } j.this.d("Initializing SDK in MAX environment..."); } } } public class d implements bg.a { final /* synthetic */ bg a; @Override // com.applovin.impl.bg.a public void a() { j.this.J(); if (n.a()) { j.this.J().d("AppLovinSdk", "Connected to internet - re-initializing SDK"); } synchronized (j.this.e0) { try { if (!j.this.h0) { j.this.P0(); } } catch (Throwable th) { throw th; } } this.a.b(this); } @Override // com.applovin.impl.bg.a public void b() { } public d(bg bgVar) { this.a = bgVar; } } public List c(sj sjVar) { return h0().c(sjVar); } public boolean a(sj sjVar, String str) { Iterator it = c(sjVar).iterator(); while (it.hasNext()) { if (((String) it.next()).equalsIgnoreCase(str)) { return true; } } return false; } public List b(sj sjVar) { return h0().b(sjVar); } public Object a(sj sjVar) { return h0().a(sjVar); } public void c(uj ujVar) { i0().b(ujVar); } /* JADX INFO: Access modifiers changed from: private */ public void c(JSONObject jSONObject) { this.d = System.currentTimeMillis(); e4.c(jSONObject, this); e4.b(jSONObject, this); e4.a(jSONObject, this); qe.f(jSONObject, this); qe.d(jSONObject, this); qe.e(jSONObject, this); qe.g(jSONObject, this); } public void c() { synchronized (this.e0) { try { if (!this.h0 && !this.i0) { P0(); } } catch (Throwable th) { throw th; } } } /* JADX INFO: Access modifiers changed from: private */ public /* synthetic */ void c(AppLovinSdk.SdkInitializationListener sdkInitializationListener) { sdkInitializationListener.onSdkInitialized(this.p0); } /* JADX INFO: Access modifiers changed from: private */ public /* synthetic */ void c(String str) { q0().a(str); } public Object b(uj ujVar) { return i0().a(ujVar); } public Object a(uj ujVar) { return a(ujVar, (Object) null); } public void b(uj ujVar, Object obj) { i0().b(ujVar, obj); } public static void b(Context context) { if (context == null) { return; } w0 = context.getApplicationContext(); } /* JADX INFO: Access modifiers changed from: private */ public /* synthetic */ void b(AppLovinSdk.SdkInitializationListener sdkInitializationListener) { sdkInitializationListener.onSdkInitialized(this.p0); } /* JADX INFO: Access modifiers changed from: private */ /* renamed from: b, reason: merged with bridge method [inline-methods] */ public void a(AppLovinSdkInitializationConfiguration appLovinSdkInitializationConfiguration) { N0(); this.f.attachAppLovinSdk(this); String pluginVersion = appLovinSdkInitializationConfiguration.getPluginVersion(); if (pluginVersion != null) { n.g("AppLovinSdk", "Setting plugin version: " + pluginVersion); h0().a(sj.a4, pluginVersion); } if (appLovinSdkInitializationConfiguration.isExceptionHandlerEnabled() && ((Boolean) a(sj.u)).booleanValue()) { AppLovinExceptionHandler.shared().addSdk(this); AppLovinExceptionHandler.shared().enable(); } tm j0 = j0(); yl ylVar = this.t0; tm.b bVar = tm.b.CORE; j0.a(ylVar, bVar); j0().a(this.u0, bVar); } /* JADX INFO: Access modifiers changed from: private */ public void b(JSONObject jSONObject) { Iterator it = JsonUtils.getList(jSONObject, "error_messages", Collections.emptyList()).iterator(); while (it.hasNext()) { n.h("AppLovinSdk", (String) it.next()); } } /* JADX WARN: Code restructure failed: missing block: B:26:0x006d, code lost: r12 = r4.entrySet().iterator(); */ /* JADX WARN: Code restructure failed: missing block: B:28:0x0079, code lost: if (r12.hasNext() == false) goto L59; */ /* JADX WARN: Code restructure failed: missing block: B:29:0x007b, code lost: r13 = (java.util.Map.Entry) r12.next(); */ /* JADX WARN: Code restructure failed: missing block: B:30:0x008b, code lost: if (r11.startsWith((java.lang.String) r13.getKey()) == false) goto L60; */ /* JADX WARN: Code restructure failed: missing block: B:32:0x008d, code lost: r15.m0 = (java.lang.String) r13.getValue(); J(); */ /* JADX WARN: Code restructure failed: missing block: B:33:0x009c, code lost: if (com.applovin.impl.sdk.n.a() == false) goto L31; */ /* JADX WARN: Code restructure failed: missing block: B:34:0x009e, code lost: J().a("AppLovinSdk", "Detected mediation provider: " + r15.m0); */ /* JADX WARN: Code restructure failed: missing block: B:36:0x00b8, code lost: return null; */ /* JADX WARN: Code restructure failed: missing block: B:40:0x00bd, code lost: if (r6.booleanValue() == false) goto L35; */ /* JADX WARN: Code restructure failed: missing block: B:41:0x00bf, code lost: r2.add(r11); */ /* JADX WARN: Code restructure failed: missing block: B:42:0x00c2, code lost: r8 = java.lang.Integer.valueOf(r8.intValue() - 1); */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ public java.lang.String b() { /* Method dump skipped, instructions count: 281 To view this dump add '--comments-level debug' option */ throw new UnsupportedOperationException("Method not decompiled: com.applovin.impl.sdk.j.b():java.lang.String"); } /* JADX INFO: Access modifiers changed from: private */ public /* synthetic */ void b(String str) { h0().a(sj.a4, str); } public Object a(uj ujVar, Object obj) { return i0().a(ujVar, obj); } public boolean a(sj sjVar, MaxAdFormat maxAdFormat) { return b(sjVar).contains(maxAdFormat); } public void a(pe peVar) { if (j0().d()) { return; } List c2 = c(ve.P6); if (c2.size() <= 0 || !L().a().containsAll(c2)) { return; } J(); if (n.a()) { J().a("AppLovinSdk", "All required adapters initialized"); } j0().e(); J0(); } public static String a(String str) { return a(str, (List) null); } public static String a(int i) { return a(i, (List) null); } public static String a(String str, List list) { if (TextUtils.isEmpty(str)) { return ""; } Context l = l(); return a(l.getResources().getIdentifier(str, "string", l.getPackageName()), list); } public static String a(int i, List list) { String string = l().getResources().getString(i); return list != null ? String.format(string, list.toArray()) : string; } public static com.applovin.impl.q a(Context context) { if (z0 == null) { synchronized (A0) { try { if (z0 == null) { z0 = new com.applovin.impl.q(context); } } finally { } } } return z0; } public void a(final AppLovinSdkInitializationConfiguration appLovinSdkInitializationConfiguration, final AppLovinSdk.SdkInitializationListener sdkInitializationListener) { if (this.s0.get()) { n.h("AppLovinSdk", "Invalid initialization process. Please initialize the SDK as soon as possible with \"AppLovinSdk#initialize(AppLovinSdkInitializationConfiguration, AppLovinSdk.SdkInitializationListener)\" before accessing any SDK fields or functions"); E().a(la.L, "legacy_init_already"); if (yp.c(this)) { throw new IllegalStateException("Invalid initialization process. Please initialize the SDK as soon as possible with \"AppLovinSdk#initialize(AppLovinSdkInitializationConfiguration, AppLovinSdk.SdkInitializationListener)\" before accessing any SDK fields or functions"); } return; } synchronized (this.o0) { try { if (this.n0 != null) { if (!u0() || sdkInitializationListener == null) { return; } AppLovinSdkUtils.runOnUiThread(new Runnable() { // from class: com.applovin.impl.sdk.j$$ExternalSyntheticLambda11 @Override // java.lang.Runnable public final void run() { j.this.b(sdkInitializationListener); } }); return; } this.n0 = appLovinSdkInitializationConfiguration; this.q0 = sdkInitializationListener; this.a = appLovinSdkInitializationConfiguration.getSdkKey(); this.h = appLovinSdkInitializationConfiguration.getMediationProvider(); this.g = appLovinSdkInitializationConfiguration.getSegmentCollection(); yp.a(new Runnable() { // from class: com.applovin.impl.sdk.j$$ExternalSyntheticLambda12 @Override // java.lang.Runnable public final void run() { j.this.a(appLovinSdkInitializationConfiguration); } }); } catch (Throwable th) { throw th; } } } public void a(String str, AppLovinSdkSettings appLovinSdkSettings) { z0().set(true); this.a = str; this.f = appLovinSdkSettings; yp.a(new Runnable() { // from class: com.applovin.impl.sdk.j$$ExternalSyntheticLambda10 @Override // java.lang.Runnable public final void run() { j.this.O0(); } }); } /* JADX INFO: Access modifiers changed from: private */ public List a(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 a(boolean z) { synchronized (this.e0) { this.h0 = false; this.i0 = z; } if (z) { List c2 = c(ve.P6); if (c2.isEmpty()) { j0().e(); J0(); return; } Long l = (Long) a(ve.Q6); jn jnVar = new jn(this, true, "timeoutInitAdapters", new Runnable() { // from class: com.applovin.impl.sdk.j$$ExternalSyntheticLambda14 @Override // java.lang.Runnable public final void run() { j.this.C0(); } }); J(); if (n.a()) { J().a("AppLovinSdk", "Waiting for required adapters to init: " + c2 + " - timing out in " + l + "ms..."); } j0().a(jnVar, tm.b.TIMEOUT, l.longValue(), true); } } public boolean a(MaxAdFormat maxAdFormat) { List list = this.d0; return (list == null || list.size() <= 0 || this.d0.contains(maxAdFormat)) ? false : true; } public void a() { String str = (String) i0().a(uj.e, null); if (StringUtils.isValidString(str)) { if (AppLovinSdk.VERSION_CODE < yp.e(str)) { n.h("AppLovinSdk", "Current version (" + AppLovinSdk.VERSION + ") is older than earlier installed version (" + str + "), which may cause compatibility issues."); } } } public void a(Map map) { N().a(map); } public void a(String str, Object obj, SharedPreferences.Editor editor) { i0().a(str, obj, editor); } public Object a(String str, Object obj, Class cls, SharedPreferences sharedPreferences) { return vj.a(str, obj, cls, sharedPreferences); } public void a(SharedPreferences sharedPreferences) { i0().a(sharedPreferences); } public void a(long j) { t().b(j); } public void a(final AppLovinSdk.SdkInitializationListener sdkInitializationListener) { if (!u0()) { this.q0 = sdkInitializationListener; } else if (sdkInitializationListener != null) { AppLovinSdkUtils.runOnUiThread(new Runnable() { // from class: com.applovin.impl.sdk.j$$ExternalSyntheticLambda2 @Override // java.lang.Runnable public final void run() { j.this.c(sdkInitializationListener); } }); } } }