正在查看: Spermatid Pro v6.4.3 应用的 a.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Spermatid Pro v6.4.3 应用的 a.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package ha;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.os.Build;
import android.os.Environment;
import android.os.Process;
import android.text.TextUtils;
import android.util.Log;
import androidx.annotation.NonNull;
import com.bytedance.sdk.openadsdk.downloadnew.core.TTDownloadField;
import com.octopus.ad.Octopus;
import com.octopus.ad.internal.m;
import com.octopus.ad.utils.b.e;
import com.octopus.ad.utils.b.g;
import com.octopus.ad.utils.b.i;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.lang.Thread;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.json.JSONObject;
public class a implements Thread.UncaughtExceptionHandler {
public static a f2888c;
public Thread.UncaughtExceptionHandler f2889a;
public Context b;
public static a a() {
if (f2888c == null) {
f2888c = new a();
}
return f2888c;
}
public static java.lang.String b(java.io.File r8) {
throw new UnsupportedOperationException("Method not decompiled: ha.a.b(java.io.File):java.lang.String");
}
public void c(Context context) {
this.b = context.getApplicationContext();
this.f2889a = Thread.getDefaultUncaughtExceptionHandler();
Thread.setDefaultUncaughtExceptionHandler(this);
}
public final void e(String str) {
try {
if (!Environment.getExternalStorageState().equals("mounted")) {
Log.e("CrashHandler", "sdcard unmounted,skip dump exception");
return;
}
Context context = this.b;
if (context == null) {
return;
}
File a4 = i.a(context);
g.a("OctopusAd", "CrashHandler storagePath == " + a4);
if (a4 != null) {
String str2 = a4.getPath() + "/Octopus/log/";
File file = new File(str2);
if (!file.exists()) {
file.mkdirs();
}
String format = new SimpleDateFormat("yyyy-MM-dd HH:MM:SS").format(new Date(System.currentTimeMillis()));
File file2 = new File(str2 + "crash_" + format + ".trace");
file2.createNewFile();
FileWriter fileWriter = new FileWriter(file2, true);
BufferedWriter bufferedWriter = new BufferedWriter(fileWriter);
bufferedWriter.write(format);
bufferedWriter.write("\r\n");
bufferedWriter.write("------------------crash----------------------");
bufferedWriter.write("\r\n");
bufferedWriter.write(str);
bufferedWriter.write("\r\n");
bufferedWriter.write("-------------------end-----------------------");
bufferedWriter.newLine();
bufferedWriter.close();
fileWriter.close();
}
} catch (Exception e2) {
g.a("OctopusAd", "An Exception Caught", e2);
} catch (Throwable th) {
g.a("OctopusAd", "A Throwable Caught", th);
}
}
public final void f(String str, boolean z) {
String str2;
try {
if (this.b == null) {
this.b = m.a().k();
}
PackageInfo packageInfo = this.b.getPackageManager().getPackageInfo(this.b.getPackageName(), 1);
JSONObject jSONObject = new JSONObject();
JSONObject jSONObject2 = new JSONObject();
jSONObject.put("appId", m.a().j());
jSONObject.put(TTDownloadField.TT_PACKAGE_NAME, this.b.getPackageName());
jSONObject.put(TTDownloadField.TT_VERSION_NAME, packageInfo.versionName);
jSONObject.put(TTDownloadField.TT_VERSION_CODE, String.valueOf(packageInfo.versionCode));
jSONObject.put("sdkVersion", "1.6.3.6");
jSONObject.put("sdkTag", "OctopusAd");
jSONObject2.put("oaid", Octopus.getOaid(this.b));
jSONObject2.put("osVersion", Build.VERSION.RELEASE + "_" + Build.VERSION.SDK_INT);
jSONObject2.put("vendor", Build.MANUFACTURER);
jSONObject2.put("model", Build.MODEL);
jSONObject2.put("cpu", Build.CPU_ABI);
jSONObject.put("device", jSONObject2);
jSONObject.put("crashType", z ? "native" : "java");
jSONObject.put("crashMessage", str);
String n2 = m.a().n();
if (z) {
str2 = n2 + "/sdk/soCrashReport";
} else {
str2 = n2 + "/sdk/crashReport";
}
e.a(str2, jSONObject.toString().getBytes());
} catch (Exception e2) {
g.a("OctopusAd", "An Exception Caught", e2);
}
}
public final void g(Throwable th) {
if (th == null) {
return;
}
StringWriter stringWriter = new StringWriter();
PrintWriter printWriter = new PrintWriter(stringWriter);
th.printStackTrace(printWriter);
for (Throwable cause = th.getCause(); cause != null; cause = cause.getCause()) {
cause.printStackTrace(printWriter);
}
printWriter.close();
i(stringWriter.toString(), false);
}
public void h() {
try {
if (this.b == null) {
this.b = m.a().k();
}
File filesDir = this.b.getFilesDir();
if (filesDir != null) {
File[] listFiles = new File(filesDir.getPath() + "/octopus-crash/").listFiles();
if (listFiles != null) {
for (File file : listFiles) {
if (file.exists()) {
i(b(file), true);
file.delete();
}
}
}
}
} catch (Exception e2) {
Log.e("OctopusAd", "Catch An Exception: " + e2.getMessage());
}
}
public final void i(String str, boolean z) {
if (TextUtils.isEmpty(str)) {
return;
}
new Thread((Runnable) new a(this, str, z)).start();
}
public final void j(String str, boolean z) {
if (str.contains("com.octopus.ad")) {
f(str, z);
if (z) {
return;
}
e(str);
}
}
@Override
public void uncaughtException(@NonNull Thread thread, @NonNull Throwable th) {
try {
g(th);
Thread.sleep(1000L);
} catch (Exception e2) {
g.a("OctopusAd", "An Exception Caught", e2);
}
Thread.UncaughtExceptionHandler uncaughtExceptionHandler = this.f2889a;
if (uncaughtExceptionHandler != null) {
uncaughtExceptionHandler.uncaughtException(thread, th);
} else {
Process.killProcess(Process.myPid());
}
}
}