Files
rr3-apk/decompiled-community/sources/com/mbridge/msdk/tracker/network/q.java
Daniel Elliott c080f0d97f Add Discord community version (64-bit only)
- Added realracing3-community.apk (71.57 MB)
- Removed 32-bit support (armeabi-v7a)
- Only includes arm64-v8a libraries
- Decompiled source code included
- Added README-community.md with analysis
2026-02-18 15:48:36 -08:00

502 lines
15 KiB
Java

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