Add decompiled APK source code (JADX)

- 28,932 files
- Full Java source code
- Smali files
- Resources

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-02-18 14:52:23 -08:00
parent cc210a65ea
commit f9d20bb3fc
26991 changed files with 2541449 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
package com.mbridge.msdk.tracker.network;
/* loaded from: classes4.dex */
public final class a extends ad {
@Override // com.mbridge.msdk.tracker.network.ad
public final int a() {
return 9;
}
public a(String str) {
super(str);
}
}

View File

@@ -0,0 +1,16 @@
package com.mbridge.msdk.tracker.network;
/* loaded from: classes4.dex */
public class aa extends ad {
@Override // com.mbridge.msdk.tracker.network.ad
public int a() {
return 7;
}
public aa(r rVar) {
super(rVar);
}
public aa() {
}
}

View File

@@ -0,0 +1,9 @@
package com.mbridge.msdk.tracker.network;
/* loaded from: classes4.dex */
public final class ab extends ad {
@Override // com.mbridge.msdk.tracker.network.ad
public final int a() {
return 8;
}
}

View File

@@ -0,0 +1,20 @@
package com.mbridge.msdk.tracker.network;
/* loaded from: classes4.dex */
public final class ac extends ad {
@Override // com.mbridge.msdk.tracker.network.ad
public final int a() {
return 0;
}
public ac() {
}
public ac(String str) {
super(str);
}
public ac(Throwable th) {
super(th);
}
}

View File

@@ -0,0 +1,57 @@
package com.mbridge.msdk.tracker.network;
/* loaded from: classes4.dex */
public abstract class ad extends Exception {
public final r a;
private long b;
private int c;
private String d;
public abstract int a();
public final void a(int i) {
this.c = i;
}
public final void a(long j) {
this.b = j;
}
public final void a(String str) {
this.d = str;
}
public final int b() {
return this.c;
}
public final String c() {
return this.d;
}
public ad() {
this.c = 0;
this.d = "";
this.a = null;
}
public ad(r rVar) {
this.c = 0;
this.d = "";
this.a = rVar;
}
public ad(String str) {
super(str);
this.c = 0;
this.d = "";
this.a = null;
}
public ad(Throwable th) {
super(th);
this.c = 0;
this.d = "";
this.a = null;
}
}

View File

@@ -0,0 +1,87 @@
package com.mbridge.msdk.tracker.network;
import android.util.Log;
import csdk.gluads.Consts;
import java.util.List;
import java.util.Locale;
/* loaded from: classes4.dex */
public class ae {
public static String a = "TrackManager_Volley";
private static final String b = "com.mbridge.msdk.tracker.network.ae";
public static void a(String str, Object... objArr) {
}
public static void b(String str, Object... objArr) {
d(str, objArr);
}
public static void c(String str, Object... objArr) {
Log.e(a, d(str, objArr));
}
public static void a(Throwable th, String str, Object... objArr) {
Log.e(a, d(str, objArr), th);
}
private static String d(String str, Object... objArr) {
String str2;
if (objArr != null) {
str = String.format(Locale.US, str, objArr);
}
StackTraceElement[] stackTrace = new Throwable().fillInStackTrace().getStackTrace();
int i = 2;
while (true) {
if (i >= stackTrace.length) {
str2 = "<unknown>";
break;
}
if (!stackTrace[i].getClassName().equals(b)) {
String className = stackTrace[i].getClassName();
String substring = className.substring(className.lastIndexOf(46) + 1);
str2 = substring.substring(substring.lastIndexOf(36) + 1) + Consts.STRING_PERIOD + stackTrace[i].getMethodName();
break;
}
i++;
}
return String.format(Locale.US, "[%d] %s: %s", Long.valueOf(Thread.currentThread().getId()), str2, str);
}
public static class a {
private final List<C0236a> a;
private boolean b;
/* renamed from: com.mbridge.msdk.tracker.network.ae$a$a, reason: collision with other inner class name */
public static class C0236a {
public final String a;
public final long b;
public final long c;
}
public final void finalize() throws Throwable {
long j;
if (this.b) {
return;
}
this.b = true;
if (this.a.size() == 0) {
j = 0;
} else {
long j2 = this.a.get(0).c;
List<C0236a> list = this.a;
j = list.get(list.size() - 1).c - j2;
}
if (j > 0) {
long j3 = this.a.get(0).c;
ae.b("(%-4d ms) %s", Long.valueOf(j), "Request on the loose");
for (C0236a c0236a : this.a) {
long j4 = c0236a.c;
ae.b("(+%-4d) [%2d] %s", Long.valueOf(j4 - j3), Long.valueOf(c0236a.b), c0236a.a);
j3 = j4;
}
}
ae.c("Marker log finalized without finish() - uncaught exit point for request", new Object[0]);
}
}
}

View File

@@ -0,0 +1,22 @@
package com.mbridge.msdk.tracker.network;
import java.util.Collections;
import java.util.List;
import java.util.Map;
/* loaded from: classes4.dex */
public interface b {
public static class a {
public byte[] a;
public String b;
public long c;
public long d;
public long e;
public long f;
public Map<String, String> g = Collections.emptyMap();
public List<h> h;
}
void a(String str, a aVar);
}

View File

@@ -0,0 +1,6 @@
package com.mbridge.msdk.tracker.network;
/* loaded from: classes4.dex */
public interface c {
String a(u<?> uVar);
}

View File

@@ -0,0 +1,16 @@
package com.mbridge.msdk.tracker.network;
/* loaded from: classes4.dex */
public final class d extends aa {
@Override // com.mbridge.msdk.tracker.network.aa, com.mbridge.msdk.tracker.network.ad
public final int a() {
return 1;
}
public d(r rVar) {
super(rVar);
}
public d() {
}
}

View File

@@ -0,0 +1,47 @@
package com.mbridge.msdk.tracker.network;
import com.mbridge.msdk.playercommon.exoplayer2.source.chunk.ChunkedTrackBlacklistUtil;
/* loaded from: classes4.dex */
public final class e implements z {
private int a;
private long b;
private int c;
private final int d;
@Override // com.mbridge.msdk.tracker.network.z
public final int a() {
return this.a;
}
@Override // com.mbridge.msdk.tracker.network.z
public final boolean a(ad adVar) {
int i = this.c + 1;
this.c = i;
return i <= this.d;
}
@Override // com.mbridge.msdk.tracker.network.z
public final long b() {
return this.b;
}
@Override // com.mbridge.msdk.tracker.network.z
public final int c() {
return this.c;
}
public e() {
this(2500, 1);
}
public e(int i, int i2) {
this(i, ChunkedTrackBlacklistUtil.DEFAULT_TRACK_BLACKLIST_MS, i2);
}
public e(int i, long j, int i2) {
this.b = j;
this.a = i;
this.d = i2;
}
}

View File

@@ -0,0 +1,16 @@
package com.mbridge.msdk.tracker.network;
/* loaded from: classes4.dex */
public final class f extends ad {
@Override // com.mbridge.msdk.tracker.network.ad
public final int a() {
return 2;
}
public f() {
}
public f(Throwable th) {
super(th);
}
}

View File

@@ -0,0 +1,67 @@
package com.mbridge.msdk.tracker.network;
import android.os.Handler;
import java.util.concurrent.Executor;
/* loaded from: classes4.dex */
public final class g implements x {
private final Executor a;
public g(final Handler handler) {
this.a = new Executor() { // from class: com.mbridge.msdk.tracker.network.g.1
@Override // java.util.concurrent.Executor
public final void execute(Runnable runnable) {
handler.post(runnable);
}
};
}
public g(Executor executor) {
this.a = executor;
}
@Override // com.mbridge.msdk.tracker.network.x
public final void a(u<?> uVar, ad adVar) {
this.a.execute(new a(uVar, w.a(adVar), null));
}
public static class a implements Runnable {
private final u a;
private final w b;
private final Runnable c;
public a(u uVar, w wVar, Runnable runnable) {
this.a = uVar;
this.b = wVar;
this.c = runnable;
}
@Override // java.lang.Runnable
public final void run() {
if (this.a.n()) {
this.a.c("canceled-at-delivery");
return;
}
w wVar = this.b;
ad adVar = wVar.c;
if (adVar == null) {
this.a.a((u) wVar.a);
} else {
this.a.b(adVar);
}
if (!this.b.d) {
this.a.c("done");
}
Runnable runnable = this.c;
if (runnable != null) {
runnable.run();
}
}
}
@Override // com.mbridge.msdk.tracker.network.x
public final void a(u<?> uVar, w<?> wVar) {
uVar.w();
this.a.execute(new a(uVar, wVar, null));
}
}

View File

@@ -0,0 +1,42 @@
package com.mbridge.msdk.tracker.network;
import android.text.TextUtils;
import com.ironsource.v8;
/* loaded from: classes4.dex */
public final class h {
private final String a;
private final String b;
public final String a() {
return this.a;
}
public final String b() {
return this.b;
}
public h(String str, String str2) {
this.a = str;
this.b = str2;
}
public final boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null || h.class != obj.getClass()) {
return false;
}
h hVar = (h) obj;
return TextUtils.equals(this.a, hVar.a) && TextUtils.equals(this.b, hVar.b);
}
public final int hashCode() {
return (this.a.hashCode() * 31) + this.b.hashCode();
}
public final String toString() {
return "Header[name=" + this.a + ",value=" + this.b + v8.i.e;
}
}

View File

