package com.applovin.impl; import android.os.Process; import androidx.core.util.Consumer; import com.google.firebase.perf.network.FirebasePerfUrlConnection; import java.net.HttpURLConnection; import java.net.URL; import java.net.URLConnection; import java.util.Collections; import java.util.HashMap; import java.util.Map; import java.util.concurrent.BlockingQueue; import java.util.concurrent.Executor; import java.util.concurrent.PriorityBlockingQueue; import java.util.concurrent.atomic.AtomicInteger; /* loaded from: classes.dex */ public class eg { private final PriorityBlockingQueue a = new PriorityBlockingQueue(); private final com.applovin.impl.sdk.j b; public eg(com.applovin.impl.sdk.j jVar) { this.b = jVar; } public void a(c cVar) { if (cVar != null) { this.a.add(cVar); return; } throw new IllegalArgumentException("No request specified"); } public static class b extends Thread { private final BlockingQueue a; private final com.applovin.impl.sdk.j b; private b(BlockingQueue blockingQueue, int i, com.applovin.impl.sdk.j jVar) { super("AppLovinSdk:network"); if (blockingQueue == null) { throw new IllegalArgumentException("No request queue specified"); } if (jVar != null) { this.a = blockingQueue; this.b = jVar; setPriority(((Integer) jVar.a(sj.W)).intValue()); return; } throw new IllegalArgumentException("No sdk specified"); } @Override // java.lang.Thread, java.lang.Runnable public void run() { Process.setThreadPriority(10); while (true) { try { a(); } catch (InterruptedException unused) { Thread.currentThread().interrupt(); } } } /* JADX INFO: Access modifiers changed from: private */ public static /* synthetic */ void b(c cVar, d dVar) { cVar.g.accept(dVar); } private HttpURLConnection a(c cVar) { HttpURLConnection httpURLConnection = (HttpURLConnection) ((URLConnection) FirebasePerfUrlConnection.instrument(new URL(cVar.a).openConnection())); httpURLConnection.setRequestMethod(cVar.b); httpURLConnection.setConnectTimeout(cVar.f); httpURLConnection.setReadTimeout(cVar.f); httpURLConnection.setDefaultUseCaches(false); httpURLConnection.setAllowUserInteraction(false); httpURLConnection.setUseCaches(false); httpURLConnection.setInstanceFollowRedirects(true); httpURLConnection.setDoInput(true); if (!cVar.c.isEmpty()) { for (Map.Entry entry : cVar.c.entrySet()) { httpURLConnection.setRequestProperty((String) entry.getKey(), (String) entry.getValue()); } } return httpURLConnection; } /* JADX WARN: Multi-variable type inference failed */ /* JADX WARN: Removed duplicated region for block: B:158:0x024c A[Catch: all -> 0x0256, TRY_LEAVE, TryCatch #19 {all -> 0x0256, blocks: (B:156:0x0234, B:158:0x024c), top: B:155:0x0234 }] */ /* JADX WARN: Removed duplicated region for block: B:161:0x02a1 */ /* JADX WARN: Removed duplicated region for block: B:162:0x025d A[EXC_TOP_SPLITTER, SYNTHETIC] */ /* JADX WARN: Removed duplicated region for block: B:58:0x00e9 A[Catch: all -> 0x00f3, TRY_LEAVE, TryCatch #7 {all -> 0x00f3, blocks: (B:56:0x00d1, B:58:0x00e9, B:71:0x0120), top: B:55:0x00d1 }] */ /* JADX WARN: Removed duplicated region for block: B:60:0x013b */ /* JADX WARN: Removed duplicated region for block: B:61:0x00f8 A[EXC_TOP_SPLITTER, SYNTHETIC] */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ private void b(final com.applovin.impl.eg.c r19) { /* Method dump skipped, instructions count: 751 To view this dump add '--comments-level debug' option */ throw new UnsupportedOperationException("Method not decompiled: com.applovin.impl.eg.b.b(com.applovin.impl.eg$c):void"); } /* JADX INFO: Access modifiers changed from: private */ public static /* synthetic */ void a(c cVar, d dVar) { cVar.g.accept(dVar); } private void a() { b((c) this.a.take()); } } public void a() { for (int i = 0; i < ((Integer) this.b.a(sj.V)).intValue(); i++) { new b(this.a, i, this.b).start(); } } public static class c implements Comparable { private static final AtomicInteger j = new AtomicInteger(); private final String a; private final String b; private final Map c; private final byte[] d; private final int f; private final Consumer g; private final Executor h; private final int i; private c(a aVar) { this.a = aVar.a; this.b = aVar.b; this.c = aVar.c != null ? aVar.c : Collections.emptyMap(); this.d = aVar.d; this.f = aVar.e; this.g = aVar.f; this.h = aVar.g; this.i = j.incrementAndGet(); } @Override // java.lang.Comparable /* renamed from: h, reason: merged with bridge method [inline-methods] */ public int compareTo(c cVar) { return this.i - cVar.i; } public static class a { private String a; private String b; private Map c = new HashMap(); private byte[] d; private int e; private Consumer f; private Executor g; public a a(int i) { this.e = i; return this; } public a a(Consumer consumer) { this.f = consumer; return this; } public a a(String str) { this.a = str; return this; } public a a(Executor executor) { this.g = executor; return this; } public a a(byte[] bArr) { this.d = bArr; return this; } public a b(String str) { this.b = str; return this; } public a a(String str, String str2) { this.c.put(str, str2); return this; } public a a(Map map) { if (map == null) { map = new HashMap(); } this.c = map; return this; } public c a() { return new c(this); } } } public static class d { private final int a; private final byte[] b; private final byte[] c; private final long d; private final Throwable e; public static a a() { return new a(); } public int b() { return this.a; } public long e() { return this.d; } public byte[] f() { return this.c; } private d(a aVar) { this.a = aVar.a; this.b = aVar.b; this.c = aVar.c; this.d = aVar.d; this.e = aVar.e; } public int c() { Throwable th = this.e; if (th == null) { return this.a; } throw th; } public byte[] d() { Throwable th = this.e; if (th == null) { return this.b; } throw th; } public static class a { private int a; private byte[] b; private byte[] c; private long d; private Throwable e; public a a(int i) { this.a = i; return this; } public a a(long j) { this.d = j; return this; } public a a(Throwable th) { this.e = th; return this; } public a a(byte[] bArr) { this.b = bArr; return this; } public a b(byte[] bArr) { this.c = bArr; return this; } public d a() { return new d(this); } } } }