卡特世界 v1.0.8版本的 MD5 值为:003518196b64b6d0c6e5f7f4996f7146
以下内容为反编译后的 q.java 源代码,内容仅作参考
package com.beizi.fusion.g;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Looper;
import android.os.Process;
import android.text.TextUtils;
import com.baidu.mobads.sdk.internal.bk;
import com.beizi.fusion.BeiZis;
import com.beizi.fusion.model.ResponseInfo;
import com.bytedance.sdk.openadsdk.downloadnew.core.TTDownloadField;
import com.czhj.sdk.common.Constants;
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.JSONException;
import org.json.JSONObject;
public class q implements Thread.UncaughtExceptionHandler {
private static q a = new q();
private Thread.UncaughtExceptionHandler b;
private Context c;
private q() {
}
public static q a() {
return a;
}
public void a(Context context) {
this.b = Thread.getDefaultUncaughtExceptionHandler();
Thread.setDefaultUncaughtExceptionHandler(this);
this.c = context.getApplicationContext();
}
@Override
public void uncaughtException(Thread thread, Throwable th) {
try {
a(th);
} catch (Exception e) {
e.printStackTrace();
} catch (Throwable th2) {
th2.printStackTrace();
}
Thread.UncaughtExceptionHandler uncaughtExceptionHandler = this.b;
if (uncaughtExceptionHandler != null) {
uncaughtExceptionHandler.uncaughtException(thread, th);
} else {
Process.killProcess(Process.myPid());
}
}
private void a(String str) {
String a2;
String a3;
try {
PackageInfo packageInfo = this.c.getPackageManager().getPackageInfo(this.c.getPackageName(), 1);
JSONObject jSONObject = new JSONObject();
JSONObject jSONObject2 = new JSONObject();
jSONObject.put("appId", com.beizi.fusion.d.b.a().b());
jSONObject.put("packageName", this.c.getPackageName());
jSONObject.put(TTDownloadField.TT_VERSION_NAME, packageInfo.versionName);
jSONObject.put(TTDownloadField.TT_VERSION_CODE, String.valueOf(packageInfo.versionCode));
jSONObject.put("sdkVersion", "4.90.3.1");
jSONObject2.put("osVersion", Build.VERSION.RELEASE + "_" + Build.VERSION.SDK_INT);
jSONObject2.put("vendor", Build.MANUFACTURER);
jSONObject2.put(bk.i, Build.MODEL);
jSONObject.put("device", jSONObject2);
jSONObject.put("crashMessage", str);
if (!TextUtils.isEmpty(ResponseInfo.getInstance(this.c).getCrashUrl()) && ResponseInfo.getInstance(this.c).getCrashUrl().startsWith(Constants.HTTP)) {
a2 = ResponseInfo.getInstance(this.c).getCrashUrl();
} else {
a2 = f.a(BeiZis.getTransferProtocol() ? "aHR0cHM6Ly9hcGktaHRwLmJlaXppLmJpei9tYi9zZGsvY3Jhc2gvdjE=" : "aHR0cDovL2FwaS5odHAuYWQtc2NvcGUuY29tLmNuOjQ1NjAwL21iL3Nkay9jcmFzaC92MQ==");
if (TextUtils.isEmpty(a2)) {
return;
}
}
if (TextUtils.isEmpty(a2) || (a3 = aa.a(a2, jSONObject.toString().getBytes())) == null) {
return;
}
ae.a("lance", "post:" + a3);
} catch (PackageManager.NameNotFoundException e) {
e = e;
e.printStackTrace();
} catch (JSONException e2) {
e = e2;
e.printStackTrace();
} catch (Exception e3) {
e3.printStackTrace();
}
}
private boolean a(final Throwable th) {
if (th == null) {
return false;
}
new Thread(new Runnable() {
@Override
public void run() {
Looper.prepare();
q.this.b(th);
Looper.loop();
}
}).start();
try {
Thread.sleep(1000L);
return true;
} catch (InterruptedException e) {
e.printStackTrace();
return true;
}
}
public void b(Throwable th) {
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();
String obj = stringWriter.toString();
a(obj);
b(obj);
}
private void b(String str) {
try {
} catch (Exception unused) {
} catch (Throwable th) {
th.printStackTrace();
}
if (this.c == null) {
return;
}
File a2 = j.a(this.c);
ae.a("BeiZis", "CrashHandler storagePath == " + a2);
if (a2 != null) {
String str2 = a2.getPath() + "/Beizi/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();
}
ae.a("lance", "writeLog ok");
}
}