@@ -0,0 +1,89 @@
package com.mbridge.msdk.tracker.network;
import android.text.TextUtils;
import com.mbridge.msdk.foundation.tools.af;
import com.mbridge.msdk.playercommon.exoplayer2.source.chunk.ChunkedTrackBlacklistUtil;
import java.util.HashMap;
import java.util.Map;
/* loaded from: classes4.dex */
public abstract class i<T> extends u<T> {
protected static final String a = "i";
private final long b;
private Map<String, String> c;
private Map<String, String> d;
private z e;
private boolean f;
public final void a(boolean z) {
this.f = z;
}
public i(int i, String str, int i2, String str2, long j) {
super(i, str, i2, str2);
this.f = false;
if (j > 0) {
this.b = j;
} else {
this.b = ChunkedTrackBlacklistUtil.DEFAULT_TRACK_BLACKLIST_MS;
}
}
public final void a(Map<String, String> map) {
if (map == null || map.isEmpty()) {
return;
}
if (this.c == null) {
this.c = new HashMap();
}
try {
this.c.putAll(map);
} catch (Exception e) {
af.b(a, "addParams error: " + e.getMessage());
}
}
public final void a(String str, String str2) {
if (TextUtils.isEmpty(str)) {
return;
}
if (this.d == null) {
this.d = new HashMap();
}
try {
this.d.put(str, str2);
} catch (Exception e) {
af.b(a, "addHeader error: " + e.getMessage());
}
}
@Override // com.mbridge.msdk.tracker.network.u
public final Map<String, String> c() {
if (this.d == null) {
this.d = new HashMap();
}
this.d.put("Charset", "UTF-8");
return this.d;
}
@Override // com.mbridge.msdk.tracker.network.u
public final Map<String, String> a() {
if (this.c == null) {
this.c = new HashMap();
}
return this.c;
}
@Override // com.mbridge.msdk.tracker.network.u
public final boolean d() {
return this.f && com.mbridge.msdk.foundation.same.d.a(f(), k());
}
@Override // com.mbridge.msdk.tracker.network.u
public final z b() {
if (this.e == null) {
this.e = new e(30000, this.b, 3);
}
return this.e;
}
}

View File

@@ -0,0 +1,73 @@
package com.mbridge.msdk.tracker.network;
import com.mbridge.msdk.foundation.tools.af;
import com.mbridge.msdk.tracker.network.w;
import java.nio.charset.StandardCharsets;
import org.json.JSONException;
import org.json.JSONObject;
/* loaded from: classes4.dex */
public final class j extends i<JSONObject> implements w.a {
private final k<JSONObject> b;
@Override // com.mbridge.msdk.tracker.network.u
public final /* bridge */ /* synthetic */ void a(Object obj) {
}
public j(int i, String str, String str2, long j, k<JSONObject> kVar) {
super(i, str, 0, str2, j);
this.b = kVar;
a((w.a) this);
}
@Override // com.mbridge.msdk.tracker.network.u
public final w<JSONObject> a(r rVar) {
try {
String str = new String(rVar.b, StandardCharsets.UTF_8);
if (rVar.a == 204) {
w<JSONObject> a = w.a(new JSONObject(), com.mbridge.msdk.tracker.network.toolbox.f.a(rVar));
a(a, rVar);
return a;
}
w<JSONObject> a2 = w.a(new JSONObject(str), com.mbridge.msdk.tracker.network.toolbox.f.a(rVar));
a(a2, rVar);
return a2;
} catch (JSONException e) {
af.b(i.a, e.getMessage());
w<JSONObject> a3 = w.a(new t(e));
b(a3);
return a3;
} catch (Throwable th) {
w<JSONObject> a4 = w.a(new ac(th));
b(a4);
return a4;
}
}
private void b(w<JSONObject> wVar) {
k<JSONObject> kVar = this.b;
if (kVar != null) {
try {
kVar.b(this, wVar, wVar.c.a);
} catch (Exception e) {
af.b(i.a, e.getMessage());
}
}
}
private void a(w<JSONObject> wVar, r rVar) {
k<JSONObject> kVar = this.b;
if (kVar != null) {
try {
kVar.a(this, wVar, rVar);
} catch (Exception e) {
af.b(i.a, e.getMessage());
}
}
}
@Override // com.mbridge.msdk.tracker.network.w.a
public final void a(ad adVar) {
b(w.a(adVar));
}
}

View File

@@ -0,0 +1,8 @@
package com.mbridge.msdk.tracker.network;
/* loaded from: classes4.dex */
public interface k<T> {
void a(i<T> iVar, w<T> wVar, r rVar);
void b(i<T> iVar, w<T> wVar, r rVar);
}

View File

@@ -0,0 +1,57 @@
package com.mbridge.msdk.tracker.network;
import com.mbridge.msdk.foundation.tools.af;
import com.mbridge.msdk.tracker.network.w;
import java.nio.charset.StandardCharsets;
/* loaded from: classes4.dex */
public final class l extends i<String> implements w.a {
private final k<String> b;
@Override // com.mbridge.msdk.tracker.network.u
public final /* bridge */ /* synthetic */ void a(Object obj) {
}
public l(int i, String str, String str2, long j, k<String> kVar) {
super(i, str, 0, str2, j);
this.b = kVar;
a((w.a) this);
}
@Override // com.mbridge.msdk.tracker.network.u
public final w<String> a(r rVar) {
try {
w<String> a = w.a(new String(rVar.b, StandardCharsets.UTF_8), com.mbridge.msdk.tracker.network.toolbox.f.a(rVar));
k<String> kVar = this.b;
if (kVar != null) {
try {
kVar.a(this, a, rVar);
} catch (Exception e) {
af.b(i.a, "parseNetworkResponse error: ", e);
}
}
return a;
} catch (Throwable th) {
af.b(i.a, "parseNetworkResponse error: ", th);
w<String> a2 = w.a(new ac(th));
b(a2);
return a2;
}
}
private void b(w<String> wVar) {
k<String> kVar = this.b;
if (kVar != null) {
try {
kVar.b(this, wVar, wVar.c.a);
} catch (Exception e) {
af.b(i.a, "parseNetworkResponse error: ", e);
}
}
}
@Override // com.mbridge.msdk.tracker.network.w.a
public final void a(ad adVar) {
b(w.a(adVar));
}
}

View File

@@ -0,0 +1,34 @@
package com.mbridge.msdk.tracker.network;
/* loaded from: classes4.dex */
public class m {
private static final String a = "m";
private static volatile m b;
private v c;
private m() {
}
public static m a() {
if (b == null) {
synchronized (m.class) {
try {
if (b == null) {
b = new m();
}
} finally {
}
}
}
return b;
}
public final v b() {
if (this.c == null) {
v a2 = com.mbridge.msdk.tracker.network.toolbox.n.a(new com.mbridge.msdk.tracker.network.toolbox.b(new com.mbridge.msdk.tracker.network.toolbox.k()), null, 10, new com.mbridge.msdk.tracker.network.toolbox.j());
this.c = a2;
a2.a();
}
return this.c;
}
}

View File

@@ -0,0 +1,6 @@
package com.mbridge.msdk.tracker.network;
/* loaded from: classes4.dex */
public interface n {
r a(u<?> uVar) throws ad;
}

View File

@@ -0,0 +1,77 @@
package com.mbridge.msdk.tracker.network;
import android.net.TrafficStats;
import android.os.Process;
import android.os.SystemClock;
import java.util.concurrent.BlockingQueue;
/* loaded from: classes4.dex */
public final class o implements Runnable {
private final BlockingQueue<u<?>> a;
private final n b;
private final b c;
private final x d;
private volatile boolean e = false;
public o(BlockingQueue<u<?>> blockingQueue, n nVar, b bVar, x xVar) {
this.a = blockingQueue;
this.b = nVar;
this.c = bVar;
this.d = xVar;
}
@Override // java.lang.Runnable
public final void run() {
Process.setThreadPriority(10);
while (true) {
try {
u<?> take = this.a.take();
long elapsedRealtime = SystemClock.elapsedRealtime();
take.b(3);
try {
try {
if (take.n()) {
take.c("network-discard-cancelled");
take.y();
} else {
TrafficStats.setThreadStatsTag(take.j());
r a = this.b.a(take);
if (a.e && take.x()) {
take.c("not-modified");
take.y();
} else {
w<?> a2 = take.a(a);
if (take.r() && a2.b != null) {
this.c.a(take.l(), a2.b);
}
take.w();
this.d.a(take, a2);
take.a(a2);
}
}
} catch (ad e) {
e.a(SystemClock.elapsedRealtime() - elapsedRealtime);
this.d.a(take, e);
take.y();
} catch (Exception e2) {
ae.a(e2, "Unhandled exception %s", e2.toString());
ac acVar = new ac(e2);
acVar.a(SystemClock.elapsedRealtime() - elapsedRealtime);
this.d.a(take, acVar);
take.y();
}
take.b(4);
} catch (Throwable th) {
take.b(4);
throw th;
}
} catch (InterruptedException unused) {
if (this.e) {
Thread.currentThread().interrupt();
return;
}
ae.c("Ignoring spurious interrupt of NetworkDispatcher thread; use quit() to terminate it", new Object[0]);
}
}
}
}

View File

@@ -0,0 +1,16 @@
package com.mbridge.msdk.tracker.network;
/* loaded from: classes4.dex */
public class p extends ad {
@Override // com.mbridge.msdk.tracker.network.ad
public int a() {
return 3;
}
public p() {
}
public p(Throwable th) {
super(th);
}
}

View File

