- 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
189 lines
7.7 KiB
Java
189 lines
7.7 KiB
Java
package com.firemint.realracing;
|
|
|
|
import android.util.Log;
|
|
import com.google.firebase.perf.network.FirebasePerfUrlConnection;
|
|
import com.mbridge.msdk.newreward.function.common.MBridgeCommon;
|
|
import java.io.IOException;
|
|
import java.io.InputStream;
|
|
import java.io.OutputStream;
|
|
import java.net.HttpURLConnection;
|
|
import java.net.MalformedURLException;
|
|
import java.net.URL;
|
|
import java.net.URLConnection;
|
|
import java.security.SecureRandom;
|
|
import java.security.cert.X509Certificate;
|
|
import javax.net.ssl.HttpsURLConnection;
|
|
import javax.net.ssl.SSLContext;
|
|
import javax.net.ssl.TrustManager;
|
|
import javax.net.ssl.X509TrustManager;
|
|
import org.apache.http.conn.ssl.SSLSocketFactory;
|
|
import org.apache.http.protocol.HTTP;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public class Http {
|
|
static final /* synthetic */ boolean $assertionsDisabled = false;
|
|
private static boolean s_sslContextInit;
|
|
private static String s_userAgent;
|
|
String m_url = "";
|
|
byte[] m_data = null;
|
|
int m_readCapacity = 0;
|
|
long m_callbackPointer = 0;
|
|
Thread m_thread = null;
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public native void completeCallback(long j);
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public native void dataCallback(long j, byte[] bArr, int i);
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public native void errorCallback(long j);
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public native void headerCallback(long j, int i);
|
|
|
|
public void close() {
|
|
this.m_callbackPointer = 0L;
|
|
this.m_thread = null;
|
|
}
|
|
|
|
public void init(String str, byte[] bArr, int i, long j) {
|
|
this.m_url = str;
|
|
this.m_data = bArr;
|
|
this.m_readCapacity = i;
|
|
this.m_callbackPointer = j;
|
|
}
|
|
|
|
public boolean isClosed() {
|
|
return this.m_callbackPointer == 0;
|
|
}
|
|
|
|
public Http() {
|
|
initUserAgent();
|
|
initSSLContext();
|
|
}
|
|
|
|
public void post() {
|
|
HttpThread httpThread = new HttpThread();
|
|
this.m_thread = httpThread;
|
|
httpThread.start();
|
|
}
|
|
|
|
public class HttpThread extends Thread {
|
|
private HttpThread() {
|
|
}
|
|
|
|
@Override // java.lang.Thread, java.lang.Runnable
|
|
public void run() {
|
|
try {
|
|
URL url = new URL(Http.this.m_url);
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.append("URL: ");
|
|
sb.append(Http.this.m_url);
|
|
HttpURLConnection httpURLConnection = (HttpURLConnection) ((URLConnection) FirebasePerfUrlConnection.instrument(url.openConnection()));
|
|
httpURLConnection.setConnectTimeout(MBridgeCommon.DEFAULT_LOAD_TIMEOUT);
|
|
int i = 0;
|
|
httpURLConnection.setUseCaches(false);
|
|
httpURLConnection.setDoInput(true);
|
|
httpURLConnection.setRequestProperty("User-Agent", Http.s_userAgent);
|
|
if (Http.this.m_data.length > 0) {
|
|
httpURLConnection.setDoOutput(true);
|
|
httpURLConnection.setFixedLengthStreamingMode(Http.this.m_data.length);
|
|
httpURLConnection.setRequestMethod("POST");
|
|
httpURLConnection.setRequestProperty(HTTP.CONTENT_LEN, Integer.toString(Http.this.m_data.length));
|
|
httpURLConnection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
|
|
}
|
|
try {
|
|
StringBuilder sb2 = new StringBuilder();
|
|
sb2.append("HTTP OUTPUT ");
|
|
sb2.append(Integer.toString(Http.this.m_data.length));
|
|
if (Http.this.m_data.length > 0) {
|
|
OutputStream outputStream = httpURLConnection.getOutputStream();
|
|
outputStream.write(Http.this.m_data);
|
|
outputStream.flush();
|
|
outputStream.close();
|
|
}
|
|
Http.this.m_data = null;
|
|
String headerField = httpURLConnection.getHeaderField(HTTP.CONTENT_LEN);
|
|
StringBuilder sb3 = new StringBuilder();
|
|
sb3.append("HTTP Content-Length: ");
|
|
sb3.append(headerField);
|
|
int parseInt = headerField != null ? Integer.parseInt(headerField) : 0;
|
|
Http http = Http.this;
|
|
http.headerCallback(http.m_callbackPointer, parseInt);
|
|
InputStream inputStream = httpURLConnection.getInputStream();
|
|
byte[] bArr = new byte[Http.this.m_readCapacity];
|
|
while (true) {
|
|
int read = inputStream.read(bArr);
|
|
if (read != -1) {
|
|
Http http2 = Http.this;
|
|
http2.dataCallback(http2.m_callbackPointer, bArr, read);
|
|
i += read;
|
|
} else {
|
|
StringBuilder sb4 = new StringBuilder();
|
|
sb4.append("HTTP DONE ");
|
|
sb4.append(Integer.toString(i));
|
|
inputStream.close();
|
|
httpURLConnection.disconnect();
|
|
Http http3 = Http.this;
|
|
http3.completeCallback(http3.m_callbackPointer);
|
|
return;
|
|
}
|
|
}
|
|
} catch (Throwable th) {
|
|
httpURLConnection.disconnect();
|
|
throw th;
|
|
}
|
|
} catch (MalformedURLException e) {
|
|
Log.e("RealRacing3", "HTTP MalformedURLException: " + e.getMessage());
|
|
Http http4 = Http.this;
|
|
http4.errorCallback(http4.m_callbackPointer);
|
|
} catch (IOException e2) {
|
|
Log.e("RealRacing3", "HTTP IOException: " + e2.getMessage());
|
|
Http http42 = Http.this;
|
|
http42.errorCallback(http42.m_callbackPointer);
|
|
} catch (Throwable th2) {
|
|
Log.e("RealRacing3", "Other Exception: " + th2.getMessage());
|
|
Http http422 = Http.this;
|
|
http422.errorCallback(http422.m_callbackPointer);
|
|
}
|
|
}
|
|
}
|
|
|
|
private static void initUserAgent() {
|
|
if (s_userAgent != null) {
|
|
return;
|
|
}
|
|
s_userAgent = (Platform.getAppName() + "/" + Platform.getAppVersion()) + " " + System.getProperty("http.agent");
|
|
}
|
|
|
|
private static void initSSLContext() {
|
|
if (s_sslContextInit) {
|
|
return;
|
|
}
|
|
try {
|
|
TrustManager[] trustManagerArr = {new X509TrustManager() { // from class: com.firemint.realracing.Http.1
|
|
@Override // javax.net.ssl.X509TrustManager
|
|
public void checkClientTrusted(X509Certificate[] x509CertificateArr, String str) {
|
|
}
|
|
|
|
@Override // javax.net.ssl.X509TrustManager
|
|
public void checkServerTrusted(X509Certificate[] x509CertificateArr, String str) {
|
|
}
|
|
|
|
@Override // javax.net.ssl.X509TrustManager
|
|
public X509Certificate[] getAcceptedIssuers() {
|
|
return null;
|
|
}
|
|
}};
|
|
SSLContext sSLContext = SSLContext.getInstance("TLS");
|
|
sSLContext.init(null, trustManagerArr, new SecureRandom());
|
|
HttpsURLConnection.setDefaultSSLSocketFactory(sSLContext.getSocketFactory());
|
|
HttpsURLConnection.setDefaultHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
|
|
} catch (Exception unused) {
|
|
Log.e("RealRacing3", "Exception when trying to init SSLContext!");
|
|
}
|
|
s_sslContextInit = true;
|
|
}
|
|
}
|