- 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
118 lines
5.6 KiB
Java
118 lines
5.6 KiB
Java
package com.singular.sdk.internal;
|
|
|
|
import android.content.Context;
|
|
import android.os.Handler;
|
|
import android.os.HandlerThread;
|
|
import android.util.Log;
|
|
import com.ea.nimble.ApplicationEnvironment;
|
|
import com.facebook.devicerequests.internal.DeviceRequestsHelper;
|
|
import com.glu.plugins.gluanalytics.AnalyticsData;
|
|
import com.google.firebase.perf.network.FirebasePerfUrlConnection;
|
|
import com.ironsource.nb;
|
|
import com.ironsource.v8;
|
|
import java.net.HttpURLConnection;
|
|
import java.net.URL;
|
|
import java.net.URLConnection;
|
|
import org.apache.http.protocol.HTTP;
|
|
import org.json.JSONObject;
|
|
|
|
/* loaded from: classes4.dex */
|
|
public class SingularExceptionReporter extends HandlerThread {
|
|
public static SingularExceptionReporter instance;
|
|
public Context context;
|
|
public DeviceInfo device_info;
|
|
public Handler handler;
|
|
|
|
public static SingularExceptionReporter getReporter(Context context) {
|
|
if (instance == null) {
|
|
synchronized (SingularExceptionReporter.class) {
|
|
SingularExceptionReporter singularExceptionReporter = new SingularExceptionReporter("singular_exception_reporter", context);
|
|
instance = singularExceptionReporter;
|
|
singularExceptionReporter.initDeviceInfo();
|
|
}
|
|
}
|
|
return instance;
|
|
}
|
|
|
|
public SingularExceptionReporter(String str, Context context) {
|
|
super(str);
|
|
this.handler = null;
|
|
this.context = null;
|
|
this.device_info = null;
|
|
start();
|
|
this.handler = new Handler(getLooper());
|
|
this.context = context;
|
|
}
|
|
|
|
public final void initDeviceInfo() {
|
|
if (this.device_info != null || this.handler == null || this.context == null) {
|
|
return;
|
|
}
|
|
this.handler.post(new Runnable() { // from class: com.singular.sdk.internal.SingularExceptionReporter.1
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
try {
|
|
SingularExceptionReporter.this.device_info = new DeviceInfo(SingularExceptionReporter.this.context);
|
|
} catch (Exception unused) {
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
public void reportException(final Throwable th) {
|
|
if (this.handler != null) {
|
|
Runnable runnable = new Runnable() { // from class: com.singular.sdk.internal.SingularExceptionReporter.2
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
try {
|
|
JSONObject jSONObject = new JSONObject();
|
|
Throwable th2 = th;
|
|
if (th2 != null) {
|
|
jSONObject.put("name", th2.getClass().getSimpleName());
|
|
jSONObject.put("message", th.getMessage());
|
|
jSONObject.put("stack_trace", Log.getStackTraceString(th));
|
|
if (SingularExceptionReporter.this.device_info != null) {
|
|
JSONObject jSONObject2 = new JSONObject();
|
|
jSONObject2.put("aifa", SingularExceptionReporter.this.device_info.aifa);
|
|
jSONObject2.put("appName", SingularExceptionReporter.this.device_info.appName);
|
|
jSONObject2.put(v8.i.W, SingularExceptionReporter.this.device_info.appVersion);
|
|
jSONObject2.put("deviceModel", SingularExceptionReporter.this.device_info.deviceModel);
|
|
jSONObject2.put(ApplicationEnvironment.NIMBLE_PARAMETER_DEVICE_BRAND, SingularExceptionReporter.this.device_info.deviceBrand);
|
|
jSONObject2.put("deviceManufacturer", SingularExceptionReporter.this.device_info.deviceManufacturer);
|
|
jSONObject2.put(AnalyticsData.S_OS_VERSION, SingularExceptionReporter.this.device_info.osVersion);
|
|
jSONObject2.put("sdkVersion", SingularExceptionReporter.this.device_info.sdkVersion);
|
|
jSONObject2.put("isGooglePlayServicesAvailable", SingularExceptionReporter.this.device_info.isGooglePlayServicesAvailable);
|
|
jSONObject.put(DeviceRequestsHelper.DEVICE_INFO_PARAM, jSONObject2);
|
|
}
|
|
} else {
|
|
jSONObject.put("error", "Throwable is null!");
|
|
}
|
|
SingularExceptionReporter.this.postExceptionDataToServer(jSONObject);
|
|
} catch (Exception unused) {
|
|
}
|
|
}
|
|
};
|
|
this.handler.removeCallbacksAndMessages(null);
|
|
this.handler.post(runnable);
|
|
}
|
|
}
|
|
|
|
public final int postExceptionDataToServer(JSONObject jSONObject) {
|
|
try {
|
|
HttpURLConnection httpURLConnection = (HttpURLConnection) ((URLConnection) FirebasePerfUrlConnection.instrument(new URL("https://exceptions.singular.net/v2/exceptions/android").openConnection()));
|
|
httpURLConnection.setRequestMethod("POST");
|
|
httpURLConnection.setRequestProperty("Content-Type", nb.L);
|
|
httpURLConnection.setConnectTimeout(10000);
|
|
httpURLConnection.setReadTimeout(10000);
|
|
httpURLConnection.setDoOutput(true);
|
|
byte[] bytes = jSONObject.toString().getBytes();
|
|
httpURLConnection.setRequestProperty(HTTP.CONTENT_LEN, Integer.toString(bytes.length));
|
|
httpURLConnection.getOutputStream().write(bytes);
|
|
httpURLConnection.connect();
|
|
return httpURLConnection.getResponseCode();
|
|
} catch (Exception unused) {
|
|
return -1;
|
|
}
|
|
}
|
|
}
|