@@ -0,0 +1,501 @@
package com.mbridge.msdk.tracker.network;
import android.os.SystemClock;
import android.text.TextUtils;
import com.mbridge.msdk.MBridgeConstans;
import com.mbridge.msdk.foundation.tools.af;
import com.mbridge.msdk.thrid.okhttp.Call;
import com.mbridge.msdk.thrid.okhttp.Connection;
import com.mbridge.msdk.thrid.okhttp.Handshake;
import com.mbridge.msdk.thrid.okhttp.Headers;
import com.mbridge.msdk.thrid.okhttp.Protocol;
import com.mbridge.msdk.thrid.okhttp.Request;
import com.mbridge.msdk.thrid.okhttp.Response;
import com.mbridge.msdk.thrid.okhttp.Route;
import com.mbridge.msdk.thrid.okhttp.TlsVersion;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.Proxy;
import java.net.URLEncoder;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicInteger;
import org.json.JSONObject;
/* loaded from: classes4.dex */
public final class q {
private volatile long A;
private volatile long B;
private volatile long C;
private volatile long D;
private volatile long E;
private volatile long F;
private volatile long G;
private volatile List<InetAddress> H;
private volatile InetSocketAddress I;
private volatile Proxy J;
private volatile Handshake K;
private volatile Protocol L;
private volatile IOException M;
private volatile Exception O;
private long Q;
private long R;
private long S;
private long T;
private volatile String d;
private volatile long f;
private volatile String j;
private volatile String k;
private volatile long s;
private volatile long t;
private volatile IOException u;
private volatile long v;
private volatile long w;
private volatile long x;
private volatile long y;
private volatile long z;
protected volatile String a = "";
private volatile String b = "";
private volatile String c = "";
private volatile String e = "";
private volatile int g = -1;
private volatile String h = "";
private volatile int i = -1;
private volatile String l = "okhttp";
private volatile boolean m = false;
private final AtomicInteger n = new AtomicInteger(0);
private volatile String o = "";
private volatile long p = 0;
private volatile long q = 0;
private volatile long r = 0;
private volatile boolean N = false;
private volatile boolean P = false;
public final void a(int i) {
this.i = i;
}
public final void a(long j) {
this.Q = j;
}
public final void a(Handshake handshake) {
this.K = handshake;
}
public final void a(Exception exc) {
this.O = exc;
}
public final void a(String str) {
this.a = str;
}
public final void b(long j) {
this.R = j;
}
public final void b(String str) {
this.c = str;
}
public final void c(long j) {
this.S = j;
}
public final void c(String str) {
this.b = str;
}
public final void d(long j) {
this.T = j;
}
public final void d(String str) {
this.h = str;
}
public final long f() {
return this.r;
}
public final void f(long j) {
this.r = j;
}
public final void h(long j) {
this.q = j;
}
public final void i(long j) {
this.p = j;
}
public q(String str, String str2) {
this.d = "";
this.j = "un_known";
this.k = "";
this.j = str;
this.k = str2;
this.d = UUID.randomUUID().toString();
}
private String g() {
return TextUtils.isEmpty(this.c) ? "" : this.c;
}
private String h() {
return TextUtils.isEmpty(this.b) ? "" : this.b;
}
private String i() {
return TextUtils.isEmpty(this.d) ? "" : this.d;
}
private String j() {
return TextUtils.isEmpty(this.e) ? "" : this.e;
}
private String k() {
try {
return TextUtils.isEmpty(this.a) ? "" : URLEncoder.encode(this.a, "UTF-8");
} catch (UnsupportedEncodingException unused) {
return "";
}
}
private String l() {
return TextUtils.isEmpty(this.j) ? "un_known" : this.j;
}
private String m() {
return TextUtils.isEmpty(this.k) ? "" : this.k;
}
private int n() {
return this.n.getAndAdd(0);
}
public final void a(Call call) {
this.s = SystemClock.elapsedRealtime();
}
public final void a() {
this.v = SystemClock.elapsedRealtime();
}
public final void a(List<InetAddress> list) {
this.w = SystemClock.elapsedRealtime();
this.H = list;
}
private String o() {
if (this.H == null || this.H.isEmpty()) {
return "";
}
StringBuilder sb = new StringBuilder();
for (int i = 0; i < this.H.size(); i++) {
try {
InetAddress inetAddress = this.H.get(i);
if (inetAddress != null) {
sb.append(inetAddress.getHostAddress());
if (i != this.H.size() - 1) {
sb.append(",");
}
}
} catch (Exception e) {
if (MBridgeConstans.DEBUG) {
af.b("NetworkMonitor", "getDnsResult ", e);
}
}
}
return sb.toString();
}
private String p() {
if (this.I != null) {
try {
InetAddress address = this.I.getAddress();
if (address == null) {
return "";
}
String hostAddress = address.getHostAddress();
return TextUtils.isEmpty(hostAddress) ? "" : hostAddress;
} catch (Exception e) {
if (MBridgeConstans.DEBUG) {
af.b("NetworkMonitor", "getAddress ", e);
}
}
}
return "";
}
private String q() {
if (this.K != null) {
try {
TlsVersion tlsVersion = this.K.tlsVersion();
return tlsVersion == null ? "" : tlsVersion.javaName();
} catch (Exception e) {
if (MBridgeConstans.DEBUG) {
af.b("NetworkMonitor", "getTlsVersion ", e);
}
}
}
return "";
}
public final void a(InetSocketAddress inetSocketAddress, Proxy proxy) {
this.x = SystemClock.elapsedRealtime();
this.I = inetSocketAddress;
this.J = proxy;
this.N = true;
}
public final void a(Protocol protocol, IOException iOException) {
this.y = SystemClock.elapsedRealtime();
this.L = protocol;
this.M = iOException;
}
public final void a(Connection connection) {
this.m = !this.N;
if (!this.m || connection == null) {
return;
}
try {
this.L = connection.protocol();
Route route = connection.route();
if (route != null) {
this.I = route.socketAddress();
this.J = route.proxy();
}
this.K = connection.handshake();
} catch (Exception e) {
if (MBridgeConstans.DEBUG) {
af.b("NetworkMonitor", "connectionAcquired ", e);
}
}
}
public final void b() {
this.z = SystemClock.elapsedRealtime();
}
public final void a(Request request) {
this.A = SystemClock.elapsedRealtime();
}
public final void c() {
this.B = SystemClock.elapsedRealtime();
}
public final void e(long j) {
this.C = SystemClock.elapsedRealtime();
}
public final void d() {
this.D = SystemClock.elapsedRealtime();
}
public final void a(Response response) {
this.E = SystemClock.elapsedRealtime();
if (response != null) {
try {
Headers headers = response.headers();
if (headers != null) {
String str = headers.get("Content-Type");
if (TextUtils.isEmpty(str)) {
str = "";
}
this.o = str;
}
} catch (Exception e) {
this.o = "unknown";
if (MBridgeConstans.DEBUG) {
af.b("NetworkMonitor", "responseHeadersEnd ", e);
}
}
}
}
public final void e() {
this.F = SystemClock.elapsedRealtime();
}
public final void g(long j) {
this.G = SystemClock.elapsedRealtime();
}
public final void a(IOException iOException) {
long elapsedRealtime = SystemClock.elapsedRealtime();
this.t = elapsedRealtime;
this.u = iOException;
if (iOException != null) {
if (this.v == 0) {
this.v = elapsedRealtime;
}
if (this.w == 0) {
this.w = elapsedRealtime;
}
if (this.x == 0) {
this.x = elapsedRealtime;
}
if (this.y == 0) {
this.y = elapsedRealtime;
}
if (this.z == 0) {
this.z = elapsedRealtime;
}
if (this.A == 0) {
this.A = elapsedRealtime;
}
if (this.B == 0) {
this.B = elapsedRealtime;
}
if (this.C == 0) {
this.C = elapsedRealtime;
}
if (this.D == 0) {
this.D = elapsedRealtime;
}
if (this.E == 0) {
this.E = elapsedRealtime;
}
if (this.F == 0) {
this.F = elapsedRealtime;
}
if (this.G == 0) {
this.G = elapsedRealtime;
}
}
}
private String r() {
try {
if (this.M != null) {
String name = this.M.getClass().getName();
String message = this.M.getMessage();
if (!TextUtils.isEmpty(message)) {
return a("connection: %s ", name, message);
}
}
if (this.u != null) {
String name2 = this.u.getClass().getName();
String message2 = this.u.getMessage();
if (!TextUtils.isEmpty(message2)) {
return a("call: %s ", name2, message2);
}
}
if (this.O == null) {
return "un_known";
}
String name3 = this.O.getClass().getName();
String message3 = this.O.getMessage();
return !TextUtils.isEmpty(message3) ? a("error: %s ", name3, message3) : "un_known";
} catch (Exception e) {
if (!MBridgeConstans.DEBUG) {
return "un_known";
}
af.b("NetworkMonitor", "getError ", e);
return "un_known";
}
}
private static String a(String str, String str2, String str3) {
StringBuilder sb = new StringBuilder();
Object[] objArr = new Object[1];
if (TextUtils.isEmpty(str2)) {
str2 = "IOException";
}
objArr[0] = str2;
sb.append(String.format(str, objArr));
sb.append(TextUtils.isEmpty(str3) ? "" : str3.replaceAll("[\\n\\r]", " "));
return sb.toString();
}
public final void j(long j) {
this.e = UUID.randomUUID().toString();
this.f = j;
this.n.addAndGet(1);
this.M = null;
this.u = null;
this.O = null;
this.s = 0L;
this.t = 0L;
this.v = 0L;
this.w = 0L;
this.x = 0L;
this.y = 0L;
this.z = 0L;
this.A = 0L;
this.B = 0L;
this.C = 0L;
this.D = 0L;
this.E = 0L;
this.F = 0L;
this.G = 0L;
this.q = 0L;
this.r = 0L;
this.m = false;
this.g = -1;
this.i = -1;
this.h = "";
this.o = "";
this.p = 0L;
this.P = false;
this.P = true;
try {
JSONObject jSONObject = new JSONObject();
jSONObject.put("key", "m_request_start");
jSONObject.put("uuid", i());
jSONObject.put("request_uuid", j());
jSONObject.put("lrid", h());
jSONObject.put("url", k());
jSONObject.put("timeout", this.Q);
jSONObject.put("timeout_connection", this.R);
jSONObject.put("timeout_read", this.S);
jSONObject.put("timeout_write", this.T);
jSONObject.put("scene", l());
jSONObject.put("method", m());
jSONObject.put("adtp", g());
jSONObject.put("http_stack", this.l);
jSONObject.put("retry_count", n() - 1);
jSONObject.put("request_wait_duration", this.f);
com.mbridge.msdk.tracker.e a = a(jSONObject, "m_request_start");
if (MBridgeConstans.DEBUG) {
af.a("NetworkMonitor_" + l(), "request start monitor = " + jSONObject.toString());
}
com.mbridge.msdk.foundation.same.report.d.d.a().c().a(a);
} catch (Throwable th) {
if (MBridgeConstans.DEBUG) {
af.b("NetworkMonitor", "reportRequestStart ", th);
}
}
}
private static com.mbridge.msdk.tracker.e a(JSONObject jSONObject, String str) {
com.mbridge.msdk.tracker.e eVar = new com.mbridge.msdk.tracker.e(str);
eVar.b(0);
eVar.a(0);
eVar.a(com.mbridge.msdk.foundation.same.report.c.c());
eVar.a(jSONObject);
return eVar;
}
/* JADX WARN: Removed duplicated region for block: B:22:0x0103 A[Catch: all -> 0x00dc, TryCatch #0 {all -> 0x00dc, blocks: (B:7:0x000c, B:10:0x00bc, B:12:0x00d5, B:13:0x00e0, B:16:0x00eb, B:19:0x00f4, B:20:0x00fa, B:22:0x0103, B:23:0x0109, B:25:0x0129, B:26:0x0139, B:28:0x019c, B:29:0x01c9), top: B:6:0x000c }] */
/* JADX WARN: Removed duplicated region for block: B:25:0x0129 A[Catch: all -> 0x00dc, TryCatch #0 {all -> 0x00dc, blocks: (B:7:0x000c, B:10:0x00bc, B:12:0x00d5, B:13:0x00e0, B:16:0x00eb, B:19:0x00f4, B:20:0x00fa, B:22:0x0103, B:23:0x0109, B:25:0x0129, B:26:0x0139, B:28:0x019c, B:29:0x01c9), top: B:6:0x000c }] */
/* JADX WARN: Removed duplicated region for block: B:28:0x019c A[Catch: all -> 0x00dc, TryCatch #0 {all -> 0x00dc, blocks: (B:7:0x000c, B:10:0x00bc, B:12:0x00d5, B:13:0x00e0, B:16:0x00eb, B:19:0x00f4, B:20:0x00fa, B:22:0x0103, B:23:0x0109, B:25:0x0129, B:26:0x0139, B:28:0x019c, B:29:0x01c9), top: B:6:0x000c }] */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public final void b(int r9) {
/*
Method dump skipped, instructions count: 481
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: com.mbridge.msdk.tracker.network.q.b(int):void");
}
}

View File

@@ -0,0 +1,47 @@
package com.mbridge.msdk.tracker.network;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
/* loaded from: classes4.dex */
public final class r {
public final int a;
public final byte[] b;
public final Map<String, String> c;
public final List<h> d;
public final boolean e;
public final long f;
public r(int i, byte[] bArr, boolean z, long j, List<h> list) {
this(i, bArr, a(list), list, z, j);
}
private r(int i, byte[] bArr, Map<String, String> map, List<h> list, boolean z, long j) {
this.a = i;
this.b = bArr;
this.c = map;
if (list == null) {
this.d = null;
} else {
this.d = Collections.unmodifiableList(list);
}
this.e = z;
this.f = j;
}
private static Map<String, String> a(List<h> list) {
if (list == null) {
return null;
}
if (list.isEmpty()) {
return Collections.emptyMap();
}
TreeMap treeMap = new TreeMap(String.CASE_INSENSITIVE_ORDER);
for (h hVar : list) {
treeMap.put(hVar.a(), hVar.b());
}
return treeMap;
}
}

View File

@@ -0,0 +1,16 @@
package com.mbridge.msdk.tracker.network;
/* loaded from: classes4.dex */
public final class s extends p {
@Override // com.mbridge.msdk.tracker.network.p, com.mbridge.msdk.tracker.network.ad
public final int a() {
return 4;
}
public s() {
}
public s(Throwable th) {
super(th);
}
}

View File

@@ -0,0 +1,16 @@
package com.mbridge.msdk.tracker.network;
/* loaded from: classes4.dex */
public final class t extends ad {
@Override // com.mbridge.msdk.tracker.network.ad
public final int a() {
return 5;
}
public t() {
}
public t(Throwable th) {
super(th);
}
}

View File

@@ -0,0 +1,217 @@
package com.mbridge.msdk.tracker.network.toolbox;
import com.mbridge.msdk.system.NoProGuard;
import com.mbridge.msdk.thrid.okhttp.Call;
import com.mbridge.msdk.thrid.okhttp.Connection;
import com.mbridge.msdk.thrid.okhttp.EventListener;
import com.mbridge.msdk.thrid.okhttp.Handshake;
import com.mbridge.msdk.thrid.okhttp.Protocol;
import com.mbridge.msdk.thrid.okhttp.Request;
import com.mbridge.msdk.thrid.okhttp.Response;
import com.mbridge.msdk.tracker.network.q;
import java.io.IOException;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.Proxy;
import java.util.List;
/* loaded from: classes4.dex */
public class OKHTTPEventListener extends EventListener implements NoProGuard {
private static String TAG = "OKHTTPEventListener";
private final q monitor;
@Override // com.mbridge.msdk.thrid.okhttp.EventListener
public void connectionReleased(Call call, Connection connection) {
}
public OKHTTPEventListener(q qVar) {
this.monitor = qVar;
}
@Override // com.mbridge.msdk.thrid.okhttp.EventListener
public void callStart(Call call) {
q qVar = this.monitor;
if (qVar == null) {
return;
}
qVar.a(call);
}
@Override // com.mbridge.msdk.thrid.okhttp.EventListener
public void dnsStart(Call call, String str) {
q qVar = this.monitor;
if (qVar == null) {
return;
}
qVar.d("dns_start");
this.monitor.a();
}
@Override // com.mbridge.msdk.thrid.okhttp.EventListener
public void dnsEnd(Call call, String str, List<InetAddress> list) {
q qVar = this.monitor;
if (qVar == null) {
return;
}
qVar.d("dns_end");
this.monitor.a(list);
}
@Override // com.mbridge.msdk.thrid.okhttp.EventListener
public void connectStart(Call call, InetSocketAddress inetSocketAddress, Proxy proxy) {
q qVar = this.monitor;
if (qVar == null) {
return;
}
qVar.d("connection_start");
this.monitor.a(inetSocketAddress, proxy);
}
@Override // com.mbridge.msdk.thrid.okhttp.EventListener
public void secureConnectStart(Call call) {
q qVar = this.monitor;
if (qVar == null) {
return;
}
qVar.d("secure_connect_start");
}
@Override // com.mbridge.msdk.thrid.okhttp.EventListener
public void secureConnectEnd(Call call, Handshake handshake) {
q qVar = this.monitor;
if (qVar == null) {
return;
}
qVar.d("secure_connect_end");
this.monitor.a(handshake);
}
@Override // com.mbridge.msdk.thrid.okhttp.EventListener
public void connectEnd(Call call, InetSocketAddress inetSocketAddress, Proxy proxy, Protocol protocol) {
q qVar = this.monitor;
if (qVar == null) {
return;
}
qVar.d("connection_end");
this.monitor.a(protocol, (IOException) null);
}
@Override // com.mbridge.msdk.thrid.okhttp.EventListener
public void connectFailed(Call call, InetSocketAddress inetSocketAddress, Proxy proxy, Protocol protocol, IOException iOException) {
q qVar = this.monitor;
if (qVar == null) {
return;
}
qVar.a(protocol, iOException);
}
@Override // com.mbridge.msdk.thrid.okhttp.EventListener
public void connectionAcquired(Call call, Connection connection) {
q qVar = this.monitor;
if (qVar == null) {
return;
}
qVar.a(connection);
}
@Override // com.mbridge.msdk.thrid.okhttp.EventListener
public void requestHeadersStart(Call call) {
q qVar = this.monitor;
if (qVar == null) {
return;
}
qVar.d("request_header_start");
this.monitor.b();
}
@Override // com.mbridge.msdk.thrid.okhttp.EventListener
public void requestHeadersEnd(Call call, Request request) {
q qVar = this.monitor;
if (qVar == null) {
return;
}
qVar.d("request_header_end");
this.monitor.a(request);
}
@Override // com.mbridge.msdk.thrid.okhttp.EventListener
public void requestBodyStart(Call call) {
q qVar = this.monitor;
if (qVar == null) {
return;
}
qVar.d("request_body_start");
this.monitor.c();
}
@Override // com.mbridge.msdk.thrid.okhttp.EventListener
public void requestBodyEnd(Call call, long j) {
q qVar = this.monitor;
if (qVar == null) {
return;
}
qVar.d("request_body_end");
this.monitor.e(j);
this.monitor.d("transmission_start");
}
@Override // com.mbridge.msdk.thrid.okhttp.EventListener
public void responseHeadersStart(Call call) {
q qVar = this.monitor;
if (qVar == null) {
return;
}
qVar.d("response_header_start");
this.monitor.d();
this.monitor.d("transmission_end");
}
@Override // com.mbridge.msdk.thrid.okhttp.EventListener
public void responseHeadersEnd(Call call, Response response) {
q qVar = this.monitor;
if (qVar == null) {
return;
}
qVar.d("response_header_end");
this.monitor.a(response);
}
@Override // com.mbridge.msdk.thrid.okhttp.EventListener
public void responseBodyStart(Call call) {
q qVar = this.monitor;
if (qVar == null) {
return;
}
qVar.d("response_body_start");
this.monitor.e();
}
@Override // com.mbridge.msdk.thrid.okhttp.EventListener
public void responseBodyEnd(Call call, long j) {
q qVar = this.monitor;
if (qVar == null) {
return;
}
qVar.d("response_body_end");
this.monitor.h(j);
this.monitor.g(j);
}
@Override // com.mbridge.msdk.thrid.okhttp.EventListener
public void callEnd(Call call) {
q qVar = this.monitor;
if (qVar == null) {
return;
}
qVar.a((IOException) null);
}
@Override // com.mbridge.msdk.thrid.okhttp.EventListener
public void callFailed(Call call, IOException iOException) {
q qVar = this.monitor;
if (qVar == null) {
return;
}
qVar.a(iOException);
}
}

View File

@@ -0,0 +1,10 @@
package com.mbridge.msdk.tracker.network.toolbox;
import com.mbridge.msdk.tracker.network.u;
import java.io.IOException;
import java.util.Map;
/* loaded from: classes4.dex */
public abstract class a {
public abstract g a(u<?> uVar, Map<String, String> map) throws IOException;
}

View File

@@ -0,0 +1,68 @@
package com.mbridge.msdk.tracker.network.toolbox;
import android.text.TextUtils;
import com.mbridge.msdk.tracker.network.q;
import com.mbridge.msdk.tracker.network.u;
/* loaded from: classes4.dex */
public final class b implements com.mbridge.msdk.tracker.network.n {
protected final c a;
private final a b;
public b(a aVar) {
this(aVar, new c(4096));
}
private b(a aVar, c cVar) {
this.b = aVar;
this.a = cVar;
}
/* JADX WARN: Removed duplicated region for block: B:42:0x0116 */
/* JADX WARN: Removed duplicated region for block: B:45:0x011e */
/* JADX WARN: Removed duplicated region for block: B:47:0x01b4 */
/* JADX WARN: Removed duplicated region for block: B:58:0x01ca A[SYNTHETIC] */
/* JADX WARN: Removed duplicated region for block: B:61:0x012d */
@Override // com.mbridge.msdk.tracker.network.n
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public final com.mbridge.msdk.tracker.network.r a(com.mbridge.msdk.tracker.network.u<?> r20) throws com.mbridge.msdk.tracker.network.ad {
/*
Method dump skipped, instructions count: 499
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: com.mbridge.msdk.tracker.network.toolbox.b.a(com.mbridge.msdk.tracker.network.u):com.mbridge.msdk.tracker.network.r");
}
private static void a(q qVar, int i, Exception exc) {
if (qVar != null) {
try {
qVar.a(exc);
qVar.b(i);
} catch (Exception unused) {
}
}
}
private static q b(u<?> uVar) {
if (uVar == null) {
return null;
}
try {
if (!uVar.d() || TextUtils.isEmpty(uVar.k())) {
return null;
}
q qVar = new q(uVar.f(), uVar.i() == 0 ? "GET" : "POST");
qVar.d("queue");
qVar.c(uVar.d("local_id"));
qVar.b(uVar.d("ad_type"));
qVar.a(uVar.v());
uVar.a(qVar);
return qVar;
} catch (Exception unused) {
return null;
}
}
}

View File

@@ -0,0 +1,60 @@
package com.mbridge.msdk.tracker.network.toolbox;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
/* loaded from: classes4.dex */
public final class c {
protected static final Comparator<byte[]> a = new Comparator<byte[]>() { // from class: com.mbridge.msdk.tracker.network.toolbox.c.1
@Override // java.util.Comparator
public final /* bridge */ /* synthetic */ int compare(byte[] bArr, byte[] bArr2) {
return bArr.length - bArr2.length;
}
};
private final List<byte[]> b = new ArrayList();
private final List<byte[]> c = new ArrayList(64);
private int d = 0;
private final int e;
public c(int i) {
this.e = i;
}
public final synchronized byte[] a(int i) {
for (int i2 = 0; i2 < this.c.size(); i2++) {
byte[] bArr = this.c.get(i2);
if (bArr.length >= i) {
this.d -= bArr.length;
this.c.remove(i2);
this.b.remove(bArr);
return bArr;
}
}
return new byte[i];
}
public final synchronized void a(byte[] bArr) {
if (bArr != null) {
if (bArr.length <= this.e) {
this.b.add(bArr);
int binarySearch = Collections.binarySearch(this.c, bArr, a);
if (binarySearch < 0) {
binarySearch = (-binarySearch) - 1;
}
this.c.add(binarySearch, bArr);
this.d += bArr.length;
a();
}
}
}
private synchronized void a() {
while (this.d > this.e) {
byte[] remove = this.b.remove(0);
this.c.remove(remove);
this.d -= remove.length;
}
}
}

View File

@@ -0,0 +1,21 @@
package com.mbridge.msdk.tracker.network.toolbox;
import android.text.TextUtils;
import com.mbridge.msdk.tracker.network.u;
/* loaded from: classes4.dex */
public final class d {
public static String a(String str, u<?> uVar) {
if (TextUtils.isEmpty(str) || uVar == null) {
return "";
}
byte[] p = uVar.p();
if (p == null || p.length == 0) {
return str;
}
if (str.endsWith("?")) {
return str + new String(p);
}
return str + "?" + new String(p);
}
}

View File

@@ -0,0 +1,16 @@
package com.mbridge.msdk.tracker.network.toolbox;
import com.mbridge.msdk.tracker.network.u;
/* loaded from: classes4.dex */
public final class e implements com.mbridge.msdk.tracker.network.c {
@Override // com.mbridge.msdk.tracker.network.c
public final String a(u<?> uVar) {
String k = uVar.k();
int i = uVar.i();
if (i == 0) {
return k;
}
return Integer.toString(i) + '-' + k;
}
}

View File

@@ -0,0 +1,163 @@
package com.mbridge.msdk.tracker.network.toolbox;
import com.ironsource.nb;
import com.ironsource.v8;
import com.mbridge.msdk.foundation.download.Command;
import com.mbridge.msdk.tracker.network.ae;
import com.mbridge.msdk.tracker.network.b;
import com.mbridge.msdk.tracker.network.r;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.TimeZone;
import java.util.TreeSet;
import org.apache.http.protocol.HTTP;
/* loaded from: classes4.dex */
public final class f {
public static b.a a(r rVar) {
boolean z;
long j;
long j2;
long j3;
long j4;
long currentTimeMillis = System.currentTimeMillis();
Map<String, String> map = rVar.c;
if (map == null) {
return null;
}
String str = map.get(HTTP.DATE_HEADER);
long a = str != null ? a(str) : 0L;
String str2 = map.get("Cache-Control");
int i = 0;
if (str2 != null) {
String[] split = str2.split(",", 0);
z = false;
j = 0;
j2 = 0;
while (i < split.length) {
String trim = split[i].trim();
if (trim.equals("no-cache") || trim.equals("no-store")) {
return null;
}
if (trim.startsWith("max-age=")) {
try {
j = Long.parseLong(trim.substring(8));
} catch (Exception unused) {
}
} else if (trim.startsWith("stale-while-revalidate=")) {
j2 = Long.parseLong(trim.substring(23));
} else if (trim.equals("must-revalidate") || trim.equals("proxy-revalidate")) {
z = true;
}
i++;
}
i = 1;
} else {
z = false;
j = 0;
j2 = 0;
}
String str3 = map.get("Expires");
long a2 = str3 != null ? a(str3) : 0L;
String str4 = map.get("Last-Modified");
long a3 = str4 != null ? a(str4) : 0L;
String str5 = map.get(Command.HTTP_HEADER_ETAG);
if (i != 0) {
j4 = currentTimeMillis + (j * 1000);
j3 = z ? j4 : (j2 * 1000) + j4;
} else {
j3 = 0;
if (a <= 0 || a2 < a) {
j4 = 0;
} else {
j4 = currentTimeMillis + (a2 - a);
j3 = j4;
}
}
b.a aVar = new b.a();
aVar.a = rVar.b;
aVar.b = str5;
aVar.f = j4;
aVar.e = j3;
aVar.c = a;
aVar.d = a3;
aVar.g = map;
aVar.h = rVar.d;
return aVar;
}
private static long a(String str) {
try {
Date parse = b("EEE, dd MMM yyyy HH:mm:ss zzz").parse(str);
if (parse != null) {
return parse.getTime();
}
return 0L;
} catch (ParseException e) {
if ("0".equals(str) || "-1".equals(str)) {
ae.a("Unable to parse dateStr: %s, falling back to 0", str);
} else {
ae.a(e, "Unable to parse dateStr: %s, falling back to 0", str);
}
return 0L;
}
}
public static String a(long j) {
return b("EEE, dd MMM yyyy HH:mm:ss 'GMT'").format(new Date(j));
}
private static SimpleDateFormat b(String str) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(str, Locale.US);
simpleDateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
return simpleDateFormat;
}
public static List<com.mbridge.msdk.tracker.network.h> a(List<com.mbridge.msdk.tracker.network.h> list, b.a aVar) {
TreeSet treeSet = new TreeSet(String.CASE_INSENSITIVE_ORDER);
if (!list.isEmpty()) {
Iterator<com.mbridge.msdk.tracker.network.h> it = list.iterator();
while (it.hasNext()) {
treeSet.add(it.next().a());
}
}
ArrayList arrayList = new ArrayList(list);
List<com.mbridge.msdk.tracker.network.h> list2 = aVar.h;
if (list2 != null) {
if (!list2.isEmpty()) {
for (com.mbridge.msdk.tracker.network.h hVar : aVar.h) {
if (!treeSet.contains(hVar.a())) {
arrayList.add(hVar);
}
}
}
} else if (!aVar.g.isEmpty()) {
for (Map.Entry<String, String> entry : aVar.g.entrySet()) {
if (!treeSet.contains(entry.getKey())) {
arrayList.add(new com.mbridge.msdk.tracker.network.h(entry.getKey(), entry.getValue()));
}
}
}
return arrayList;
}
public static String a(Map<String, String> map) {
String str;
if (map != null && (str = map.get("Content-Type")) != null) {
String[] split = str.split(";", 0);
for (int i = 1; i < split.length; i++) {
String[] split2 = split[i].trim().split(v8.i.b, 0);
if (split2.length == 2 && split2[0].equals(nb.M)) {
return split2[1];
}
}
}
return "ISO-8859-1";
}
}

View File

@@ -0,0 +1,50 @@
package com.mbridge.msdk.tracker.network.toolbox;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.util.Collections;
import java.util.List;
/* loaded from: classes4.dex */
public final class g {
private final int a;
private final List<com.mbridge.msdk.tracker.network.h> b;
private final int c;
private final InputStream d;
private final byte[] e;
public final int a() {
return this.a;
}
public final int c() {
return this.c;
}
public g(int i, List<com.mbridge.msdk.tracker.network.h> list) {
this(i, list, -1, null);
}
public g(int i, List<com.mbridge.msdk.tracker.network.h> list, int i2, InputStream inputStream) {
this.a = i;
this.b = list;
this.c = i2;
this.d = inputStream;
this.e = null;
}
public final List<com.mbridge.msdk.tracker.network.h> b() {
return Collections.unmodifiableList(this.b);
}
public final InputStream d() {
InputStream inputStream = this.d;
if (inputStream != null) {
return inputStream;
}
if (this.e != null) {
return new ByteArrayInputStream(this.e);
}
return null;
}
}

View File

@@ -0,0 +1,186 @@
package com.mbridge.msdk.tracker.network.toolbox;
import com.google.firebase.perf.network.FirebasePerfUrlConnection;
import com.mbridge.msdk.tracker.network.u;
import java.io.DataOutputStream;
import java.io.FilterInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLSocketFactory;
import org.apache.http.client.methods.HttpDelete;
import org.apache.http.client.methods.HttpHead;
import org.apache.http.client.methods.HttpOptions;
import org.apache.http.client.methods.HttpPut;
import org.apache.http.client.methods.HttpTrace;
/* loaded from: classes4.dex */
public final class h extends com.mbridge.msdk.tracker.network.toolbox.a {
private final b a;
private final SSLSocketFactory b;
public interface b extends m {
}
public h() {
this(null);
}
private h(b bVar) {
this(bVar, null);
}
private h(b bVar, SSLSocketFactory sSLSocketFactory) {
this.a = bVar;
this.b = sSLSocketFactory;
}
@Override // com.mbridge.msdk.tracker.network.toolbox.a
public final g a(u<?> uVar, Map<String, String> map) throws IOException {
SSLSocketFactory sSLSocketFactory;
String a2 = uVar.i() == 0 ? d.a(uVar.k(), uVar) : uVar.k();
HashMap hashMap = new HashMap();
hashMap.putAll(map);
hashMap.putAll(uVar.c());
b bVar = this.a;
if (bVar != null) {
String a3 = bVar.a(a2);
if (a3 == null) {
throw new IOException("URL blocked by rewriter: " + a2);
}
a2 = a3;
}
URL url = new URL(a2);
HttpURLConnection httpURLConnection = (HttpURLConnection) ((URLConnection) FirebasePerfUrlConnection.instrument(url.openConnection()));
httpURLConnection.setInstanceFollowRedirects(HttpURLConnection.getFollowRedirects());
int u = uVar.u();
httpURLConnection.setConnectTimeout(u);
httpURLConnection.setReadTimeout(u);
boolean z = false;
httpURLConnection.setUseCaches(false);
httpURLConnection.setDoInput(true);
if ("https".equals(url.getProtocol()) && (sSLSocketFactory = this.b) != null) {
((HttpsURLConnection) httpURLConnection).setSSLSocketFactory(sSLSocketFactory);
}
try {
for (String str : hashMap.keySet()) {
httpURLConnection.setRequestProperty(str, (String) hashMap.get(str));
}
switch (uVar.i()) {
case 0:
httpURLConnection.setRequestMethod("GET");
break;
case 1:
httpURLConnection.setRequestMethod("POST");
a(httpURLConnection, uVar);
break;
case 2:
httpURLConnection.setRequestMethod(HttpPut.METHOD_NAME);
a(httpURLConnection, uVar);
break;
case 3:
httpURLConnection.setRequestMethod(HttpDelete.METHOD_NAME);
break;
case 4:
httpURLConnection.setRequestMethod(HttpHead.METHOD_NAME);
break;
case 5:
httpURLConnection.setRequestMethod(HttpOptions.METHOD_NAME);
break;
case 6:
httpURLConnection.setRequestMethod(HttpTrace.METHOD_NAME);
break;
case 7:
httpURLConnection.setRequestMethod("PATCH");
a(httpURLConnection, uVar);
break;
default:
throw new IllegalStateException("Unknown method type.");
}
int responseCode = httpURLConnection.getResponseCode();
if (responseCode == -1) {
throw new IOException("Could not retrieve response code from HttpUrlConnection.");
}
if (uVar.i() == 4 || ((100 <= responseCode && responseCode < 200) || responseCode == 204 || responseCode == 304)) {
g gVar = new g(responseCode, a(httpURLConnection.getHeaderFields()));
httpURLConnection.disconnect();
return gVar;
}
try {
return new g(responseCode, a(httpURLConnection.getHeaderFields()), httpURLConnection.getContentLength(), new a(httpURLConnection));
} catch (Throwable th) {
th = th;
z = true;
if (!z) {
httpURLConnection.disconnect();
}
throw th;
}
} catch (Throwable th2) {
th = th2;
}
}
private static List<com.mbridge.msdk.tracker.network.h> a(Map<String, List<String>> map) {
ArrayList arrayList = new ArrayList(map.size());
for (Map.Entry<String, List<String>> entry : map.entrySet()) {
if (entry.getKey() != null) {
Iterator<String> it = entry.getValue().iterator();
while (it.hasNext()) {
arrayList.add(new com.mbridge.msdk.tracker.network.h(entry.getKey(), it.next()));
}
}
}
return arrayList;
}
public static class a extends FilterInputStream {
private final HttpURLConnection a;
public a(HttpURLConnection httpURLConnection) {
super(h.b(httpURLConnection));
this.a = httpURLConnection;
}
@Override // java.io.FilterInputStream, java.io.InputStream, java.io.Closeable, java.lang.AutoCloseable
public final void close() throws IOException {
super.close();
this.a.disconnect();
}
}
/* JADX INFO: Access modifiers changed from: private */
public static InputStream b(HttpURLConnection httpURLConnection) {
try {
return httpURLConnection.getInputStream();
} catch (IOException unused) {
return httpURLConnection.getErrorStream();
}
}
private void a(HttpURLConnection httpURLConnection, u<?> uVar) throws IOException {
byte[] p = uVar.p();
if (p != null) {
a(httpURLConnection, uVar, p);
}
}
private void a(HttpURLConnection httpURLConnection, u<?> uVar, byte[] bArr) throws IOException {
httpURLConnection.setDoOutput(true);
if (!httpURLConnection.getRequestProperties().containsKey("Content-Type")) {
httpURLConnection.setRequestProperty("Content-Type", uVar.o());
}
int length = bArr.length;
DataOutputStream dataOutputStream = new DataOutputStream(httpURLConnection.getOutputStream());
dataOutputStream.write(bArr);
dataOutputStream.close();
}
}

View File

@@ -0,0 +1,67 @@
package com.mbridge.msdk.tracker.network.toolbox;
import com.mbridge.msdk.tracker.network.ad;
import com.mbridge.msdk.tracker.network.ae;
import com.mbridge.msdk.tracker.network.q;
import java.io.IOException;
import java.io.InputStream;
/* loaded from: classes4.dex */
final class i {
public static byte[] a(InputStream inputStream, int i, c cVar, q qVar) throws IOException {
byte[] bArr;
l lVar = new l(cVar, i);
if (qVar != null) {
qVar.f(0L);
}
try {
bArr = cVar.a(1024);
while (true) {
try {
int read = inputStream.read(bArr);
if (read == -1) {
break;
}
lVar.write(bArr, 0, read);
if (qVar != null) {
qVar.f(qVar.f() + read);
}
} catch (Throwable th) {
th = th;
if (inputStream != null) {
try {
inputStream.close();
} catch (IOException unused) {
ae.a("Error occurred when closing InputStream", new Object[0]);
}
}
cVar.a(bArr);
lVar.close();
throw th;
}
}
byte[] byteArray = lVar.toByteArray();
try {
inputStream.close();
} catch (IOException unused2) {
ae.a("Error occurred when closing InputStream", new Object[0]);
}
cVar.a(bArr);
lVar.close();
return byteArray;
} catch (Throwable th2) {
th = th2;
bArr = null;
}
}
public static class a {
final String a;
final ad b;
private a(String str, ad adVar) {
this.a = str;
this.b = adVar;
}
}
}

View File

@@ -0,0 +1,10 @@
package com.mbridge.msdk.tracker.network.toolbox;
import com.mbridge.msdk.tracker.network.b;
/* loaded from: classes4.dex */
public final class j implements com.mbridge.msdk.tracker.network.b {
@Override // com.mbridge.msdk.tracker.network.b
public final void a(String str, b.a aVar) {
}
}

View File

@@ -0,0 +1,151 @@
package com.mbridge.msdk.tracker.network.toolbox;
import com.mbridge.msdk.thrid.okhttp.ConnectionPool;
import com.mbridge.msdk.thrid.okhttp.Dispatcher;
import com.mbridge.msdk.thrid.okhttp.Headers;
import com.mbridge.msdk.thrid.okhttp.MediaType;
import com.mbridge.msdk.thrid.okhttp.OkHttpClient;
import com.mbridge.msdk.thrid.okhttp.Protocol;
import com.mbridge.msdk.thrid.okhttp.Request;
import com.mbridge.msdk.thrid.okhttp.RequestBody;
import com.mbridge.msdk.thrid.okhttp.Response;
import com.mbridge.msdk.thrid.okhttp.ResponseBody;
import com.mbridge.msdk.thrid.okhttp.internal.Util;
import com.mbridge.msdk.tracker.network.q;
import com.mbridge.msdk.tracker.network.u;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Map;
import java.util.concurrent.SynchronousQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import org.apache.http.client.methods.HttpOptions;
import org.apache.http.client.methods.HttpTrace;
import org.apache.http.protocol.HTTP;
/* loaded from: classes4.dex */
public final class k extends a {
private final OkHttpClient a;
public k() {
TimeUnit timeUnit = TimeUnit.SECONDS;
Dispatcher dispatcher = new Dispatcher(new ThreadPoolExecutor(0, Integer.MAX_VALUE, 60L, timeUnit, new SynchronousQueue(), Util.threadFactory("OkHttp Dispatcher", false)));
dispatcher.setMaxRequestsPerHost(50);
dispatcher.setMaxRequests(256);
OkHttpClient.Builder builder = new OkHttpClient.Builder();
builder.readTimeout(30L, timeUnit);
builder.connectTimeout(30L, timeUnit);
builder.writeTimeout(30L, timeUnit);
builder.retryOnConnectionFailure(true);
builder.connectionPool(new ConnectionPool(32, 5L, TimeUnit.MINUTES));
builder.dispatcher(dispatcher);
this.a = builder.build();
}
private static RequestBody a(u uVar) {
byte[] p;
if (uVar == null || (p = uVar.p()) == null) {
return null;
}
return RequestBody.create((MediaType) null, p);
}
@Override // com.mbridge.msdk.tracker.network.toolbox.a
public final g a(u<?> uVar, Map<String, String> map) throws IOException {
q z = uVar.z();
if (this.a == null) {
throw new IOException("okhttp client is null");
}
int u = uVar.u() <= 0 ? 30000 : uVar.u();
long v = uVar.v();
String a = uVar.i() == 0 ? d.a(uVar.k(), uVar) : uVar.k();
if (z != null) {
z.a(a);
long j = u;
z.b(j);
z.c(j);
z.d(j);
z.j(uVar.g());
}
if (z != null) {
try {
z.i(uVar.q());
} catch (Exception unused) {
}
}
ArrayList arrayList = new ArrayList();
arrayList.add(Protocol.HTTP_1_1);
arrayList.add(Protocol.HTTP_2);
OkHttpClient.Builder protocols = this.a.newBuilder().protocols(arrayList);
long j2 = u;
TimeUnit timeUnit = TimeUnit.MILLISECONDS;
OkHttpClient.Builder callTimeout = protocols.readTimeout(j2, timeUnit).connectTimeout(j2, timeUnit).writeTimeout(j2, timeUnit).callTimeout(Math.max(v, 0L), timeUnit);
if (z != null && callTimeout != null) {
try {
callTimeout.eventListener(new OKHTTPEventListener(z));
} catch (Exception unused2) {
}
}
Request.Builder builder = new Request.Builder();
for (Map.Entry<String, String> entry : uVar.c().entrySet()) {
builder.addHeader(entry.getKey(), entry.getValue());
}
builder.addHeader(HTTP.CONN_DIRECTIVE, "close");
switch (uVar.i()) {
case 0:
builder.get();
break;
case 1:
RequestBody a2 = a(uVar);
if (a2 == null) {
throw new IOException("can't create request body for post");
}
builder.post(a2);
break;
case 2:
RequestBody a3 = a(uVar);
if (a3 == null) {
throw new IOException("can't create request body for put");
}
builder.put(a3);
break;
case 3:
builder.delete();
break;
case 4:
builder.head();
break;
case 5:
builder.method(HttpOptions.METHOD_NAME, null);
break;
case 6:
builder.method(HttpTrace.METHOD_NAME, null);
break;
case 7:
RequestBody a4 = a(uVar);
if (a4 == null) {
throw new IOException("can't create request body for patch");
}
builder.patch(a4);
break;
default:
throw new IllegalStateException("Unknown method type.");
}
Response execute = callTimeout.build().newCall(builder.url(a).build()).execute();
Headers headers = execute.headers();
ArrayList arrayList2 = new ArrayList();
int size = headers.size();
for (int i = 0; i < size; i++) {
String name = headers.name(i);
String value = headers.value(i);
if (name != null) {
arrayList2.add(new com.mbridge.msdk.tracker.network.h(name, value));
}
}
ResponseBody body = execute.body();
if (body == null) {
return new g(execute.code(), arrayList2);
}
return new g(execute.code(), arrayList2, body.contentLength() > 2147483647L ? -1 : (int) body.contentLength(), body.byteStream());
}
}

View File

@@ -0,0 +1,50 @@
package com.mbridge.msdk.tracker.network.toolbox;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
/* loaded from: classes4.dex */
public final class l extends ByteArrayOutputStream {
private final c a;
public l(c cVar, int i) {
this.a = cVar;
((ByteArrayOutputStream) this).buf = cVar.a(Math.max(i, 256));
}
@Override // java.io.ByteArrayOutputStream, java.io.OutputStream, java.io.Closeable, java.lang.AutoCloseable
public final void close() throws IOException {
this.a.a(((ByteArrayOutputStream) this).buf);
((ByteArrayOutputStream) this).buf = null;
super.close();
}
public final void finalize() {
this.a.a(((ByteArrayOutputStream) this).buf);
}
private void a(int i) {
int i2 = ((ByteArrayOutputStream) this).count;
if (i2 + i <= ((ByteArrayOutputStream) this).buf.length) {
return;
}
byte[] a = this.a.a((i2 + i) * 2);
System.arraycopy(((ByteArrayOutputStream) this).buf, 0, a, 0, ((ByteArrayOutputStream) this).count);
this.a.a(((ByteArrayOutputStream) this).buf);
((ByteArrayOutputStream) this).buf = a;
}
@Override // java.io.ByteArrayOutputStream, java.io.OutputStream
public final synchronized void write(byte[] bArr, int i, int i2) {
a(i2);
if (bArr != null) {
super.write(bArr, i, i2);
}
}
@Override // java.io.ByteArrayOutputStream, java.io.OutputStream
public final synchronized void write(int i) {
a(1);
super.write(i);
}
}

View File

@@ -0,0 +1,6 @@
package com.mbridge.msdk.tracker.network.toolbox;
/* loaded from: classes4.dex */
public interface m {
String a(String str);
}

View File

@@ -0,0 +1,25 @@
package com.mbridge.msdk.tracker.network.toolbox;
import android.os.Handler;
import android.os.Looper;
import com.mbridge.msdk.tracker.network.v;
import com.mbridge.msdk.tracker.network.x;
/* loaded from: classes4.dex */
public final class n {
public static v a(com.mbridge.msdk.tracker.network.n nVar, x xVar, int i, com.mbridge.msdk.tracker.network.b bVar) {
if (nVar == null) {
nVar = new b(new h());
}
if (xVar == null) {
xVar = new com.mbridge.msdk.tracker.network.g(new Handler(Looper.getMainLooper()));
}
if (i <= 0) {
i = 4;
}
if (bVar == null) {
bVar = new j();
}
return new v(nVar, xVar, i, bVar);
}
}

View File

@@ -0,0 +1,379 @@
package com.mbridge.msdk.tracker.network;
import android.net.Uri;
import android.os.SystemClock;
import android.text.TextUtils;
import androidx.work.WorkRequest;
import com.ironsource.nb;
import com.mbridge.msdk.tracker.network.ae;
import com.mbridge.msdk.tracker.network.b;
import com.mbridge.msdk.tracker.network.w;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
/* loaded from: classes4.dex */
public abstract class u<T> implements Comparable<u<T>> {
private c a;
private String b;
private volatile q c;
private long d;
private Map<String, String> e;
private final ae.a f;
private int g;
private final String h;
private final int i;
private final String j;
private final int k;
private final Object l;
private w.a m;
private Integer n;
private v o;
private boolean p;
private boolean q;
private boolean r;
private boolean s;
private boolean t;
private z u;
private b.a v;
private a w;
private long x;
public interface a {
void a(u<?> uVar);
void a(u<?> uVar, w<?> wVar);
}
public enum b {
LOW,
NORMAL,
HIGH,
IMMEDIATE
}
/* JADX WARN: Multi-variable type inference failed */
public final u<?> a(v vVar) {
this.o = vVar;
return this;
}
public abstract w<T> a(r rVar);
public Map<String, String> a() {
return null;
}
public final void a(int i) {
this.g = i;
}
public final void a(q qVar) {
this.c = qVar;
}
public final void a(w.a aVar) {
this.m = aVar;
}
public abstract void a(T t);
/* JADX WARN: Multi-variable type inference failed */
public final u<?> b(boolean z) {
this.p = z;
return this;
}
public z b() {
return this.u;
}
/* JADX WARN: Multi-variable type inference failed */
public final u<?> c(boolean z) {
this.s = z;
return this;
}
/* JADX WARN: Multi-variable type inference failed */
public final u<?> d(boolean z) {
this.t = z;
return this;
}
public boolean d() {
return false;
}
public final String f() {
return this.j;
}
public final int h() {
return this.i;
}
public final int i() {
return this.g;
}
public final int j() {
return this.k;
}
public final String k() {
return this.h;
}
public final b.a m() {
return this.v;
}
public final long q() {
return this.x;
}
public final boolean r() {
return this.p;
}
public final boolean s() {
return this.s;
}
public final boolean t() {
return this.t;
}
public final q z() {
return this.c;
}
@Override // java.lang.Comparable
public /* synthetic */ int compareTo(Object obj) {
u uVar = (u) obj;
b e = e();
b e2 = uVar.e();
return e == e2 ? this.n.intValue() - uVar.n.intValue() : e2.ordinal() - e.ordinal();
}
public u(int i, String str) {
this(i, str, 0);
}
public u(int i, String str, int i2) {
this(i, str, i2, "un_known");
}
public u(int i, String str, int i2, String str2) {
Uri parse;
String host;
this.f = null;
this.l = new Object();
int i3 = 0;
this.p = false;
this.q = false;
this.r = false;
this.s = false;
this.t = false;
this.v = null;
this.x = 0L;
this.g = i;
this.h = str;
this.i = i2;
this.j = str2;
this.u = new e();
if (!TextUtils.isEmpty(str) && (parse = Uri.parse(str)) != null && (host = parse.getHost()) != null) {
i3 = host.hashCode();
}
this.k = i3;
this.d = SystemClock.elapsedRealtime();
}
public final long g() {
return SystemClock.elapsedRealtime() - this.d;
}
public final void c(String str) {
v vVar = this.o;
if (vVar != null) {
vVar.b(this);
}
}
public final void b(int i) {
v vVar = this.o;
if (vVar != null) {
vVar.a(this, i);
}
}
/* JADX WARN: Multi-variable type inference failed */
public final u<?> c(int i) {
this.n = Integer.valueOf(i);
return this;
}
public final String l() {
if (!TextUtils.isEmpty(this.b)) {
return this.b;
}
if (this.a == null) {
this.a = new com.mbridge.msdk.tracker.network.toolbox.e();
}
String a2 = this.a.a(this);
this.b = a2;
return a2;
}
public final boolean n() {
boolean z;
synchronized (this.l) {
z = this.q;
}
return z;
}
public Map<String, String> c() {
return Collections.emptyMap();
}
public final String o() {
return "application/x-www-form-urlencoded; charset=UTF-8";
}
public final byte[] p() {
Map<String, String> a2 = a();
if (a2 == null || a2.size() <= 0) {
this.x = 0L;
return null;
}
byte[] a3 = a(a2, "UTF-8");
this.x = a3.length;
return a3;
}
private byte[] a(Map<String, String> map, String str) {
StringBuilder sb = new StringBuilder();
try {
int i = 0;
for (Map.Entry<String, String> entry : map.entrySet()) {
i++;
if (entry.getKey() != null) {
sb.append(URLEncoder.encode(entry.getKey(), str));
sb.append(nb.T);
sb.append(URLEncoder.encode(entry.getValue() == null ? "" : entry.getValue(), str));
if (i <= map.size() - 1) {
sb.append('&');
}
}
}
return sb.toString().getBytes(str);
} catch (UnsupportedEncodingException e) {
throw new RuntimeException("Encoding not supported: " + str, e);
}
}
public b e() {
return b.NORMAL;
}
public final int u() {
z b2 = b();
if (b2 == null) {
return 30000;
}
return b2.a();
}
public final long v() {
z b2 = b();
if (b2 == null) {
return WorkRequest.DEFAULT_BACKOFF_DELAY_MILLIS;
}
long b3 = b2.b();
return b3 < 0 ? WorkRequest.DEFAULT_BACKOFF_DELAY_MILLIS : b3;
}
public final void w() {
synchronized (this.l) {
this.r = true;
}
}
public final boolean x() {
boolean z;
synchronized (this.l) {
z = this.r;
}
return z;
}
public final void b(ad adVar) {
w.a aVar;
synchronized (this.l) {
aVar = this.m;
}
if (aVar != null) {
aVar.a(adVar);
}
}
public final void a(w<?> wVar) {
a aVar;
synchronized (this.l) {
aVar = this.w;
}
if (aVar != null) {
aVar.a(this, wVar);
}
}
public final void y() {
a aVar;
synchronized (this.l) {
aVar = this.w;
}
if (aVar != null) {
aVar.a(this);
}
}
public final void c(String str, String str2) {
if (this.e == null) {
this.e = new HashMap();
}
if (TextUtils.isEmpty(str) || TextUtils.isEmpty(str2)) {
return;
}
try {
this.e.put(str, str2);
} catch (Exception unused) {
}
}
public final String d(String str) {
if (this.e != null && !TextUtils.isEmpty(str)) {
try {
return this.e.get(str);
} catch (Exception unused) {
}
}
return "";
}
public String toString() {
String str = "0x" + Integer.toHexString(this.k);
StringBuilder sb = new StringBuilder();
sb.append(n() ? "[X] " : "[ ] ");
sb.append(this.h);
sb.append(" ");
sb.append(str);
sb.append(" ");
sb.append(e());
sb.append(" ");
sb.append(this.n);
return sb.toString();
}
}

View File

@@ -0,0 +1,120 @@
package com.mbridge.msdk.tracker.network;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.PriorityBlockingQueue;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
/* loaded from: classes4.dex */
public final class v {
private volatile ThreadPoolExecutor a;
private final int e;
private final b f;
private final n g;
private final x h;
private final AtomicInteger b = new AtomicInteger();
private final Set<u<?>> c = new HashSet();
private final PriorityBlockingQueue<u<?>> d = new PriorityBlockingQueue<>();
private final List<a> i = new ArrayList();
public interface a {
void a(u<?> uVar, int i);
}
public v(n nVar, x xVar, int i, b bVar) {
this.e = i;
this.f = bVar;
this.g = nVar;
this.h = xVar;
}
public final void a() {
this.a = null;
a(this.e);
}
private void a(int i) {
if (this.a != null) {
return;
}
try {
b(i);
if (this.a == null) {
return;
}
} catch (Throwable unused) {
try {
b(5);
} catch (Exception unused2) {
} catch (Throwable th) {
if (this.a != null) {
this.a.allowCoreThreadTimeOut(true);
}
throw th;
}
if (this.a == null) {
return;
}
}
this.a.allowCoreThreadTimeOut(true);
}
private void b(int i) {
this.a = new ThreadPoolExecutor(i, i, 100L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue(), new ThreadFactory() { // from class: com.mbridge.msdk.tracker.network.v.1
@Override // java.util.concurrent.ThreadFactory
public final Thread newThread(Runnable runnable) {
return new Thread(runnable, "NetworkDispatcher");
}
}, new ThreadPoolExecutor.DiscardPolicy());
}
public final <T> u<T> a(u<T> uVar) {
uVar.a(this);
synchronized (this.c) {
this.c.add(uVar);
}
uVar.c(this.b.incrementAndGet());
a(uVar, 0);
this.d.add(uVar);
if (this.a == null) {
a(this.e);
}
this.a.execute(new Runnable() { // from class: com.mbridge.msdk.tracker.network.v.2
@Override // java.lang.Runnable
public final void run() {
try {
new o(v.this.d, v.this.g, v.this.f, v.this.h).run();
} catch (Throwable unused) {
}
}
});
return uVar;
}
public final <T> void b(u<T> uVar) {
synchronized (this.c) {
this.c.remove(uVar);
}
a(uVar, 5);
}
public final void a(u<?> uVar, int i) {
synchronized (this.i) {
try {
Iterator<a> it = this.i.iterator();
while (it.hasNext()) {
it.next().a(uVar, i);
}
} catch (Throwable th) {
throw th;
}
}
}
}

View File

@@ -0,0 +1,41 @@
package com.mbridge.msdk.tracker.network;
import com.mbridge.msdk.tracker.network.b;
/* loaded from: classes4.dex */
public final class w<T> {
public final T a;
public final b.a b;
public final ad c;
public boolean d;
public interface a {
void a(ad adVar);
}
public interface b<T> {
void a(T t);
}
public static <T> w<T> a(T t, b.a aVar) {
return new w<>(t, aVar);
}
public static <T> w<T> a(ad adVar) {
return new w<>(adVar);
}
private w(T t, b.a aVar) {
this.d = false;
this.a = t;
this.b = aVar;
this.c = null;
}
private w(ad adVar) {
this.d = false;
this.a = null;
this.b = null;
this.c = adVar;
}
}

View File

@@ -0,0 +1,8 @@
package com.mbridge.msdk.tracker.network;
/* loaded from: classes4.dex */
public interface x {
void a(u<?> uVar, ad adVar);
void a(u<?> uVar, w<?> wVar);
}

View File

@@ -0,0 +1,9 @@
package com.mbridge.msdk.tracker.network;
/* loaded from: classes4.dex */
public final class y extends ad {
@Override // com.mbridge.msdk.tracker.network.ad
public final int a() {
return 6;
}
}

View File

@@ -0,0 +1,12 @@
package com.mbridge.msdk.tracker.network;
/* loaded from: classes4.dex */
public interface z {
int a();
boolean a(ad adVar);
long b();
int c();
}