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,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);
}
}