package com.vungle.warren; import android.content.Context; import android.content.pm.PackageManager; import android.os.Build; import android.security.NetworkSecurityPolicy; import android.telephony.TelephonyManager; import android.text.TextUtils; import android.util.DisplayMetrics; import android.util.Log; import android.view.WindowManager; import android.webkit.URLUtil; import androidx.annotation.Keep; import com.google.android.gms.ads.RequestConfiguration; import com.google.android.gms.appset.AppSet; import com.google.android.gms.appset.AppSetIdInfo; import com.google.android.gms.common.GoogleApiAvailabilityLight; import com.google.android.gms.tasks.OnSuccessListener; import com.unity3d.services.core.request.metrics.MetricCommonTags; import com.vungle.warren.model.r; import com.vungle.warren.network.VungleApi; import com.vungle.warren.z; import g8.d; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.TimeUnit; import n9.b0; import n9.g0; import n9.z; /* loaded from: classes2.dex */ public class VungleApiClient { private static final String C = "com.vungle.warren.VungleApiClient"; private static String D; private static String E; private static Set F; private static Set G; private final f8.a A; /* renamed from: a, reason: collision with root package name */ private final p8.b f7895a; /* renamed from: b, reason: collision with root package name */ private Context f7896b; /* renamed from: c, reason: collision with root package name */ private VungleApi f7897c; /* renamed from: d, reason: collision with root package name */ private String f7898d; /* renamed from: e, reason: collision with root package name */ private String f7899e; /* renamed from: f, reason: collision with root package name */ private String f7900f; /* renamed from: g, reason: collision with root package name */ private String f7901g; /* renamed from: h, reason: collision with root package name */ private String f7902h; /* renamed from: i, reason: collision with root package name */ private String f7903i; /* renamed from: j, reason: collision with root package name */ private String f7904j; /* renamed from: k, reason: collision with root package name */ private String f7905k; /* renamed from: l, reason: collision with root package name */ private z4.k f7906l; /* renamed from: m, reason: collision with root package name */ private z4.k f7907m; /* renamed from: n, reason: collision with root package name */ private boolean f7908n; /* renamed from: o, reason: collision with root package name */ private int f7909o; /* renamed from: p, reason: collision with root package name */ private n9.b0 f7910p; /* renamed from: q, reason: collision with root package name */ private VungleApi f7911q; /* renamed from: r, reason: collision with root package name */ private VungleApi f7912r; /* renamed from: s, reason: collision with root package name */ private boolean f7913s; /* renamed from: t, reason: collision with root package name */ private g8.a f7914t; /* renamed from: u, reason: collision with root package name */ private Boolean f7915u; /* renamed from: v, reason: collision with root package name */ private com.vungle.warren.utility.w f7916v; /* renamed from: x, reason: collision with root package name */ private boolean f7918x; /* renamed from: y, reason: collision with root package name */ private g8.j f7919y; /* renamed from: w, reason: collision with root package name */ private Map f7917w = new ConcurrentHashMap(); /* renamed from: z, reason: collision with root package name */ private String f7920z = System.getProperty("http.agent"); private String B = RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED; @Keep public enum WrapperFramework { admob, air, cocos2dx, corona, dfp, heyzap, marmalade, mopub, unity, fyber, ironsource, upsight, appodeal, aerserv, adtoapp, tapdaq, vunglehbs, max, none } class a implements n9.z { a() { } @Override // n9.z public n9.g0 a(z.a aVar) { int G; n9.e0 d10 = aVar.d(); String g10 = d10.h().g(); Long l10 = (Long) VungleApiClient.this.f7917w.get(g10); if (l10 != null) { long seconds = TimeUnit.MILLISECONDS.toSeconds(l10.longValue() - System.currentTimeMillis()); if (seconds > 0) { return new g0.a().q(d10).a("Retry-After", String.valueOf(seconds)).g(500).o(n9.c0.HTTP_1_1).l("Server is busy").b(n9.h0.P(n9.a0.d("application/json; charset=utf-8"), "{\"Error\":\"Retry-After\"}")).c(); } VungleApiClient.this.f7917w.remove(g10); } n9.g0 e10 = aVar.e(d10); if (e10 != null && ((G = e10.G()) == 429 || G == 500 || G == 502 || G == 503)) { String c10 = e10.R().c("Retry-After"); if (!TextUtils.isEmpty(c10)) { try { long parseLong = Long.parseLong(c10); if (parseLong > 0) { VungleApiClient.this.f7917w.put(g10, Long.valueOf((parseLong * 1000) + System.currentTimeMillis())); } } catch (NumberFormatException unused) { Log.d(VungleApiClient.C, "Retry-After value is not an valid value"); } } } return e10; } } class b implements y.a { b() { } @Override // y.a /* renamed from: b, reason: merged with bridge method [inline-methods] */ public void a(String str) { if (str == null) { Log.e(VungleApiClient.C, "Cannot Get UserAgent. Setting Default Device UserAgent"); } else { VungleApiClient.this.f7920z = str; } } } class c implements OnSuccessListener { c() { } @Override // com.google.android.gms.tasks.OnSuccessListener /* renamed from: a, reason: merged with bridge method [inline-methods] */ public void onSuccess(AppSetIdInfo appSetIdInfo) { if (appSetIdInfo != null) { VungleApiClient.this.B = appSetIdInfo.getId(); if (TextUtils.isEmpty(VungleApiClient.this.B)) { return; } com.vungle.warren.model.j jVar = new com.vungle.warren.model.j("appSetIdCookie"); jVar.e("appSetId", VungleApiClient.this.B); try { VungleApiClient.this.f7919y.h0(jVar); } catch (d.a e10) { Log.e(VungleApiClient.C, "error saving AppSetId in Cookie: " + e10.getLocalizedMessage()); } } } } public static class d extends IOException { d(String str) { super(str); } } static class e implements n9.z { class a extends n9.f0 { /* renamed from: a, reason: collision with root package name */ final /* synthetic */ n9.f0 f7924a; /* renamed from: b, reason: collision with root package name */ final /* synthetic */ x9.c f7925b; a(n9.f0 f0Var, x9.c cVar) { this.f7924a = f0Var; this.f7925b = cVar; } @Override // n9.f0 public long a() { return this.f7925b.u0(); } @Override // n9.f0 public n9.a0 b() { return this.f7924a.b(); } @Override // n9.f0 public void h(x9.d dVar) { dVar.v0(this.f7925b.w0()); } } e() { } private n9.f0 b(n9.f0 f0Var) { x9.c cVar = new x9.c(); x9.d b10 = x9.n.b(new x9.k(cVar)); f0Var.h(b10); b10.close(); return new a(f0Var, cVar); } @Override // n9.z public n9.g0 a(z.a aVar) { n9.e0 d10 = aVar.d(); return (d10.a() == null || d10.c("Content-Encoding") != null) ? aVar.e(d10) : aVar.e(d10.g().d("Content-Encoding", "gzip").f(d10.f(), b(d10.a())).b()); } } static { StringBuilder sb = new StringBuilder(); sb.append("Amazon".equals(Build.MANUFACTURER) ? "VungleAmazon/" : "VungleDroid/"); sb.append("6.11.0"); D = sb.toString(); E = "https://ads.api.vungle.com/"; F = new HashSet(); G = new HashSet(); } VungleApiClient(Context context, g8.a aVar, g8.j jVar, f8.a aVar2, p8.b bVar) { this.f7914t = aVar; this.f7896b = context.getApplicationContext(); this.f7919y = jVar; this.A = aVar2; this.f7895a = bVar; b0.b a10 = new b0.b().a(new a()); this.f7910p = a10.b(); n9.b0 b10 = a10.a(new e()).b(); d8.a aVar3 = new d8.a(this.f7910p, E); Vungle vungle = Vungle._instance; this.f7897c = aVar3.a(vungle.appID); this.f7912r = new d8.a(b10, E).a(vungle.appID); this.f7916v = (com.vungle.warren.utility.w) b0.f(context).h(com.vungle.warren.utility.w.class); } private void I(String str, z4.k kVar) { kVar.r("id", str); } private void K() { try { AppSet.getClient(this.f7896b).getAppSetIdInfo().addOnSuccessListener(new c()); } catch (NoClassDefFoundError e10) { Log.e(C, "Required libs to get AppSetID Not available: " + e10.getLocalizedMessage()); } } private String k() { if (TextUtils.isEmpty(this.B)) { com.vungle.warren.model.j jVar = (com.vungle.warren.model.j) this.f7919y.T("appSetIdCookie", com.vungle.warren.model.j.class).get(this.f7916v.a(), TimeUnit.MILLISECONDS); this.B = jVar != null ? jVar.d("appSetId") : null; } return this.B; } private String l(int i10) { switch (i10) { case 1: return "gprs"; case 2: return "edge"; case 3: case 10: case 11: default: return "unknown"; case 4: return "wcdma"; case 5: return "cdma_evdo_0"; case 6: return "cdma_evdo_a"; case 7: return "cdma_1xrtt"; case 8: return "hsdpa"; case 9: return "hsupa"; case 12: return "cdma_evdo_b"; case 13: return "LTE"; case 14: return "hrpd"; } } private z4.k m() { return n(false); } /* JADX WARN: Can't wrap try/catch for region: R(40:2|3|4|5|6|(1:7)|(6:9|10|(1:12)(1:172)|13|14|15)(3:176|177|(4:179|180|181|182)(2:190|186))|16|(1:(3:19|(1:21)(1:23)|22)(4:24|(1:26)(2:32|(1:34)(1:35))|27|(1:31)))|36|(1:166)|39|(1:41)(1:165)|42|(1:44)|45|(1:47)|48|(4:50|(1:53)|54|(1:56)(3:(1:155)|156|(1:(1:(1:160)(1:161))(1:162))(1:163)))(1:164)|57|(1:150)(1:61)|62|(4:64|(2:68|(1:(1:80)(2:73|(2:75|(1:77)(1:78))(1:79)))(1:81))|82|(2:84|(3:86|(1:(1:(1:90)(1:92))(1:93))(1:94)|91)(1:95)))|96|(3:98|(1:100)(1:102)|101)|103|(1:107)|108|(1:110)(3:139|(1:144)|143)|111|(1:113)|114|115|(3:117|(1:119)|133)(3:134|(1:136)|133)|120|(1:122)|123|(1:125)(1:131)|126|127) */ /* JADX WARN: Code restructure failed: missing block: B:137:0x03a3, code lost: r13 = move-exception; */ /* JADX WARN: Code restructure failed: missing block: B:138:0x03a4, code lost: android.util.Log.e(com.vungle.warren.VungleApiClient.C, "isInstallNonMarketAppsEnabled Settings not found", r13); */ /* JADX WARN: Multi-variable type inference failed */ /* JADX WARN: Removed duplicated region for block: B:105:0x02cd A[Catch: all -> 0x0408, TryCatch #3 {, blocks: (B:3:0x0001, B:6:0x000f, B:10:0x0019, B:14:0x002a, B:16:0x00ae, B:19:0x00ba, B:22:0x00c9, B:24:0x00d2, B:27:0x00f1, B:29:0x00fa, B:31:0x00fe, B:32:0x00e7, B:36:0x0103, B:42:0x012a, B:44:0x014e, B:45:0x0155, B:47:0x0159, B:50:0x0168, B:53:0x0179, B:54:0x0185, B:57:0x01b3, B:59:0x01c6, B:62:0x01cf, B:64:0x01e3, B:66:0x01f3, B:68:0x01f9, B:81:0x0217, B:82:0x0221, B:84:0x022f, B:86:0x0235, B:91:0x024a, B:95:0x0259, B:96:0x0269, B:98:0x029c, B:101:0x02b7, B:103:0x02be, B:105:0x02cd, B:107:0x02d3, B:108:0x02e2, B:110:0x02ec, B:111:0x033c, B:113:0x0363, B:117:0x037a, B:119:0x0384, B:120:0x03ac, B:123:0x03c4, B:126:0x0403, B:134:0x0393, B:138:0x03a4, B:139:0x02fd, B:141:0x0303, B:145:0x0317, B:147:0x0329, B:156:0x0199, B:166:0x010f, B:170:0x0036, B:196:0x00a4, B:177:0x0043, B:179:0x004b, B:181:0x004f, B:185:0x005d, B:188:0x007b), top: B:2:0x0001, inners: #5 }] */ /* JADX WARN: Removed duplicated region for block: B:110:0x02ec A[Catch: all -> 0x0408, TryCatch #3 {, blocks: (B:3:0x0001, B:6:0x000f, B:10:0x0019, B:14:0x002a, B:16:0x00ae, B:19:0x00ba, B:22:0x00c9, B:24:0x00d2, B:27:0x00f1, B:29:0x00fa, B:31:0x00fe, B:32:0x00e7, B:36:0x0103, B:42:0x012a, B:44:0x014e, B:45:0x0155, B:47:0x0159, B:50:0x0168, B:53:0x0179, B:54:0x0185, B:57:0x01b3, B:59:0x01c6, B:62:0x01cf, B:64:0x01e3, B:66:0x01f3, B:68:0x01f9, B:81:0x0217, B:82:0x0221, B:84:0x022f, B:86:0x0235, B:91:0x024a, B:95:0x0259, B:96:0x0269, B:98:0x029c, B:101:0x02b7, B:103:0x02be, B:105:0x02cd, B:107:0x02d3, B:108:0x02e2, B:110:0x02ec, B:111:0x033c, B:113:0x0363, B:117:0x037a, B:119:0x0384, B:120:0x03ac, B:123:0x03c4, B:126:0x0403, B:134:0x0393, B:138:0x03a4, B:139:0x02fd, B:141:0x0303, B:145:0x0317, B:147:0x0329, B:156:0x0199, B:166:0x010f, B:170:0x0036, B:196:0x00a4, B:177:0x0043, B:179:0x004b, B:181:0x004f, B:185:0x005d, B:188:0x007b), top: B:2:0x0001, inners: #5 }] */ /* JADX WARN: Removed duplicated region for block: B:113:0x0363 A[Catch: all -> 0x0408, TRY_LEAVE, TryCatch #3 {, blocks: (B:3:0x0001, B:6:0x000f, B:10:0x0019, B:14:0x002a, B:16:0x00ae, B:19:0x00ba, B:22:0x00c9, B:24:0x00d2, B:27:0x00f1, B:29:0x00fa, B:31:0x00fe, B:32:0x00e7, B:36:0x0103, B:42:0x012a, B:44:0x014e, B:45:0x0155, B:47:0x0159, B:50:0x0168, B:53:0x0179, B:54:0x0185, B:57:0x01b3, B:59:0x01c6, B:62:0x01cf, B:64:0x01e3, B:66:0x01f3, B:68:0x01f9, B:81:0x0217, B:82:0x0221, B:84:0x022f, B:86:0x0235, B:91:0x024a, B:95:0x0259, B:96:0x0269, B:98:0x029c, B:101:0x02b7, B:103:0x02be, B:105:0x02cd, B:107:0x02d3, B:108:0x02e2, B:110:0x02ec, B:111:0x033c, B:113:0x0363, B:117:0x037a, B:119:0x0384, B:120:0x03ac, B:123:0x03c4, B:126:0x0403, B:134:0x0393, B:138:0x03a4, B:139:0x02fd, B:141:0x0303, B:145:0x0317, B:147:0x0329, B:156:0x0199, B:166:0x010f, B:170:0x0036, B:196:0x00a4, B:177:0x0043, B:179:0x004b, B:181:0x004f, B:185:0x005d, B:188:0x007b), top: B:2:0x0001, inners: #5 }] */ /* JADX WARN: Removed duplicated region for block: B:117:0x037a A[Catch: SettingNotFoundException -> 0x03a3, all -> 0x0408, TRY_ENTER, TryCatch #5 {SettingNotFoundException -> 0x03a3, blocks: (B:117:0x037a, B:119:0x0384, B:134:0x0393), top: B:115:0x0378, outer: #3 }] */ /* JADX WARN: Removed duplicated region for block: B:122:0x03c3 */ /* JADX WARN: Removed duplicated region for block: B:125:0x03fe */ /* JADX WARN: Removed duplicated region for block: B:131:0x0401 */ /* JADX WARN: Removed duplicated region for block: B:134:0x0393 A[Catch: SettingNotFoundException -> 0x03a3, all -> 0x0408, TRY_LEAVE, TryCatch #5 {SettingNotFoundException -> 0x03a3, blocks: (B:117:0x037a, B:119:0x0384, B:134:0x0393), top: B:115:0x0378, outer: #3 }] */ /* JADX WARN: Removed duplicated region for block: B:139:0x02fd A[Catch: all -> 0x0408, TryCatch #3 {, blocks: (B:3:0x0001, B:6:0x000f, B:10:0x0019, B:14:0x002a, B:16:0x00ae, B:19:0x00ba, B:22:0x00c9, B:24:0x00d2, B:27:0x00f1, B:29:0x00fa, B:31:0x00fe, B:32:0x00e7, B:36:0x0103, B:42:0x012a, B:44:0x014e, B:45:0x0155, B:47:0x0159, B:50:0x0168, B:53:0x0179, B:54:0x0185, B:57:0x01b3, B:59:0x01c6, B:62:0x01cf, B:64:0x01e3, B:66:0x01f3, B:68:0x01f9, B:81:0x0217, B:82:0x0221, B:84:0x022f, B:86:0x0235, B:91:0x024a, B:95:0x0259, B:96:0x0269, B:98:0x029c, B:101:0x02b7, B:103:0x02be, B:105:0x02cd, B:107:0x02d3, B:108:0x02e2, B:110:0x02ec, B:111:0x033c, B:113:0x0363, B:117:0x037a, B:119:0x0384, B:120:0x03ac, B:123:0x03c4, B:126:0x0403, B:134:0x0393, B:138:0x03a4, B:139:0x02fd, B:141:0x0303, B:145:0x0317, B:147:0x0329, B:156:0x0199, B:166:0x010f, B:170:0x0036, B:196:0x00a4, B:177:0x0043, B:179:0x004b, B:181:0x004f, B:185:0x005d, B:188:0x007b), top: B:2:0x0001, inners: #5 }] */ /* JADX WARN: Removed duplicated region for block: B:164:0x01b1 */ /* JADX WARN: Removed duplicated region for block: B:165:0x0129 */ /* JADX WARN: Removed duplicated region for block: B:18:0x00b8 */ /* JADX WARN: Removed duplicated region for block: B:38:0x010d A[ADDED_TO_REGION] */ /* JADX WARN: Removed duplicated region for block: B:41:0x0127 */ /* JADX WARN: Removed duplicated region for block: B:44:0x014e A[Catch: all -> 0x0408, TryCatch #3 {, blocks: (B:3:0x0001, B:6:0x000f, B:10:0x0019, B:14:0x002a, B:16:0x00ae, B:19:0x00ba, B:22:0x00c9, B:24:0x00d2, B:27:0x00f1, B:29:0x00fa, B:31:0x00fe, B:32:0x00e7, B:36:0x0103, B:42:0x012a, B:44:0x014e, B:45:0x0155, B:47:0x0159, B:50:0x0168, B:53:0x0179, B:54:0x0185, B:57:0x01b3, B:59:0x01c6, B:62:0x01cf, B:64:0x01e3, B:66:0x01f3, B:68:0x01f9, B:81:0x0217, B:82:0x0221, B:84:0x022f, B:86:0x0235, B:91:0x024a, B:95:0x0259, B:96:0x0269, B:98:0x029c, B:101:0x02b7, B:103:0x02be, B:105:0x02cd, B:107:0x02d3, B:108:0x02e2, B:110:0x02ec, B:111:0x033c, B:113:0x0363, B:117:0x037a, B:119:0x0384, B:120:0x03ac, B:123:0x03c4, B:126:0x0403, B:134:0x0393, B:138:0x03a4, B:139:0x02fd, B:141:0x0303, B:145:0x0317, B:147:0x0329, B:156:0x0199, B:166:0x010f, B:170:0x0036, B:196:0x00a4, B:177:0x0043, B:179:0x004b, B:181:0x004f, B:185:0x005d, B:188:0x007b), top: B:2:0x0001, inners: #5 }] */ /* JADX WARN: Removed duplicated region for block: B:47:0x0159 A[Catch: all -> 0x0408, TryCatch #3 {, blocks: (B:3:0x0001, B:6:0x000f, B:10:0x0019, B:14:0x002a, B:16:0x00ae, B:19:0x00ba, B:22:0x00c9, B:24:0x00d2, B:27:0x00f1, B:29:0x00fa, B:31:0x00fe, B:32:0x00e7, B:36:0x0103, B:42:0x012a, B:44:0x014e, B:45:0x0155, B:47:0x0159, B:50:0x0168, B:53:0x0179, B:54:0x0185, B:57:0x01b3, B:59:0x01c6, B:62:0x01cf, B:64:0x01e3, B:66:0x01f3, B:68:0x01f9, B:81:0x0217, B:82:0x0221, B:84:0x022f, B:86:0x0235, B:91:0x024a, B:95:0x0259, B:96:0x0269, B:98:0x029c, B:101:0x02b7, B:103:0x02be, B:105:0x02cd, B:107:0x02d3, B:108:0x02e2, B:110:0x02ec, B:111:0x033c, B:113:0x0363, B:117:0x037a, B:119:0x0384, B:120:0x03ac, B:123:0x03c4, B:126:0x0403, B:134:0x0393, B:138:0x03a4, B:139:0x02fd, B:141:0x0303, B:145:0x0317, B:147:0x0329, B:156:0x0199, B:166:0x010f, B:170:0x0036, B:196:0x00a4, B:177:0x0043, B:179:0x004b, B:181:0x004f, B:185:0x005d, B:188:0x007b), top: B:2:0x0001, inners: #5 }] */ /* JADX WARN: Removed duplicated region for block: B:50:0x0168 A[Catch: all -> 0x0408, TryCatch #3 {, blocks: (B:3:0x0001, B:6:0x000f, B:10:0x0019, B:14:0x002a, B:16:0x00ae, B:19:0x00ba, B:22:0x00c9, B:24:0x00d2, B:27:0x00f1, B:29:0x00fa, B:31:0x00fe, B:32:0x00e7, B:36:0x0103, B:42:0x012a, B:44:0x014e, B:45:0x0155, B:47:0x0159, B:50:0x0168, B:53:0x0179, B:54:0x0185, B:57:0x01b3, B:59:0x01c6, B:62:0x01cf, B:64:0x01e3, B:66:0x01f3, B:68:0x01f9, B:81:0x0217, B:82:0x0221, B:84:0x022f, B:86:0x0235, B:91:0x024a, B:95:0x0259, B:96:0x0269, B:98:0x029c, B:101:0x02b7, B:103:0x02be, B:105:0x02cd, B:107:0x02d3, B:108:0x02e2, B:110:0x02ec, B:111:0x033c, B:113:0x0363, B:117:0x037a, B:119:0x0384, B:120:0x03ac, B:123:0x03c4, B:126:0x0403, B:134:0x0393, B:138:0x03a4, B:139:0x02fd, B:141:0x0303, B:145:0x0317, B:147:0x0329, B:156:0x0199, B:166:0x010f, B:170:0x0036, B:196:0x00a4, B:177:0x0043, B:179:0x004b, B:181:0x004f, B:185:0x005d, B:188:0x007b), top: B:2:0x0001, inners: #5 }] */ /* JADX WARN: Removed duplicated region for block: B:59:0x01c6 A[Catch: all -> 0x0408, TryCatch #3 {, blocks: (B:3:0x0001, B:6:0x000f, B:10:0x0019, B:14:0x002a, B:16:0x00ae, B:19:0x00ba, B:22:0x00c9, B:24:0x00d2, B:27:0x00f1, B:29:0x00fa, B:31:0x00fe, B:32:0x00e7, B:36:0x0103, B:42:0x012a, B:44:0x014e, B:45:0x0155, B:47:0x0159, B:50:0x0168, B:53:0x0179, B:54:0x0185, B:57:0x01b3, B:59:0x01c6, B:62:0x01cf, B:64:0x01e3, B:66:0x01f3, B:68:0x01f9, B:81:0x0217, B:82:0x0221, B:84:0x022f, B:86:0x0235, B:91:0x024a, B:95:0x0259, B:96:0x0269, B:98:0x029c, B:101:0x02b7, B:103:0x02be, B:105:0x02cd, B:107:0x02d3, B:108:0x02e2, B:110:0x02ec, B:111:0x033c, B:113:0x0363, B:117:0x037a, B:119:0x0384, B:120:0x03ac, B:123:0x03c4, B:126:0x0403, B:134:0x0393, B:138:0x03a4, B:139:0x02fd, B:141:0x0303, B:145:0x0317, B:147:0x0329, B:156:0x0199, B:166:0x010f, B:170:0x0036, B:196:0x00a4, B:177:0x0043, B:179:0x004b, B:181:0x004f, B:185:0x005d, B:188:0x007b), top: B:2:0x0001, inners: #5 }] */ /* JADX WARN: Removed duplicated region for block: B:64:0x01e3 A[Catch: all -> 0x0408, TryCatch #3 {, blocks: (B:3:0x0001, B:6:0x000f, B:10:0x0019, B:14:0x002a, B:16:0x00ae, B:19:0x00ba, B:22:0x00c9, B:24:0x00d2, B:27:0x00f1, B:29:0x00fa, B:31:0x00fe, B:32:0x00e7, B:36:0x0103, B:42:0x012a, B:44:0x014e, B:45:0x0155, B:47:0x0159, B:50:0x0168, B:53:0x0179, B:54:0x0185, B:57:0x01b3, B:59:0x01c6, B:62:0x01cf, B:64:0x01e3, B:66:0x01f3, B:68:0x01f9, B:81:0x0217, B:82:0x0221, B:84:0x022f, B:86:0x0235, B:91:0x024a, B:95:0x0259, B:96:0x0269, B:98:0x029c, B:101:0x02b7, B:103:0x02be, B:105:0x02cd, B:107:0x02d3, B:108:0x02e2, B:110:0x02ec, B:111:0x033c, B:113:0x0363, B:117:0x037a, B:119:0x0384, B:120:0x03ac, B:123:0x03c4, B:126:0x0403, B:134:0x0393, B:138:0x03a4, B:139:0x02fd, B:141:0x0303, B:145:0x0317, B:147:0x0329, B:156:0x0199, B:166:0x010f, B:170:0x0036, B:196:0x00a4, B:177:0x0043, B:179:0x004b, B:181:0x004f, B:185:0x005d, B:188:0x007b), top: B:2:0x0001, inners: #5 }] */ /* JADX WARN: Removed duplicated region for block: B:98:0x029c A[Catch: all -> 0x0408, TryCatch #3 {, blocks: (B:3:0x0001, B:6:0x000f, B:10:0x0019, B:14:0x002a, B:16:0x00ae, B:19:0x00ba, B:22:0x00c9, B:24:0x00d2, B:27:0x00f1, B:29:0x00fa, B:31:0x00fe, B:32:0x00e7, B:36:0x0103, B:42:0x012a, B:44:0x014e, B:45:0x0155, B:47:0x0159, B:50:0x0168, B:53:0x0179, B:54:0x0185, B:57:0x01b3, B:59:0x01c6, B:62:0x01cf, B:64:0x01e3, B:66:0x01f3, B:68:0x01f9, B:81:0x0217, B:82:0x0221, B:84:0x022f, B:86:0x0235, B:91:0x024a, B:95:0x0259, B:96:0x0269, B:98:0x029c, B:101:0x02b7, B:103:0x02be, B:105:0x02cd, B:107:0x02d3, B:108:0x02e2, B:110:0x02ec, B:111:0x033c, B:113:0x0363, B:117:0x037a, B:119:0x0384, B:120:0x03ac, B:123:0x03c4, B:126:0x0403, B:134:0x0393, B:138:0x03a4, B:139:0x02fd, B:141:0x0303, B:145:0x0317, B:147:0x0329, B:156:0x0199, B:166:0x010f, B:170:0x0036, B:196:0x00a4, B:177:0x0043, B:179:0x004b, B:181:0x004f, B:185:0x005d, B:188:0x007b), top: B:2:0x0001, inners: #5 }] */ /* JADX WARN: Type inference failed for: r0v1, types: [z4.k] */ /* JADX WARN: Type inference failed for: r6v0 */ /* JADX WARN: Type inference failed for: r6v1 */ /* JADX WARN: Type inference failed for: r6v20, types: [java.lang.Object, java.lang.String] */ /* JADX WARN: Type inference failed for: r6v21 */ /* JADX WARN: Type inference failed for: r6v25 */ /* JADX WARN: Type inference failed for: r6v30 */ /* JADX WARN: Type inference failed for: r6v36 */ /* JADX WARN: Type inference failed for: r6v37 */ /* JADX WARN: Type inference failed for: r6v4 */ /* JADX WARN: Type inference failed for: r6v5 */ /* JADX WARN: Unsupported multi-entry loop pattern (BACK_EDGE: B:133:0x03ab -> B:120:0x03ac). Please report as a decompilation issue!!! */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct code enable 'Show inconsistent code' option in preferences */ private synchronized z4.k n(boolean r13) { /* Method dump skipped, instructions count: 1035 To view this dump change 'Code comments level' option to 'DEBUG' */ throw new UnsupportedOperationException("Method not decompiled: com.vungle.warren.VungleApiClient.n(boolean):z4.k"); } private z4.k o() { com.vungle.warren.model.j jVar = (com.vungle.warren.model.j) this.f7919y.T("config_extension", com.vungle.warren.model.j.class).get(this.f7916v.a(), TimeUnit.MILLISECONDS); String d10 = jVar != null ? jVar.d("config_extension") : RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED; if (TextUtils.isEmpty(d10)) { return null; } z4.k kVar = new z4.k(); kVar.r("config_extension", d10); return kVar; } public static String p() { return D; } private z4.k u() { String str; String str2; long j10; String str3; z4.k kVar = new z4.k(); com.vungle.warren.model.j jVar = (com.vungle.warren.model.j) this.f7919y.T("consentIsImportantToVungle", com.vungle.warren.model.j.class).get(this.f7916v.a(), TimeUnit.MILLISECONDS); String str4 = RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED; if (jVar != null) { str = jVar.d("consent_status"); str2 = jVar.d("consent_source"); j10 = jVar.c("timestamp").longValue(); str3 = jVar.d("consent_message_version"); } else { str = "unknown"; str2 = "no_interaction"; j10 = 0; str3 = RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED; } z4.k kVar2 = new z4.k(); kVar2.r("consent_status", str); kVar2.r("consent_source", str2); kVar2.q("consent_timestamp", Long.valueOf(j10)); if (!TextUtils.isEmpty(str3)) { str4 = str3; } kVar2.r("consent_message_version", str4); kVar.o("gdpr", kVar2); com.vungle.warren.model.j jVar2 = (com.vungle.warren.model.j) this.f7919y.T("ccpaIsImportantToVungle", com.vungle.warren.model.j.class).get(); String d10 = jVar2 != null ? jVar2.d("ccpa_status") : "opted_in"; z4.k kVar3 = new z4.k(); kVar3.r("status", d10); kVar.o("ccpa", kVar3); if (z.d().c() != z.b.COPPA_NOTSET) { z4.k kVar4 = new z4.k(); kVar4.p("is_coppa", Boolean.valueOf(z.d().c().a())); kVar.o("coppa", kVar4); } return kVar; } private void x() { this.f7895a.c(new b()); } public d8.b A(z4.k kVar) { if (this.f7900f == null) { throw new IllegalStateException("API Client not configured yet! Must call /config first."); } z4.k kVar2 = new z4.k(); kVar2.o("device", m()); kVar2.o("app", this.f7907m); kVar2.o("request", kVar); kVar2.o("user", u()); z4.k o10 = o(); if (o10 != null) { kVar2.o("ext", o10); } return this.f7912r.reportAd(p(), this.f7900f, kVar2); } public d8.b B() { if (this.f7898d == null) { throw new IllegalStateException("API Client not configured yet! Must call /config first."); } HashMap hashMap = new HashMap(2); z4.h u10 = this.f7907m.u("id"); String str = RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED; hashMap.put("app_id", u10 != null ? u10.j() : RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED); z4.k m10 = m(); if (z.d().f()) { z4.h u11 = m10.u("ifa"); if (u11 != null) { str = u11.j(); } hashMap.put("ifa", str); } return this.f7897c.reportNew(p(), this.f7898d, hashMap); } public d8.b C(String str, String str2, boolean z10, z4.k kVar) { if (this.f7899e == null) { throw new IllegalStateException("API Client not configured yet! Must call /config first."); } z4.k kVar2 = new z4.k(); kVar2.o("device", m()); kVar2.o("app", this.f7907m); z4.k u10 = u(); if (kVar != null) { u10.o("vision", kVar); } kVar2.o("user", u10); z4.k o10 = o(); if (o10 != null) { kVar2.o("ext", o10); } z4.k kVar3 = new z4.k(); z4.g gVar = new z4.g(); gVar.o(str); kVar3.o("placements", gVar); kVar3.p("header_bidding", Boolean.valueOf(z10)); if (!TextUtils.isEmpty(str2)) { kVar3.r("ad_size", str2); } kVar2.o("request", kVar3); return this.f7912r.ads(p(), this.f7899e, kVar2); } public d8.b D(z4.k kVar) { if (this.f7902h == null) { throw new IllegalStateException("API Client not configured yet! Must call /config first."); } z4.k kVar2 = new z4.k(); kVar2.o("device", m()); kVar2.o("app", this.f7907m); kVar2.o("request", kVar); kVar2.o("user", u()); z4.k o10 = o(); if (o10 != null) { kVar2.o("ext", o10); } return this.f7897c.ri(p(), this.f7902h, kVar2); } public d8.b E(Collection collection) { if (this.f7905k == null) { throw new IllegalStateException("API Client not configured yet! Must call /config first."); } if (collection == null || collection.isEmpty()) { throw new IllegalArgumentException("Cannot send analytics when bust and session data is empty"); } z4.k kVar = new z4.k(); kVar.o("device", m()); kVar.o("app", this.f7907m); z4.k kVar2 = new z4.k(); z4.g gVar = new z4.g(collection.size()); Iterator it = collection.iterator(); while (it.hasNext()) { com.vungle.warren.model.h hVar = (com.vungle.warren.model.h) it.next(); for (int i10 = 0; i10 < hVar.b().length; i10++) { z4.k kVar3 = new z4.k(); kVar3.r("target", hVar.d() == 1 ? "campaign" : "creative"); kVar3.r("id", hVar.c()); kVar3.r("event_id", hVar.b()[i10]); gVar.p(kVar3); } } if (gVar.size() > 0) { kVar2.o("cache_bust", gVar); } kVar.o("request", kVar2); return this.f7912r.sendBiAnalytics(p(), this.f7905k, kVar); } public d8.b F(z4.k kVar) { if (this.f7903i != null) { return this.f7912r.sendLog(p(), this.f7903i, kVar); } throw new IllegalStateException("API Client not configured yet! Must call /config first."); } public d8.b G(z4.g gVar) { if (this.f7905k == null) { throw new IllegalStateException("API Client not configured yet! Must call /config first."); } z4.k kVar = new z4.k(); kVar.o("device", m()); kVar.o("app", this.f7907m); z4.k kVar2 = new z4.k(); kVar2.o("session_events", gVar); kVar.o("request", kVar2); return this.f7912r.sendBiAnalytics(p(), this.f7905k, kVar); } void H(String str) { I(str, this.f7907m); } public void J(boolean z10) { this.f7918x = z10; } d8.b L(String str, boolean z10, String str2) { z4.k kVar = new z4.k(); kVar.o("device", m()); kVar.o("app", this.f7907m); kVar.o("user", u()); z4.k kVar2 = new z4.k(); z4.k kVar3 = new z4.k(); kVar3.r("reference_id", str); kVar3.p("is_auto_cached", Boolean.valueOf(z10)); kVar2.o("placement", kVar3); kVar2.r("ad_token", str2); kVar.o("request", kVar2); return this.f7911q.willPlayAd(p(), this.f7901g, kVar); } void g(boolean z10) { com.vungle.warren.model.j jVar = new com.vungle.warren.model.j("isPlaySvcAvailable"); jVar.e("isPlaySvcAvailable", Boolean.valueOf(z10)); this.f7919y.h0(jVar); } public d8.b h(long j10) { if (this.f7904j == null) { throw new IllegalStateException("API Client not configured yet! Must call /config first."); } z4.k kVar = new z4.k(); kVar.o("device", m()); kVar.o("app", this.f7907m); kVar.o("user", u()); z4.k kVar2 = new z4.k(); kVar2.q("last_cache_bust", Long.valueOf(j10)); kVar.o("request", kVar2); return this.f7912r.cacheBust(p(), this.f7904j, kVar); } boolean i() { return this.f7908n && !TextUtils.isEmpty(this.f7901g); } public d8.e j() { z4.k kVar = new z4.k(); kVar.o("device", n(true)); kVar.o("app", this.f7907m); kVar.o("user", u()); z4.k o10 = o(); if (o10 != null) { kVar.o("ext", o10); } d8.e c10 = this.f7897c.config(p(), kVar).c(); if (!c10.e()) { return c10; } z4.k kVar2 = (z4.k) c10.a(); String str = C; Log.d(str, "Config Response: " + kVar2); if (com.vungle.warren.model.m.e(kVar2, "sleep")) { Log.e(str, "Error Initializing Vungle. Please try again. " + (com.vungle.warren.model.m.e(kVar2, "info") ? kVar2.u("info").j() : RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED)); throw new com.vungle.warren.error.a(3); } if (!com.vungle.warren.model.m.e(kVar2, "endpoints")) { Log.e(str, "Error Initializing Vungle. Please try again. "); throw new com.vungle.warren.error.a(3); } z4.k w10 = kVar2.w("endpoints"); n9.y q10 = n9.y.q(w10.u("new").j()); n9.y q11 = n9.y.q(w10.u("ads").j()); n9.y q12 = n9.y.q(w10.u("will_play_ad").j()); n9.y q13 = n9.y.q(w10.u("report_ad").j()); n9.y q14 = n9.y.q(w10.u("ri").j()); n9.y q15 = n9.y.q(w10.u("log").j()); n9.y q16 = n9.y.q(w10.u("cache_bust").j()); n9.y q17 = n9.y.q(w10.u("sdk_bi").j()); if (q10 == null || q11 == null || q12 == null || q13 == null || q14 == null || q15 == null || q16 == null || q17 == null) { Log.e(str, "Error Initializing Vungle. Please try again. "); throw new com.vungle.warren.error.a(3); } this.f7898d = q10.toString(); this.f7899e = q11.toString(); this.f7901g = q12.toString(); this.f7900f = q13.toString(); this.f7902h = q14.toString(); this.f7903i = q15.toString(); this.f7904j = q16.toString(); this.f7905k = q17.toString(); z4.k w11 = kVar2.w("will_play_ad"); this.f7909o = w11.u("request_timeout").e(); this.f7908n = w11.u("enabled").b(); this.f7913s = com.vungle.warren.model.m.a(kVar2.w("viewability"), "om", false); if (this.f7908n) { Log.v(str, "willPlayAd is enabled, generating a timeout client."); this.f7911q = new d8.a(this.f7910p.s().g(this.f7909o, TimeUnit.MILLISECONDS).b(), "https://api.vungle.com/").a(Vungle._instance.appID); } if (q()) { this.A.c(); } else { c0.l().w(new r.b().d(h8.c.OM_SDK).b(h8.a.ENABLED, false).c()); } return c10; } public boolean q() { return this.f7913s; } Boolean r() { Boolean bool = null; try { GoogleApiAvailabilityLight googleApiAvailabilityLight = GoogleApiAvailabilityLight.getInstance(); if (googleApiAvailabilityLight == null) { return null; } bool = Boolean.valueOf(googleApiAvailabilityLight.isGooglePlayServicesAvailable(this.f7896b) == 0); g(bool.booleanValue()); return bool; } catch (Exception unused) { Log.w(C, "Unexpected exception from Play services lib."); return bool; } catch (NoClassDefFoundError unused2) { Log.w(C, "Play services Not available"); Boolean bool2 = Boolean.FALSE; try { g(false); return bool2; } catch (d.a unused3) { Log.w(C, "Failure to write GPS availability to DB"); return bool2; } } } Boolean s() { com.vungle.warren.model.j jVar = (com.vungle.warren.model.j) this.f7919y.T("isPlaySvcAvailable", com.vungle.warren.model.j.class).get(this.f7916v.a(), TimeUnit.MILLISECONDS); if (jVar != null) { return jVar.a("isPlaySvcAvailable"); } return null; } public long t(d8.e eVar) { try { return Long.parseLong(eVar.d().c("Retry-After")) * 1000; } catch (NumberFormatException unused) { return 0L; } } public void v() { w(this.f7896b); } synchronized void w(Context context) { String str; z4.k kVar = new z4.k(); kVar.r("bundle", context.getPackageName()); try { str = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionName; } catch (PackageManager.NameNotFoundException unused) { str = null; } if (str == null) { str = "1.0"; } kVar.r("ver", str); z4.k kVar2 = new z4.k(); String str2 = Build.MANUFACTURER; kVar2.r("make", str2); kVar2.r("model", Build.MODEL); kVar2.r("osv", Build.VERSION.RELEASE); kVar2.r("carrier", ((TelephonyManager) context.getSystemService("phone")).getNetworkOperatorName()); kVar2.r("os", "Amazon".equals(str2) ? "amazon" : MetricCommonTags.METRIC_COMMON_TAG_PLATFORM_ANDROID); DisplayMetrics displayMetrics = new DisplayMetrics(); ((WindowManager) context.getSystemService("window")).getDefaultDisplay().getMetrics(displayMetrics); kVar2.q("w", Integer.valueOf(displayMetrics.widthPixels)); kVar2.q(com.vungle.warren.utility.h.f8597a, Integer.valueOf(displayMetrics.heightPixels)); try { String a10 = this.f7895a.a(); this.f7920z = a10; kVar2.r("ua", a10); x(); } catch (Exception e10) { Log.e(C, "Cannot Get UserAgent. Setting Default Device UserAgent." + e10.getLocalizedMessage()); } this.f7906l = kVar2; this.f7907m = kVar; this.f7915u = r(); K(); } public Boolean y() { if (this.f7915u == null) { this.f7915u = s(); } if (this.f7915u == null) { this.f7915u = r(); } return this.f7915u; } public boolean z(String str) { boolean z10; NetworkSecurityPolicy networkSecurityPolicy; NetworkSecurityPolicy networkSecurityPolicy2; if (TextUtils.isEmpty(str) || n9.y.q(str) == null) { c0.l().w(new r.b().d(h8.c.TPAT).b(h8.a.SUCCESS, false).a(h8.a.REASON, "Invalid URL").a(h8.a.URL, str).c()); throw new MalformedURLException("Invalid URL : " + str); } try { String host = new URL(str).getHost(); int i10 = Build.VERSION.SDK_INT; if (i10 >= 24) { networkSecurityPolicy2 = NetworkSecurityPolicy.getInstance(); z10 = networkSecurityPolicy2.isCleartextTrafficPermitted(host); } else if (i10 >= 23) { networkSecurityPolicy = NetworkSecurityPolicy.getInstance(); z10 = networkSecurityPolicy.isCleartextTrafficPermitted(); } else { z10 = true; } if (!z10 && URLUtil.isHttpUrl(str)) { c0.l().w(new r.b().d(h8.c.TPAT).b(h8.a.SUCCESS, false).a(h8.a.REASON, "Clear Text Traffic is blocked").a(h8.a.URL, str).c()); throw new d("Clear Text Traffic is blocked"); } try { d8.e c10 = this.f7897c.pingTPAT(this.f7920z, str).c(); if (c10 == null) { c0.l().w(new r.b().d(h8.c.TPAT).b(h8.a.SUCCESS, false).a(h8.a.REASON, "Error on pinging TPAT").a(h8.a.URL, str).c()); } else if (!c10.e()) { c0.l().w(new r.b().d(h8.c.TPAT).b(h8.a.SUCCESS, false).a(h8.a.REASON, c10.b() + ": " + c10.f()).a(h8.a.URL, str).c()); } return true; } catch (IOException e10) { c0.l().w(new r.b().d(h8.c.TPAT).b(h8.a.SUCCESS, false).a(h8.a.REASON, e10.getMessage()).a(h8.a.URL, str).c()); Log.d(C, "Error on pinging TPAT"); return false; } } catch (MalformedURLException unused) { c0.l().w(new r.b().d(h8.c.TPAT).b(h8.a.SUCCESS, false).a(h8.a.REASON, "Invalid URL").a(h8.a.URL, str).c()); throw new MalformedURLException("Invalid URL : " + str); } } }