Initial commit
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
package com.tencent.bugly.crashreport;
|
||||
|
||||
/* compiled from: BUGLY */
|
||||
/* loaded from: classes.dex */
|
||||
public class BuglyHintException extends RuntimeException {
|
||||
public BuglyHintException(String str) {
|
||||
super(str);
|
||||
}
|
||||
}
|
91
sources/com/tencent/bugly/crashreport/BuglyLog.java
Normal file
91
sources/com/tencent/bugly/crashreport/BuglyLog.java
Normal file
@@ -0,0 +1,91 @@
|
||||
package com.tencent.bugly.crashreport;
|
||||
|
||||
import android.util.Log;
|
||||
import com.tencent.bugly.b;
|
||||
import com.tencent.bugly.proguard.y;
|
||||
|
||||
/* compiled from: BUGLY */
|
||||
/* loaded from: classes.dex */
|
||||
public class BuglyLog {
|
||||
public static void d(String str, String str2) {
|
||||
if (str == null) {
|
||||
str = "";
|
||||
}
|
||||
if (str2 == null) {
|
||||
str2 = "null";
|
||||
}
|
||||
if (b.c) {
|
||||
Log.d(str, str2);
|
||||
}
|
||||
y.a("D", str, str2);
|
||||
}
|
||||
|
||||
public static void e(String str, String str2) {
|
||||
if (str == null) {
|
||||
str = "";
|
||||
}
|
||||
if (str2 == null) {
|
||||
str2 = "null";
|
||||
}
|
||||
if (b.c) {
|
||||
Log.e(str, str2);
|
||||
}
|
||||
y.a("E", str, str2);
|
||||
}
|
||||
|
||||
public static void i(String str, String str2) {
|
||||
if (str == null) {
|
||||
str = "";
|
||||
}
|
||||
if (str2 == null) {
|
||||
str2 = "null";
|
||||
}
|
||||
if (b.c) {
|
||||
Log.i(str, str2);
|
||||
}
|
||||
y.a("I", str, str2);
|
||||
}
|
||||
|
||||
public static void setCache(int i) {
|
||||
y.a(i);
|
||||
}
|
||||
|
||||
public static void v(String str, String str2) {
|
||||
if (str == null) {
|
||||
str = "";
|
||||
}
|
||||
if (str2 == null) {
|
||||
str2 = "null";
|
||||
}
|
||||
if (b.c) {
|
||||
Log.v(str, str2);
|
||||
}
|
||||
y.a("V", str, str2);
|
||||
}
|
||||
|
||||
public static void w(String str, String str2) {
|
||||
if (str == null) {
|
||||
str = "";
|
||||
}
|
||||
if (str2 == null) {
|
||||
str2 = "null";
|
||||
}
|
||||
if (b.c) {
|
||||
Log.w(str, str2);
|
||||
}
|
||||
y.a("W", str, str2);
|
||||
}
|
||||
|
||||
public static void e(String str, String str2, Throwable th) {
|
||||
if (str == null) {
|
||||
str = "";
|
||||
}
|
||||
if (str2 == null) {
|
||||
str2 = "null";
|
||||
}
|
||||
if (b.c) {
|
||||
Log.e(str, str2, th);
|
||||
}
|
||||
y.a("E", str, th);
|
||||
}
|
||||
}
|
812
sources/com/tencent/bugly/crashreport/CrashReport.java
Normal file
812
sources/com/tencent/bugly/crashreport/CrashReport.java
Normal file
@@ -0,0 +1,812 @@
|
||||
package com.tencent.bugly.crashreport;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.util.Log;
|
||||
import android.webkit.WebSettings;
|
||||
import android.webkit.WebView;
|
||||
import com.tencent.bugly.BuglyStrategy;
|
||||
import com.tencent.bugly.CrashModule;
|
||||
import com.tencent.bugly.b;
|
||||
import com.tencent.bugly.crashreport.common.strategy.StrategyBean;
|
||||
import com.tencent.bugly.crashreport.crash.BuglyBroadcastReceiver;
|
||||
import com.tencent.bugly.crashreport.crash.c;
|
||||
import com.tencent.bugly.crashreport.crash.d;
|
||||
import com.tencent.bugly.crashreport.crash.h5.H5JavaScriptInterface;
|
||||
import com.tencent.bugly.crashreport.crash.jni.NativeCrashHandler;
|
||||
import com.tencent.bugly.proguard.q;
|
||||
import com.tencent.bugly.proguard.w;
|
||||
import com.tencent.bugly.proguard.x;
|
||||
import com.tencent.bugly.proguard.z;
|
||||
import com.ubt.jimu.diy.model.CategoryModel;
|
||||
import java.net.InetAddress;
|
||||
import java.net.Proxy;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/* compiled from: BUGLY */
|
||||
/* loaded from: classes.dex */
|
||||
public class CrashReport {
|
||||
private static Context a;
|
||||
|
||||
/* compiled from: BUGLY */
|
||||
public static class CrashHandleCallback extends BuglyStrategy.a {
|
||||
}
|
||||
|
||||
/* compiled from: BUGLY */
|
||||
public static class UserStrategy extends BuglyStrategy {
|
||||
private CrashHandleCallback a;
|
||||
|
||||
public UserStrategy(Context context) {
|
||||
}
|
||||
|
||||
public synchronized void setCrashHandleCallback(CrashHandleCallback crashHandleCallback) {
|
||||
this.a = crashHandleCallback;
|
||||
}
|
||||
|
||||
@Override // com.tencent.bugly.BuglyStrategy
|
||||
public synchronized CrashHandleCallback getCrashHandleCallback() {
|
||||
return this.a;
|
||||
}
|
||||
}
|
||||
|
||||
/* compiled from: BUGLY */
|
||||
public interface WebViewInterface {
|
||||
void addJavascriptInterface(H5JavaScriptInterface h5JavaScriptInterface, String str);
|
||||
|
||||
CharSequence getContentDescription();
|
||||
|
||||
String getUrl();
|
||||
|
||||
void loadUrl(String str);
|
||||
|
||||
void setJavaScriptEnabled(boolean z);
|
||||
}
|
||||
|
||||
public static void closeBugly() {
|
||||
if (!b.a) {
|
||||
Log.w(x.a, "Can not close bugly because bugly is disable.");
|
||||
return;
|
||||
}
|
||||
if (!CrashModule.getInstance().hasInitialized()) {
|
||||
Log.w(x.a, "CrashReport has not been initialed! pls to call method 'initCrashReport' first!");
|
||||
return;
|
||||
}
|
||||
if (a == null) {
|
||||
return;
|
||||
}
|
||||
BuglyBroadcastReceiver buglyBroadcastReceiver = BuglyBroadcastReceiver.getInstance();
|
||||
if (buglyBroadcastReceiver != null) {
|
||||
buglyBroadcastReceiver.unregister(a);
|
||||
}
|
||||
closeCrashReport();
|
||||
com.tencent.bugly.crashreport.biz.b.a(a);
|
||||
w a2 = w.a();
|
||||
if (a2 != null) {
|
||||
a2.b();
|
||||
}
|
||||
}
|
||||
|
||||
public static void closeCrashReport() {
|
||||
if (!b.a) {
|
||||
Log.w(x.a, "Can not close crash report because bugly is disable.");
|
||||
} else if (CrashModule.getInstance().hasInitialized()) {
|
||||
c.a().d();
|
||||
} else {
|
||||
Log.w(x.a, "CrashReport has not been initialed! pls to call method 'initCrashReport' first!");
|
||||
}
|
||||
}
|
||||
|
||||
public static void closeNativeReport() {
|
||||
if (!b.a) {
|
||||
Log.w(x.a, "Can not close native report because bugly is disable.");
|
||||
} else if (CrashModule.getInstance().hasInitialized()) {
|
||||
c.a().f();
|
||||
} else {
|
||||
Log.e(x.a, "CrashReport has not been initialed! pls to call method 'initCrashReport' first!");
|
||||
}
|
||||
}
|
||||
|
||||
public static void enableBugly(boolean z) {
|
||||
b.a = z;
|
||||
}
|
||||
|
||||
public static void enableObtainId(Context context, boolean z) {
|
||||
if (!b.a) {
|
||||
Log.w(x.a, "Can not set DB name because bugly is disable.");
|
||||
return;
|
||||
}
|
||||
if (context == null) {
|
||||
Log.w(x.a, "enableObtainId args context should not be null");
|
||||
return;
|
||||
}
|
||||
Log.i(x.a, "Enable identification obtaining? " + z);
|
||||
com.tencent.bugly.crashreport.common.info.a.a(context).b(z);
|
||||
}
|
||||
|
||||
public static Set<String> getAllUserDataKeys(Context context) {
|
||||
if (!b.a) {
|
||||
Log.w(x.a, "Can not get all keys of user data because bugly is disable.");
|
||||
return new HashSet();
|
||||
}
|
||||
if (context != null) {
|
||||
return com.tencent.bugly.crashreport.common.info.a.a(context).E();
|
||||
}
|
||||
Log.e(x.a, "getAllUserDataKeys args context should not be null");
|
||||
return new HashSet();
|
||||
}
|
||||
|
||||
public static String getAppChannel() {
|
||||
if (!b.a) {
|
||||
Log.w(x.a, "Can not get App channel because bugly is disable.");
|
||||
return CategoryModel.unknown;
|
||||
}
|
||||
if (CrashModule.getInstance().hasInitialized()) {
|
||||
return com.tencent.bugly.crashreport.common.info.a.a(a).l;
|
||||
}
|
||||
Log.e(x.a, "CrashReport has not been initialed! pls to call method 'initCrashReport' first!");
|
||||
return CategoryModel.unknown;
|
||||
}
|
||||
|
||||
public static String getAppID() {
|
||||
if (!b.a) {
|
||||
Log.w(x.a, "Can not get App ID because bugly is disable.");
|
||||
return CategoryModel.unknown;
|
||||
}
|
||||
if (CrashModule.getInstance().hasInitialized()) {
|
||||
return com.tencent.bugly.crashreport.common.info.a.a(a).f();
|
||||
}
|
||||
Log.e(x.a, "CrashReport has not been initialed! pls to call method 'initCrashReport' first!");
|
||||
return CategoryModel.unknown;
|
||||
}
|
||||
|
||||
public static String getAppVer() {
|
||||
if (!b.a) {
|
||||
Log.w(x.a, "Can not get app version because bugly is disable.");
|
||||
return CategoryModel.unknown;
|
||||
}
|
||||
if (CrashModule.getInstance().hasInitialized()) {
|
||||
return com.tencent.bugly.crashreport.common.info.a.a(a).j;
|
||||
}
|
||||
Log.e(x.a, "CrashReport has not been initialed! pls to call method 'initCrashReport' first!");
|
||||
return CategoryModel.unknown;
|
||||
}
|
||||
|
||||
public static String getBuglyVersion(Context context) {
|
||||
if (context == null) {
|
||||
x.d("Please call with context.", new Object[0]);
|
||||
return CategoryModel.unknown;
|
||||
}
|
||||
com.tencent.bugly.crashreport.common.info.a.a(context);
|
||||
return com.tencent.bugly.crashreport.common.info.a.c();
|
||||
}
|
||||
|
||||
public static Proxy getHttpProxy() {
|
||||
return com.tencent.bugly.proguard.a.b();
|
||||
}
|
||||
|
||||
public static Map<String, String> getSdkExtraData() {
|
||||
if (!b.a) {
|
||||
Log.w(x.a, "Can not get SDK extra data because bugly is disable.");
|
||||
return new HashMap();
|
||||
}
|
||||
if (CrashModule.getInstance().hasInitialized()) {
|
||||
return com.tencent.bugly.crashreport.common.info.a.a(a).A;
|
||||
}
|
||||
Log.e(x.a, "CrashReport has not been initialed! pls to call method 'initCrashReport' first!");
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String getUserData(Context context, String str) {
|
||||
if (!b.a) {
|
||||
Log.w(x.a, "Can not get user data because bugly is disable.");
|
||||
return CategoryModel.unknown;
|
||||
}
|
||||
if (context == null) {
|
||||
Log.e(x.a, "getUserDataValue args context should not be null");
|
||||
return CategoryModel.unknown;
|
||||
}
|
||||
if (z.a(str)) {
|
||||
return null;
|
||||
}
|
||||
return com.tencent.bugly.crashreport.common.info.a.a(context).g(str);
|
||||
}
|
||||
|
||||
public static int getUserDatasSize(Context context) {
|
||||
if (!b.a) {
|
||||
Log.w(x.a, "Can not get size of user data because bugly is disable.");
|
||||
return -1;
|
||||
}
|
||||
if (context != null) {
|
||||
return com.tencent.bugly.crashreport.common.info.a.a(context).D();
|
||||
}
|
||||
Log.e(x.a, "getUserDatasSize args context should not be null");
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static String getUserId() {
|
||||
if (!b.a) {
|
||||
Log.w(x.a, "Can not get user ID because bugly is disable.");
|
||||
return CategoryModel.unknown;
|
||||
}
|
||||
if (CrashModule.getInstance().hasInitialized()) {
|
||||
return com.tencent.bugly.crashreport.common.info.a.a(a).g();
|
||||
}
|
||||
Log.e(x.a, "CrashReport has not been initialed! pls to call method 'initCrashReport' first!");
|
||||
return CategoryModel.unknown;
|
||||
}
|
||||
|
||||
public static int getUserSceneTagId(Context context) {
|
||||
if (!b.a) {
|
||||
Log.w(x.a, "Can not get user scene tag because bugly is disable.");
|
||||
return -1;
|
||||
}
|
||||
if (context != null) {
|
||||
return com.tencent.bugly.crashreport.common.info.a.a(context).H();
|
||||
}
|
||||
Log.e(x.a, "getUserSceneTagId args context should not be null");
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static void initCrashReport(Context context) {
|
||||
a = context;
|
||||
b.a(CrashModule.getInstance());
|
||||
b.a(context);
|
||||
}
|
||||
|
||||
public static boolean isLastSessionCrash() {
|
||||
if (!b.a) {
|
||||
Log.w(x.a, "The info 'isLastSessionCrash' is not accurate because bugly is disable.");
|
||||
return false;
|
||||
}
|
||||
if (CrashModule.getInstance().hasInitialized()) {
|
||||
return c.a().b();
|
||||
}
|
||||
Log.e(x.a, "CrashReport has not been initialed! pls to call method 'initCrashReport' first!");
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void postCatchedException(Throwable th) {
|
||||
postCatchedException(th, Thread.currentThread(), false);
|
||||
}
|
||||
|
||||
public static void postException(Thread thread, int i, String str, String str2, String str3, Map<String, String> map) {
|
||||
if (!b.a) {
|
||||
Log.w(x.a, "Can not post crash caught because bugly is disable.");
|
||||
} else if (CrashModule.getInstance().hasInitialized()) {
|
||||
d.a(thread, i, str, str2, str3, map);
|
||||
} else {
|
||||
Log.e(x.a, "CrashReport has not been initialed! pls to call method 'initCrashReport' first!");
|
||||
}
|
||||
}
|
||||
|
||||
private static void putSdkData(Context context, String str, String str2) {
|
||||
if (context == null || z.a(str) || z.a(str2)) {
|
||||
return;
|
||||
}
|
||||
String replace = str.replace("[a-zA-Z[0-9]]+", "");
|
||||
if (replace.length() > 100) {
|
||||
Log.w(x.a, String.format("putSdkData key length over limit %d, will be cutted.", 50));
|
||||
replace = replace.substring(0, 50);
|
||||
}
|
||||
if (str2.length() > 500) {
|
||||
Log.w(x.a, String.format("putSdkData value length over limit %d, will be cutted!", 200));
|
||||
str2 = str2.substring(0, 200);
|
||||
}
|
||||
com.tencent.bugly.crashreport.common.info.a.a(context).c(replace, str2);
|
||||
x.b(String.format("[param] putSdkData data: %s - %s", replace, str2), new Object[0]);
|
||||
}
|
||||
|
||||
public static void putUserData(Context context, String str, String str2) {
|
||||
if (!b.a) {
|
||||
Log.w(x.a, "Can not put user data because bugly is disable.");
|
||||
return;
|
||||
}
|
||||
if (context == null) {
|
||||
Log.w(x.a, "putUserData args context should not be null");
|
||||
return;
|
||||
}
|
||||
if (str == null) {
|
||||
String str3 = str;
|
||||
x.d("putUserData args key should not be null or empty", new Object[0]);
|
||||
return;
|
||||
}
|
||||
if (str2 == null) {
|
||||
String str4 = str2;
|
||||
x.d("putUserData args value should not be null", new Object[0]);
|
||||
return;
|
||||
}
|
||||
if (!str.matches("[a-zA-Z[0-9]]+")) {
|
||||
x.d("putUserData args key should match [a-zA-Z[0-9]]+ {" + str + "}", new Object[0]);
|
||||
return;
|
||||
}
|
||||
if (str2.length() > 200) {
|
||||
x.d("user data value length over limit %d, it will be cutted!", 200);
|
||||
str2 = str2.substring(0, 200);
|
||||
}
|
||||
com.tencent.bugly.crashreport.common.info.a a2 = com.tencent.bugly.crashreport.common.info.a.a(context);
|
||||
if (a2.E().contains(str)) {
|
||||
NativeCrashHandler nativeCrashHandler = NativeCrashHandler.getInstance();
|
||||
if (nativeCrashHandler != null) {
|
||||
nativeCrashHandler.putKeyValueToNative(str, str2);
|
||||
}
|
||||
com.tencent.bugly.crashreport.common.info.a.a(context).b(str, str2);
|
||||
x.c("replace KV %s %s", str, str2);
|
||||
return;
|
||||
}
|
||||
if (a2.D() >= 10) {
|
||||
x.d("user data size is over limit %d, it will be cutted!", 10);
|
||||
return;
|
||||
}
|
||||
if (str.length() > 50) {
|
||||
x.d("user data key length over limit %d , will drop this new key %s", 50, str);
|
||||
str = str.substring(0, 50);
|
||||
}
|
||||
NativeCrashHandler nativeCrashHandler2 = NativeCrashHandler.getInstance();
|
||||
if (nativeCrashHandler2 != null) {
|
||||
nativeCrashHandler2.putKeyValueToNative(str, str2);
|
||||
}
|
||||
com.tencent.bugly.crashreport.common.info.a.a(context).b(str, str2);
|
||||
x.b("[param] set user data: %s - %s", str, str2);
|
||||
}
|
||||
|
||||
public static String removeUserData(Context context, String str) {
|
||||
if (!b.a) {
|
||||
Log.w(x.a, "Can not remove user data because bugly is disable.");
|
||||
return CategoryModel.unknown;
|
||||
}
|
||||
if (context == null) {
|
||||
Log.e(x.a, "removeUserData args context should not be null");
|
||||
return CategoryModel.unknown;
|
||||
}
|
||||
if (z.a(str)) {
|
||||
return null;
|
||||
}
|
||||
x.b("[param] remove user data: %s", str);
|
||||
return com.tencent.bugly.crashreport.common.info.a.a(context).f(str);
|
||||
}
|
||||
|
||||
public static void setAppChannel(Context context, String str) {
|
||||
if (!b.a) {
|
||||
Log.w(x.a, "Can not set App channel because Bugly is disable.");
|
||||
return;
|
||||
}
|
||||
if (context == null) {
|
||||
Log.w(x.a, "setAppChannel args context should not be null");
|
||||
return;
|
||||
}
|
||||
if (str == null) {
|
||||
Log.w(x.a, "App channel is null, will not set");
|
||||
return;
|
||||
}
|
||||
com.tencent.bugly.crashreport.common.info.a.a(context).l = str;
|
||||
NativeCrashHandler nativeCrashHandler = NativeCrashHandler.getInstance();
|
||||
if (nativeCrashHandler != null) {
|
||||
nativeCrashHandler.setNativeAppChannel(str);
|
||||
}
|
||||
}
|
||||
|
||||
public static void setAppPackage(Context context, String str) {
|
||||
if (!b.a) {
|
||||
Log.w(x.a, "Can not set App package because bugly is disable.");
|
||||
return;
|
||||
}
|
||||
if (context == null) {
|
||||
Log.w(x.a, "setAppPackage args context should not be null");
|
||||
return;
|
||||
}
|
||||
if (str == null) {
|
||||
Log.w(x.a, "App package is null, will not set");
|
||||
return;
|
||||
}
|
||||
com.tencent.bugly.crashreport.common.info.a.a(context).c = str;
|
||||
NativeCrashHandler nativeCrashHandler = NativeCrashHandler.getInstance();
|
||||
if (nativeCrashHandler != null) {
|
||||
nativeCrashHandler.setNativeAppPackage(str);
|
||||
}
|
||||
}
|
||||
|
||||
public static void setAppVersion(Context context, String str) {
|
||||
if (!b.a) {
|
||||
Log.w(x.a, "Can not set App version because bugly is disable.");
|
||||
return;
|
||||
}
|
||||
if (context == null) {
|
||||
Log.w(x.a, "setAppVersion args context should not be null");
|
||||
return;
|
||||
}
|
||||
if (str == null) {
|
||||
Log.w(x.a, "App version is null, will not set");
|
||||
return;
|
||||
}
|
||||
com.tencent.bugly.crashreport.common.info.a.a(context).j = str;
|
||||
NativeCrashHandler nativeCrashHandler = NativeCrashHandler.getInstance();
|
||||
if (nativeCrashHandler != null) {
|
||||
nativeCrashHandler.setNativeAppVersion(str);
|
||||
}
|
||||
}
|
||||
|
||||
public static void setAuditEnable(Context context, boolean z) {
|
||||
if (!b.a) {
|
||||
Log.w(x.a, "Can not set App package because bugly is disable.");
|
||||
return;
|
||||
}
|
||||
if (context == null) {
|
||||
Log.w(x.a, "setAppPackage args context should not be null");
|
||||
return;
|
||||
}
|
||||
Log.i(x.a, "Set audit enable: " + z);
|
||||
com.tencent.bugly.crashreport.common.info.a.a(context).B = z;
|
||||
}
|
||||
|
||||
public static void setBuglyDbName(String str) {
|
||||
if (!b.a) {
|
||||
Log.w(x.a, "Can not set DB name because bugly is disable.");
|
||||
return;
|
||||
}
|
||||
Log.i(x.a, "Set Bugly DB name: " + str);
|
||||
q.a = str;
|
||||
}
|
||||
|
||||
public static void setContext(Context context) {
|
||||
a = context;
|
||||
}
|
||||
|
||||
public static void setCrashFilter(String str) {
|
||||
if (!b.a) {
|
||||
Log.w(x.a, "Can not set App package because bugly is disable.");
|
||||
return;
|
||||
}
|
||||
Log.i(x.a, "Set crash stack filter: " + str);
|
||||
c.n = str;
|
||||
}
|
||||
|
||||
public static void setCrashRegularFilter(String str) {
|
||||
if (!b.a) {
|
||||
Log.w(x.a, "Can not set App package because bugly is disable.");
|
||||
return;
|
||||
}
|
||||
Log.i(x.a, "Set crash stack filter: " + str);
|
||||
c.o = str;
|
||||
}
|
||||
|
||||
public static void setHandleNativeCrashInJava(boolean z) {
|
||||
if (!b.a) {
|
||||
Log.w(x.a, "Can not set App package because bugly is disable.");
|
||||
return;
|
||||
}
|
||||
Log.i(x.a, "Should handle native crash in Java profile after handled in native profile: " + z);
|
||||
NativeCrashHandler.setShouldHandleInJava(z);
|
||||
}
|
||||
|
||||
public static void setHttpProxy(String str, int i) {
|
||||
com.tencent.bugly.proguard.a.a(str, i);
|
||||
}
|
||||
|
||||
public static void setIsAppForeground(Context context, boolean z) {
|
||||
if (!b.a) {
|
||||
Log.w(x.a, "Can not set 'isAppForeground' because bugly is disable.");
|
||||
return;
|
||||
}
|
||||
if (context == null) {
|
||||
x.d("Context should not be null.", new Object[0]);
|
||||
return;
|
||||
}
|
||||
if (z) {
|
||||
x.c("App is in foreground.", new Object[0]);
|
||||
} else {
|
||||
x.c("App is in background.", new Object[0]);
|
||||
}
|
||||
com.tencent.bugly.crashreport.common.info.a.a(context).a(z);
|
||||
}
|
||||
|
||||
public static void setIsDevelopmentDevice(Context context, boolean z) {
|
||||
if (!b.a) {
|
||||
Log.w(x.a, "Can not set 'isDevelopmentDevice' because bugly is disable.");
|
||||
return;
|
||||
}
|
||||
if (context == null) {
|
||||
x.d("Context should not be null.", new Object[0]);
|
||||
return;
|
||||
}
|
||||
if (z) {
|
||||
x.c("This is a development device.", new Object[0]);
|
||||
} else {
|
||||
x.c("This is not a development device.", new Object[0]);
|
||||
}
|
||||
com.tencent.bugly.crashreport.common.info.a.a(context).y = z;
|
||||
}
|
||||
|
||||
public static boolean setJavascriptMonitor(WebView webView, boolean z) {
|
||||
return setJavascriptMonitor(webView, z, false);
|
||||
}
|
||||
|
||||
public static void setSdkExtraData(Context context, String str, String str2) {
|
||||
if (!b.a) {
|
||||
Log.w(x.a, "Can not put SDK extra data because bugly is disable.");
|
||||
} else {
|
||||
if (context == null || z.a(str) || z.a(str2)) {
|
||||
return;
|
||||
}
|
||||
com.tencent.bugly.crashreport.common.info.a.a(context).a(str, str2);
|
||||
}
|
||||
}
|
||||
|
||||
public static void setServerUrl(String str) {
|
||||
if (z.a(str) || !z.c(str)) {
|
||||
Log.i(x.a, "URL is invalid.");
|
||||
return;
|
||||
}
|
||||
com.tencent.bugly.crashreport.common.strategy.a.a(str);
|
||||
StrategyBean.b = str;
|
||||
StrategyBean.c = str;
|
||||
}
|
||||
|
||||
public static void setSessionIntervalMills(long j) {
|
||||
if (b.a) {
|
||||
com.tencent.bugly.crashreport.biz.b.a(j);
|
||||
} else {
|
||||
Log.w(x.a, "Can not set 'SessionIntervalMills' because bugly is disable.");
|
||||
}
|
||||
}
|
||||
|
||||
public static void setUserId(String str) {
|
||||
if (!b.a) {
|
||||
Log.w(x.a, "Can not set user ID because bugly is disable.");
|
||||
} else if (CrashModule.getInstance().hasInitialized()) {
|
||||
setUserId(a, str);
|
||||
} else {
|
||||
Log.e(x.a, "CrashReport has not been initialed! pls to call method 'initCrashReport' first!");
|
||||
}
|
||||
}
|
||||
|
||||
public static void setUserSceneTag(Context context, int i) {
|
||||
if (!b.a) {
|
||||
Log.w(x.a, "Can not set tag caught because bugly is disable.");
|
||||
return;
|
||||
}
|
||||
if (context == null) {
|
||||
Log.e(x.a, "setTag args context should not be null");
|
||||
return;
|
||||
}
|
||||
if (i <= 0) {
|
||||
x.d("setTag args tagId should > 0", new Object[0]);
|
||||
}
|
||||
com.tencent.bugly.crashreport.common.info.a.a(context).a(i);
|
||||
x.b("[param] set user scene tag: %d", Integer.valueOf(i));
|
||||
}
|
||||
|
||||
public static void startCrashReport() {
|
||||
if (!b.a) {
|
||||
Log.w(x.a, "Can not start crash report because bugly is disable.");
|
||||
} else if (CrashModule.getInstance().hasInitialized()) {
|
||||
c.a().c();
|
||||
} else {
|
||||
Log.w(x.a, "CrashReport has not been initialed! pls to call method 'initCrashReport' first!");
|
||||
}
|
||||
}
|
||||
|
||||
public static void testANRCrash() {
|
||||
if (!b.a) {
|
||||
Log.w(x.a, "Can not test ANR crash because bugly is disable.");
|
||||
} else if (!CrashModule.getInstance().hasInitialized()) {
|
||||
Log.e(x.a, "CrashReport has not been initialed! pls to call method 'initCrashReport' first!");
|
||||
} else {
|
||||
x.a("start to create a anr crash for test!", new Object[0]);
|
||||
c.a().j();
|
||||
}
|
||||
}
|
||||
|
||||
public static void testJavaCrash() {
|
||||
if (!b.a) {
|
||||
Log.w(x.a, "Can not test Java crash because bugly is disable.");
|
||||
} else {
|
||||
if (!CrashModule.getInstance().hasInitialized()) {
|
||||
Log.e(x.a, "CrashReport has not been initialed! pls to call method 'initCrashReport' first!");
|
||||
return;
|
||||
}
|
||||
com.tencent.bugly.crashreport.common.info.a b = com.tencent.bugly.crashreport.common.info.a.b();
|
||||
if (b != null) {
|
||||
b.b(24096);
|
||||
}
|
||||
throw new RuntimeException("This Crash create for Test! You can go to Bugly see more detail!");
|
||||
}
|
||||
}
|
||||
|
||||
public static void testNativeCrash() {
|
||||
testNativeCrash(false, false, false);
|
||||
}
|
||||
|
||||
public static void postCatchedException(Throwable th, Thread thread) {
|
||||
postCatchedException(th, thread, false);
|
||||
}
|
||||
|
||||
public static void setHttpProxy(InetAddress inetAddress, int i) {
|
||||
com.tencent.bugly.proguard.a.a(inetAddress, i);
|
||||
}
|
||||
|
||||
@SuppressLint({"SetJavaScriptEnabled"})
|
||||
public static boolean setJavascriptMonitor(final WebView webView, boolean z, boolean z2) {
|
||||
if (webView != null) {
|
||||
return setJavascriptMonitor(new WebViewInterface() { // from class: com.tencent.bugly.crashreport.CrashReport.1
|
||||
@Override // com.tencent.bugly.crashreport.CrashReport.WebViewInterface
|
||||
public final void addJavascriptInterface(H5JavaScriptInterface h5JavaScriptInterface, String str) {
|
||||
webView.addJavascriptInterface(h5JavaScriptInterface, str);
|
||||
}
|
||||
|
||||
@Override // com.tencent.bugly.crashreport.CrashReport.WebViewInterface
|
||||
public final CharSequence getContentDescription() {
|
||||
return webView.getContentDescription();
|
||||
}
|
||||
|
||||
@Override // com.tencent.bugly.crashreport.CrashReport.WebViewInterface
|
||||
public final String getUrl() {
|
||||
return webView.getUrl();
|
||||
}
|
||||
|
||||
@Override // com.tencent.bugly.crashreport.CrashReport.WebViewInterface
|
||||
public final void loadUrl(String str) {
|
||||
webView.loadUrl(str);
|
||||
}
|
||||
|
||||
@Override // com.tencent.bugly.crashreport.CrashReport.WebViewInterface
|
||||
public final void setJavaScriptEnabled(boolean z3) {
|
||||
WebSettings settings = webView.getSettings();
|
||||
if (settings.getJavaScriptEnabled()) {
|
||||
return;
|
||||
}
|
||||
settings.setJavaScriptEnabled(true);
|
||||
}
|
||||
}, z, z2);
|
||||
}
|
||||
Log.w(x.a, "WebView is null.");
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void testNativeCrash(boolean z, boolean z2, boolean z3) {
|
||||
if (!b.a) {
|
||||
Log.w(x.a, "Can not test native crash because bugly is disable.");
|
||||
} else if (!CrashModule.getInstance().hasInitialized()) {
|
||||
Log.e(x.a, "CrashReport has not been initialed! pls to call method 'initCrashReport' first!");
|
||||
} else {
|
||||
x.a("start to create a native crash for test!", new Object[0]);
|
||||
c.a().a(z, z2, z3);
|
||||
}
|
||||
}
|
||||
|
||||
public static void postCatchedException(Throwable th, Thread thread, boolean z) {
|
||||
if (!b.a) {
|
||||
Log.w(x.a, "Can not post crash caught because bugly is disable.");
|
||||
return;
|
||||
}
|
||||
if (!CrashModule.getInstance().hasInitialized()) {
|
||||
Log.e(x.a, "CrashReport has not been initialed! pls to call method 'initCrashReport' first!");
|
||||
return;
|
||||
}
|
||||
if (th == null) {
|
||||
x.d("throwable is null, just return", new Object[0]);
|
||||
return;
|
||||
}
|
||||
if (thread == null) {
|
||||
thread = Thread.currentThread();
|
||||
}
|
||||
c.a().a(thread, th, false, (String) null, (byte[]) null, z);
|
||||
}
|
||||
|
||||
public static void initCrashReport(Context context, UserStrategy userStrategy) {
|
||||
a = context;
|
||||
b.a(CrashModule.getInstance());
|
||||
b.a(context, userStrategy);
|
||||
}
|
||||
|
||||
public static boolean setJavascriptMonitor(WebViewInterface webViewInterface, boolean z) {
|
||||
return setJavascriptMonitor(webViewInterface, z, false);
|
||||
}
|
||||
|
||||
public static void postException(int i, String str, String str2, String str3, Map<String, String> map) {
|
||||
postException(Thread.currentThread(), i, str, str2, str3, map);
|
||||
}
|
||||
|
||||
@SuppressLint({"SetJavaScriptEnabled"})
|
||||
public static boolean setJavascriptMonitor(WebViewInterface webViewInterface, boolean z, boolean z2) {
|
||||
if (webViewInterface == null) {
|
||||
Log.w(x.a, "WebViewInterface is null.");
|
||||
return false;
|
||||
}
|
||||
if (!CrashModule.getInstance().hasInitialized()) {
|
||||
x.e("CrashReport has not been initialed! please to call method 'initCrashReport' first!", new Object[0]);
|
||||
return false;
|
||||
}
|
||||
x.a("Set Javascript exception monitor of webview.", new Object[0]);
|
||||
if (!b.a) {
|
||||
Log.w(x.a, "Can not set JavaScript monitor because bugly is disable.");
|
||||
return false;
|
||||
}
|
||||
x.c("URL of webview is %s", webViewInterface.getUrl());
|
||||
if (!z2 && Build.VERSION.SDK_INT < 19) {
|
||||
x.e("This interface is only available for Android 4.4 or later.", new Object[0]);
|
||||
return false;
|
||||
}
|
||||
x.a("Enable the javascript needed by webview monitor.", new Object[0]);
|
||||
webViewInterface.setJavaScriptEnabled(true);
|
||||
H5JavaScriptInterface h5JavaScriptInterface = H5JavaScriptInterface.getInstance(webViewInterface);
|
||||
if (h5JavaScriptInterface != null) {
|
||||
x.a("Add a secure javascript interface to the webview.", new Object[0]);
|
||||
webViewInterface.addJavascriptInterface(h5JavaScriptInterface, "exceptionUploader");
|
||||
}
|
||||
if (z) {
|
||||
x.a("Inject bugly.js(v%s) to the webview.", com.tencent.bugly.crashreport.crash.h5.b.b());
|
||||
String a2 = com.tencent.bugly.crashreport.crash.h5.b.a();
|
||||
if (a2 == null) {
|
||||
x.e("Failed to inject Bugly.js.", com.tencent.bugly.crashreport.crash.h5.b.b());
|
||||
return false;
|
||||
}
|
||||
webViewInterface.loadUrl("javascript:" + a2);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void setUserId(Context context, String str) {
|
||||
if (!b.a) {
|
||||
Log.w(x.a, "Can not set user ID because bugly is disable.");
|
||||
return;
|
||||
}
|
||||
if (context == null) {
|
||||
Log.e(x.a, "Context should not be null when bugly has not been initialed!");
|
||||
return;
|
||||
}
|
||||
if (str == null) {
|
||||
x.d("userId should not be null", new Object[0]);
|
||||
return;
|
||||
}
|
||||
if (str.length() > 100) {
|
||||
String substring = str.substring(0, 100);
|
||||
x.d("userId %s length is over limit %d substring to %s", str, 100, substring);
|
||||
str = substring;
|
||||
}
|
||||
if (str.equals(com.tencent.bugly.crashreport.common.info.a.a(context).g())) {
|
||||
return;
|
||||
}
|
||||
com.tencent.bugly.crashreport.common.info.a.a(context).b(str);
|
||||
x.b("[user] set userId : %s", str);
|
||||
NativeCrashHandler nativeCrashHandler = NativeCrashHandler.getInstance();
|
||||
if (nativeCrashHandler != null) {
|
||||
nativeCrashHandler.setNativeUserId(str);
|
||||
}
|
||||
if (CrashModule.getInstance().hasInitialized()) {
|
||||
com.tencent.bugly.crashreport.biz.b.a();
|
||||
}
|
||||
}
|
||||
|
||||
public static Map<String, String> getSdkExtraData(Context context) {
|
||||
if (!b.a) {
|
||||
Log.w(x.a, "Can not get SDK extra data because bugly is disable.");
|
||||
return new HashMap();
|
||||
}
|
||||
if (context == null) {
|
||||
x.d("Context should not be null.", new Object[0]);
|
||||
return null;
|
||||
}
|
||||
return com.tencent.bugly.crashreport.common.info.a.a(context).A;
|
||||
}
|
||||
|
||||
public static void initCrashReport(Context context, String str, boolean z) {
|
||||
if (context != null) {
|
||||
a = context;
|
||||
b.a(CrashModule.getInstance());
|
||||
b.a(context, str, z, null);
|
||||
}
|
||||
}
|
||||
|
||||
public static void initCrashReport(Context context, String str, boolean z, UserStrategy userStrategy) {
|
||||
if (context == null) {
|
||||
return;
|
||||
}
|
||||
a = context;
|
||||
b.a(CrashModule.getInstance());
|
||||
b.a(context, str, z, userStrategy);
|
||||
}
|
||||
}
|
15
sources/com/tencent/bugly/crashreport/R.java
Normal file
15
sources/com/tencent/bugly/crashreport/R.java
Normal file
@@ -0,0 +1,15 @@
|
||||
package com.tencent.bugly.crashreport;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class R {
|
||||
|
||||
public static final class string {
|
||||
public static final int app_name = 0x7f110069;
|
||||
|
||||
private string() {
|
||||
}
|
||||
}
|
||||
|
||||
private R() {
|
||||
}
|
||||
}
|
11
sources/com/tencent/bugly/crashreport/a.java
Normal file
11
sources/com/tencent/bugly/crashreport/a.java
Normal file
@@ -0,0 +1,11 @@
|
||||
package com.tencent.bugly.crashreport;
|
||||
|
||||
/* compiled from: BUGLY */
|
||||
/* loaded from: classes.dex */
|
||||
public interface a {
|
||||
boolean appendLogToNative(String str, String str2, String str3);
|
||||
|
||||
String getLogFromNative();
|
||||
|
||||
boolean setNativeIsAppForeground(boolean z);
|
||||
}
|
107
sources/com/tencent/bugly/crashreport/biz/UserInfoBean.java
Normal file
107
sources/com/tencent/bugly/crashreport/biz/UserInfoBean.java
Normal file
@@ -0,0 +1,107 @@
|
||||
package com.tencent.bugly.crashreport.biz;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import com.tencent.bugly.proguard.z;
|
||||
import com.ubt.jimu.diy.model.CategoryModel;
|
||||
import java.util.Map;
|
||||
|
||||
/* compiled from: BUGLY */
|
||||
/* loaded from: classes.dex */
|
||||
public class UserInfoBean implements Parcelable {
|
||||
public static final Parcelable.Creator<UserInfoBean> CREATOR = new Parcelable.Creator<UserInfoBean>() { // from class: com.tencent.bugly.crashreport.biz.UserInfoBean.1
|
||||
@Override // android.os.Parcelable.Creator
|
||||
public final /* synthetic */ UserInfoBean createFromParcel(Parcel parcel) {
|
||||
return new UserInfoBean(parcel);
|
||||
}
|
||||
|
||||
@Override // android.os.Parcelable.Creator
|
||||
public final /* bridge */ /* synthetic */ UserInfoBean[] newArray(int i) {
|
||||
return new UserInfoBean[i];
|
||||
}
|
||||
};
|
||||
public long a;
|
||||
public int b;
|
||||
public String c;
|
||||
public String d;
|
||||
public long e;
|
||||
public long f;
|
||||
public long g;
|
||||
public long h;
|
||||
public long i;
|
||||
public String j;
|
||||
public long k;
|
||||
public boolean l;
|
||||
public String m;
|
||||
public String n;
|
||||
public int o;
|
||||
public int p;
|
||||
public int q;
|
||||
public Map<String, String> r;
|
||||
public Map<String, String> s;
|
||||
|
||||
public UserInfoBean() {
|
||||
this.k = 0L;
|
||||
this.l = false;
|
||||
this.m = CategoryModel.unknown;
|
||||
this.p = -1;
|
||||
this.q = -1;
|
||||
this.r = null;
|
||||
this.s = null;
|
||||
}
|
||||
|
||||
@Override // android.os.Parcelable
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override // android.os.Parcelable
|
||||
public void writeToParcel(Parcel parcel, int i) {
|
||||
parcel.writeInt(this.b);
|
||||
parcel.writeString(this.c);
|
||||
parcel.writeString(this.d);
|
||||
parcel.writeLong(this.e);
|
||||
parcel.writeLong(this.f);
|
||||
parcel.writeLong(this.g);
|
||||
parcel.writeLong(this.h);
|
||||
parcel.writeLong(this.i);
|
||||
parcel.writeString(this.j);
|
||||
parcel.writeLong(this.k);
|
||||
parcel.writeByte(this.l ? (byte) 1 : (byte) 0);
|
||||
parcel.writeString(this.m);
|
||||
parcel.writeInt(this.p);
|
||||
parcel.writeInt(this.q);
|
||||
z.b(parcel, this.r);
|
||||
z.b(parcel, this.s);
|
||||
parcel.writeString(this.n);
|
||||
parcel.writeInt(this.o);
|
||||
}
|
||||
|
||||
public UserInfoBean(Parcel parcel) {
|
||||
this.k = 0L;
|
||||
this.l = false;
|
||||
this.m = CategoryModel.unknown;
|
||||
this.p = -1;
|
||||
this.q = -1;
|
||||
this.r = null;
|
||||
this.s = null;
|
||||
this.b = parcel.readInt();
|
||||
this.c = parcel.readString();
|
||||
this.d = parcel.readString();
|
||||
this.e = parcel.readLong();
|
||||
this.f = parcel.readLong();
|
||||
this.g = parcel.readLong();
|
||||
this.h = parcel.readLong();
|
||||
this.i = parcel.readLong();
|
||||
this.j = parcel.readString();
|
||||
this.k = parcel.readLong();
|
||||
this.l = parcel.readByte() == 1;
|
||||
this.m = parcel.readString();
|
||||
this.p = parcel.readInt();
|
||||
this.q = parcel.readInt();
|
||||
this.r = z.b(parcel);
|
||||
this.s = z.b(parcel);
|
||||
this.n = parcel.readString();
|
||||
this.o = parcel.readInt();
|
||||
}
|
||||
}
|
332
sources/com/tencent/bugly/crashreport/biz/a.java
Normal file
332
sources/com/tencent/bugly/crashreport/biz/a.java
Normal file
@@ -0,0 +1,332 @@
|
||||
package com.tencent.bugly.crashreport.biz;
|
||||
|
||||
import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import com.liulishuo.filedownloader.model.FileDownloadModel;
|
||||
import com.tencent.bugly.proguard.o;
|
||||
import com.tencent.bugly.proguard.p;
|
||||
import com.tencent.bugly.proguard.w;
|
||||
import com.tencent.bugly.proguard.x;
|
||||
import com.tencent.bugly.proguard.z;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/* compiled from: BUGLY */
|
||||
/* loaded from: classes.dex */
|
||||
public final class a {
|
||||
private Context a;
|
||||
private long b;
|
||||
private int c;
|
||||
private boolean d;
|
||||
|
||||
/* compiled from: BUGLY */
|
||||
/* renamed from: com.tencent.bugly.crashreport.biz.a$2, reason: invalid class name */
|
||||
final class AnonymousClass2 implements Runnable {
|
||||
AnonymousClass2() {
|
||||
}
|
||||
|
||||
@Override // java.lang.Runnable
|
||||
public final void run() {
|
||||
try {
|
||||
a.this.c();
|
||||
} catch (Throwable th) {
|
||||
x.a(th);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* compiled from: BUGLY */
|
||||
/* renamed from: com.tencent.bugly.crashreport.biz.a$a, reason: collision with other inner class name */
|
||||
class RunnableC0012a implements Runnable {
|
||||
private boolean a;
|
||||
private UserInfoBean b;
|
||||
|
||||
public RunnableC0012a(UserInfoBean userInfoBean, boolean z) {
|
||||
this.b = userInfoBean;
|
||||
this.a = z;
|
||||
}
|
||||
|
||||
@Override // java.lang.Runnable
|
||||
public final void run() {
|
||||
com.tencent.bugly.crashreport.common.info.a b;
|
||||
try {
|
||||
if (this.b != null) {
|
||||
UserInfoBean userInfoBean = this.b;
|
||||
if (userInfoBean != null && (b = com.tencent.bugly.crashreport.common.info.a.b()) != null) {
|
||||
userInfoBean.j = b.e();
|
||||
}
|
||||
x.c("[UserInfo] Record user info.", new Object[0]);
|
||||
a.a(a.this, this.b, false);
|
||||
}
|
||||
if (this.a) {
|
||||
a aVar = a.this;
|
||||
w a = w.a();
|
||||
if (a != null) {
|
||||
a.a(aVar.new AnonymousClass2());
|
||||
}
|
||||
}
|
||||
} catch (Throwable th) {
|
||||
if (x.a(th)) {
|
||||
return;
|
||||
}
|
||||
th.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* compiled from: BUGLY */
|
||||
class b implements Runnable {
|
||||
b() {
|
||||
}
|
||||
|
||||
@Override // java.lang.Runnable
|
||||
public final void run() {
|
||||
long currentTimeMillis = System.currentTimeMillis();
|
||||
if (currentTimeMillis < a.this.b) {
|
||||
w.a().a(a.this.new b(), (a.this.b - currentTimeMillis) + 5000);
|
||||
} else {
|
||||
a.this.a(3, false, 0L);
|
||||
a.this.a();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* compiled from: BUGLY */
|
||||
class c implements Runnable {
|
||||
private long a;
|
||||
|
||||
public c(long j) {
|
||||
this.a = 21600000L;
|
||||
this.a = j;
|
||||
}
|
||||
|
||||
@Override // java.lang.Runnable
|
||||
public final void run() {
|
||||
a aVar = a.this;
|
||||
w a = w.a();
|
||||
if (a != null) {
|
||||
a.a(aVar.new AnonymousClass2());
|
||||
}
|
||||
a aVar2 = a.this;
|
||||
long j = this.a;
|
||||
w.a().a(aVar2.new c(j), j);
|
||||
}
|
||||
}
|
||||
|
||||
public a(Context context, boolean z) {
|
||||
this.d = true;
|
||||
this.a = context;
|
||||
this.d = z;
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
/* JADX WARN: Removed duplicated region for block: B:118:0x0116 */
|
||||
/* JADX WARN: Removed duplicated region for block: B:76:0x00f2 A[Catch: all -> 0x018b, TryCatch #0 {, blocks: (B:3:0x0001, B:8:0x0007, B:12:0x000f, B:16:0x0017, B:18:0x001d, B:22:0x0027, B:24:0x003c, B:27:0x0045, B:29:0x004c, B:30:0x004f, B:32:0x0055, B:34:0x0069, B:36:0x0079, B:43:0x0081, B:45:0x008b, B:46:0x0090, B:48:0x0096, B:50:0x00a4, B:52:0x00b1, B:53:0x00b4, B:56:0x00c2, B:58:0x00c6, B:60:0x00cb, B:63:0x00d0, B:73:0x00d7, B:74:0x00ec, B:76:0x00f2, B:78:0x00f7, B:81:0x00ff, B:84:0x0117, B:86:0x011d, B:89:0x0126, B:91:0x012c, B:94:0x0135, B:97:0x013e, B:99:0x0146, B:102:0x014f, B:104:0x0160, B:105:0x0165, B:107:0x016a, B:108:0x016f, B:111:0x017d, B:115:0x016d, B:116:0x0163, B:119:0x0182, B:123:0x00e6), top: B:2:0x0001 }] */
|
||||
/* JADX WARN: Removed duplicated region for block: B:83:0x0114 */
|
||||
/* JADX WARN: Removed duplicated region for block: B:86:0x011d A[Catch: all -> 0x018b, TRY_LEAVE, TryCatch #0 {, blocks: (B:3:0x0001, B:8:0x0007, B:12:0x000f, B:16:0x0017, B:18:0x001d, B:22:0x0027, B:24:0x003c, B:27:0x0045, B:29:0x004c, B:30:0x004f, B:32:0x0055, B:34:0x0069, B:36:0x0079, B:43:0x0081, B:45:0x008b, B:46:0x0090, B:48:0x0096, B:50:0x00a4, B:52:0x00b1, B:53:0x00b4, B:56:0x00c2, B:58:0x00c6, B:60:0x00cb, B:63:0x00d0, B:73:0x00d7, B:74:0x00ec, B:76:0x00f2, B:78:0x00f7, B:81:0x00ff, B:84:0x0117, B:86:0x011d, B:89:0x0126, B:91:0x012c, B:94:0x0135, B:97:0x013e, B:99:0x0146, B:102:0x014f, B:104:0x0160, B:105:0x0165, B:107:0x016a, B:108:0x016f, B:111:0x017d, B:115:0x016d, B:116:0x0163, B:119:0x0182, B:123:0x00e6), top: B:2:0x0001 }] */
|
||||
/* JADX WARN: Removed duplicated region for block: B:89:0x0126 A[Catch: all -> 0x018b, TRY_ENTER, TryCatch #0 {, blocks: (B:3:0x0001, B:8:0x0007, B:12:0x000f, B:16:0x0017, B:18:0x001d, B:22:0x0027, B:24:0x003c, B:27:0x0045, B:29:0x004c, B:30:0x004f, B:32:0x0055, B:34:0x0069, B:36:0x0079, B:43:0x0081, B:45:0x008b, B:46:0x0090, B:48:0x0096, B:50:0x00a4, B:52:0x00b1, B:53:0x00b4, B:56:0x00c2, B:58:0x00c6, B:60:0x00cb, B:63:0x00d0, B:73:0x00d7, B:74:0x00ec, B:76:0x00f2, B:78:0x00f7, B:81:0x00ff, B:84:0x0117, B:86:0x011d, B:89:0x0126, B:91:0x012c, B:94:0x0135, B:97:0x013e, B:99:0x0146, B:102:0x014f, B:104:0x0160, B:105:0x0165, B:107:0x016a, B:108:0x016f, B:111:0x017d, B:115:0x016d, B:116:0x0163, B:119:0x0182, B:123:0x00e6), top: B:2:0x0001 }] */
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
||||
*/
|
||||
public synchronized void c() {
|
||||
/*
|
||||
Method dump skipped, instructions count: 398
|
||||
To view this dump change 'Code comments level' option to 'DEBUG'
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: com.tencent.bugly.crashreport.biz.a.c():void");
|
||||
}
|
||||
|
||||
static /* synthetic */ void a(a aVar, UserInfoBean userInfoBean, boolean z) {
|
||||
List<UserInfoBean> a;
|
||||
if (userInfoBean != null) {
|
||||
if (!z && userInfoBean.b != 1 && (a = aVar.a(com.tencent.bugly.crashreport.common.info.a.a(aVar.a).d)) != null && a.size() >= 20) {
|
||||
x.a("[UserInfo] There are too many user info in local: %d", Integer.valueOf(a.size()));
|
||||
return;
|
||||
}
|
||||
long a2 = p.a().a("t_ui", a(userInfoBean), (o) null, true);
|
||||
if (a2 >= 0) {
|
||||
x.c("[Database] insert %s success with ID: %d", "t_ui", Long.valueOf(a2));
|
||||
userInfoBean.a = a2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public final void b() {
|
||||
w a = w.a();
|
||||
if (a != null) {
|
||||
a.a(new AnonymousClass2());
|
||||
}
|
||||
}
|
||||
|
||||
public final void a(int i, boolean z, long j) {
|
||||
com.tencent.bugly.crashreport.common.strategy.a a = com.tencent.bugly.crashreport.common.strategy.a.a();
|
||||
if (a != null && !a.c().h && i != 1 && i != 3) {
|
||||
x.e("UserInfo is disable", new Object[0]);
|
||||
return;
|
||||
}
|
||||
if (i == 1 || i == 3) {
|
||||
this.c++;
|
||||
}
|
||||
com.tencent.bugly.crashreport.common.info.a a2 = com.tencent.bugly.crashreport.common.info.a.a(this.a);
|
||||
UserInfoBean userInfoBean = new UserInfoBean();
|
||||
userInfoBean.b = i;
|
||||
userInfoBean.c = a2.d;
|
||||
userInfoBean.d = a2.g();
|
||||
userInfoBean.e = System.currentTimeMillis();
|
||||
userInfoBean.f = -1L;
|
||||
userInfoBean.n = a2.j;
|
||||
userInfoBean.o = i == 1 ? 1 : 0;
|
||||
userInfoBean.l = a2.a();
|
||||
userInfoBean.m = a2.p;
|
||||
userInfoBean.g = a2.q;
|
||||
userInfoBean.h = a2.r;
|
||||
userInfoBean.i = a2.s;
|
||||
userInfoBean.k = a2.t;
|
||||
userInfoBean.r = a2.B();
|
||||
userInfoBean.s = a2.G();
|
||||
userInfoBean.p = a2.H();
|
||||
userInfoBean.q = a2.I();
|
||||
w.a().a(new RunnableC0012a(userInfoBean, z), 0L);
|
||||
}
|
||||
|
||||
public final void a() {
|
||||
this.b = z.b() + 86400000;
|
||||
w.a().a(new b(), (this.b - System.currentTimeMillis()) + 5000);
|
||||
}
|
||||
|
||||
public final List<UserInfoBean> a(String str) {
|
||||
Cursor cursor;
|
||||
String str2;
|
||||
try {
|
||||
if (z.a(str)) {
|
||||
str2 = null;
|
||||
} else {
|
||||
str2 = "_pc = '" + str + "'";
|
||||
}
|
||||
cursor = p.a().a("t_ui", null, str2, null, null, true);
|
||||
if (cursor == null) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
ArrayList arrayList = new ArrayList();
|
||||
while (cursor.moveToNext()) {
|
||||
UserInfoBean a = a(cursor);
|
||||
if (a != null) {
|
||||
arrayList.add(a);
|
||||
} else {
|
||||
try {
|
||||
long j = cursor.getLong(cursor.getColumnIndex(FileDownloadModel.ID));
|
||||
sb.append(" or _id");
|
||||
sb.append(" = ");
|
||||
sb.append(j);
|
||||
} catch (Throwable unused) {
|
||||
x.d("[Database] unknown id.", new Object[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
String sb2 = sb.toString();
|
||||
if (sb2.length() > 0) {
|
||||
x.d("[Database] deleted %s error data %d", "t_ui", Integer.valueOf(p.a().a("t_ui", sb2.substring(4), (String[]) null, (o) null, true)));
|
||||
}
|
||||
if (cursor != null) {
|
||||
cursor.close();
|
||||
}
|
||||
return arrayList;
|
||||
} catch (Throwable th) {
|
||||
th = th;
|
||||
try {
|
||||
if (!x.a(th)) {
|
||||
th.printStackTrace();
|
||||
}
|
||||
if (cursor != null) {
|
||||
cursor.close();
|
||||
}
|
||||
return null;
|
||||
} finally {
|
||||
if (cursor != null) {
|
||||
cursor.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Throwable th2) {
|
||||
th = th2;
|
||||
cursor = null;
|
||||
}
|
||||
}
|
||||
|
||||
private static void a(List<UserInfoBean> list) {
|
||||
if (list == null || list.size() == 0) {
|
||||
return;
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < list.size() && i < 50; i++) {
|
||||
UserInfoBean userInfoBean = list.get(i);
|
||||
sb.append(" or _id");
|
||||
sb.append(" = ");
|
||||
sb.append(userInfoBean.a);
|
||||
}
|
||||
String sb2 = sb.toString();
|
||||
if (sb2.length() > 0) {
|
||||
sb2 = sb2.substring(4);
|
||||
}
|
||||
String str = sb2;
|
||||
sb.setLength(0);
|
||||
try {
|
||||
x.c("[Database] deleted %s data %d", "t_ui", Integer.valueOf(p.a().a("t_ui", str, (String[]) null, (o) null, true)));
|
||||
} catch (Throwable th) {
|
||||
if (x.a(th)) {
|
||||
return;
|
||||
}
|
||||
th.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private static ContentValues a(UserInfoBean userInfoBean) {
|
||||
if (userInfoBean == null) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
ContentValues contentValues = new ContentValues();
|
||||
if (userInfoBean.a > 0) {
|
||||
contentValues.put(FileDownloadModel.ID, Long.valueOf(userInfoBean.a));
|
||||
}
|
||||
contentValues.put("_tm", Long.valueOf(userInfoBean.e));
|
||||
contentValues.put("_ut", Long.valueOf(userInfoBean.f));
|
||||
contentValues.put("_tp", Integer.valueOf(userInfoBean.b));
|
||||
contentValues.put("_pc", userInfoBean.c);
|
||||
contentValues.put("_dt", z.a(userInfoBean));
|
||||
return contentValues;
|
||||
} catch (Throwable th) {
|
||||
if (!x.a(th)) {
|
||||
th.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static UserInfoBean a(Cursor cursor) {
|
||||
if (cursor == null) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
byte[] blob = cursor.getBlob(cursor.getColumnIndex("_dt"));
|
||||
if (blob == null) {
|
||||
return null;
|
||||
}
|
||||
long j = cursor.getLong(cursor.getColumnIndex(FileDownloadModel.ID));
|
||||
UserInfoBean userInfoBean = (UserInfoBean) z.a(blob, UserInfoBean.CREATOR);
|
||||
if (userInfoBean != null) {
|
||||
userInfoBean.a = j;
|
||||
}
|
||||
return userInfoBean;
|
||||
} catch (Throwable th) {
|
||||
if (!x.a(th)) {
|
||||
th.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
138
sources/com/tencent/bugly/crashreport/biz/b.java
Normal file
138
sources/com/tencent/bugly/crashreport/biz/b.java
Normal file
@@ -0,0 +1,138 @@
|
||||
package com.tencent.bugly.crashreport.biz;
|
||||
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import com.tencent.bugly.BuglyStrategy;
|
||||
import com.tencent.bugly.crashreport.biz.a.AnonymousClass2;
|
||||
import com.tencent.bugly.crashreport.common.strategy.StrategyBean;
|
||||
import com.tencent.bugly.proguard.w;
|
||||
import com.tencent.bugly.proguard.x;
|
||||
import com.tencent.bugly.proguard.z;
|
||||
|
||||
/* compiled from: BUGLY */
|
||||
/* loaded from: classes.dex */
|
||||
public class b {
|
||||
public static a a = null;
|
||||
private static boolean b = false;
|
||||
private static int c = 10;
|
||||
private static long d = 300000;
|
||||
private static long e = 30000;
|
||||
private static long f = 0;
|
||||
private static int g = 0;
|
||||
private static long h = 0;
|
||||
private static long i = 0;
|
||||
private static long j = 0;
|
||||
private static Application.ActivityLifecycleCallbacks k = null;
|
||||
private static Class<?> l = null;
|
||||
private static boolean m = true;
|
||||
|
||||
static /* synthetic */ String a(String str, String str2) {
|
||||
return z.a() + " " + str + " " + str2 + "\n";
|
||||
}
|
||||
|
||||
static /* synthetic */ int g() {
|
||||
int i2 = g;
|
||||
g = i2 + 1;
|
||||
return i2;
|
||||
}
|
||||
|
||||
public static void a(final Context context, final BuglyStrategy buglyStrategy) {
|
||||
long j2;
|
||||
if (b) {
|
||||
return;
|
||||
}
|
||||
m = com.tencent.bugly.crashreport.common.info.a.a(context).e;
|
||||
a = new a(context, m);
|
||||
b = true;
|
||||
if (buglyStrategy != null) {
|
||||
l = buglyStrategy.getUserInfoActivity();
|
||||
j2 = buglyStrategy.getAppReportDelay();
|
||||
} else {
|
||||
j2 = 0;
|
||||
}
|
||||
if (j2 <= 0) {
|
||||
c(context, buglyStrategy);
|
||||
} else {
|
||||
w.a().a(new Runnable() { // from class: com.tencent.bugly.crashreport.biz.b.1
|
||||
@Override // java.lang.Runnable
|
||||
public final void run() {
|
||||
b.c(context, buglyStrategy);
|
||||
}
|
||||
}, j2);
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
/* JADX WARN: Removed duplicated region for block: B:27:0x0068 A[RETURN] */
|
||||
/* JADX WARN: Removed duplicated region for block: B:29:0x0069 */
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
||||
*/
|
||||
public static void c(android.content.Context r14, com.tencent.bugly.BuglyStrategy r15) {
|
||||
/*
|
||||
Method dump skipped, instructions count: 273
|
||||
To view this dump change 'Code comments level' option to 'DEBUG'
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: com.tencent.bugly.crashreport.biz.b.c(android.content.Context, com.tencent.bugly.BuglyStrategy):void");
|
||||
}
|
||||
|
||||
public static void a(long j2) {
|
||||
if (j2 < 0) {
|
||||
j2 = com.tencent.bugly.crashreport.common.strategy.a.a().c().q;
|
||||
}
|
||||
f = j2;
|
||||
}
|
||||
|
||||
public static void a(StrategyBean strategyBean, boolean z) {
|
||||
w a2;
|
||||
a aVar = a;
|
||||
if (aVar != null && !z && (a2 = w.a()) != null) {
|
||||
a2.a(aVar.new AnonymousClass2());
|
||||
}
|
||||
if (strategyBean == null) {
|
||||
return;
|
||||
}
|
||||
long j2 = strategyBean.q;
|
||||
if (j2 > 0) {
|
||||
e = j2;
|
||||
}
|
||||
int i2 = strategyBean.w;
|
||||
if (i2 > 0) {
|
||||
c = i2;
|
||||
}
|
||||
long j3 = strategyBean.x;
|
||||
if (j3 > 0) {
|
||||
d = j3;
|
||||
}
|
||||
}
|
||||
|
||||
public static void a() {
|
||||
a aVar = a;
|
||||
if (aVar != null) {
|
||||
aVar.a(2, false, 0L);
|
||||
}
|
||||
}
|
||||
|
||||
public static void a(Context context) {
|
||||
if (!b || context == null) {
|
||||
return;
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= 14) {
|
||||
Application application = context.getApplicationContext() instanceof Application ? (Application) context.getApplicationContext() : null;
|
||||
if (application != null) {
|
||||
try {
|
||||
if (k != null) {
|
||||
application.unregisterActivityLifecycleCallbacks(k);
|
||||
}
|
||||
} catch (Exception e2) {
|
||||
if (!x.a(e2)) {
|
||||
e2.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
b = false;
|
||||
}
|
||||
}
|
392
sources/com/tencent/bugly/crashreport/common/info/AppInfo.java
Normal file
392
sources/com/tencent/bugly/crashreport/common/info/AppInfo.java
Normal file
@@ -0,0 +1,392 @@
|
||||
package com.tencent.bugly.crashreport.common.info;
|
||||
|
||||
import android.app.ActivityManager;
|
||||
import android.content.Context;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.Signature;
|
||||
import com.ijm.dataencryption.de.DataDecryptTool;
|
||||
import com.tencent.bugly.proguard.x;
|
||||
import com.tencent.bugly.proguard.z;
|
||||
import com.ubt.jimu.base.util.FileUtil;
|
||||
import com.ubt.jimu.diy.model.CategoryModel;
|
||||
import com.ubtrobot.jimu.robotapi.PeripheralType;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.math.BigInteger;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.Principal;
|
||||
import java.security.cert.CertificateException;
|
||||
import java.security.cert.CertificateFactory;
|
||||
import java.security.cert.X509Certificate;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
/* compiled from: BUGLY */
|
||||
/* loaded from: classes.dex */
|
||||
public class AppInfo {
|
||||
private static ActivityManager a;
|
||||
|
||||
static {
|
||||
"@buglyAllChannel@".split(",");
|
||||
"@buglyAllChannelPriority@".split(",");
|
||||
}
|
||||
|
||||
public static String a(Context context) {
|
||||
if (context == null) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return context.getPackageName();
|
||||
} catch (Throwable th) {
|
||||
if (x.a(th)) {
|
||||
return "fail";
|
||||
}
|
||||
th.printStackTrace();
|
||||
return "fail";
|
||||
}
|
||||
}
|
||||
|
||||
public static PackageInfo b(Context context) {
|
||||
try {
|
||||
return context.getPackageManager().getPackageInfo(a(context), 0);
|
||||
} catch (Throwable th) {
|
||||
if (x.a(th)) {
|
||||
return null;
|
||||
}
|
||||
th.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static String c(Context context) {
|
||||
CharSequence applicationLabel;
|
||||
if (context == null) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
PackageManager packageManager = context.getPackageManager();
|
||||
ApplicationInfo applicationInfo = context.getApplicationInfo();
|
||||
if (packageManager != null && applicationInfo != null && (applicationLabel = packageManager.getApplicationLabel(applicationInfo)) != null) {
|
||||
return applicationLabel.toString();
|
||||
}
|
||||
} catch (Throwable th) {
|
||||
if (!x.a(th)) {
|
||||
th.printStackTrace();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Map<String, String> d(Context context) {
|
||||
if (context == null) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
ApplicationInfo applicationInfo = context.getPackageManager().getApplicationInfo(context.getPackageName(), PeripheralType.SERVO);
|
||||
if (applicationInfo.metaData == null) {
|
||||
return null;
|
||||
}
|
||||
HashMap hashMap = new HashMap();
|
||||
Object obj = applicationInfo.metaData.get("BUGLY_DISABLE");
|
||||
if (obj != null) {
|
||||
hashMap.put("BUGLY_DISABLE", obj.toString());
|
||||
}
|
||||
Object obj2 = applicationInfo.metaData.get("BUGLY_APPID");
|
||||
if (obj2 != null) {
|
||||
hashMap.put("BUGLY_APPID", obj2.toString());
|
||||
}
|
||||
Object obj3 = applicationInfo.metaData.get("BUGLY_APP_CHANNEL");
|
||||
if (obj3 != null) {
|
||||
hashMap.put("BUGLY_APP_CHANNEL", obj3.toString());
|
||||
}
|
||||
Object obj4 = applicationInfo.metaData.get("BUGLY_APP_VERSION");
|
||||
if (obj4 != null) {
|
||||
hashMap.put("BUGLY_APP_VERSION", obj4.toString());
|
||||
}
|
||||
Object obj5 = applicationInfo.metaData.get("BUGLY_ENABLE_DEBUG");
|
||||
if (obj5 != null) {
|
||||
hashMap.put("BUGLY_ENABLE_DEBUG", obj5.toString());
|
||||
}
|
||||
Object obj6 = applicationInfo.metaData.get("com.tencent.rdm.uuid");
|
||||
if (obj6 != null) {
|
||||
hashMap.put("com.tencent.rdm.uuid", obj6.toString());
|
||||
}
|
||||
return hashMap;
|
||||
} catch (Throwable th) {
|
||||
if (!x.a(th)) {
|
||||
th.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static String e(Context context) {
|
||||
Signature[] signatureArr;
|
||||
String a2 = a(context);
|
||||
if (a2 == null) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
PackageInfo packageInfo = context.getPackageManager().getPackageInfo(a2, 64);
|
||||
if (packageInfo != null && (signatureArr = packageInfo.signatures) != null && signatureArr.length != 0) {
|
||||
return a(signatureArr[0].toByteArray());
|
||||
}
|
||||
} catch (PackageManager.NameNotFoundException unused) {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static boolean f(Context context) {
|
||||
if (context == null) {
|
||||
return false;
|
||||
}
|
||||
if (a == null) {
|
||||
a = (ActivityManager) context.getSystemService("activity");
|
||||
}
|
||||
try {
|
||||
ActivityManager.MemoryInfo memoryInfo = new ActivityManager.MemoryInfo();
|
||||
a.getMemoryInfo(memoryInfo);
|
||||
if (!memoryInfo.lowMemory) {
|
||||
return false;
|
||||
}
|
||||
x.c("Memory is low.", new Object[0]);
|
||||
return true;
|
||||
} catch (Throwable th) {
|
||||
if (!x.a(th)) {
|
||||
th.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static String g(Context context) {
|
||||
if (context == null) {
|
||||
return "";
|
||||
}
|
||||
String h = h(context);
|
||||
return !z.a(h) ? h : i(context);
|
||||
}
|
||||
|
||||
private static String h(Context context) {
|
||||
String str = "";
|
||||
InputStream inputStream = null;
|
||||
try {
|
||||
} catch (IOException e) {
|
||||
x.a(e);
|
||||
}
|
||||
try {
|
||||
try {
|
||||
String string = z.a("DENGTA_META", context).getString("key_channelpath", "");
|
||||
if (z.a(string)) {
|
||||
string = "channel.ini";
|
||||
}
|
||||
x.a("[AppInfo] Beacon channel file path: " + string, new Object[0]);
|
||||
if (!string.equals("")) {
|
||||
inputStream = context.getAssets().open(string);
|
||||
Properties properties = new Properties();
|
||||
properties.load(inputStream);
|
||||
str = properties.getProperty("CHANNEL", "");
|
||||
x.a("[AppInfo] Beacon channel read from assert: " + str, new Object[0]);
|
||||
if (!z.a(str)) {
|
||||
return str;
|
||||
}
|
||||
}
|
||||
} catch (Exception unused) {
|
||||
x.d("[AppInfo] Failed to get get beacon channel", new Object[0]);
|
||||
if (inputStream != null) {
|
||||
inputStream.close();
|
||||
}
|
||||
}
|
||||
if (inputStream != null) {
|
||||
inputStream.close();
|
||||
}
|
||||
return str;
|
||||
} finally {
|
||||
if (inputStream != null) {
|
||||
try {
|
||||
inputStream.close();
|
||||
} catch (IOException e2) {
|
||||
x.a(e2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static String i(Context context) {
|
||||
try {
|
||||
Object obj = context.getPackageManager().getApplicationInfo(context.getPackageName(), PeripheralType.SERVO).metaData.get("CHANNEL_DENGTA");
|
||||
return obj != null ? obj.toString() : "";
|
||||
} catch (Throwable th) {
|
||||
x.d("[AppInfo] Failed to read beacon channel from manifest.", new Object[0]);
|
||||
x.a(th);
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean a(Context context, String str) {
|
||||
if (context != null && str != null && str.trim().length() > 0) {
|
||||
try {
|
||||
String[] strArr = context.getPackageManager().getPackageInfo(context.getPackageName(), FileUtil.ZIP_BUFFER_SIZE).requestedPermissions;
|
||||
if (strArr != null) {
|
||||
for (String str2 : strArr) {
|
||||
if (str.equals(str2)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Throwable th) {
|
||||
if (!x.a(th)) {
|
||||
th.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static String a(int i) {
|
||||
FileReader fileReader;
|
||||
FileReader fileReader2 = null;
|
||||
try {
|
||||
fileReader = new FileReader("/proc/" + i + "/cmdline");
|
||||
} catch (Throwable th) {
|
||||
th = th;
|
||||
}
|
||||
try {
|
||||
char[] cArr = new char[DataDecryptTool.DECRYPT_DB_FILE];
|
||||
fileReader.read(cArr);
|
||||
int i2 = 0;
|
||||
while (i2 < cArr.length && cArr[i2] != 0) {
|
||||
i2++;
|
||||
}
|
||||
String substring = new String(cArr).substring(0, i2);
|
||||
try {
|
||||
fileReader.close();
|
||||
} catch (Throwable unused) {
|
||||
}
|
||||
return substring;
|
||||
} catch (Throwable th2) {
|
||||
th = th2;
|
||||
fileReader2 = fileReader;
|
||||
try {
|
||||
if (!x.a(th)) {
|
||||
th.printStackTrace();
|
||||
}
|
||||
String valueOf = String.valueOf(i);
|
||||
if (fileReader2 != null) {
|
||||
try {
|
||||
fileReader2.close();
|
||||
} catch (Throwable unused2) {
|
||||
}
|
||||
}
|
||||
return valueOf;
|
||||
} catch (Throwable th3) {
|
||||
if (fileReader2 != null) {
|
||||
try {
|
||||
fileReader2.close();
|
||||
} catch (Throwable unused3) {
|
||||
}
|
||||
}
|
||||
throw th3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static List<String> a(Map<String, String> map) {
|
||||
if (map == null) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
String str = map.get("BUGLY_DISABLE");
|
||||
if (str != null && str.length() != 0) {
|
||||
String[] split = str.split(",");
|
||||
for (int i = 0; i < split.length; i++) {
|
||||
split[i] = split[i].trim();
|
||||
}
|
||||
return Arrays.asList(split);
|
||||
}
|
||||
return null;
|
||||
} catch (Throwable th) {
|
||||
if (!x.a(th)) {
|
||||
th.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static String a(byte[] bArr) {
|
||||
X509Certificate x509Certificate;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (bArr != null && bArr.length > 0) {
|
||||
try {
|
||||
CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509");
|
||||
if (certificateFactory == null || (x509Certificate = (X509Certificate) certificateFactory.generateCertificate(new ByteArrayInputStream(bArr))) == null) {
|
||||
return null;
|
||||
}
|
||||
sb.append("Issuer|");
|
||||
Principal issuerDN = x509Certificate.getIssuerDN();
|
||||
if (issuerDN != null) {
|
||||
sb.append(issuerDN.toString());
|
||||
} else {
|
||||
sb.append(CategoryModel.unknown);
|
||||
}
|
||||
sb.append("\n");
|
||||
sb.append("SerialNumber|");
|
||||
BigInteger serialNumber = x509Certificate.getSerialNumber();
|
||||
if (issuerDN != null) {
|
||||
sb.append(serialNumber.toString(16));
|
||||
} else {
|
||||
sb.append(CategoryModel.unknown);
|
||||
}
|
||||
sb.append("\n");
|
||||
sb.append("NotBefore|");
|
||||
Date notBefore = x509Certificate.getNotBefore();
|
||||
if (issuerDN != null) {
|
||||
sb.append(notBefore.toString());
|
||||
} else {
|
||||
sb.append(CategoryModel.unknown);
|
||||
}
|
||||
sb.append("\n");
|
||||
sb.append("NotAfter|");
|
||||
Date notAfter = x509Certificate.getNotAfter();
|
||||
if (issuerDN != null) {
|
||||
sb.append(notAfter.toString());
|
||||
} else {
|
||||
sb.append(CategoryModel.unknown);
|
||||
}
|
||||
sb.append("\n");
|
||||
sb.append("SHA1|");
|
||||
String a2 = z.a(MessageDigest.getInstance("SHA1").digest(x509Certificate.getEncoded()));
|
||||
if (a2 != null && a2.length() > 0) {
|
||||
sb.append(a2.toString());
|
||||
} else {
|
||||
sb.append(CategoryModel.unknown);
|
||||
}
|
||||
sb.append("\n");
|
||||
sb.append("MD5|");
|
||||
String a3 = z.a(MessageDigest.getInstance("MD5").digest(x509Certificate.getEncoded()));
|
||||
if (a3 != null && a3.length() > 0) {
|
||||
sb.append(a3.toString());
|
||||
} else {
|
||||
sb.append(CategoryModel.unknown);
|
||||
}
|
||||
} catch (CertificateException e) {
|
||||
if (!x.a(e)) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} catch (Throwable th) {
|
||||
if (!x.a(th)) {
|
||||
th.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sb.length() == 0 ? CategoryModel.unknown : sb.toString();
|
||||
}
|
||||
}
|
@@ -0,0 +1,51 @@
|
||||
package com.tencent.bugly.crashreport.common.info;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
/* compiled from: BUGLY */
|
||||
/* loaded from: classes.dex */
|
||||
public class PlugInBean implements Parcelable {
|
||||
public static final Parcelable.Creator<PlugInBean> CREATOR = new Parcelable.Creator<PlugInBean>() { // from class: com.tencent.bugly.crashreport.common.info.PlugInBean.1
|
||||
@Override // android.os.Parcelable.Creator
|
||||
public final /* synthetic */ PlugInBean createFromParcel(Parcel parcel) {
|
||||
return new PlugInBean(parcel);
|
||||
}
|
||||
|
||||
@Override // android.os.Parcelable.Creator
|
||||
public final /* bridge */ /* synthetic */ PlugInBean[] newArray(int i) {
|
||||
return new PlugInBean[i];
|
||||
}
|
||||
};
|
||||
public final String a;
|
||||
public final String b;
|
||||
public final String c;
|
||||
|
||||
public PlugInBean(String str, String str2, String str3) {
|
||||
this.a = str;
|
||||
this.b = str2;
|
||||
this.c = str3;
|
||||
}
|
||||
|
||||
@Override // android.os.Parcelable
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "plid:" + this.a + " plV:" + this.b + " plUUID:" + this.c;
|
||||
}
|
||||
|
||||
@Override // android.os.Parcelable
|
||||
public void writeToParcel(Parcel parcel, int i) {
|
||||
parcel.writeString(this.a);
|
||||
parcel.writeString(this.b);
|
||||
parcel.writeString(this.c);
|
||||
}
|
||||
|
||||
public PlugInBean(Parcel parcel) {
|
||||
this.a = parcel.readString();
|
||||
this.b = parcel.readString();
|
||||
this.c = parcel.readString();
|
||||
}
|
||||
}
|
652
sources/com/tencent/bugly/crashreport/common/info/a.java
Normal file
652
sources/com/tencent/bugly/crashreport/common/info/a.java
Normal file
@@ -0,0 +1,652 @@
|
||||
package com.tencent.bugly.crashreport.common.info;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.os.Process;
|
||||
import com.tencent.bugly.proguard.x;
|
||||
import com.tencent.bugly.proguard.z;
|
||||
import com.ubt.jimu.diy.model.CategoryModel;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/* compiled from: BUGLY */
|
||||
/* loaded from: classes.dex */
|
||||
public final class a {
|
||||
private static a af;
|
||||
public SharedPreferences E;
|
||||
private final Context F;
|
||||
private String G;
|
||||
private String H;
|
||||
private String I;
|
||||
private String Y;
|
||||
public String c;
|
||||
public final String d;
|
||||
public final String f;
|
||||
public final String g;
|
||||
public final String h;
|
||||
public long i;
|
||||
public String j;
|
||||
public String k;
|
||||
public String l;
|
||||
public List<String> o;
|
||||
public boolean u;
|
||||
public String v;
|
||||
public String w;
|
||||
public String x;
|
||||
public boolean z;
|
||||
public boolean e = true;
|
||||
private String J = CategoryModel.unknown;
|
||||
private String K = CategoryModel.unknown;
|
||||
private String L = "";
|
||||
private String M = null;
|
||||
private String N = null;
|
||||
private String O = null;
|
||||
private String P = null;
|
||||
private long Q = -1;
|
||||
private long R = -1;
|
||||
private long S = -1;
|
||||
private String T = null;
|
||||
private String U = null;
|
||||
private Map<String, PlugInBean> V = null;
|
||||
private boolean W = true;
|
||||
private String X = null;
|
||||
private Boolean Z = null;
|
||||
private String aa = null;
|
||||
private String ab = null;
|
||||
private String ac = null;
|
||||
public String m = null;
|
||||
public String n = null;
|
||||
private Map<String, PlugInBean> ad = null;
|
||||
private Map<String, PlugInBean> ae = null;
|
||||
private int ag = -1;
|
||||
private int ah = -1;
|
||||
private Map<String, String> ai = new HashMap();
|
||||
private Map<String, String> aj = new HashMap();
|
||||
private Map<String, String> ak = new HashMap();
|
||||
private boolean al = true;
|
||||
public String p = CategoryModel.unknown;
|
||||
public long q = 0;
|
||||
public long r = 0;
|
||||
public long s = 0;
|
||||
public long t = 0;
|
||||
public boolean y = false;
|
||||
private Boolean am = null;
|
||||
private Boolean an = null;
|
||||
public HashMap<String, String> A = new HashMap<>();
|
||||
private String ao = null;
|
||||
private String ap = null;
|
||||
private String aq = null;
|
||||
private String ar = null;
|
||||
private String as = null;
|
||||
public boolean B = true;
|
||||
public List<String> C = new ArrayList();
|
||||
public com.tencent.bugly.crashreport.a D = null;
|
||||
|
||||
/* renamed from: at, reason: collision with root package name */
|
||||
private final Object f1at = new Object();
|
||||
private final Object au = new Object();
|
||||
private final Object av = new Object();
|
||||
private final Object aw = new Object();
|
||||
private final Object ax = new Object();
|
||||
private final Object ay = new Object();
|
||||
private final Object az = new Object();
|
||||
public final long a = System.currentTimeMillis();
|
||||
public final byte b = 1;
|
||||
|
||||
private a(Context context) {
|
||||
this.j = null;
|
||||
this.k = null;
|
||||
this.Y = null;
|
||||
this.l = null;
|
||||
this.o = null;
|
||||
this.u = false;
|
||||
this.v = null;
|
||||
this.w = null;
|
||||
this.x = null;
|
||||
this.z = false;
|
||||
this.F = z.a(context);
|
||||
PackageInfo b = AppInfo.b(context);
|
||||
if (b != null) {
|
||||
try {
|
||||
this.j = b.versionName;
|
||||
this.v = this.j;
|
||||
this.w = Integer.toString(b.versionCode);
|
||||
} catch (Throwable th) {
|
||||
if (!x.a(th)) {
|
||||
th.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
this.c = AppInfo.a(context);
|
||||
this.d = AppInfo.a(Process.myPid());
|
||||
this.f = b.o();
|
||||
this.g = b.a();
|
||||
this.k = AppInfo.c(context);
|
||||
this.h = "Android " + b.b() + ",level " + b.c();
|
||||
String str = this.g + ";" + this.h;
|
||||
Map<String, String> d = AppInfo.d(context);
|
||||
if (d != null) {
|
||||
try {
|
||||
this.o = AppInfo.a(d);
|
||||
String str2 = d.get("BUGLY_APPID");
|
||||
if (str2 != null) {
|
||||
this.Y = str2;
|
||||
c("APP_ID", this.Y);
|
||||
}
|
||||
String str3 = d.get("BUGLY_APP_VERSION");
|
||||
if (str3 != null) {
|
||||
this.j = str3;
|
||||
}
|
||||
String str4 = d.get("BUGLY_APP_CHANNEL");
|
||||
if (str4 != null) {
|
||||
this.l = str4;
|
||||
}
|
||||
String str5 = d.get("BUGLY_ENABLE_DEBUG");
|
||||
if (str5 != null) {
|
||||
this.u = str5.equalsIgnoreCase("true");
|
||||
}
|
||||
String str6 = d.get("com.tencent.rdm.uuid");
|
||||
if (str6 != null) {
|
||||
this.x = str6;
|
||||
}
|
||||
} catch (Throwable th2) {
|
||||
if (!x.a(th2)) {
|
||||
th2.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
try {
|
||||
if (!context.getDatabasePath("bugly_db_").exists()) {
|
||||
this.z = true;
|
||||
x.c("App is first time to be installed on the device.", new Object[0]);
|
||||
}
|
||||
} catch (Throwable th3) {
|
||||
if (com.tencent.bugly.b.c) {
|
||||
th3.printStackTrace();
|
||||
}
|
||||
}
|
||||
this.E = z.a("BUGLY_COMMON_VALUES", context);
|
||||
x.c("com info create end", new Object[0]);
|
||||
}
|
||||
|
||||
public static int K() {
|
||||
return b.c();
|
||||
}
|
||||
|
||||
public static synchronized a b() {
|
||||
a aVar;
|
||||
synchronized (a.class) {
|
||||
aVar = af;
|
||||
}
|
||||
return aVar;
|
||||
}
|
||||
|
||||
public static String c() {
|
||||
return "3.1.0";
|
||||
}
|
||||
|
||||
public final String A() {
|
||||
if (this.ac == null) {
|
||||
this.ac = b.g();
|
||||
x.a("Hardware serial number: %s", this.ac);
|
||||
}
|
||||
return this.ac;
|
||||
}
|
||||
|
||||
public final Map<String, String> B() {
|
||||
synchronized (this.av) {
|
||||
if (this.ai.size() <= 0) {
|
||||
return null;
|
||||
}
|
||||
return new HashMap(this.ai);
|
||||
}
|
||||
}
|
||||
|
||||
public final void C() {
|
||||
synchronized (this.av) {
|
||||
this.ai.clear();
|
||||
}
|
||||
}
|
||||
|
||||
public final int D() {
|
||||
int size;
|
||||
synchronized (this.av) {
|
||||
size = this.ai.size();
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
public final Set<String> E() {
|
||||
Set<String> keySet;
|
||||
synchronized (this.av) {
|
||||
keySet = this.ai.keySet();
|
||||
}
|
||||
return keySet;
|
||||
}
|
||||
|
||||
public final Map<String, String> F() {
|
||||
synchronized (this.az) {
|
||||
if (this.aj.size() <= 0) {
|
||||
return null;
|
||||
}
|
||||
return new HashMap(this.aj);
|
||||
}
|
||||
}
|
||||
|
||||
public final Map<String, String> G() {
|
||||
synchronized (this.aw) {
|
||||
if (this.ak.size() <= 0) {
|
||||
return null;
|
||||
}
|
||||
return new HashMap(this.ak);
|
||||
}
|
||||
}
|
||||
|
||||
public final int H() {
|
||||
int i;
|
||||
synchronized (this.ax) {
|
||||
i = this.ag;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
public final int I() {
|
||||
return this.ah;
|
||||
}
|
||||
|
||||
public final synchronized Map<String, PlugInBean> J() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public final String L() {
|
||||
if (this.ao == null) {
|
||||
this.ao = b.q();
|
||||
}
|
||||
return this.ao;
|
||||
}
|
||||
|
||||
public final String M() {
|
||||
if (this.ap == null) {
|
||||
this.ap = b.f(this.F);
|
||||
}
|
||||
return this.ap;
|
||||
}
|
||||
|
||||
public final String N() {
|
||||
if (this.aq == null) {
|
||||
this.aq = b.g(this.F);
|
||||
}
|
||||
return this.aq;
|
||||
}
|
||||
|
||||
public final String O() {
|
||||
return b.r();
|
||||
}
|
||||
|
||||
public final String P() {
|
||||
if (this.ar == null) {
|
||||
this.ar = b.h(this.F);
|
||||
}
|
||||
return this.ar;
|
||||
}
|
||||
|
||||
public final long Q() {
|
||||
return b.s();
|
||||
}
|
||||
|
||||
public final boolean R() {
|
||||
if (this.am == null) {
|
||||
this.am = Boolean.valueOf(b.i(this.F));
|
||||
x.a("Is it a virtual machine? " + this.am, new Object[0]);
|
||||
}
|
||||
return this.am.booleanValue();
|
||||
}
|
||||
|
||||
public final boolean S() {
|
||||
if (this.an == null) {
|
||||
this.an = Boolean.valueOf(b.j(this.F));
|
||||
x.a("Does it has hook frame? " + this.an, new Object[0]);
|
||||
}
|
||||
return this.an.booleanValue();
|
||||
}
|
||||
|
||||
public final String T() {
|
||||
if (this.H == null) {
|
||||
this.H = AppInfo.g(this.F);
|
||||
x.a("Beacon channel " + this.H, new Object[0]);
|
||||
}
|
||||
return this.H;
|
||||
}
|
||||
|
||||
public final boolean a() {
|
||||
return this.al;
|
||||
}
|
||||
|
||||
public final void c(String str) {
|
||||
this.I = str;
|
||||
synchronized (this.az) {
|
||||
this.aj.put("E8", str);
|
||||
}
|
||||
}
|
||||
|
||||
public final void d() {
|
||||
synchronized (this.f1at) {
|
||||
this.G = UUID.randomUUID().toString();
|
||||
}
|
||||
}
|
||||
|
||||
public final String e() {
|
||||
String str;
|
||||
synchronized (this.f1at) {
|
||||
if (this.G == null) {
|
||||
synchronized (this.f1at) {
|
||||
this.G = UUID.randomUUID().toString();
|
||||
}
|
||||
}
|
||||
str = this.G;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
public final String f() {
|
||||
if (z.a((String) null)) {
|
||||
return this.Y;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public final String g() {
|
||||
String str;
|
||||
synchronized (this.ay) {
|
||||
str = this.J;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
public final String h() {
|
||||
String str = this.I;
|
||||
if (str != null) {
|
||||
return str;
|
||||
}
|
||||
this.I = k() + "|" + m() + "|" + n();
|
||||
return this.I;
|
||||
}
|
||||
|
||||
public final synchronized String i() {
|
||||
return this.K;
|
||||
}
|
||||
|
||||
public final synchronized String j() {
|
||||
return this.L;
|
||||
}
|
||||
|
||||
public final String k() {
|
||||
if (!this.W) {
|
||||
return "";
|
||||
}
|
||||
if (this.M == null) {
|
||||
this.M = b.d();
|
||||
}
|
||||
return this.M;
|
||||
}
|
||||
|
||||
public final String l() {
|
||||
if (!this.W) {
|
||||
return "";
|
||||
}
|
||||
String str = this.N;
|
||||
if (str == null || !str.contains(":")) {
|
||||
this.N = b.f();
|
||||
}
|
||||
return this.N;
|
||||
}
|
||||
|
||||
public final String m() {
|
||||
if (!this.W) {
|
||||
return "";
|
||||
}
|
||||
if (this.O == null) {
|
||||
this.O = b.e();
|
||||
}
|
||||
return this.O;
|
||||
}
|
||||
|
||||
public final String n() {
|
||||
if (!this.W) {
|
||||
return "";
|
||||
}
|
||||
if (this.P == null) {
|
||||
this.P = b.a(this.F);
|
||||
}
|
||||
return this.P;
|
||||
}
|
||||
|
||||
public final long o() {
|
||||
if (this.Q <= 0) {
|
||||
this.Q = b.h();
|
||||
}
|
||||
return this.Q;
|
||||
}
|
||||
|
||||
public final long p() {
|
||||
if (this.R <= 0) {
|
||||
this.R = b.j();
|
||||
}
|
||||
return this.R;
|
||||
}
|
||||
|
||||
public final long q() {
|
||||
if (this.S <= 0) {
|
||||
this.S = b.l();
|
||||
}
|
||||
return this.S;
|
||||
}
|
||||
|
||||
public final String r() {
|
||||
if (this.T == null) {
|
||||
this.T = b.a(this.F, true);
|
||||
}
|
||||
return this.T;
|
||||
}
|
||||
|
||||
public final String s() {
|
||||
if (this.U == null) {
|
||||
this.U = b.e(this.F);
|
||||
}
|
||||
return this.U;
|
||||
}
|
||||
|
||||
public final String t() {
|
||||
try {
|
||||
Map<String, ?> all = this.F.getSharedPreferences("BuglySdkInfos", 0).getAll();
|
||||
if (!all.isEmpty()) {
|
||||
synchronized (this.au) {
|
||||
for (Map.Entry<String, ?> entry : all.entrySet()) {
|
||||
try {
|
||||
this.A.put(entry.getKey(), entry.getValue().toString());
|
||||
} catch (Throwable th) {
|
||||
x.a(th);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Throwable th2) {
|
||||
x.a(th2);
|
||||
}
|
||||
if (this.A.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (Map.Entry<String, String> entry2 : this.A.entrySet()) {
|
||||
sb.append("[");
|
||||
sb.append(entry2.getKey());
|
||||
sb.append(",");
|
||||
sb.append(entry2.getValue());
|
||||
sb.append("] ");
|
||||
}
|
||||
c("SDK_INFO", sb.toString());
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public final String u() {
|
||||
if (this.as == null) {
|
||||
this.as = AppInfo.e(this.F);
|
||||
}
|
||||
return this.as;
|
||||
}
|
||||
|
||||
public final synchronized Map<String, PlugInBean> v() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public final String w() {
|
||||
if (this.X == null) {
|
||||
this.X = b.n();
|
||||
}
|
||||
return this.X;
|
||||
}
|
||||
|
||||
public final Boolean x() {
|
||||
if (this.Z == null) {
|
||||
this.Z = Boolean.valueOf(b.p());
|
||||
}
|
||||
return this.Z;
|
||||
}
|
||||
|
||||
public final String y() {
|
||||
if (this.aa == null) {
|
||||
this.aa = b.d(this.F);
|
||||
x.a("ROM ID: %s", this.aa);
|
||||
}
|
||||
return this.aa;
|
||||
}
|
||||
|
||||
public final String z() {
|
||||
if (this.ab == null) {
|
||||
this.ab = b.b(this.F);
|
||||
x.a("SIM serial number: %s", this.ab);
|
||||
}
|
||||
return this.ab;
|
||||
}
|
||||
|
||||
public final void a(boolean z) {
|
||||
this.al = z;
|
||||
com.tencent.bugly.crashreport.a aVar = this.D;
|
||||
if (aVar != null) {
|
||||
aVar.setNativeIsAppForeground(z);
|
||||
}
|
||||
}
|
||||
|
||||
public final void b(String str) {
|
||||
synchronized (this.ay) {
|
||||
if (str == null) {
|
||||
str = "10000";
|
||||
}
|
||||
this.J = str;
|
||||
}
|
||||
}
|
||||
|
||||
public final String f(String str) {
|
||||
String remove;
|
||||
if (z.a(str)) {
|
||||
x.d("key should not be empty %s", str);
|
||||
return null;
|
||||
}
|
||||
synchronized (this.av) {
|
||||
remove = this.ai.remove(str);
|
||||
}
|
||||
return remove;
|
||||
}
|
||||
|
||||
public final synchronized void d(String str) {
|
||||
this.K = str;
|
||||
}
|
||||
|
||||
public final String g(String str) {
|
||||
String str2;
|
||||
if (z.a(str)) {
|
||||
x.d("key should not be empty %s", str);
|
||||
return null;
|
||||
}
|
||||
synchronized (this.av) {
|
||||
str2 = this.ai.get(str);
|
||||
}
|
||||
return str2;
|
||||
}
|
||||
|
||||
public static synchronized a a(Context context) {
|
||||
a aVar;
|
||||
synchronized (a.class) {
|
||||
if (af == null) {
|
||||
af = new a(context);
|
||||
}
|
||||
aVar = af;
|
||||
}
|
||||
return aVar;
|
||||
}
|
||||
|
||||
public final void b(boolean z) {
|
||||
this.W = z;
|
||||
}
|
||||
|
||||
public final void c(String str, String str2) {
|
||||
if (!z.a(str) && !z.a(str2)) {
|
||||
synchronized (this.aw) {
|
||||
this.ak.put(str, str2);
|
||||
}
|
||||
} else {
|
||||
x.d("server key&value should not be empty %s %s", str, str2);
|
||||
}
|
||||
}
|
||||
|
||||
public final void b(String str, String str2) {
|
||||
if (!z.a(str) && !z.a(str2)) {
|
||||
synchronized (this.av) {
|
||||
this.ai.put(str, str2);
|
||||
}
|
||||
} else {
|
||||
x.d("key&value should not be empty %s %s", str, str2);
|
||||
}
|
||||
}
|
||||
|
||||
public final synchronized void e(String str) {
|
||||
this.L = str;
|
||||
}
|
||||
|
||||
public final void a(String str) {
|
||||
this.Y = str;
|
||||
c("APP_ID", str);
|
||||
}
|
||||
|
||||
public final void a(String str, String str2) {
|
||||
if (str == null || str2 == null) {
|
||||
return;
|
||||
}
|
||||
synchronized (this.au) {
|
||||
this.A.put(str, str2);
|
||||
}
|
||||
}
|
||||
|
||||
public final void b(int i) {
|
||||
int i2 = this.ah;
|
||||
if (i2 != 24096) {
|
||||
this.ah = 24096;
|
||||
x.a("server scene tag %d changed to tag %d", Integer.valueOf(i2), Integer.valueOf(this.ah));
|
||||
}
|
||||
}
|
||||
|
||||
public final void a(int i) {
|
||||
synchronized (this.ax) {
|
||||
int i2 = this.ag;
|
||||
if (i2 != i) {
|
||||
this.ag = i;
|
||||
x.a("user scene tag %d changed to tag %d", Integer.valueOf(i2), Integer.valueOf(this.ag));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
1254
sources/com/tencent/bugly/crashreport/common/info/b.java
Normal file
1254
sources/com/tencent/bugly/crashreport/common/info/b.java
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,154 @@
|
||||
package com.tencent.bugly.crashreport.common.strategy;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import com.tencent.bugly.proguard.z;
|
||||
import java.util.Map;
|
||||
|
||||
/* compiled from: BUGLY */
|
||||
/* loaded from: classes.dex */
|
||||
public class StrategyBean implements Parcelable {
|
||||
public static final Parcelable.Creator<StrategyBean> CREATOR = new Parcelable.Creator<StrategyBean>() { // from class: com.tencent.bugly.crashreport.common.strategy.StrategyBean.1
|
||||
@Override // android.os.Parcelable.Creator
|
||||
public final /* synthetic */ StrategyBean createFromParcel(Parcel parcel) {
|
||||
return new StrategyBean(parcel);
|
||||
}
|
||||
|
||||
@Override // android.os.Parcelable.Creator
|
||||
public final /* bridge */ /* synthetic */ StrategyBean[] newArray(int i) {
|
||||
return new StrategyBean[i];
|
||||
}
|
||||
};
|
||||
public static String a = "http://rqd.uu.qq.com/rqd/sync";
|
||||
public static String b = "http://android.bugly.qq.com/rqd/async";
|
||||
public static String c = "http://android.bugly.qq.com/rqd/async";
|
||||
public static String d;
|
||||
public long e;
|
||||
public long f;
|
||||
public boolean g;
|
||||
public boolean h;
|
||||
public boolean i;
|
||||
public boolean j;
|
||||
public boolean k;
|
||||
public boolean l;
|
||||
public boolean m;
|
||||
public boolean n;
|
||||
public boolean o;
|
||||
public long p;
|
||||
public long q;
|
||||
public String r;
|
||||
public String s;
|
||||
public String t;
|
||||
public String u;
|
||||
public Map<String, String> v;
|
||||
public int w;
|
||||
public long x;
|
||||
public long y;
|
||||
|
||||
public StrategyBean() {
|
||||
this.e = -1L;
|
||||
this.f = -1L;
|
||||
this.g = true;
|
||||
this.h = true;
|
||||
this.i = true;
|
||||
this.j = true;
|
||||
this.k = false;
|
||||
this.l = true;
|
||||
this.m = true;
|
||||
this.n = true;
|
||||
this.o = true;
|
||||
this.q = 30000L;
|
||||
this.r = b;
|
||||
this.s = c;
|
||||
this.t = a;
|
||||
this.w = 10;
|
||||
this.x = 300000L;
|
||||
this.y = -1L;
|
||||
this.f = System.currentTimeMillis();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("S(@L@L");
|
||||
sb.append("@)");
|
||||
d = sb.toString();
|
||||
sb.setLength(0);
|
||||
sb.append("*^@K#K");
|
||||
sb.append("@!");
|
||||
this.u = sb.toString();
|
||||
}
|
||||
|
||||
@Override // android.os.Parcelable
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override // android.os.Parcelable
|
||||
public void writeToParcel(Parcel parcel, int i) {
|
||||
parcel.writeLong(this.f);
|
||||
parcel.writeByte(this.g ? (byte) 1 : (byte) 0);
|
||||
parcel.writeByte(this.h ? (byte) 1 : (byte) 0);
|
||||
parcel.writeByte(this.i ? (byte) 1 : (byte) 0);
|
||||
parcel.writeString(this.r);
|
||||
parcel.writeString(this.s);
|
||||
parcel.writeString(this.u);
|
||||
z.b(parcel, this.v);
|
||||
parcel.writeByte(this.j ? (byte) 1 : (byte) 0);
|
||||
parcel.writeByte(this.k ? (byte) 1 : (byte) 0);
|
||||
parcel.writeByte(this.n ? (byte) 1 : (byte) 0);
|
||||
parcel.writeByte(this.o ? (byte) 1 : (byte) 0);
|
||||
parcel.writeLong(this.q);
|
||||
parcel.writeByte(this.l ? (byte) 1 : (byte) 0);
|
||||
parcel.writeByte(this.m ? (byte) 1 : (byte) 0);
|
||||
parcel.writeLong(this.p);
|
||||
parcel.writeInt(this.w);
|
||||
parcel.writeLong(this.x);
|
||||
parcel.writeLong(this.y);
|
||||
}
|
||||
|
||||
public StrategyBean(Parcel parcel) {
|
||||
this.e = -1L;
|
||||
this.f = -1L;
|
||||
boolean z = true;
|
||||
this.g = true;
|
||||
this.h = true;
|
||||
this.i = true;
|
||||
this.j = true;
|
||||
this.k = false;
|
||||
this.l = true;
|
||||
this.m = true;
|
||||
this.n = true;
|
||||
this.o = true;
|
||||
this.q = 30000L;
|
||||
this.r = b;
|
||||
this.s = c;
|
||||
this.t = a;
|
||||
this.w = 10;
|
||||
this.x = 300000L;
|
||||
this.y = -1L;
|
||||
try {
|
||||
d = "S(@L@L@)";
|
||||
this.f = parcel.readLong();
|
||||
this.g = parcel.readByte() == 1;
|
||||
this.h = parcel.readByte() == 1;
|
||||
this.i = parcel.readByte() == 1;
|
||||
this.r = parcel.readString();
|
||||
this.s = parcel.readString();
|
||||
this.u = parcel.readString();
|
||||
this.v = z.b(parcel);
|
||||
this.j = parcel.readByte() == 1;
|
||||
this.k = parcel.readByte() == 1;
|
||||
this.n = parcel.readByte() == 1;
|
||||
this.o = parcel.readByte() == 1;
|
||||
this.q = parcel.readLong();
|
||||
this.l = parcel.readByte() == 1;
|
||||
if (parcel.readByte() != 1) {
|
||||
z = false;
|
||||
}
|
||||
this.m = z;
|
||||
this.p = parcel.readLong();
|
||||
this.w = parcel.readInt();
|
||||
this.x = parcel.readLong();
|
||||
this.y = parcel.readLong();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
202
sources/com/tencent/bugly/crashreport/common/strategy/a.java
Normal file
202
sources/com/tencent/bugly/crashreport/common/strategy/a.java
Normal file
@@ -0,0 +1,202 @@
|
||||
package com.tencent.bugly.crashreport.common.strategy;
|
||||
|
||||
import android.content.Context;
|
||||
import com.tencent.bugly.crashreport.biz.b;
|
||||
import com.tencent.bugly.proguard.ar;
|
||||
import com.tencent.bugly.proguard.as;
|
||||
import com.tencent.bugly.proguard.o;
|
||||
import com.tencent.bugly.proguard.p;
|
||||
import com.tencent.bugly.proguard.r;
|
||||
import com.tencent.bugly.proguard.w;
|
||||
import com.tencent.bugly.proguard.x;
|
||||
import com.tencent.bugly.proguard.z;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/* compiled from: BUGLY */
|
||||
/* loaded from: classes.dex */
|
||||
public final class a {
|
||||
public static int a = 1000;
|
||||
private static a b;
|
||||
private static String h;
|
||||
private final List<com.tencent.bugly.a> c;
|
||||
private Context g;
|
||||
private StrategyBean f = null;
|
||||
private final StrategyBean e = new StrategyBean();
|
||||
private final w d = w.a();
|
||||
|
||||
private a(Context context, List<com.tencent.bugly.a> list) {
|
||||
this.g = context;
|
||||
this.c = list;
|
||||
}
|
||||
|
||||
public static StrategyBean d() {
|
||||
byte[] bArr;
|
||||
List<r> a2 = p.a().a(2);
|
||||
if (a2 == null || a2.size() <= 0 || (bArr = a2.get(0).g) == null) {
|
||||
return null;
|
||||
}
|
||||
return (StrategyBean) z.a(bArr, StrategyBean.CREATOR);
|
||||
}
|
||||
|
||||
public final StrategyBean c() {
|
||||
StrategyBean strategyBean = this.f;
|
||||
return strategyBean != null ? strategyBean : this.e;
|
||||
}
|
||||
|
||||
public final synchronized boolean b() {
|
||||
return this.f != null;
|
||||
}
|
||||
|
||||
public static synchronized a a(Context context, List<com.tencent.bugly.a> list) {
|
||||
a aVar;
|
||||
synchronized (a.class) {
|
||||
if (b == null) {
|
||||
b = new a(context, list);
|
||||
}
|
||||
aVar = b;
|
||||
}
|
||||
return aVar;
|
||||
}
|
||||
|
||||
public final void a(long j) {
|
||||
this.d.a(new Thread() { // from class: com.tencent.bugly.crashreport.common.strategy.a.1
|
||||
@Override // java.lang.Thread, java.lang.Runnable
|
||||
public final void run() {
|
||||
try {
|
||||
Map<String, byte[]> a2 = p.a().a(a.a, (o) null, true);
|
||||
if (a2 != null) {
|
||||
byte[] bArr = a2.get("device");
|
||||
byte[] bArr2 = a2.get("gateway");
|
||||
if (bArr != null) {
|
||||
com.tencent.bugly.crashreport.common.info.a.a(a.this.g).e(new String(bArr));
|
||||
}
|
||||
if (bArr2 != null) {
|
||||
com.tencent.bugly.crashreport.common.info.a.a(a.this.g).d(new String(bArr2));
|
||||
}
|
||||
}
|
||||
a.this.f = a.d();
|
||||
if (a.this.f != null && !z.a(a.h) && z.c(a.h)) {
|
||||
a.this.f.r = a.h;
|
||||
a.this.f.s = a.h;
|
||||
}
|
||||
} catch (Throwable th) {
|
||||
if (!x.a(th)) {
|
||||
th.printStackTrace();
|
||||
}
|
||||
}
|
||||
a aVar = a.this;
|
||||
aVar.a(aVar.f, false);
|
||||
}
|
||||
}, j);
|
||||
}
|
||||
|
||||
public static synchronized a a() {
|
||||
a aVar;
|
||||
synchronized (a.class) {
|
||||
aVar = b;
|
||||
}
|
||||
return aVar;
|
||||
}
|
||||
|
||||
protected final void a(StrategyBean strategyBean, boolean z) {
|
||||
x.c("[Strategy] Notify %s", b.class.getName());
|
||||
b.a(strategyBean, z);
|
||||
for (com.tencent.bugly.a aVar : this.c) {
|
||||
try {
|
||||
x.c("[Strategy] Notify %s", aVar.getClass().getName());
|
||||
aVar.onServerStrategyChanged(strategyBean);
|
||||
} catch (Throwable th) {
|
||||
if (!x.a(th)) {
|
||||
th.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void a(String str) {
|
||||
if (!z.a(str) && z.c(str)) {
|
||||
h = str;
|
||||
} else {
|
||||
x.d("URL user set is invalid.", new Object[0]);
|
||||
}
|
||||
}
|
||||
|
||||
public final void a(as asVar) {
|
||||
if (asVar == null) {
|
||||
return;
|
||||
}
|
||||
StrategyBean strategyBean = this.f;
|
||||
if (strategyBean == null || asVar.h != strategyBean.p) {
|
||||
StrategyBean strategyBean2 = new StrategyBean();
|
||||
strategyBean2.g = asVar.a;
|
||||
strategyBean2.i = asVar.c;
|
||||
strategyBean2.h = asVar.b;
|
||||
if (z.a(h) || !z.c(h)) {
|
||||
if (z.c(asVar.d)) {
|
||||
x.c("[Strategy] Upload url changes to %s", asVar.d);
|
||||
strategyBean2.r = asVar.d;
|
||||
}
|
||||
if (z.c(asVar.e)) {
|
||||
x.c("[Strategy] Exception upload url changes to %s", asVar.e);
|
||||
strategyBean2.s = asVar.e;
|
||||
}
|
||||
}
|
||||
ar arVar = asVar.f;
|
||||
if (arVar != null && !z.a(arVar.a)) {
|
||||
strategyBean2.u = asVar.f.a;
|
||||
}
|
||||
long j = asVar.h;
|
||||
if (j != 0) {
|
||||
strategyBean2.p = j;
|
||||
}
|
||||
Map<String, String> map = asVar.g;
|
||||
if (map != null && map.size() > 0) {
|
||||
Map<String, String> map2 = asVar.g;
|
||||
strategyBean2.v = map2;
|
||||
String str = map2.get("B11");
|
||||
if (str != null && str.equals("1")) {
|
||||
strategyBean2.j = true;
|
||||
} else {
|
||||
strategyBean2.j = false;
|
||||
}
|
||||
String str2 = asVar.g.get("B3");
|
||||
if (str2 != null) {
|
||||
strategyBean2.y = Long.valueOf(str2).longValue();
|
||||
}
|
||||
int i = asVar.i;
|
||||
strategyBean2.q = i;
|
||||
strategyBean2.x = i;
|
||||
String str3 = asVar.g.get("B27");
|
||||
if (str3 != null && str3.length() > 0) {
|
||||
try {
|
||||
int parseInt = Integer.parseInt(str3);
|
||||
if (parseInt > 0) {
|
||||
strategyBean2.w = parseInt;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
if (!x.a(e)) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
String str4 = asVar.g.get("B25");
|
||||
if (str4 != null && str4.equals("1")) {
|
||||
strategyBean2.l = true;
|
||||
} else {
|
||||
strategyBean2.l = false;
|
||||
}
|
||||
}
|
||||
x.a("[Strategy] enableCrashReport:%b, enableQuery:%b, enableUserInfo:%b, enableAnr:%b, enableBlock:%b, enableSession:%b, enableSessionTimer:%b, sessionOverTime:%d, enableCocos:%b, strategyLastUpdateTime:%d", Boolean.valueOf(strategyBean2.g), Boolean.valueOf(strategyBean2.i), Boolean.valueOf(strategyBean2.h), Boolean.valueOf(strategyBean2.j), Boolean.valueOf(strategyBean2.k), Boolean.valueOf(strategyBean2.n), Boolean.valueOf(strategyBean2.o), Long.valueOf(strategyBean2.q), Boolean.valueOf(strategyBean2.l), Long.valueOf(strategyBean2.p));
|
||||
this.f = strategyBean2;
|
||||
p.a().b(2);
|
||||
r rVar = new r();
|
||||
rVar.b = 2;
|
||||
rVar.a = strategyBean2.e;
|
||||
rVar.e = strategyBean2.f;
|
||||
rVar.g = z.a(strategyBean2);
|
||||
p.a().a(rVar);
|
||||
a(strategyBean2, true);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,122 @@
|
||||
package com.tencent.bugly.crashreport.crash;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import com.tencent.bugly.proguard.u;
|
||||
import com.tencent.bugly.proguard.x;
|
||||
import com.tencent.bugly.proguard.z;
|
||||
|
||||
/* compiled from: BUGLY */
|
||||
/* loaded from: classes.dex */
|
||||
public class BuglyBroadcastReceiver extends BroadcastReceiver {
|
||||
private static BuglyBroadcastReceiver d;
|
||||
private Context b;
|
||||
private String c;
|
||||
private boolean e = true;
|
||||
private IntentFilter a = new IntentFilter();
|
||||
|
||||
public static synchronized BuglyBroadcastReceiver getInstance() {
|
||||
BuglyBroadcastReceiver buglyBroadcastReceiver;
|
||||
synchronized (BuglyBroadcastReceiver.class) {
|
||||
if (d == null) {
|
||||
d = new BuglyBroadcastReceiver();
|
||||
}
|
||||
buglyBroadcastReceiver = d;
|
||||
}
|
||||
return buglyBroadcastReceiver;
|
||||
}
|
||||
|
||||
public synchronized void addFilter(String str) {
|
||||
if (!this.a.hasAction(str)) {
|
||||
this.a.addAction(str);
|
||||
}
|
||||
x.c("add action %s", str);
|
||||
}
|
||||
|
||||
@Override // android.content.BroadcastReceiver
|
||||
public final void onReceive(Context context, Intent intent) {
|
||||
try {
|
||||
a(context, intent);
|
||||
} catch (Throwable th) {
|
||||
if (x.a(th)) {
|
||||
return;
|
||||
}
|
||||
th.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void register(Context context) {
|
||||
this.b = context;
|
||||
z.a(new Runnable() { // from class: com.tencent.bugly.crashreport.crash.BuglyBroadcastReceiver.1
|
||||
@Override // java.lang.Runnable
|
||||
public final void run() {
|
||||
try {
|
||||
x.a(BuglyBroadcastReceiver.d.getClass(), "Register broadcast receiver of Bugly.", new Object[0]);
|
||||
synchronized (this) {
|
||||
BuglyBroadcastReceiver.this.b.registerReceiver(BuglyBroadcastReceiver.d, BuglyBroadcastReceiver.this.a);
|
||||
}
|
||||
} catch (Throwable th) {
|
||||
th.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public synchronized void unregister(Context context) {
|
||||
try {
|
||||
x.a(getClass(), "Unregister broadcast receiver of Bugly.", new Object[0]);
|
||||
context.unregisterReceiver(this);
|
||||
this.b = context;
|
||||
} catch (Throwable th) {
|
||||
if (x.a(th)) {
|
||||
return;
|
||||
}
|
||||
th.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private synchronized boolean a(Context context, Intent intent) {
|
||||
if (context != null && intent != null) {
|
||||
if (intent.getAction().equals("android.net.conn.CONNECTIVITY_CHANGE")) {
|
||||
if (this.e) {
|
||||
this.e = false;
|
||||
return true;
|
||||
}
|
||||
String c = com.tencent.bugly.crashreport.common.info.b.c(this.b);
|
||||
x.c("is Connect BC " + c, new Object[0]);
|
||||
x.a("network %s changed to %s", this.c, c);
|
||||
if (c == null) {
|
||||
this.c = null;
|
||||
return true;
|
||||
}
|
||||
String str = this.c;
|
||||
this.c = c;
|
||||
long currentTimeMillis = System.currentTimeMillis();
|
||||
com.tencent.bugly.crashreport.common.strategy.a a = com.tencent.bugly.crashreport.common.strategy.a.a();
|
||||
u a2 = u.a();
|
||||
com.tencent.bugly.crashreport.common.info.a a3 = com.tencent.bugly.crashreport.common.info.a.a(context);
|
||||
if (a != null && a2 != null && a3 != null) {
|
||||
if (!c.equals(str)) {
|
||||
if (currentTimeMillis - a2.a(c.a) > 30000) {
|
||||
x.a("try to upload crash on network changed.", new Object[0]);
|
||||
c a4 = c.a();
|
||||
if (a4 != null) {
|
||||
a4.a(0L);
|
||||
}
|
||||
}
|
||||
if (currentTimeMillis - a2.a(1001) > 30000) {
|
||||
x.a("try to upload userinfo on network changed.", new Object[0]);
|
||||
com.tencent.bugly.crashreport.biz.b.a.b();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
x.d("not inited BC not work", new Object[0]);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
295
sources/com/tencent/bugly/crashreport/crash/CrashDetailBean.java
Normal file
295
sources/com/tencent/bugly/crashreport/crash/CrashDetailBean.java
Normal file
@@ -0,0 +1,295 @@
|
||||
package com.tencent.bugly.crashreport.crash;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import com.tencent.bugly.crashreport.common.info.PlugInBean;
|
||||
import com.tencent.bugly.proguard.z;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
/* compiled from: BUGLY */
|
||||
/* loaded from: classes.dex */
|
||||
public class CrashDetailBean implements Parcelable, Comparable<CrashDetailBean> {
|
||||
public static final Parcelable.Creator<CrashDetailBean> CREATOR = new Parcelable.Creator<CrashDetailBean>() { // from class: com.tencent.bugly.crashreport.crash.CrashDetailBean.1
|
||||
@Override // android.os.Parcelable.Creator
|
||||
public final /* synthetic */ CrashDetailBean createFromParcel(Parcel parcel) {
|
||||
return new CrashDetailBean(parcel);
|
||||
}
|
||||
|
||||
@Override // android.os.Parcelable.Creator
|
||||
public final /* bridge */ /* synthetic */ CrashDetailBean[] newArray(int i) {
|
||||
return new CrashDetailBean[i];
|
||||
}
|
||||
};
|
||||
public String A;
|
||||
public String B;
|
||||
public long C;
|
||||
public long D;
|
||||
public long E;
|
||||
public long F;
|
||||
public long G;
|
||||
public long H;
|
||||
public String I;
|
||||
public String J;
|
||||
public String K;
|
||||
public String L;
|
||||
public long M;
|
||||
public boolean N;
|
||||
public Map<String, String> O;
|
||||
public int P;
|
||||
public int Q;
|
||||
public Map<String, String> R;
|
||||
public Map<String, String> S;
|
||||
public byte[] T;
|
||||
public String U;
|
||||
public String V;
|
||||
private String W;
|
||||
public long a;
|
||||
public int b;
|
||||
public String c;
|
||||
public boolean d;
|
||||
public String e;
|
||||
public String f;
|
||||
public String g;
|
||||
public Map<String, PlugInBean> h;
|
||||
public Map<String, PlugInBean> i;
|
||||
public boolean j;
|
||||
public boolean k;
|
||||
public int l;
|
||||
public String m;
|
||||
public String n;
|
||||
public String o;
|
||||
public String p;
|
||||
public String q;
|
||||
public long r;
|
||||
public String s;
|
||||
public int t;
|
||||
public String u;
|
||||
public String v;
|
||||
public String w;
|
||||
public String x;
|
||||
public byte[] y;
|
||||
public Map<String, String> z;
|
||||
|
||||
public CrashDetailBean() {
|
||||
this.a = -1L;
|
||||
this.b = 0;
|
||||
this.c = UUID.randomUUID().toString();
|
||||
this.d = false;
|
||||
this.e = "";
|
||||
this.f = "";
|
||||
this.g = "";
|
||||
this.h = null;
|
||||
this.i = null;
|
||||
this.j = false;
|
||||
this.k = false;
|
||||
this.l = 0;
|
||||
this.m = "";
|
||||
this.n = "";
|
||||
this.o = "";
|
||||
this.p = "";
|
||||
this.q = "";
|
||||
this.r = -1L;
|
||||
this.s = null;
|
||||
this.t = 0;
|
||||
this.u = "";
|
||||
this.v = "";
|
||||
this.w = null;
|
||||
this.x = null;
|
||||
this.y = null;
|
||||
this.z = null;
|
||||
this.A = "";
|
||||
this.B = "";
|
||||
this.C = -1L;
|
||||
this.D = -1L;
|
||||
this.E = -1L;
|
||||
this.F = -1L;
|
||||
this.G = -1L;
|
||||
this.H = -1L;
|
||||
this.I = "";
|
||||
this.W = "";
|
||||
this.J = "";
|
||||
this.K = "";
|
||||
this.L = "";
|
||||
this.M = -1L;
|
||||
this.N = false;
|
||||
this.O = null;
|
||||
this.P = -1;
|
||||
this.Q = -1;
|
||||
this.R = null;
|
||||
this.S = null;
|
||||
this.T = null;
|
||||
this.U = null;
|
||||
this.V = null;
|
||||
}
|
||||
|
||||
@Override // java.lang.Comparable
|
||||
public /* bridge */ /* synthetic */ int compareTo(CrashDetailBean crashDetailBean) {
|
||||
CrashDetailBean crashDetailBean2 = crashDetailBean;
|
||||
if (crashDetailBean2 == null) {
|
||||
return 1;
|
||||
}
|
||||
long j = this.r - crashDetailBean2.r;
|
||||
if (j <= 0) {
|
||||
return j < 0 ? -1 : 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override // android.os.Parcelable
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override // android.os.Parcelable
|
||||
public void writeToParcel(Parcel parcel, int i) {
|
||||
parcel.writeInt(this.b);
|
||||
parcel.writeString(this.c);
|
||||
parcel.writeByte(this.d ? (byte) 1 : (byte) 0);
|
||||
parcel.writeString(this.e);
|
||||
parcel.writeString(this.f);
|
||||
parcel.writeString(this.g);
|
||||
parcel.writeByte(this.j ? (byte) 1 : (byte) 0);
|
||||
parcel.writeByte(this.k ? (byte) 1 : (byte) 0);
|
||||
parcel.writeInt(this.l);
|
||||
parcel.writeString(this.m);
|
||||
parcel.writeString(this.n);
|
||||
parcel.writeString(this.o);
|
||||
parcel.writeString(this.p);
|
||||
parcel.writeString(this.q);
|
||||
parcel.writeLong(this.r);
|
||||
parcel.writeString(this.s);
|
||||
parcel.writeInt(this.t);
|
||||
parcel.writeString(this.u);
|
||||
parcel.writeString(this.v);
|
||||
parcel.writeString(this.w);
|
||||
z.b(parcel, this.z);
|
||||
parcel.writeString(this.A);
|
||||
parcel.writeString(this.B);
|
||||
parcel.writeLong(this.C);
|
||||
parcel.writeLong(this.D);
|
||||
parcel.writeLong(this.E);
|
||||
parcel.writeLong(this.F);
|
||||
parcel.writeLong(this.G);
|
||||
parcel.writeLong(this.H);
|
||||
parcel.writeString(this.I);
|
||||
parcel.writeString(this.W);
|
||||
parcel.writeString(this.J);
|
||||
parcel.writeString(this.K);
|
||||
parcel.writeString(this.L);
|
||||
parcel.writeLong(this.M);
|
||||
parcel.writeByte(this.N ? (byte) 1 : (byte) 0);
|
||||
z.b(parcel, this.O);
|
||||
z.a(parcel, this.h);
|
||||
z.a(parcel, this.i);
|
||||
parcel.writeInt(this.P);
|
||||
parcel.writeInt(this.Q);
|
||||
z.b(parcel, this.R);
|
||||
z.b(parcel, this.S);
|
||||
parcel.writeByteArray(this.T);
|
||||
parcel.writeByteArray(this.y);
|
||||
parcel.writeString(this.U);
|
||||
parcel.writeString(this.V);
|
||||
parcel.writeString(this.x);
|
||||
}
|
||||
|
||||
public CrashDetailBean(Parcel parcel) {
|
||||
this.a = -1L;
|
||||
this.b = 0;
|
||||
this.c = UUID.randomUUID().toString();
|
||||
this.d = false;
|
||||
this.e = "";
|
||||
this.f = "";
|
||||
this.g = "";
|
||||
this.h = null;
|
||||
this.i = null;
|
||||
this.j = false;
|
||||
this.k = false;
|
||||
this.l = 0;
|
||||
this.m = "";
|
||||
this.n = "";
|
||||
this.o = "";
|
||||
this.p = "";
|
||||
this.q = "";
|
||||
this.r = -1L;
|
||||
this.s = null;
|
||||
this.t = 0;
|
||||
this.u = "";
|
||||
this.v = "";
|
||||
this.w = null;
|
||||
this.x = null;
|
||||
this.y = null;
|
||||
this.z = null;
|
||||
this.A = "";
|
||||
this.B = "";
|
||||
this.C = -1L;
|
||||
this.D = -1L;
|
||||
this.E = -1L;
|
||||
this.F = -1L;
|
||||
this.G = -1L;
|
||||
this.H = -1L;
|
||||
this.I = "";
|
||||
this.W = "";
|
||||
this.J = "";
|
||||
this.K = "";
|
||||
this.L = "";
|
||||
this.M = -1L;
|
||||
this.N = false;
|
||||
this.O = null;
|
||||
this.P = -1;
|
||||
this.Q = -1;
|
||||
this.R = null;
|
||||
this.S = null;
|
||||
this.T = null;
|
||||
this.U = null;
|
||||
this.V = null;
|
||||
this.b = parcel.readInt();
|
||||
this.c = parcel.readString();
|
||||
this.d = parcel.readByte() == 1;
|
||||
this.e = parcel.readString();
|
||||
this.f = parcel.readString();
|
||||
this.g = parcel.readString();
|
||||
this.j = parcel.readByte() == 1;
|
||||
this.k = parcel.readByte() == 1;
|
||||
this.l = parcel.readInt();
|
||||
this.m = parcel.readString();
|
||||
this.n = parcel.readString();
|
||||
this.o = parcel.readString();
|
||||
this.p = parcel.readString();
|
||||
this.q = parcel.readString();
|
||||
this.r = parcel.readLong();
|
||||
this.s = parcel.readString();
|
||||
this.t = parcel.readInt();
|
||||
this.u = parcel.readString();
|
||||
this.v = parcel.readString();
|
||||
this.w = parcel.readString();
|
||||
this.z = z.b(parcel);
|
||||
this.A = parcel.readString();
|
||||
this.B = parcel.readString();
|
||||
this.C = parcel.readLong();
|
||||
this.D = parcel.readLong();
|
||||
this.E = parcel.readLong();
|
||||
this.F = parcel.readLong();
|
||||
this.G = parcel.readLong();
|
||||
this.H = parcel.readLong();
|
||||
this.I = parcel.readString();
|
||||
this.W = parcel.readString();
|
||||
this.J = parcel.readString();
|
||||
this.K = parcel.readString();
|
||||
this.L = parcel.readString();
|
||||
this.M = parcel.readLong();
|
||||
this.N = parcel.readByte() == 1;
|
||||
this.O = z.b(parcel);
|
||||
this.h = z.a(parcel);
|
||||
this.i = z.a(parcel);
|
||||
this.P = parcel.readInt();
|
||||
this.Q = parcel.readInt();
|
||||
this.R = z.b(parcel);
|
||||
this.S = z.b(parcel);
|
||||
this.T = parcel.createByteArray();
|
||||
this.y = parcel.createByteArray();
|
||||
this.U = parcel.readString();
|
||||
this.V = parcel.readString();
|
||||
this.x = parcel.readString();
|
||||
}
|
||||
}
|
25
sources/com/tencent/bugly/crashreport/crash/a.java
Normal file
25
sources/com/tencent/bugly/crashreport/crash/a.java
Normal file
@@ -0,0 +1,25 @@
|
||||
package com.tencent.bugly.crashreport.crash;
|
||||
|
||||
/* compiled from: BUGLY */
|
||||
/* loaded from: classes.dex */
|
||||
public final class a implements Comparable<a> {
|
||||
public long a = -1;
|
||||
public long b = -1;
|
||||
public String c = null;
|
||||
public boolean d = false;
|
||||
public boolean e = false;
|
||||
public int f = 0;
|
||||
|
||||
@Override // java.lang.Comparable
|
||||
public final /* bridge */ /* synthetic */ int compareTo(a aVar) {
|
||||
a aVar2 = aVar;
|
||||
if (aVar2 == null) {
|
||||
return 1;
|
||||
}
|
||||
long j = this.b - aVar2.b;
|
||||
if (j <= 0) {
|
||||
return j < 0 ? -1 : 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
}
|
@@ -0,0 +1,308 @@
|
||||
package com.tencent.bugly.crashreport.crash.anr;
|
||||
|
||||
import com.tencent.bugly.proguard.x;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/* compiled from: BUGLY */
|
||||
/* loaded from: classes.dex */
|
||||
public class TraceFileHelper {
|
||||
|
||||
/* compiled from: BUGLY */
|
||||
public static class a {
|
||||
public long a;
|
||||
public String b;
|
||||
public long c;
|
||||
public Map<String, String[]> d;
|
||||
}
|
||||
|
||||
/* compiled from: BUGLY */
|
||||
public interface b {
|
||||
boolean a(long j);
|
||||
|
||||
boolean a(long j, long j2, String str);
|
||||
|
||||
boolean a(String str, int i, String str2, String str3);
|
||||
}
|
||||
|
||||
private static Object[] a(BufferedReader bufferedReader, Pattern... patternArr) throws IOException {
|
||||
if (bufferedReader != null && patternArr != null) {
|
||||
while (true) {
|
||||
String readLine = bufferedReader.readLine();
|
||||
if (readLine == null) {
|
||||
break;
|
||||
}
|
||||
for (Pattern pattern : patternArr) {
|
||||
if (pattern.matcher(readLine).matches()) {
|
||||
return new Object[]{pattern, readLine};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static String b(BufferedReader bufferedReader) throws IOException {
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
while (true) {
|
||||
String readLine = bufferedReader.readLine();
|
||||
if (readLine == null || readLine.trim().length() <= 0) {
|
||||
break;
|
||||
}
|
||||
stringBuffer.append(readLine + "\n");
|
||||
}
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
|
||||
public static a readFirstDumpInfo(String str, final boolean z) {
|
||||
if (str == null) {
|
||||
x.e("path:%s", str);
|
||||
return null;
|
||||
}
|
||||
final a aVar = new a();
|
||||
readTraceFile(str, new b() { // from class: com.tencent.bugly.crashreport.crash.anr.TraceFileHelper.2
|
||||
@Override // com.tencent.bugly.crashreport.crash.anr.TraceFileHelper.b
|
||||
public final boolean a(String str2, int i, String str3, String str4) {
|
||||
x.c("new thread %s", str2);
|
||||
a aVar2 = a.this;
|
||||
if (aVar2.d == null) {
|
||||
aVar2.d = new HashMap();
|
||||
}
|
||||
Map<String, String[]> map = a.this.d;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(i);
|
||||
map.put(str2, new String[]{str3, str4, sb.toString()});
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // com.tencent.bugly.crashreport.crash.anr.TraceFileHelper.b
|
||||
public final boolean a(long j, long j2, String str2) {
|
||||
x.c("new process %s", str2);
|
||||
a aVar2 = a.this;
|
||||
aVar2.a = j;
|
||||
aVar2.b = str2;
|
||||
aVar2.c = j2;
|
||||
return z;
|
||||
}
|
||||
|
||||
@Override // com.tencent.bugly.crashreport.crash.anr.TraceFileHelper.b
|
||||
public final boolean a(long j) {
|
||||
x.c("process end %d", Long.valueOf(j));
|
||||
return false;
|
||||
}
|
||||
});
|
||||
if (aVar.a > 0 && aVar.c > 0 && aVar.b != null) {
|
||||
return aVar;
|
||||
}
|
||||
x.e("first dump error %s", aVar.a + " " + aVar.c + " " + aVar.b);
|
||||
return null;
|
||||
}
|
||||
|
||||
public static a readTargetDumpInfo(final String str, String str2, final boolean z) {
|
||||
if (str != null && str2 != null) {
|
||||
final a aVar = new a();
|
||||
readTraceFile(str2, new b() { // from class: com.tencent.bugly.crashreport.crash.anr.TraceFileHelper.1
|
||||
@Override // com.tencent.bugly.crashreport.crash.anr.TraceFileHelper.b
|
||||
public final boolean a(String str3, int i, String str4, String str5) {
|
||||
x.c("new thread %s", str3);
|
||||
a aVar2 = a.this;
|
||||
if (aVar2.a > 0 && aVar2.c > 0 && aVar2.b != null) {
|
||||
if (aVar2.d == null) {
|
||||
aVar2.d = new HashMap();
|
||||
}
|
||||
Map<String, String[]> map = a.this.d;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(i);
|
||||
map.put(str3, new String[]{str4, str5, sb.toString()});
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // com.tencent.bugly.crashreport.crash.anr.TraceFileHelper.b
|
||||
public final boolean a(long j, long j2, String str3) {
|
||||
x.c("new process %s", str3);
|
||||
if (!str3.equals(str)) {
|
||||
return true;
|
||||
}
|
||||
a aVar2 = a.this;
|
||||
aVar2.a = j;
|
||||
aVar2.b = str3;
|
||||
aVar2.c = j2;
|
||||
return z;
|
||||
}
|
||||
|
||||
@Override // com.tencent.bugly.crashreport.crash.anr.TraceFileHelper.b
|
||||
public final boolean a(long j) {
|
||||
x.c("process end %d", Long.valueOf(j));
|
||||
a aVar2 = a.this;
|
||||
return aVar2.a <= 0 || aVar2.c <= 0 || aVar2.b == null;
|
||||
}
|
||||
});
|
||||
if (aVar.a > 0 && aVar.c > 0 && aVar.b != null) {
|
||||
return aVar;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void readTraceFile(String str, b bVar) {
|
||||
Throwable th;
|
||||
BufferedReader bufferedReader;
|
||||
if (str == null || bVar == null) {
|
||||
return;
|
||||
}
|
||||
File file = new File(str);
|
||||
if (!file.exists()) {
|
||||
return;
|
||||
}
|
||||
file.lastModified();
|
||||
file.length();
|
||||
BufferedReader bufferedReader2 = null;
|
||||
try {
|
||||
try {
|
||||
bufferedReader = new BufferedReader(new FileReader(file));
|
||||
try {
|
||||
Pattern compile = Pattern.compile("-{5}\\spid\\s\\d+\\sat\\s\\d+-\\d+-\\d+\\s\\d{2}:\\d{2}:\\d{2}\\s-{5}");
|
||||
Pattern compile2 = Pattern.compile("-{5}\\send\\s\\d+\\s-{5}");
|
||||
Pattern compile3 = Pattern.compile("Cmd\\sline:\\s(\\S+)");
|
||||
Pattern compile4 = Pattern.compile("\".+\"\\s(daemon\\s){0,1}prio=\\d+\\stid=\\d+\\s.*");
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.US);
|
||||
while (true) {
|
||||
Object[] a2 = a(bufferedReader, compile);
|
||||
if (a2 == null) {
|
||||
try {
|
||||
bufferedReader.close();
|
||||
return;
|
||||
} catch (IOException e) {
|
||||
if (x.a(e)) {
|
||||
return;
|
||||
}
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
}
|
||||
String[] split = a2[1].toString().split("\\s");
|
||||
long parseLong = Long.parseLong(split[2]);
|
||||
long time = simpleDateFormat.parse(split[4] + " " + split[5]).getTime();
|
||||
Object[] a3 = a(bufferedReader, compile3);
|
||||
if (a3 == null) {
|
||||
try {
|
||||
bufferedReader.close();
|
||||
return;
|
||||
} catch (IOException e2) {
|
||||
if (x.a(e2)) {
|
||||
return;
|
||||
}
|
||||
e2.printStackTrace();
|
||||
return;
|
||||
}
|
||||
}
|
||||
Matcher matcher = compile3.matcher(a3[1].toString());
|
||||
matcher.find();
|
||||
matcher.group(1);
|
||||
SimpleDateFormat simpleDateFormat2 = simpleDateFormat;
|
||||
if (!bVar.a(parseLong, time, matcher.group(1))) {
|
||||
try {
|
||||
bufferedReader.close();
|
||||
return;
|
||||
} catch (IOException e3) {
|
||||
if (x.a(e3)) {
|
||||
return;
|
||||
}
|
||||
e3.printStackTrace();
|
||||
return;
|
||||
}
|
||||
}
|
||||
while (true) {
|
||||
Object[] a4 = a(bufferedReader, compile4, compile2);
|
||||
if (a4 == null) {
|
||||
break;
|
||||
}
|
||||
if (a4[0] == compile4) {
|
||||
String obj = a4[1].toString();
|
||||
Matcher matcher2 = Pattern.compile("\".+\"").matcher(obj);
|
||||
matcher2.find();
|
||||
String group = matcher2.group();
|
||||
String substring = group.substring(1, group.length() - 1);
|
||||
obj.contains("NATIVE");
|
||||
Matcher matcher3 = Pattern.compile("tid=\\d+").matcher(obj);
|
||||
matcher3.find();
|
||||
String group2 = matcher3.group();
|
||||
bVar.a(substring, Integer.parseInt(group2.substring(group2.indexOf("=") + 1)), a(bufferedReader), b(bufferedReader));
|
||||
} else if (!bVar.a(Long.parseLong(a4[1].toString().split("\\s")[2]))) {
|
||||
try {
|
||||
bufferedReader.close();
|
||||
return;
|
||||
} catch (IOException e4) {
|
||||
if (x.a(e4)) {
|
||||
return;
|
||||
}
|
||||
e4.printStackTrace();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
simpleDateFormat = simpleDateFormat2;
|
||||
}
|
||||
} catch (Exception e5) {
|
||||
e = e5;
|
||||
bufferedReader2 = bufferedReader;
|
||||
if (!x.a(e)) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
x.d("trace open fail:%s : %s", e.getClass().getName(), e.getMessage());
|
||||
if (bufferedReader2 != null) {
|
||||
try {
|
||||
bufferedReader2.close();
|
||||
} catch (IOException e6) {
|
||||
if (x.a(e6)) {
|
||||
return;
|
||||
}
|
||||
e6.printStackTrace();
|
||||
}
|
||||
}
|
||||
} catch (Throwable th2) {
|
||||
th = th2;
|
||||
if (bufferedReader == null) {
|
||||
throw th;
|
||||
}
|
||||
try {
|
||||
bufferedReader.close();
|
||||
throw th;
|
||||
} catch (IOException e7) {
|
||||
if (x.a(e7)) {
|
||||
throw th;
|
||||
}
|
||||
e7.printStackTrace();
|
||||
throw th;
|
||||
}
|
||||
}
|
||||
} catch (Exception e8) {
|
||||
e = e8;
|
||||
}
|
||||
} catch (Throwable th3) {
|
||||
th = th3;
|
||||
bufferedReader = null;
|
||||
}
|
||||
}
|
||||
|
||||
private static String a(BufferedReader bufferedReader) throws IOException {
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
for (int i = 0; i < 3; i++) {
|
||||
String readLine = bufferedReader.readLine();
|
||||
if (readLine == null) {
|
||||
return null;
|
||||
}
|
||||
stringBuffer.append(readLine + "\n");
|
||||
}
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
}
|
15
sources/com/tencent/bugly/crashreport/crash/anr/a.java
Normal file
15
sources/com/tencent/bugly/crashreport/crash/anr/a.java
Normal file
@@ -0,0 +1,15 @@
|
||||
package com.tencent.bugly.crashreport.crash.anr;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/* compiled from: BUGLY */
|
||||
/* loaded from: classes.dex */
|
||||
public final class a {
|
||||
public String a = null;
|
||||
public Map<String, String> b = null;
|
||||
public long c = -1;
|
||||
public String d = null;
|
||||
public String e = null;
|
||||
public String f = null;
|
||||
public String g = null;
|
||||
}
|
548
sources/com/tencent/bugly/crashreport/crash/anr/b.java
Normal file
548
sources/com/tencent/bugly/crashreport/crash/anr/b.java
Normal file
@@ -0,0 +1,548 @@
|
||||
package com.tencent.bugly.crashreport.crash.anr;
|
||||
|
||||
import android.app.ActivityManager;
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.os.FileObserver;
|
||||
import android.os.Process;
|
||||
import com.tencent.bugly.crashreport.common.strategy.StrategyBean;
|
||||
import com.tencent.bugly.crashreport.crash.CrashDetailBean;
|
||||
import com.tencent.bugly.crashreport.crash.anr.TraceFileHelper;
|
||||
import com.tencent.bugly.crashreport.crash.c;
|
||||
import com.tencent.bugly.proguard.ab;
|
||||
import com.tencent.bugly.proguard.ac;
|
||||
import com.tencent.bugly.proguard.w;
|
||||
import com.tencent.bugly.proguard.x;
|
||||
import com.tencent.bugly.proguard.y;
|
||||
import com.tencent.bugly.proguard.z;
|
||||
import com.thoughtworks.xstream.XStream;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
/* compiled from: BUGLY */
|
||||
/* loaded from: classes.dex */
|
||||
public final class b implements ac {
|
||||
private final Context c;
|
||||
private final com.tencent.bugly.crashreport.common.info.a d;
|
||||
private final w e;
|
||||
private final com.tencent.bugly.crashreport.common.strategy.a f;
|
||||
private final String g;
|
||||
private final com.tencent.bugly.crashreport.crash.b h;
|
||||
private FileObserver i;
|
||||
private ab k;
|
||||
private int l;
|
||||
private AtomicInteger a = new AtomicInteger(0);
|
||||
private long b = -1;
|
||||
private boolean j = true;
|
||||
|
||||
public b(Context context, com.tencent.bugly.crashreport.common.strategy.a aVar, com.tencent.bugly.crashreport.common.info.a aVar2, w wVar, com.tencent.bugly.crashreport.crash.b bVar) {
|
||||
this.c = z.a(context);
|
||||
this.g = context.getDir("bugly", 0).getAbsolutePath();
|
||||
this.d = aVar2;
|
||||
this.e = wVar;
|
||||
this.f = aVar;
|
||||
this.h = bVar;
|
||||
}
|
||||
|
||||
private static ActivityManager.ProcessErrorStateInfo a(Context context, long j) {
|
||||
try {
|
||||
x.c("to find!", new Object[0]);
|
||||
ActivityManager activityManager = (ActivityManager) context.getSystemService("activity");
|
||||
int i = 0;
|
||||
while (true) {
|
||||
x.c("waiting!", new Object[0]);
|
||||
List<ActivityManager.ProcessErrorStateInfo> processesInErrorState = activityManager.getProcessesInErrorState();
|
||||
if (processesInErrorState != null) {
|
||||
for (ActivityManager.ProcessErrorStateInfo processErrorStateInfo : processesInErrorState) {
|
||||
if (processErrorStateInfo.condition == 2) {
|
||||
x.c("found!", new Object[0]);
|
||||
return processErrorStateInfo;
|
||||
}
|
||||
}
|
||||
}
|
||||
z.b(500L);
|
||||
int i2 = i + 1;
|
||||
if (i >= 20) {
|
||||
x.c("end!", new Object[0]);
|
||||
return null;
|
||||
}
|
||||
i = i2;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
x.b(e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private synchronized void b(boolean z) {
|
||||
if (z) {
|
||||
e();
|
||||
} else {
|
||||
f();
|
||||
}
|
||||
}
|
||||
|
||||
private synchronized void c(boolean z) {
|
||||
if (this.j != z) {
|
||||
x.a("user change anr %b", Boolean.valueOf(z));
|
||||
this.j = z;
|
||||
}
|
||||
}
|
||||
|
||||
private synchronized void e() {
|
||||
if (g()) {
|
||||
x.d("start when started!", new Object[0]);
|
||||
return;
|
||||
}
|
||||
this.i = new FileObserver("/data/anr/", 8) { // from class: com.tencent.bugly.crashreport.crash.anr.b.1
|
||||
@Override // android.os.FileObserver
|
||||
public final void onEvent(int i, String str) {
|
||||
if (str == null) {
|
||||
return;
|
||||
}
|
||||
String str2 = "/data/anr/" + str;
|
||||
if (str2.contains("trace")) {
|
||||
b.this.a(str2);
|
||||
} else {
|
||||
x.d("not anr file %s", str2);
|
||||
}
|
||||
}
|
||||
};
|
||||
try {
|
||||
this.i.startWatching();
|
||||
x.a("start anr monitor!", new Object[0]);
|
||||
this.e.a(new Runnable() { // from class: com.tencent.bugly.crashreport.crash.anr.b.2
|
||||
@Override // java.lang.Runnable
|
||||
public final void run() {
|
||||
b.this.b();
|
||||
}
|
||||
});
|
||||
} catch (Throwable th) {
|
||||
this.i = null;
|
||||
x.d("start anr monitor failed!", new Object[0]);
|
||||
if (x.a(th)) {
|
||||
return;
|
||||
}
|
||||
th.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private synchronized void f() {
|
||||
if (!g()) {
|
||||
x.d("close when closed!", new Object[0]);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
this.i.stopWatching();
|
||||
this.i = null;
|
||||
x.d("close anr monitor!", new Object[0]);
|
||||
} catch (Throwable th) {
|
||||
x.d("stop anr monitor failed!", new Object[0]);
|
||||
if (x.a(th)) {
|
||||
return;
|
||||
}
|
||||
th.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private synchronized boolean g() {
|
||||
return this.i != null;
|
||||
}
|
||||
|
||||
private synchronized boolean h() {
|
||||
return this.j;
|
||||
}
|
||||
|
||||
public final boolean d() {
|
||||
ab abVar = this.k;
|
||||
if (abVar == null) {
|
||||
return false;
|
||||
}
|
||||
abVar.b();
|
||||
this.k.b(this);
|
||||
boolean c = this.k.c();
|
||||
this.k = null;
|
||||
return c;
|
||||
}
|
||||
|
||||
protected final void b() {
|
||||
long b = z.b() - c.g;
|
||||
File file = new File(this.g);
|
||||
if (file.exists() && file.isDirectory()) {
|
||||
try {
|
||||
File[] listFiles = file.listFiles();
|
||||
if (listFiles != null && listFiles.length != 0) {
|
||||
int i = 0;
|
||||
for (File file2 : listFiles) {
|
||||
String name = file2.getName();
|
||||
if (name.startsWith("bugly_trace_")) {
|
||||
try {
|
||||
int indexOf = name.indexOf(".txt");
|
||||
if (indexOf > 0 && Long.parseLong(name.substring(12, indexOf)) >= b) {
|
||||
}
|
||||
} catch (Throwable unused) {
|
||||
x.c("Trace file that has invalid format: " + name, new Object[0]);
|
||||
}
|
||||
if (file2.delete()) {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
x.c("Number of overdue trace files that has deleted: " + i, new Object[0]);
|
||||
}
|
||||
} catch (Throwable th) {
|
||||
x.a(th);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public final boolean c() {
|
||||
ab abVar = this.k;
|
||||
if (abVar != null && abVar.isAlive()) {
|
||||
return false;
|
||||
}
|
||||
this.k = new ab();
|
||||
ab abVar2 = this.k;
|
||||
StringBuilder sb = new StringBuilder("Bugly-ThreadMonitor");
|
||||
int i = this.l;
|
||||
this.l = i + 1;
|
||||
sb.append(i);
|
||||
abVar2.setName(sb.toString());
|
||||
this.k.a();
|
||||
this.k.a(this);
|
||||
return this.k.d();
|
||||
}
|
||||
|
||||
private CrashDetailBean a(a aVar) {
|
||||
CrashDetailBean crashDetailBean = new CrashDetailBean();
|
||||
try {
|
||||
crashDetailBean.C = com.tencent.bugly.crashreport.common.info.b.k();
|
||||
crashDetailBean.D = com.tencent.bugly.crashreport.common.info.b.i();
|
||||
crashDetailBean.E = com.tencent.bugly.crashreport.common.info.b.m();
|
||||
crashDetailBean.F = this.d.p();
|
||||
crashDetailBean.G = this.d.o();
|
||||
crashDetailBean.H = this.d.q();
|
||||
crashDetailBean.w = z.a(this.c, c.e, (String) null);
|
||||
crashDetailBean.b = 3;
|
||||
crashDetailBean.e = this.d.h();
|
||||
crashDetailBean.f = this.d.j;
|
||||
crashDetailBean.g = this.d.w();
|
||||
crashDetailBean.m = this.d.g();
|
||||
crashDetailBean.n = "ANR_EXCEPTION";
|
||||
crashDetailBean.o = aVar.f;
|
||||
crashDetailBean.q = aVar.g;
|
||||
crashDetailBean.O = new HashMap();
|
||||
crashDetailBean.O.put("BUGLY_CR_01", aVar.e);
|
||||
int indexOf = crashDetailBean.q != null ? crashDetailBean.q.indexOf("\n") : -1;
|
||||
crashDetailBean.p = indexOf > 0 ? crashDetailBean.q.substring(0, indexOf) : "GET_FAIL";
|
||||
crashDetailBean.r = aVar.c;
|
||||
if (crashDetailBean.q != null) {
|
||||
crashDetailBean.u = z.b(crashDetailBean.q.getBytes());
|
||||
}
|
||||
crashDetailBean.z = aVar.b;
|
||||
crashDetailBean.A = aVar.a;
|
||||
crashDetailBean.B = "main(1)";
|
||||
crashDetailBean.I = this.d.y();
|
||||
crashDetailBean.h = this.d.v();
|
||||
crashDetailBean.i = this.d.J();
|
||||
crashDetailBean.v = aVar.d;
|
||||
crashDetailBean.L = this.d.n;
|
||||
crashDetailBean.M = this.d.a;
|
||||
crashDetailBean.N = this.d.a();
|
||||
crashDetailBean.P = this.d.H();
|
||||
crashDetailBean.Q = this.d.I();
|
||||
crashDetailBean.R = this.d.B();
|
||||
crashDetailBean.S = this.d.G();
|
||||
this.h.c(crashDetailBean);
|
||||
crashDetailBean.y = y.a();
|
||||
} catch (Throwable th) {
|
||||
if (!x.a(th)) {
|
||||
th.printStackTrace();
|
||||
}
|
||||
}
|
||||
return crashDetailBean;
|
||||
}
|
||||
|
||||
private static boolean a(String str, String str2, String str3) {
|
||||
Map<String, String[]> map;
|
||||
BufferedWriter bufferedWriter;
|
||||
TraceFileHelper.a readTargetDumpInfo = TraceFileHelper.readTargetDumpInfo(str3, str, true);
|
||||
if (readTargetDumpInfo != null && (map = readTargetDumpInfo.d) != null && map.size() > 0) {
|
||||
File file = new File(str2);
|
||||
try {
|
||||
if (!file.exists()) {
|
||||
if (!file.getParentFile().exists()) {
|
||||
file.getParentFile().mkdirs();
|
||||
}
|
||||
file.createNewFile();
|
||||
}
|
||||
if (file.exists() && file.canWrite()) {
|
||||
BufferedWriter bufferedWriter2 = null;
|
||||
try {
|
||||
try {
|
||||
bufferedWriter = new BufferedWriter(new FileWriter(file, false));
|
||||
try {
|
||||
String[] strArr = readTargetDumpInfo.d.get("main");
|
||||
int i = 3;
|
||||
if (strArr != null && strArr.length >= 3) {
|
||||
String str4 = strArr[0];
|
||||
String str5 = strArr[1];
|
||||
bufferedWriter.write("\"main\" tid=" + strArr[2] + " :\n" + str4 + "\n" + str5 + "\n\n");
|
||||
bufferedWriter.flush();
|
||||
}
|
||||
for (Map.Entry<String, String[]> entry : readTargetDumpInfo.d.entrySet()) {
|
||||
if (!entry.getKey().equals("main")) {
|
||||
if (entry.getValue() != null && entry.getValue().length >= i) {
|
||||
String str6 = entry.getValue()[0];
|
||||
String str7 = entry.getValue()[1];
|
||||
bufferedWriter.write("\"" + entry.getKey() + "\" tid=" + entry.getValue()[2] + " :\n" + str6 + "\n" + str7 + "\n\n");
|
||||
bufferedWriter.flush();
|
||||
}
|
||||
i = 3;
|
||||
}
|
||||
}
|
||||
try {
|
||||
bufferedWriter.close();
|
||||
} catch (IOException e) {
|
||||
if (!x.a(e)) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} catch (IOException e2) {
|
||||
e = e2;
|
||||
bufferedWriter2 = bufferedWriter;
|
||||
if (!x.a(e)) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
x.e("dump trace fail %s", e.getClass().getName() + ":" + e.getMessage());
|
||||
if (bufferedWriter2 != null) {
|
||||
try {
|
||||
bufferedWriter2.close();
|
||||
} catch (IOException e3) {
|
||||
if (!x.a(e3)) {
|
||||
e3.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
} catch (Throwable th) {
|
||||
th = th;
|
||||
Throwable th2 = th;
|
||||
if (bufferedWriter != null) {
|
||||
try {
|
||||
bufferedWriter.close();
|
||||
throw th2;
|
||||
} catch (IOException e4) {
|
||||
if (!x.a(e4)) {
|
||||
e4.printStackTrace();
|
||||
throw th2;
|
||||
}
|
||||
throw th2;
|
||||
}
|
||||
}
|
||||
throw th2;
|
||||
}
|
||||
} catch (Throwable th3) {
|
||||
th = th3;
|
||||
bufferedWriter = bufferedWriter2;
|
||||
}
|
||||
} catch (IOException e5) {
|
||||
e = e5;
|
||||
}
|
||||
} else {
|
||||
x.e("backup file create fail %s", str2);
|
||||
return false;
|
||||
}
|
||||
} catch (Exception e6) {
|
||||
if (!x.a(e6)) {
|
||||
e6.printStackTrace();
|
||||
}
|
||||
x.e("backup file create error! %s %s", e6.getClass().getName() + ":" + e6.getMessage(), str2);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
x.e("not found trace dump for %s", str3);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public final boolean a() {
|
||||
return this.a.get() != 0;
|
||||
}
|
||||
|
||||
private boolean a(Context context, String str, ActivityManager.ProcessErrorStateInfo processErrorStateInfo, long j, Map<String, String> map) {
|
||||
File file = new File(context.getFilesDir(), "bugly/bugly_trace_" + j + ".txt");
|
||||
a aVar = new a();
|
||||
aVar.c = j;
|
||||
aVar.d = file.getAbsolutePath();
|
||||
aVar.a = processErrorStateInfo != null ? processErrorStateInfo.processName : "";
|
||||
aVar.f = processErrorStateInfo != null ? processErrorStateInfo.shortMsg : "";
|
||||
aVar.e = processErrorStateInfo != null ? processErrorStateInfo.longMsg : "";
|
||||
aVar.b = map;
|
||||
if (map != null) {
|
||||
for (String str2 : map.keySet()) {
|
||||
if (str2.startsWith("main(")) {
|
||||
aVar.g = map.get(str2);
|
||||
}
|
||||
}
|
||||
}
|
||||
Object[] objArr = new Object[6];
|
||||
objArr[0] = Long.valueOf(aVar.c);
|
||||
objArr[1] = aVar.d;
|
||||
objArr[2] = aVar.a;
|
||||
objArr[3] = aVar.f;
|
||||
objArr[4] = aVar.e;
|
||||
Map<String, String> map2 = aVar.b;
|
||||
objArr[5] = Integer.valueOf(map2 == null ? 0 : map2.size());
|
||||
x.c("anr tm:%d\ntr:%s\nproc:%s\nsMsg:%s\n lMsg:%s\n threads:%d", objArr);
|
||||
if (!this.f.b()) {
|
||||
x.e("crash report sync remote fail, will not upload to Bugly , print local for helpful!", new Object[0]);
|
||||
com.tencent.bugly.crashreport.crash.b.a("ANR", z.a(), aVar.a, "main", aVar.e, null);
|
||||
return false;
|
||||
}
|
||||
if (!this.f.c().j) {
|
||||
x.d("ANR Report is closed!", new Object[0]);
|
||||
return false;
|
||||
}
|
||||
x.a("found visiable anr , start to upload!", new Object[0]);
|
||||
CrashDetailBean a = a(aVar);
|
||||
if (a == null) {
|
||||
x.e("pack anr fail!", new Object[0]);
|
||||
return false;
|
||||
}
|
||||
c.a().a(a);
|
||||
if (a.a >= 0) {
|
||||
x.a("backup anr record success!", new Object[0]);
|
||||
} else {
|
||||
x.d("backup anr record fail!", new Object[0]);
|
||||
}
|
||||
if (str != null && new File(str).exists()) {
|
||||
this.a.set(3);
|
||||
if (a(str, aVar.d, aVar.a)) {
|
||||
x.a("backup trace success", new Object[0]);
|
||||
}
|
||||
}
|
||||
com.tencent.bugly.crashreport.crash.b.a("ANR", z.a(), aVar.a, "main", aVar.e, a);
|
||||
if (!this.h.a(a)) {
|
||||
this.h.a(a, 3000L, true);
|
||||
}
|
||||
this.h.b(a);
|
||||
return true;
|
||||
}
|
||||
|
||||
public final void a(String str) {
|
||||
synchronized (this) {
|
||||
if (this.a.get() != 0) {
|
||||
x.c("trace started return ", new Object[0]);
|
||||
return;
|
||||
}
|
||||
this.a.set(1);
|
||||
try {
|
||||
x.c("read trace first dump for create time!", new Object[0]);
|
||||
TraceFileHelper.a readFirstDumpInfo = TraceFileHelper.readFirstDumpInfo(str, false);
|
||||
long j = readFirstDumpInfo != null ? readFirstDumpInfo.c : -1L;
|
||||
if (j == -1) {
|
||||
x.d("trace dump fail could not get time!", new Object[0]);
|
||||
j = System.currentTimeMillis();
|
||||
}
|
||||
long j2 = j;
|
||||
if (Math.abs(j2 - this.b) < 10000) {
|
||||
x.d("should not process ANR too Fre in %d", Integer.valueOf(XStream.PRIORITY_VERY_HIGH));
|
||||
} else {
|
||||
this.b = j2;
|
||||
this.a.set(1);
|
||||
try {
|
||||
Map<String, String> a = z.a(c.f, false);
|
||||
if (a != null && a.size() > 0) {
|
||||
ActivityManager.ProcessErrorStateInfo a2 = a(this.c, 10000L);
|
||||
if (a2 == null) {
|
||||
x.c("proc state is unvisiable!", new Object[0]);
|
||||
} else if (a2.pid != Process.myPid()) {
|
||||
x.c("not mind proc!", a2.processName);
|
||||
} else {
|
||||
x.a("found visiable anr , start to process!", new Object[0]);
|
||||
a(this.c, str, a2, j2, a);
|
||||
}
|
||||
}
|
||||
x.d("can't get all thread skip this anr", new Object[0]);
|
||||
} catch (Throwable th) {
|
||||
x.a(th);
|
||||
x.e("get all thread stack fail!", new Object[0]);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
try {
|
||||
} finally {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public final void a(boolean z) {
|
||||
c(z);
|
||||
boolean h = h();
|
||||
com.tencent.bugly.crashreport.common.strategy.a a = com.tencent.bugly.crashreport.common.strategy.a.a();
|
||||
if (a != null) {
|
||||
h = h && a.c().g;
|
||||
}
|
||||
if (h != g()) {
|
||||
x.a("anr changed to %b", Boolean.valueOf(h));
|
||||
b(h);
|
||||
}
|
||||
}
|
||||
|
||||
public final synchronized void a(StrategyBean strategyBean) {
|
||||
if (strategyBean == null) {
|
||||
return;
|
||||
}
|
||||
if (strategyBean.j != g()) {
|
||||
x.d("server anr changed to %b", Boolean.valueOf(strategyBean.j));
|
||||
}
|
||||
if (Build.VERSION.SDK_INT <= 19) {
|
||||
boolean z = strategyBean.j && h();
|
||||
if (z != g()) {
|
||||
x.a("anr changed to %b", Boolean.valueOf(z));
|
||||
b(z);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (strategyBean.j) {
|
||||
c();
|
||||
} else {
|
||||
d();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.tencent.bugly.proguard.ac
|
||||
public final boolean a(Thread thread) {
|
||||
new HashMap();
|
||||
if (thread.getName().contains("main")) {
|
||||
ActivityManager.ProcessErrorStateInfo a = a(this.c, 10000L);
|
||||
if (a == null) {
|
||||
x.c("anr handler onThreadBlock proc state is unvisiable!", new Object[0]);
|
||||
return false;
|
||||
}
|
||||
if (a.pid != Process.myPid()) {
|
||||
x.c("onThreadBlock not mind proc!", a.processName);
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
Map<String, String> a2 = z.a(200000, false);
|
||||
x.a("onThreadBlock found visiable anr , start to process!", new Object[0]);
|
||||
a(this.c, "", a, System.currentTimeMillis(), a2);
|
||||
} catch (Throwable unused) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
x.c("anr handler onThreadBlock only care main thread", new Object[0]);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
1214
sources/com/tencent/bugly/crashreport/crash/b.java
Normal file
1214
sources/com/tencent/bugly/crashreport/crash/b.java
Normal file
File diff suppressed because it is too large
Load Diff
260
sources/com/tencent/bugly/crashreport/crash/c.java
Normal file
260
sources/com/tencent/bugly/crashreport/crash/c.java
Normal file
@@ -0,0 +1,260 @@
|
||||
package com.tencent.bugly.crashreport.crash;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import com.tencent.bugly.BuglyStrategy;
|
||||
import com.tencent.bugly.crashreport.common.info.AppInfo;
|
||||
import com.tencent.bugly.crashreport.common.strategy.StrategyBean;
|
||||
import com.tencent.bugly.crashreport.crash.jni.NativeCrashHandler;
|
||||
import com.tencent.bugly.proguard.o;
|
||||
import com.tencent.bugly.proguard.p;
|
||||
import com.tencent.bugly.proguard.r;
|
||||
import com.tencent.bugly.proguard.u;
|
||||
import com.tencent.bugly.proguard.w;
|
||||
import com.tencent.bugly.proguard.x;
|
||||
import com.tencent.bugly.proguard.z;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/* compiled from: BUGLY */
|
||||
/* loaded from: classes.dex */
|
||||
public final class c {
|
||||
public static int a = 0;
|
||||
public static boolean b = false;
|
||||
public static int c = 2;
|
||||
public static boolean d = true;
|
||||
public static int e = 20480;
|
||||
public static int f = 20480;
|
||||
public static long g = 604800000;
|
||||
public static String h = null;
|
||||
public static boolean i = false;
|
||||
public static String j = null;
|
||||
public static int k = 5000;
|
||||
public static boolean l = true;
|
||||
public static boolean m = false;
|
||||
public static String n;
|
||||
public static String o;
|
||||
private static c r;
|
||||
public final b p;
|
||||
private final Context q;
|
||||
private final e s;
|
||||
private final NativeCrashHandler t;
|
||||
private com.tencent.bugly.crashreport.common.strategy.a u;
|
||||
private w v;
|
||||
private final com.tencent.bugly.crashreport.crash.anr.b w;
|
||||
private Boolean x;
|
||||
|
||||
/* compiled from: BUGLY */
|
||||
/* renamed from: com.tencent.bugly.crashreport.crash.c$2, reason: invalid class name */
|
||||
final class AnonymousClass2 extends Thread {
|
||||
AnonymousClass2() {
|
||||
}
|
||||
|
||||
@Override // java.lang.Thread, java.lang.Runnable
|
||||
public final void run() {
|
||||
List<CrashDetailBean> list;
|
||||
if (z.a(c.this.q, "local_crash_lock", 10000L)) {
|
||||
List<CrashDetailBean> a = c.this.p.a();
|
||||
if (a != null && a.size() > 0) {
|
||||
x.c("Size of crash list: %s", Integer.valueOf(a.size()));
|
||||
int size = a.size();
|
||||
if (size > 20) {
|
||||
ArrayList arrayList = new ArrayList();
|
||||
Collections.sort(a);
|
||||
for (int i = 0; i < 20; i++) {
|
||||
arrayList.add(a.get((size - 1) - i));
|
||||
}
|
||||
list = arrayList;
|
||||
} else {
|
||||
list = a;
|
||||
}
|
||||
c.this.p.a(list, 0L, false, false, false);
|
||||
}
|
||||
z.b(c.this.q, "local_crash_lock");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private c(int i2, Context context, w wVar, boolean z, BuglyStrategy.a aVar, o oVar, String str) {
|
||||
a = i2;
|
||||
Context a2 = z.a(context);
|
||||
this.q = a2;
|
||||
this.u = com.tencent.bugly.crashreport.common.strategy.a.a();
|
||||
this.v = wVar;
|
||||
this.p = new b(i2, a2, u.a(), p.a(), this.u, aVar, oVar);
|
||||
com.tencent.bugly.crashreport.common.info.a a3 = com.tencent.bugly.crashreport.common.info.a.a(a2);
|
||||
this.s = new e(a2, this.p, this.u, a3);
|
||||
this.t = NativeCrashHandler.getInstance(a2, a3, this.p, this.u, wVar, z, str);
|
||||
a3.D = this.t;
|
||||
this.w = new com.tencent.bugly.crashreport.crash.anr.b(a2, this.u, a3, wVar, this.p);
|
||||
}
|
||||
|
||||
public final synchronized void c() {
|
||||
this.s.a();
|
||||
this.t.setUserOpened(true);
|
||||
if (Build.VERSION.SDK_INT <= 19) {
|
||||
this.w.a(true);
|
||||
} else {
|
||||
this.w.c();
|
||||
}
|
||||
}
|
||||
|
||||
public final synchronized void d() {
|
||||
this.s.b();
|
||||
this.t.setUserOpened(false);
|
||||
if (Build.VERSION.SDK_INT < 19) {
|
||||
this.w.a(false);
|
||||
} else {
|
||||
this.w.d();
|
||||
}
|
||||
}
|
||||
|
||||
public final void e() {
|
||||
this.s.a();
|
||||
}
|
||||
|
||||
public final void f() {
|
||||
this.t.setUserOpened(false);
|
||||
}
|
||||
|
||||
public final void g() {
|
||||
this.t.setUserOpened(true);
|
||||
}
|
||||
|
||||
public final void h() {
|
||||
if (Build.VERSION.SDK_INT <= 19) {
|
||||
this.w.a(true);
|
||||
} else {
|
||||
this.w.c();
|
||||
}
|
||||
}
|
||||
|
||||
public final void i() {
|
||||
if (Build.VERSION.SDK_INT < 19) {
|
||||
this.w.a(false);
|
||||
} else {
|
||||
this.w.d();
|
||||
}
|
||||
}
|
||||
|
||||
public final synchronized void j() {
|
||||
int i2 = 0;
|
||||
while (true) {
|
||||
int i3 = i2 + 1;
|
||||
if (i2 < 30) {
|
||||
try {
|
||||
x.a("try main sleep for make a test anr! try:%d/30 , kill it if you don't want to wait!", Integer.valueOf(i3));
|
||||
z.b(5000L);
|
||||
i2 = i3;
|
||||
} catch (Throwable th) {
|
||||
if (x.a(th)) {
|
||||
return;
|
||||
}
|
||||
th.printStackTrace();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public final boolean k() {
|
||||
return this.w.a();
|
||||
}
|
||||
|
||||
public final void l() {
|
||||
this.t.checkUploadRecordCrash();
|
||||
}
|
||||
|
||||
public final void m() {
|
||||
if (com.tencent.bugly.crashreport.common.info.a.b().d.equals(AppInfo.a(this.q))) {
|
||||
this.t.removeEmptyNativeRecordFiles();
|
||||
}
|
||||
}
|
||||
|
||||
public static synchronized c a(int i2, Context context, boolean z, BuglyStrategy.a aVar, o oVar, String str) {
|
||||
c cVar;
|
||||
synchronized (c.class) {
|
||||
if (r == null) {
|
||||
r = new c(1004, context, w.a(), z, aVar, null, null);
|
||||
}
|
||||
cVar = r;
|
||||
}
|
||||
return cVar;
|
||||
}
|
||||
|
||||
public final boolean b() {
|
||||
Boolean bool = this.x;
|
||||
if (bool != null) {
|
||||
return bool.booleanValue();
|
||||
}
|
||||
String str = com.tencent.bugly.crashreport.common.info.a.b().d;
|
||||
List<r> a2 = p.a().a(1);
|
||||
ArrayList arrayList = new ArrayList();
|
||||
if (a2 == null || a2.size() <= 0) {
|
||||
this.x = false;
|
||||
return false;
|
||||
}
|
||||
for (r rVar : a2) {
|
||||
if (str.equals(rVar.c)) {
|
||||
this.x = true;
|
||||
arrayList.add(rVar);
|
||||
}
|
||||
}
|
||||
if (arrayList.size() > 0) {
|
||||
p.a().a(arrayList);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static synchronized c a() {
|
||||
c cVar;
|
||||
synchronized (c.class) {
|
||||
cVar = r;
|
||||
}
|
||||
return cVar;
|
||||
}
|
||||
|
||||
public final void a(StrategyBean strategyBean) {
|
||||
this.s.a(strategyBean);
|
||||
this.t.onStrategyChanged(strategyBean);
|
||||
this.w.a(strategyBean);
|
||||
w.a().a(new AnonymousClass2(), 3000L);
|
||||
}
|
||||
|
||||
public final synchronized void a(boolean z, boolean z2, boolean z3) {
|
||||
this.t.testNativeCrash(z, z2, z3);
|
||||
}
|
||||
|
||||
public final void a(final Thread thread, final Throwable th, boolean z, String str, byte[] bArr, final boolean z2) {
|
||||
final boolean z3 = false;
|
||||
final String str2 = null;
|
||||
final byte[] bArr2 = null;
|
||||
this.v.a(new Runnable() { // from class: com.tencent.bugly.crashreport.crash.c.1
|
||||
@Override // java.lang.Runnable
|
||||
public final void run() {
|
||||
try {
|
||||
x.c("post a throwable %b", Boolean.valueOf(z3));
|
||||
c.this.s.a(thread, th, false, str2, bArr2);
|
||||
if (z2) {
|
||||
x.a("clear user datas", new Object[0]);
|
||||
com.tencent.bugly.crashreport.common.info.a.a(c.this.q).C();
|
||||
}
|
||||
} catch (Throwable th2) {
|
||||
if (!x.b(th2)) {
|
||||
th2.printStackTrace();
|
||||
}
|
||||
x.e("java catch error: %s", th.toString());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public final void a(CrashDetailBean crashDetailBean) {
|
||||
this.p.d(crashDetailBean);
|
||||
}
|
||||
|
||||
public final void a(long j2) {
|
||||
w.a().a(new AnonymousClass2(), j2);
|
||||
}
|
||||
}
|
91
sources/com/tencent/bugly/crashreport/crash/d.java
Normal file
91
sources/com/tencent/bugly/crashreport/crash/d.java
Normal file
@@ -0,0 +1,91 @@
|
||||
package com.tencent.bugly.crashreport.crash;
|
||||
|
||||
import android.content.Context;
|
||||
import com.tencent.bugly.proguard.w;
|
||||
import com.tencent.bugly.proguard.x;
|
||||
import com.tencent.bugly.proguard.z;
|
||||
import java.util.Map;
|
||||
|
||||
/* compiled from: BUGLY */
|
||||
/* loaded from: classes.dex */
|
||||
public final class d {
|
||||
private static d a;
|
||||
private com.tencent.bugly.crashreport.common.strategy.a b;
|
||||
private com.tencent.bugly.crashreport.common.info.a c;
|
||||
private b d;
|
||||
private Context e;
|
||||
|
||||
private d(Context context) {
|
||||
c a2 = c.a();
|
||||
if (a2 == null) {
|
||||
return;
|
||||
}
|
||||
this.b = com.tencent.bugly.crashreport.common.strategy.a.a();
|
||||
this.c = com.tencent.bugly.crashreport.common.info.a.a(context);
|
||||
this.d = a2.p;
|
||||
this.e = context;
|
||||
w.a().a(new Runnable() { // from class: com.tencent.bugly.crashreport.crash.d.1
|
||||
@Override // java.lang.Runnable
|
||||
public final void run() {
|
||||
d.a(d.this);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
static /* synthetic */ void a(d dVar) {
|
||||
x.c("[ExtraCrashManager] Trying to notify Bugly agents.", new Object[0]);
|
||||
try {
|
||||
Class<?> cls = Class.forName("com.tencent.bugly.agent.GameAgent");
|
||||
dVar.c.getClass();
|
||||
z.a(cls, "sdkPackageName", "com.tencent.bugly", (Object) null);
|
||||
x.c("[ExtraCrashManager] Bugly game agent has been notified.", new Object[0]);
|
||||
} catch (Throwable unused) {
|
||||
x.a("[ExtraCrashManager] no game agent", new Object[0]);
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX WARN: Removed duplicated region for block: B:38:0x00df */
|
||||
/* JADX WARN: Removed duplicated region for block: B:42:0x015a A[Catch: all -> 0x0250, TRY_ENTER, TryCatch #1 {all -> 0x0250, blocks: (B:15:0x0045, B:17:0x004d, B:18:0x0054, B:21:0x0060, B:23:0x0068, B:32:0x00b6, B:34:0x00ba, B:39:0x00e0, B:42:0x015a, B:44:0x0161, B:46:0x0166, B:48:0x01fa, B:50:0x0203, B:51:0x0208, B:53:0x0243, B:57:0x00c8, B:59:0x00cc), top: B:14:0x0045 }] */
|
||||
/* JADX WARN: Removed duplicated region for block: B:48:0x01fa A[Catch: all -> 0x0250, TryCatch #1 {all -> 0x0250, blocks: (B:15:0x0045, B:17:0x004d, B:18:0x0054, B:21:0x0060, B:23:0x0068, B:32:0x00b6, B:34:0x00ba, B:39:0x00e0, B:42:0x015a, B:44:0x0161, B:46:0x0166, B:48:0x01fa, B:50:0x0203, B:51:0x0208, B:53:0x0243, B:57:0x00c8, B:59:0x00cc), top: B:14:0x0045 }] */
|
||||
/* JADX WARN: Removed duplicated region for block: B:50:0x0203 A[Catch: all -> 0x0250, TryCatch #1 {all -> 0x0250, blocks: (B:15:0x0045, B:17:0x004d, B:18:0x0054, B:21:0x0060, B:23:0x0068, B:32:0x00b6, B:34:0x00ba, B:39:0x00e0, B:42:0x015a, B:44:0x0161, B:46:0x0166, B:48:0x01fa, B:50:0x0203, B:51:0x0208, B:53:0x0243, B:57:0x00c8, B:59:0x00cc), top: B:14:0x0045 }] */
|
||||
/* JADX WARN: Removed duplicated region for block: B:53:0x0243 A[Catch: all -> 0x0250, TRY_LEAVE, TryCatch #1 {all -> 0x0250, blocks: (B:15:0x0045, B:17:0x004d, B:18:0x0054, B:21:0x0060, B:23:0x0068, B:32:0x00b6, B:34:0x00ba, B:39:0x00e0, B:42:0x015a, B:44:0x0161, B:46:0x0166, B:48:0x01fa, B:50:0x0203, B:51:0x0208, B:53:0x0243, B:57:0x00c8, B:59:0x00cc), top: B:14:0x0045 }] */
|
||||
/* JADX WARN: Removed duplicated region for block: B:56:0x0165 */
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
||||
*/
|
||||
static /* synthetic */ void a(com.tencent.bugly.crashreport.crash.d r16, java.lang.Thread r17, int r18, java.lang.String r19, java.lang.String r20, java.lang.String r21, java.util.Map r22) {
|
||||
/*
|
||||
Method dump skipped, instructions count: 615
|
||||
To view this dump change 'Code comments level' option to 'DEBUG'
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: com.tencent.bugly.crashreport.crash.d.a(com.tencent.bugly.crashreport.crash.d, java.lang.Thread, int, java.lang.String, java.lang.String, java.lang.String, java.util.Map):void");
|
||||
}
|
||||
|
||||
public static d a(Context context) {
|
||||
if (a == null) {
|
||||
a = new d(context);
|
||||
}
|
||||
return a;
|
||||
}
|
||||
|
||||
public static void a(final Thread thread, final int i, final String str, final String str2, final String str3, final Map<String, String> map) {
|
||||
w.a().a(new Runnable() { // from class: com.tencent.bugly.crashreport.crash.d.2
|
||||
@Override // java.lang.Runnable
|
||||
public final void run() {
|
||||
try {
|
||||
if (d.a == null) {
|
||||
x.e("[ExtraCrashManager] Extra crash manager has not been initialized.", new Object[0]);
|
||||
} else {
|
||||
d.a(d.a, thread, i, str, str2, str3, map);
|
||||
}
|
||||
} catch (Throwable th) {
|
||||
if (!x.b(th)) {
|
||||
th.printStackTrace();
|
||||
}
|
||||
x.e("[ExtraCrashManager] Crash error %s %s %s", str, str2, str3);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
430
sources/com/tencent/bugly/crashreport/crash/e.java
Normal file
430
sources/com/tencent/bugly/crashreport/crash/e.java
Normal file
@@ -0,0 +1,430 @@
|
||||
package com.tencent.bugly.crashreport.crash;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Process;
|
||||
import com.tencent.bugly.crashreport.common.strategy.StrategyBean;
|
||||
import com.tencent.bugly.proguard.x;
|
||||
import com.tencent.bugly.proguard.y;
|
||||
import com.tencent.bugly.proguard.z;
|
||||
import java.lang.Thread;
|
||||
import java.util.HashMap;
|
||||
|
||||
/* compiled from: BUGLY */
|
||||
/* loaded from: classes.dex */
|
||||
public final class e implements Thread.UncaughtExceptionHandler {
|
||||
private static String h;
|
||||
private static final Object i = new Object();
|
||||
private Context a;
|
||||
private b b;
|
||||
private com.tencent.bugly.crashreport.common.strategy.a c;
|
||||
private com.tencent.bugly.crashreport.common.info.a d;
|
||||
private Thread.UncaughtExceptionHandler e;
|
||||
private Thread.UncaughtExceptionHandler f;
|
||||
private boolean g = false;
|
||||
private int j;
|
||||
|
||||
public e(Context context, b bVar, com.tencent.bugly.crashreport.common.strategy.a aVar, com.tencent.bugly.crashreport.common.info.a aVar2) {
|
||||
this.a = context;
|
||||
this.b = bVar;
|
||||
this.c = aVar;
|
||||
this.d = aVar2;
|
||||
}
|
||||
|
||||
public final synchronized void a() {
|
||||
if (this.j >= 10) {
|
||||
x.a("java crash handler over %d, no need set.", 10);
|
||||
return;
|
||||
}
|
||||
this.g = true;
|
||||
Thread.UncaughtExceptionHandler defaultUncaughtExceptionHandler = Thread.getDefaultUncaughtExceptionHandler();
|
||||
if (defaultUncaughtExceptionHandler != null) {
|
||||
if (getClass().getName().equals(defaultUncaughtExceptionHandler.getClass().getName())) {
|
||||
return;
|
||||
}
|
||||
if ("com.android.internal.os.RuntimeInit$UncaughtHandler".equals(defaultUncaughtExceptionHandler.getClass().getName())) {
|
||||
x.a("backup system java handler: %s", defaultUncaughtExceptionHandler.toString());
|
||||
this.f = defaultUncaughtExceptionHandler;
|
||||
this.e = defaultUncaughtExceptionHandler;
|
||||
} else {
|
||||
x.a("backup java handler: %s", defaultUncaughtExceptionHandler.toString());
|
||||
this.e = defaultUncaughtExceptionHandler;
|
||||
}
|
||||
}
|
||||
Thread.setDefaultUncaughtExceptionHandler(this);
|
||||
this.j++;
|
||||
x.a("registered java monitor: %s", toString());
|
||||
}
|
||||
|
||||
public final synchronized void b() {
|
||||
this.g = false;
|
||||
x.a("close java monitor!", new Object[0]);
|
||||
if (Thread.getDefaultUncaughtExceptionHandler().getClass().getName().contains("bugly")) {
|
||||
x.a("Java monitor to unregister: %s", toString());
|
||||
Thread.setDefaultUncaughtExceptionHandler(this.e);
|
||||
this.j--;
|
||||
}
|
||||
}
|
||||
|
||||
@Override // java.lang.Thread.UncaughtExceptionHandler
|
||||
public final void uncaughtException(Thread thread, Throwable th) {
|
||||
synchronized (i) {
|
||||
a(thread, th, true, null, null);
|
||||
}
|
||||
}
|
||||
|
||||
private CrashDetailBean b(Thread thread, Throwable th, boolean z, String str, byte[] bArr) {
|
||||
String a;
|
||||
boolean z2 = false;
|
||||
if (th == null) {
|
||||
x.d("We can do nothing with a null throwable.", new Object[0]);
|
||||
return null;
|
||||
}
|
||||
boolean k = c.a().k();
|
||||
String str2 = (k && z) ? " This Crash Caused By ANR , PLS To Fix ANR , This Trace May Be Not Useful![Bugly]" : "";
|
||||
if (k && z) {
|
||||
x.e("This Crash Caused By ANR , PLS To Fix ANR , This Trace May Be Not Useful!", new Object[0]);
|
||||
}
|
||||
CrashDetailBean crashDetailBean = new CrashDetailBean();
|
||||
crashDetailBean.C = com.tencent.bugly.crashreport.common.info.b.k();
|
||||
crashDetailBean.D = com.tencent.bugly.crashreport.common.info.b.i();
|
||||
crashDetailBean.E = com.tencent.bugly.crashreport.common.info.b.m();
|
||||
crashDetailBean.F = this.d.p();
|
||||
crashDetailBean.G = this.d.o();
|
||||
crashDetailBean.H = this.d.q();
|
||||
crashDetailBean.w = z.a(this.a, c.e, (String) null);
|
||||
crashDetailBean.y = y.a();
|
||||
Object[] objArr = new Object[1];
|
||||
byte[] bArr2 = crashDetailBean.y;
|
||||
objArr[0] = Integer.valueOf(bArr2 == null ? 0 : bArr2.length);
|
||||
x.a("user log size:%d", objArr);
|
||||
crashDetailBean.b = z ? 0 : 2;
|
||||
crashDetailBean.e = this.d.h();
|
||||
com.tencent.bugly.crashreport.common.info.a aVar = this.d;
|
||||
crashDetailBean.f = aVar.j;
|
||||
crashDetailBean.g = aVar.w();
|
||||
crashDetailBean.m = this.d.g();
|
||||
String name = th.getClass().getName();
|
||||
String b = b(th, 1000);
|
||||
if (b == null) {
|
||||
b = "";
|
||||
}
|
||||
Object[] objArr2 = new Object[2];
|
||||
objArr2[0] = Integer.valueOf(th.getStackTrace().length);
|
||||
objArr2[1] = Boolean.valueOf(th.getCause() != null);
|
||||
x.e("stack frame :%d, has cause %b", objArr2);
|
||||
String stackTraceElement = th.getStackTrace().length > 0 ? th.getStackTrace()[0].toString() : "";
|
||||
Throwable th2 = th;
|
||||
while (th2 != null && th2.getCause() != null) {
|
||||
th2 = th2.getCause();
|
||||
}
|
||||
if (th2 != null && th2 != th) {
|
||||
crashDetailBean.n = th2.getClass().getName();
|
||||
crashDetailBean.o = b(th2, 1000);
|
||||
if (crashDetailBean.o == null) {
|
||||
crashDetailBean.o = "";
|
||||
}
|
||||
if (th2.getStackTrace().length > 0) {
|
||||
crashDetailBean.p = th2.getStackTrace()[0].toString();
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(name);
|
||||
sb.append(":");
|
||||
sb.append(b);
|
||||
sb.append("\n");
|
||||
sb.append(stackTraceElement);
|
||||
sb.append("\n......");
|
||||
sb.append("\nCaused by:\n");
|
||||
sb.append(crashDetailBean.n);
|
||||
sb.append(":");
|
||||
sb.append(crashDetailBean.o);
|
||||
sb.append("\n");
|
||||
a = a(th2, c.f);
|
||||
sb.append(a);
|
||||
crashDetailBean.q = sb.toString();
|
||||
} else {
|
||||
crashDetailBean.n = name;
|
||||
crashDetailBean.o = b + str2;
|
||||
if (crashDetailBean.o == null) {
|
||||
crashDetailBean.o = "";
|
||||
}
|
||||
crashDetailBean.p = stackTraceElement;
|
||||
a = a(th, c.f);
|
||||
crashDetailBean.q = a;
|
||||
}
|
||||
crashDetailBean.r = System.currentTimeMillis();
|
||||
crashDetailBean.u = z.b(crashDetailBean.q.getBytes());
|
||||
try {
|
||||
crashDetailBean.z = z.a(c.f, false);
|
||||
crashDetailBean.A = this.d.d;
|
||||
crashDetailBean.B = thread.getName() + "(" + thread.getId() + ")";
|
||||
crashDetailBean.z.put(crashDetailBean.B, a);
|
||||
crashDetailBean.I = this.d.y();
|
||||
crashDetailBean.h = this.d.v();
|
||||
crashDetailBean.i = this.d.J();
|
||||
crashDetailBean.M = this.d.a;
|
||||
crashDetailBean.N = this.d.a();
|
||||
crashDetailBean.P = this.d.H();
|
||||
crashDetailBean.Q = this.d.I();
|
||||
crashDetailBean.R = this.d.B();
|
||||
crashDetailBean.S = this.d.G();
|
||||
} catch (Throwable th3) {
|
||||
x.e("handle crash error %s", th3.toString());
|
||||
}
|
||||
if (z) {
|
||||
this.b.c(crashDetailBean);
|
||||
} else {
|
||||
boolean z3 = str != null && str.length() > 0;
|
||||
if (bArr != null && bArr.length > 0) {
|
||||
z2 = true;
|
||||
}
|
||||
if (z3) {
|
||||
crashDetailBean.O = new HashMap(1);
|
||||
crashDetailBean.O.put("UserData", str);
|
||||
}
|
||||
if (z2) {
|
||||
crashDetailBean.T = bArr;
|
||||
}
|
||||
}
|
||||
return crashDetailBean;
|
||||
}
|
||||
|
||||
private static boolean a(Thread thread) {
|
||||
synchronized (i) {
|
||||
if (h != null && thread.getName().equals(h)) {
|
||||
return true;
|
||||
}
|
||||
h = thread.getName();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public final void a(Thread thread, Throwable th, boolean z, String str, byte[] bArr) {
|
||||
if (z) {
|
||||
x.e("Java Crash Happen cause by %s(%d)", thread.getName(), Long.valueOf(thread.getId()));
|
||||
if (a(thread)) {
|
||||
x.a("this class has handled this exception", new Object[0]);
|
||||
if (this.f != null) {
|
||||
x.a("call system handler", new Object[0]);
|
||||
this.f.uncaughtException(thread, th);
|
||||
} else {
|
||||
x.e("current process die", new Object[0]);
|
||||
Process.killProcess(Process.myPid());
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
x.e("Java Catch Happen", new Object[0]);
|
||||
}
|
||||
try {
|
||||
if (!this.g) {
|
||||
x.c("Java crash handler is disable. Just return.", new Object[0]);
|
||||
if (z) {
|
||||
Thread.UncaughtExceptionHandler uncaughtExceptionHandler = this.e;
|
||||
if (uncaughtExceptionHandler != null && a(uncaughtExceptionHandler)) {
|
||||
x.e("sys default last handle start!", new Object[0]);
|
||||
this.e.uncaughtException(thread, th);
|
||||
x.e("sys default last handle end!", new Object[0]);
|
||||
return;
|
||||
} else if (this.f != null) {
|
||||
x.e("system handle start!", new Object[0]);
|
||||
this.f.uncaughtException(thread, th);
|
||||
x.e("system handle end!", new Object[0]);
|
||||
return;
|
||||
} else {
|
||||
x.e("crashreport last handle start!", new Object[0]);
|
||||
x.e("current process die", new Object[0]);
|
||||
Process.killProcess(Process.myPid());
|
||||
System.exit(1);
|
||||
x.e("crashreport last handle end!", new Object[0]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (!this.c.b()) {
|
||||
x.d("no remote but still store!", new Object[0]);
|
||||
}
|
||||
if (!this.c.c().g && this.c.b()) {
|
||||
x.e("crash report was closed by remote , will not upload to Bugly , print local for helpful!", new Object[0]);
|
||||
b.a(z ? "JAVA_CRASH" : "JAVA_CATCH", z.a(), this.d.d, thread.getName(), z.a(th), null);
|
||||
if (z) {
|
||||
Thread.UncaughtExceptionHandler uncaughtExceptionHandler2 = this.e;
|
||||
if (uncaughtExceptionHandler2 != null && a(uncaughtExceptionHandler2)) {
|
||||
x.e("sys default last handle start!", new Object[0]);
|
||||
this.e.uncaughtException(thread, th);
|
||||
x.e("sys default last handle end!", new Object[0]);
|
||||
return;
|
||||
} else if (this.f != null) {
|
||||
x.e("system handle start!", new Object[0]);
|
||||
this.f.uncaughtException(thread, th);
|
||||
x.e("system handle end!", new Object[0]);
|
||||
return;
|
||||
} else {
|
||||
x.e("crashreport last handle start!", new Object[0]);
|
||||
x.e("current process die", new Object[0]);
|
||||
Process.killProcess(Process.myPid());
|
||||
System.exit(1);
|
||||
x.e("crashreport last handle end!", new Object[0]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
CrashDetailBean b = b(thread, th, z, str, bArr);
|
||||
if (b == null) {
|
||||
x.e("pkg crash datas fail!", new Object[0]);
|
||||
if (z) {
|
||||
Thread.UncaughtExceptionHandler uncaughtExceptionHandler3 = this.e;
|
||||
if (uncaughtExceptionHandler3 != null && a(uncaughtExceptionHandler3)) {
|
||||
x.e("sys default last handle start!", new Object[0]);
|
||||
this.e.uncaughtException(thread, th);
|
||||
x.e("sys default last handle end!", new Object[0]);
|
||||
return;
|
||||
} else if (this.f != null) {
|
||||
x.e("system handle start!", new Object[0]);
|
||||
this.f.uncaughtException(thread, th);
|
||||
x.e("system handle end!", new Object[0]);
|
||||
return;
|
||||
} else {
|
||||
x.e("crashreport last handle start!", new Object[0]);
|
||||
x.e("current process die", new Object[0]);
|
||||
Process.killProcess(Process.myPid());
|
||||
System.exit(1);
|
||||
x.e("crashreport last handle end!", new Object[0]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
b.a(z ? "JAVA_CRASH" : "JAVA_CATCH", z.a(), this.d.d, thread.getName(), z.a(th), b);
|
||||
if (!this.b.a(b)) {
|
||||
this.b.a(b, 3000L, z);
|
||||
}
|
||||
if (z) {
|
||||
this.b.b(b);
|
||||
}
|
||||
if (z) {
|
||||
Thread.UncaughtExceptionHandler uncaughtExceptionHandler4 = this.e;
|
||||
if (uncaughtExceptionHandler4 != null && a(uncaughtExceptionHandler4)) {
|
||||
x.e("sys default last handle start!", new Object[0]);
|
||||
this.e.uncaughtException(thread, th);
|
||||
x.e("sys default last handle end!", new Object[0]);
|
||||
} else if (this.f != null) {
|
||||
x.e("system handle start!", new Object[0]);
|
||||
this.f.uncaughtException(thread, th);
|
||||
x.e("system handle end!", new Object[0]);
|
||||
} else {
|
||||
x.e("crashreport last handle start!", new Object[0]);
|
||||
x.e("current process die", new Object[0]);
|
||||
Process.killProcess(Process.myPid());
|
||||
System.exit(1);
|
||||
x.e("crashreport last handle end!", new Object[0]);
|
||||
}
|
||||
}
|
||||
} catch (Throwable th2) {
|
||||
try {
|
||||
if (!x.a(th2)) {
|
||||
th2.printStackTrace();
|
||||
}
|
||||
if (z) {
|
||||
Thread.UncaughtExceptionHandler uncaughtExceptionHandler5 = this.e;
|
||||
if (uncaughtExceptionHandler5 != null && a(uncaughtExceptionHandler5)) {
|
||||
x.e("sys default last handle start!", new Object[0]);
|
||||
this.e.uncaughtException(thread, th);
|
||||
x.e("sys default last handle end!", new Object[0]);
|
||||
} else if (this.f != null) {
|
||||
x.e("system handle start!", new Object[0]);
|
||||
this.f.uncaughtException(thread, th);
|
||||
x.e("system handle end!", new Object[0]);
|
||||
} else {
|
||||
x.e("crashreport last handle start!", new Object[0]);
|
||||
x.e("current process die", new Object[0]);
|
||||
Process.killProcess(Process.myPid());
|
||||
System.exit(1);
|
||||
x.e("crashreport last handle end!", new Object[0]);
|
||||
}
|
||||
}
|
||||
} catch (Throwable th3) {
|
||||
if (z) {
|
||||
Thread.UncaughtExceptionHandler uncaughtExceptionHandler6 = this.e;
|
||||
if (uncaughtExceptionHandler6 != null && a(uncaughtExceptionHandler6)) {
|
||||
x.e("sys default last handle start!", new Object[0]);
|
||||
this.e.uncaughtException(thread, th);
|
||||
x.e("sys default last handle end!", new Object[0]);
|
||||
} else if (this.f != null) {
|
||||
x.e("system handle start!", new Object[0]);
|
||||
this.f.uncaughtException(thread, th);
|
||||
x.e("system handle end!", new Object[0]);
|
||||
} else {
|
||||
x.e("crashreport last handle start!", new Object[0]);
|
||||
x.e("current process die", new Object[0]);
|
||||
Process.killProcess(Process.myPid());
|
||||
System.exit(1);
|
||||
x.e("crashreport last handle end!", new Object[0]);
|
||||
}
|
||||
}
|
||||
throw th3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static String b(Throwable th, int i2) {
|
||||
if (th.getMessage() == null) {
|
||||
return "";
|
||||
}
|
||||
if (th.getMessage().length() <= 1000) {
|
||||
return th.getMessage();
|
||||
}
|
||||
return th.getMessage().substring(0, 1000) + "\n[Message over limit size:1000, has been cutted!]";
|
||||
}
|
||||
|
||||
private static boolean a(Thread.UncaughtExceptionHandler uncaughtExceptionHandler) {
|
||||
if (uncaughtExceptionHandler == null) {
|
||||
return true;
|
||||
}
|
||||
String name = uncaughtExceptionHandler.getClass().getName();
|
||||
for (StackTraceElement stackTraceElement : Thread.currentThread().getStackTrace()) {
|
||||
String className = stackTraceElement.getClassName();
|
||||
String methodName = stackTraceElement.getMethodName();
|
||||
if (name.equals(className) && "uncaughtException".equals(methodName)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public final synchronized void a(StrategyBean strategyBean) {
|
||||
if (strategyBean != null) {
|
||||
if (strategyBean.g != this.g) {
|
||||
x.a("java changed to %b", Boolean.valueOf(strategyBean.g));
|
||||
if (strategyBean.g) {
|
||||
a();
|
||||
return;
|
||||
}
|
||||
b();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static String a(Throwable th, int i2) {
|
||||
if (th == null) {
|
||||
return null;
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
try {
|
||||
if (th.getStackTrace() != null) {
|
||||
for (StackTraceElement stackTraceElement : th.getStackTrace()) {
|
||||
if (i2 > 0 && sb.length() >= i2) {
|
||||
sb.append("\n[Stack over limit size :" + i2 + " , has been cutted !]");
|
||||
return sb.toString();
|
||||
}
|
||||
sb.append(stackTraceElement.toString());
|
||||
sb.append("\n");
|
||||
}
|
||||
}
|
||||
} catch (Throwable th2) {
|
||||
x.e("gen stack error %s", th2.toString());
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
@@ -0,0 +1,190 @@
|
||||
package com.tencent.bugly.crashreport.crash.h5;
|
||||
|
||||
import android.webkit.JavascriptInterface;
|
||||
import com.tencent.bugly.crashreport.CrashReport;
|
||||
import com.tencent.bugly.crashreport.inner.InnerApi;
|
||||
import com.tencent.bugly.proguard.x;
|
||||
import com.tencent.bugly.proguard.z;
|
||||
import com.unity3d.ads.metadata.MediationMetaData;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import org.json.JSONObject;
|
||||
|
||||
/* compiled from: BUGLY */
|
||||
/* loaded from: classes.dex */
|
||||
public class H5JavaScriptInterface {
|
||||
private static HashSet<Integer> a = new HashSet<>();
|
||||
private String b = null;
|
||||
private Thread c = null;
|
||||
private String d = null;
|
||||
private Map<String, String> e = null;
|
||||
|
||||
private H5JavaScriptInterface() {
|
||||
}
|
||||
|
||||
private static a a(String str) {
|
||||
String string;
|
||||
if (str != null && str.length() > 0) {
|
||||
try {
|
||||
JSONObject jSONObject = new JSONObject(str);
|
||||
a aVar = new a();
|
||||
aVar.a = jSONObject.getString("projectRoot");
|
||||
if (aVar.a == null) {
|
||||
return null;
|
||||
}
|
||||
aVar.b = jSONObject.getString("context");
|
||||
if (aVar.b == null) {
|
||||
return null;
|
||||
}
|
||||
aVar.c = jSONObject.getString("url");
|
||||
if (aVar.c == null) {
|
||||
return null;
|
||||
}
|
||||
aVar.d = jSONObject.getString("userAgent");
|
||||
if (aVar.d == null) {
|
||||
return null;
|
||||
}
|
||||
aVar.e = jSONObject.getString("language");
|
||||
if (aVar.e == null) {
|
||||
return null;
|
||||
}
|
||||
aVar.f = jSONObject.getString(MediationMetaData.KEY_NAME);
|
||||
if (aVar.f == null || aVar.f.equals("null") || (string = jSONObject.getString("stacktrace")) == null) {
|
||||
return null;
|
||||
}
|
||||
int indexOf = string.indexOf("\n");
|
||||
if (indexOf < 0) {
|
||||
x.d("H5 crash stack's format is wrong!", new Object[0]);
|
||||
return null;
|
||||
}
|
||||
aVar.h = string.substring(indexOf + 1);
|
||||
aVar.g = string.substring(0, indexOf);
|
||||
int indexOf2 = aVar.g.indexOf(":");
|
||||
if (indexOf2 > 0) {
|
||||
aVar.g = aVar.g.substring(indexOf2 + 1);
|
||||
}
|
||||
aVar.i = jSONObject.getString("file");
|
||||
if (aVar.f == null) {
|
||||
return null;
|
||||
}
|
||||
aVar.j = jSONObject.getLong("lineNumber");
|
||||
if (aVar.j < 0) {
|
||||
return null;
|
||||
}
|
||||
aVar.k = jSONObject.getLong("columnNumber");
|
||||
if (aVar.k < 0) {
|
||||
return null;
|
||||
}
|
||||
x.a("H5 crash information is following: ", new Object[0]);
|
||||
x.a("[projectRoot]: " + aVar.a, new Object[0]);
|
||||
x.a("[context]: " + aVar.b, new Object[0]);
|
||||
x.a("[url]: " + aVar.c, new Object[0]);
|
||||
x.a("[userAgent]: " + aVar.d, new Object[0]);
|
||||
x.a("[language]: " + aVar.e, new Object[0]);
|
||||
x.a("[name]: " + aVar.f, new Object[0]);
|
||||
x.a("[message]: " + aVar.g, new Object[0]);
|
||||
x.a("[stacktrace]: \n" + aVar.h, new Object[0]);
|
||||
x.a("[file]: " + aVar.i, new Object[0]);
|
||||
x.a("[lineNumber]: " + aVar.j, new Object[0]);
|
||||
x.a("[columnNumber]: " + aVar.k, new Object[0]);
|
||||
return aVar;
|
||||
} catch (Throwable th) {
|
||||
if (!x.a(th)) {
|
||||
th.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static H5JavaScriptInterface getInstance(CrashReport.WebViewInterface webViewInterface) {
|
||||
String str = null;
|
||||
if (webViewInterface == null || a.contains(Integer.valueOf(webViewInterface.hashCode()))) {
|
||||
return null;
|
||||
}
|
||||
H5JavaScriptInterface h5JavaScriptInterface = new H5JavaScriptInterface();
|
||||
a.add(Integer.valueOf(webViewInterface.hashCode()));
|
||||
h5JavaScriptInterface.c = Thread.currentThread();
|
||||
Thread thread = h5JavaScriptInterface.c;
|
||||
if (thread != null) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("\n");
|
||||
for (int i = 2; i < thread.getStackTrace().length; i++) {
|
||||
StackTraceElement stackTraceElement = thread.getStackTrace()[i];
|
||||
if (!stackTraceElement.toString().contains("crashreport")) {
|
||||
sb.append(stackTraceElement.toString());
|
||||
sb.append("\n");
|
||||
}
|
||||
}
|
||||
str = sb.toString();
|
||||
}
|
||||
h5JavaScriptInterface.d = str;
|
||||
HashMap hashMap = new HashMap();
|
||||
StringBuilder sb2 = new StringBuilder();
|
||||
sb2.append((Object) webViewInterface.getContentDescription());
|
||||
hashMap.put("[WebView] ContentDescription", sb2.toString());
|
||||
h5JavaScriptInterface.e = hashMap;
|
||||
return h5JavaScriptInterface;
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void printLog(String str) {
|
||||
x.d("Log from js: %s", str);
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void reportJSException(String str) {
|
||||
if (str == null) {
|
||||
x.d("Payload from JS is null.", new Object[0]);
|
||||
return;
|
||||
}
|
||||
String b = z.b(str.getBytes());
|
||||
String str2 = this.b;
|
||||
if (str2 != null && str2.equals(b)) {
|
||||
x.d("Same payload from js. Please check whether you've injected bugly.js more than one times.", new Object[0]);
|
||||
return;
|
||||
}
|
||||
this.b = b;
|
||||
x.d("Handling JS exception ...", new Object[0]);
|
||||
a a2 = a(str);
|
||||
if (a2 == null) {
|
||||
x.d("Failed to parse payload.", new Object[0]);
|
||||
return;
|
||||
}
|
||||
LinkedHashMap linkedHashMap = new LinkedHashMap();
|
||||
LinkedHashMap linkedHashMap2 = new LinkedHashMap();
|
||||
String str3 = a2.a;
|
||||
if (str3 != null) {
|
||||
linkedHashMap2.put("[JS] projectRoot", str3);
|
||||
}
|
||||
String str4 = a2.b;
|
||||
if (str4 != null) {
|
||||
linkedHashMap2.put("[JS] context", str4);
|
||||
}
|
||||
String str5 = a2.c;
|
||||
if (str5 != null) {
|
||||
linkedHashMap2.put("[JS] url", str5);
|
||||
}
|
||||
String str6 = a2.d;
|
||||
if (str6 != null) {
|
||||
linkedHashMap2.put("[JS] userAgent", str6);
|
||||
}
|
||||
String str7 = a2.i;
|
||||
if (str7 != null) {
|
||||
linkedHashMap2.put("[JS] file", str7);
|
||||
}
|
||||
long j = a2.j;
|
||||
if (j != 0) {
|
||||
linkedHashMap2.put("[JS] lineNumber", Long.toString(j));
|
||||
}
|
||||
linkedHashMap.putAll(linkedHashMap2);
|
||||
linkedHashMap.putAll(this.e);
|
||||
linkedHashMap.put("Java Stack", this.d);
|
||||
Thread thread = this.c;
|
||||
if (a2 != null) {
|
||||
InnerApi.postH5CrashAsync(thread, a2.f, a2.g, a2.h, linkedHashMap);
|
||||
}
|
||||
}
|
||||
}
|
17
sources/com/tencent/bugly/crashreport/crash/h5/a.java
Normal file
17
sources/com/tencent/bugly/crashreport/crash/h5/a.java
Normal file
@@ -0,0 +1,17 @@
|
||||
package com.tencent.bugly.crashreport.crash.h5;
|
||||
|
||||
/* compiled from: BUGLY */
|
||||
/* loaded from: classes.dex */
|
||||
public final class a {
|
||||
public String a = null;
|
||||
public String b = null;
|
||||
public String c = null;
|
||||
public String d = null;
|
||||
public String e = null;
|
||||
public String f = null;
|
||||
public String g = null;
|
||||
public String h = null;
|
||||
public String i = null;
|
||||
public long j = 0;
|
||||
public long k = 0;
|
||||
}
|
27
sources/com/tencent/bugly/crashreport/crash/h5/b.java
Normal file
27
sources/com/tencent/bugly/crashreport/crash/h5/b.java
Normal file
File diff suppressed because one or more lines are too long
@@ -0,0 +1,458 @@
|
||||
package com.tencent.bugly.crashreport.crash.jni;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import com.tencent.bugly.Bugly;
|
||||
import com.tencent.bugly.crashreport.common.strategy.StrategyBean;
|
||||
import com.tencent.bugly.crashreport.crash.CrashDetailBean;
|
||||
import com.tencent.bugly.crashreport.crash.c;
|
||||
import com.tencent.bugly.proguard.w;
|
||||
import com.tencent.bugly.proguard.x;
|
||||
import com.tencent.bugly.proguard.z;
|
||||
import java.io.File;
|
||||
|
||||
/* compiled from: BUGLY */
|
||||
/* loaded from: classes.dex */
|
||||
public class NativeCrashHandler implements com.tencent.bugly.crashreport.a {
|
||||
private static NativeCrashHandler a = null;
|
||||
private static boolean l = false;
|
||||
private static boolean m = false;
|
||||
private static boolean o = true;
|
||||
private final Context b;
|
||||
private final com.tencent.bugly.crashreport.common.info.a c;
|
||||
private final w d;
|
||||
private NativeExceptionHandler e;
|
||||
private String f;
|
||||
private final boolean g;
|
||||
private boolean h = false;
|
||||
private boolean i = false;
|
||||
private boolean j = false;
|
||||
private boolean k = false;
|
||||
private com.tencent.bugly.crashreport.crash.b n;
|
||||
|
||||
@SuppressLint({"SdCardPath"})
|
||||
private NativeCrashHandler(Context context, com.tencent.bugly.crashreport.common.info.a aVar, com.tencent.bugly.crashreport.crash.b bVar, w wVar, boolean z, String str) {
|
||||
this.b = z.a(context);
|
||||
try {
|
||||
if (z.a(str)) {
|
||||
str = context.getDir("bugly", 0).getAbsolutePath();
|
||||
}
|
||||
} catch (Throwable unused) {
|
||||
str = "/data/data/" + com.tencent.bugly.crashreport.common.info.a.a(context).c + "/app_bugly";
|
||||
}
|
||||
this.n = bVar;
|
||||
this.f = str;
|
||||
this.c = aVar;
|
||||
this.d = wVar;
|
||||
this.g = z;
|
||||
this.e = new a(context, aVar, bVar, com.tencent.bugly.crashreport.common.strategy.a.a());
|
||||
}
|
||||
|
||||
public static synchronized NativeCrashHandler getInstance(Context context, com.tencent.bugly.crashreport.common.info.a aVar, com.tencent.bugly.crashreport.crash.b bVar, com.tencent.bugly.crashreport.common.strategy.a aVar2, w wVar, boolean z, String str) {
|
||||
NativeCrashHandler nativeCrashHandler;
|
||||
synchronized (NativeCrashHandler.class) {
|
||||
if (a == null) {
|
||||
a = new NativeCrashHandler(context, aVar, bVar, wVar, z, str);
|
||||
}
|
||||
nativeCrashHandler = a;
|
||||
}
|
||||
return nativeCrashHandler;
|
||||
}
|
||||
|
||||
public static boolean isShouldHandleInJava() {
|
||||
return o;
|
||||
}
|
||||
|
||||
public static void setShouldHandleInJava(boolean z) {
|
||||
o = z;
|
||||
NativeCrashHandler nativeCrashHandler = a;
|
||||
if (nativeCrashHandler != null) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(z);
|
||||
nativeCrashHandler.a(999, sb.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.tencent.bugly.crashreport.a
|
||||
public boolean appendLogToNative(String str, String str2, String str3) {
|
||||
if ((this.h || this.i) && l && str != null && str2 != null && str3 != null) {
|
||||
try {
|
||||
if (this.i) {
|
||||
return appendNativeLog(str, str2, str3);
|
||||
}
|
||||
Boolean bool = (Boolean) z.a("com.tencent.feedback.eup.jni.NativeExceptionUpload", "appendNativeLog", null, new Class[]{String.class, String.class, String.class}, new Object[]{str, str2, str3});
|
||||
if (bool != null) {
|
||||
return bool.booleanValue();
|
||||
}
|
||||
return false;
|
||||
} catch (UnsatisfiedLinkError unused) {
|
||||
l = false;
|
||||
} catch (Throwable th) {
|
||||
if (!x.a(th)) {
|
||||
th.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected native boolean appendNativeLog(String str, String str2, String str3);
|
||||
|
||||
protected native boolean appendWholeNativeLog(String str);
|
||||
|
||||
public void checkUploadRecordCrash() {
|
||||
this.d.a(new Runnable() { // from class: com.tencent.bugly.crashreport.crash.jni.NativeCrashHandler.1
|
||||
@Override // java.lang.Runnable
|
||||
public final void run() {
|
||||
if (!z.a(NativeCrashHandler.this.b, "native_record_lock", 10000L)) {
|
||||
x.a("[Native] Failed to lock file for handling native crash record.", new Object[0]);
|
||||
return;
|
||||
}
|
||||
if (!NativeCrashHandler.o) {
|
||||
NativeCrashHandler.a(NativeCrashHandler.this, 999, Bugly.SDK_IS_DEV);
|
||||
}
|
||||
CrashDetailBean a2 = b.a(NativeCrashHandler.this.b, NativeCrashHandler.this.f, NativeCrashHandler.this.e);
|
||||
if (a2 != null) {
|
||||
x.a("[Native] Get crash from native record.", new Object[0]);
|
||||
if (!NativeCrashHandler.this.n.a(a2)) {
|
||||
NativeCrashHandler.this.n.a(a2, 3000L, false);
|
||||
}
|
||||
b.a(false, NativeCrashHandler.this.f);
|
||||
}
|
||||
NativeCrashHandler.this.a();
|
||||
z.b(NativeCrashHandler.this.b, "native_record_lock");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public boolean filterSigabrtSysLog() {
|
||||
return a(998, "true");
|
||||
}
|
||||
|
||||
public synchronized String getDumpFilePath() {
|
||||
return this.f;
|
||||
}
|
||||
|
||||
@Override // com.tencent.bugly.crashreport.a
|
||||
public String getLogFromNative() {
|
||||
if ((!this.h && !this.i) || !l) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return this.i ? getNativeLog() : (String) z.a("com.tencent.feedback.eup.jni.NativeExceptionUpload", "getNativeLog", null, null, null);
|
||||
} catch (UnsatisfiedLinkError unused) {
|
||||
l = false;
|
||||
return null;
|
||||
} catch (Throwable th) {
|
||||
if (!x.a(th)) {
|
||||
th.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public NativeExceptionHandler getNativeExceptionHandler() {
|
||||
return this.e;
|
||||
}
|
||||
|
||||
protected native String getNativeKeyValueList();
|
||||
|
||||
protected native String getNativeLog();
|
||||
|
||||
public synchronized boolean isUserOpened() {
|
||||
return this.k;
|
||||
}
|
||||
|
||||
public synchronized void onStrategyChanged(StrategyBean strategyBean) {
|
||||
if (strategyBean != null) {
|
||||
if (strategyBean.g != this.j) {
|
||||
x.d("server native changed to %b", Boolean.valueOf(strategyBean.g));
|
||||
}
|
||||
}
|
||||
boolean z = com.tencent.bugly.crashreport.common.strategy.a.a().c().g && this.k;
|
||||
if (z != this.j) {
|
||||
x.a("native changed to %b", Boolean.valueOf(z));
|
||||
b(z);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean putKeyValueToNative(String str, String str2) {
|
||||
if ((this.h || this.i) && l && str != null && str2 != null) {
|
||||
try {
|
||||
if (this.i) {
|
||||
return putNativeKeyValue(str, str2);
|
||||
}
|
||||
Boolean bool = (Boolean) z.a("com.tencent.feedback.eup.jni.NativeExceptionUpload", "putNativeKeyValue", null, new Class[]{String.class, String.class}, new Object[]{str, str2});
|
||||
if (bool != null) {
|
||||
return bool.booleanValue();
|
||||
}
|
||||
return false;
|
||||
} catch (UnsatisfiedLinkError unused) {
|
||||
l = false;
|
||||
} catch (Throwable th) {
|
||||
if (!x.a(th)) {
|
||||
th.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected native boolean putNativeKeyValue(String str, String str2);
|
||||
|
||||
protected native String regist(String str, boolean z, int i);
|
||||
|
||||
public void removeEmptyNativeRecordFiles() {
|
||||
b.c(this.f);
|
||||
}
|
||||
|
||||
protected native String removeNativeKeyValue(String str);
|
||||
|
||||
public synchronized void setDumpFilePath(String str) {
|
||||
this.f = str;
|
||||
}
|
||||
|
||||
public boolean setNativeAppChannel(String str) {
|
||||
return a(12, str);
|
||||
}
|
||||
|
||||
public boolean setNativeAppPackage(String str) {
|
||||
return a(13, str);
|
||||
}
|
||||
|
||||
public boolean setNativeAppVersion(String str) {
|
||||
return a(10, str);
|
||||
}
|
||||
|
||||
protected native void setNativeInfo(int i, String str);
|
||||
|
||||
@Override // com.tencent.bugly.crashreport.a
|
||||
public boolean setNativeIsAppForeground(boolean z) {
|
||||
return a(14, z ? "true" : Bugly.SDK_IS_DEV);
|
||||
}
|
||||
|
||||
public boolean setNativeLaunchTime(long j) {
|
||||
try {
|
||||
return a(15, String.valueOf(j));
|
||||
} catch (NumberFormatException e) {
|
||||
if (x.a(e)) {
|
||||
return false;
|
||||
}
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean setNativeUserId(String str) {
|
||||
return a(11, str);
|
||||
}
|
||||
|
||||
public synchronized void setUserOpened(boolean z) {
|
||||
c(z);
|
||||
boolean isUserOpened = isUserOpened();
|
||||
com.tencent.bugly.crashreport.common.strategy.a a2 = com.tencent.bugly.crashreport.common.strategy.a.a();
|
||||
if (a2 != null) {
|
||||
isUserOpened = isUserOpened && a2.c().g;
|
||||
}
|
||||
if (isUserOpened != this.j) {
|
||||
x.a("native changed to %b", Boolean.valueOf(isUserOpened));
|
||||
b(isUserOpened);
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void startNativeMonitor() {
|
||||
if (!this.i && !this.h) {
|
||||
String str = "Bugly";
|
||||
boolean z = !z.a(this.c.m);
|
||||
String str2 = this.c.m;
|
||||
if (z) {
|
||||
str = str2;
|
||||
} else {
|
||||
this.c.getClass();
|
||||
}
|
||||
this.i = a(str, z);
|
||||
if (this.i || this.h) {
|
||||
a(this.g);
|
||||
if (l) {
|
||||
setNativeAppVersion(this.c.j);
|
||||
setNativeAppChannel(this.c.l);
|
||||
setNativeAppPackage(this.c.c);
|
||||
setNativeUserId(this.c.g());
|
||||
setNativeIsAppForeground(this.c.a());
|
||||
setNativeLaunchTime(this.c.a);
|
||||
}
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
a(this.g);
|
||||
}
|
||||
|
||||
protected native void testCrash();
|
||||
|
||||
public void testNativeCrash() {
|
||||
if (this.i) {
|
||||
testCrash();
|
||||
} else {
|
||||
x.d("[Native] Bugly SO file has not been load.", new Object[0]);
|
||||
}
|
||||
}
|
||||
|
||||
protected native String unregist();
|
||||
|
||||
static /* synthetic */ boolean a(NativeCrashHandler nativeCrashHandler, int i, String str) {
|
||||
return nativeCrashHandler.a(999, str);
|
||||
}
|
||||
|
||||
private synchronized void c() {
|
||||
if (!this.j) {
|
||||
x.d("[Native] Native crash report has already unregistered.", new Object[0]);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
if (unregist() != null) {
|
||||
x.a("[Native] Successfully closed native crash report.", new Object[0]);
|
||||
this.j = false;
|
||||
return;
|
||||
}
|
||||
} catch (Throwable unused) {
|
||||
x.c("[Native] Failed to close native crash report.", new Object[0]);
|
||||
}
|
||||
try {
|
||||
z.a("com.tencent.feedback.eup.jni.NativeExceptionUpload", "enableHandler", null, new Class[]{Boolean.TYPE}, new Object[]{false});
|
||||
this.j = false;
|
||||
x.a("[Native] Successfully closed native crash report.", new Object[0]);
|
||||
} catch (Throwable unused2) {
|
||||
x.c("[Native] Failed to close native crash report.", new Object[0]);
|
||||
this.i = false;
|
||||
this.h = false;
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX WARN: Can't wrap try/catch for region: R(15:40|(1:42)(14:65|(1:67)|44|45|(1:47)|48|(1:50)|52|(1:54)(1:63)|55|(1:57)(1:62)|58|59|60)|43|44|45|(0)|48|(0)|52|(0)(0)|55|(0)(0)|58|59|60) */
|
||||
/* JADX WARN: Removed duplicated region for block: B:47:0x007c A[Catch: all -> 0x008a, TryCatch #1 {all -> 0x008a, blocks: (B:45:0x0072, B:47:0x007c, B:48:0x007e, B:50:0x0088), top: B:44:0x0072 }] */
|
||||
/* JADX WARN: Removed duplicated region for block: B:50:0x0088 A[Catch: all -> 0x008a, TRY_LEAVE, TryCatch #1 {all -> 0x008a, blocks: (B:45:0x0072, B:47:0x007c, B:48:0x007e, B:50:0x0088), top: B:44:0x0072 }] */
|
||||
/* JADX WARN: Removed duplicated region for block: B:54:0x008e A[Catch: all -> 0x00bd, TryCatch #3 {all -> 0x00bd, blocks: (B:38:0x0015, B:40:0x001d, B:42:0x004f, B:43:0x0059, B:52:0x008a, B:54:0x008e, B:55:0x009d, B:57:0x00a1, B:58:0x00b0, B:62:0x00a9, B:63:0x0096, B:65:0x0061, B:67:0x0067), top: B:37:0x0015, outer: #2 }] */
|
||||
/* JADX WARN: Removed duplicated region for block: B:57:0x00a1 A[Catch: all -> 0x00bd, TryCatch #3 {all -> 0x00bd, blocks: (B:38:0x0015, B:40:0x001d, B:42:0x004f, B:43:0x0059, B:52:0x008a, B:54:0x008e, B:55:0x009d, B:57:0x00a1, B:58:0x00b0, B:62:0x00a9, B:63:0x0096, B:65:0x0061, B:67:0x0067), top: B:37:0x0015, outer: #2 }] */
|
||||
/* JADX WARN: Removed duplicated region for block: B:62:0x00a9 A[Catch: all -> 0x00bd, TryCatch #3 {all -> 0x00bd, blocks: (B:38:0x0015, B:40:0x001d, B:42:0x004f, B:43:0x0059, B:52:0x008a, B:54:0x008e, B:55:0x009d, B:57:0x00a1, B:58:0x00b0, B:62:0x00a9, B:63:0x0096, B:65:0x0061, B:67:0x0067), top: B:37:0x0015, outer: #2 }] */
|
||||
/* JADX WARN: Removed duplicated region for block: B:63:0x0096 A[Catch: all -> 0x00bd, TryCatch #3 {all -> 0x00bd, blocks: (B:38:0x0015, B:40:0x001d, B:42:0x004f, B:43:0x0059, B:52:0x008a, B:54:0x008e, B:55:0x009d, B:57:0x00a1, B:58:0x00b0, B:62:0x00a9, B:63:0x0096, B:65:0x0061, B:67:0x0067), top: B:37:0x0015, outer: #2 }] */
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
||||
*/
|
||||
private synchronized void a(boolean r11) {
|
||||
/*
|
||||
Method dump skipped, instructions count: 415
|
||||
To view this dump change 'Code comments level' option to 'DEBUG'
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: com.tencent.bugly.crashreport.crash.jni.NativeCrashHandler.a(boolean):void");
|
||||
}
|
||||
|
||||
private synchronized void b(boolean z) {
|
||||
if (z) {
|
||||
startNativeMonitor();
|
||||
} else {
|
||||
c();
|
||||
}
|
||||
}
|
||||
|
||||
public static synchronized NativeCrashHandler getInstance() {
|
||||
NativeCrashHandler nativeCrashHandler;
|
||||
synchronized (NativeCrashHandler.class) {
|
||||
nativeCrashHandler = a;
|
||||
}
|
||||
return nativeCrashHandler;
|
||||
}
|
||||
|
||||
public void testNativeCrash(boolean z, boolean z2, boolean z3) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(z);
|
||||
a(16, sb.toString());
|
||||
StringBuilder sb2 = new StringBuilder();
|
||||
sb2.append(z2);
|
||||
a(17, sb2.toString());
|
||||
StringBuilder sb3 = new StringBuilder();
|
||||
sb3.append(z3);
|
||||
a(18, sb3.toString());
|
||||
testNativeCrash();
|
||||
}
|
||||
|
||||
private synchronized void c(boolean z) {
|
||||
if (this.k != z) {
|
||||
x.a("user change native %b", Boolean.valueOf(z));
|
||||
this.k = z;
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean a(String str, boolean z) {
|
||||
boolean z2;
|
||||
try {
|
||||
x.a("[Native] Trying to load so: %s", str);
|
||||
if (z) {
|
||||
System.load(str);
|
||||
} else {
|
||||
System.loadLibrary(str);
|
||||
}
|
||||
try {
|
||||
x.a("[Native] Successfully loaded SO: %s", str);
|
||||
return true;
|
||||
} catch (Throwable th) {
|
||||
th = th;
|
||||
z2 = true;
|
||||
x.d(th.getMessage(), new Object[0]);
|
||||
x.d("[Native] Failed to load so: %s", str);
|
||||
return z2;
|
||||
}
|
||||
} catch (Throwable th2) {
|
||||
th = th2;
|
||||
z2 = false;
|
||||
}
|
||||
}
|
||||
|
||||
protected final void a() {
|
||||
long b = z.b() - c.g;
|
||||
long b2 = z.b() + 86400000;
|
||||
File file = new File(this.f);
|
||||
if (file.exists() && file.isDirectory()) {
|
||||
try {
|
||||
File[] listFiles = file.listFiles();
|
||||
if (listFiles != null && listFiles.length != 0) {
|
||||
int i = 0;
|
||||
int i2 = 0;
|
||||
for (File file2 : listFiles) {
|
||||
long lastModified = file2.lastModified();
|
||||
if (lastModified < b || lastModified >= b2) {
|
||||
x.a("[Native] Delete record file: %s", file2.getAbsolutePath());
|
||||
i++;
|
||||
if (file2.delete()) {
|
||||
i2++;
|
||||
}
|
||||
}
|
||||
}
|
||||
x.c("[Native] Number of record files overdue: %d, has deleted: %d", Integer.valueOf(i), Integer.valueOf(i2));
|
||||
}
|
||||
} catch (Throwable th) {
|
||||
x.a(th);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean a(int i, String str) {
|
||||
if (this.i && m) {
|
||||
try {
|
||||
setNativeInfo(i, str);
|
||||
return true;
|
||||
} catch (UnsatisfiedLinkError unused) {
|
||||
m = false;
|
||||
} catch (Throwable th) {
|
||||
if (!x.a(th)) {
|
||||
th.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
@@ -0,0 +1,14 @@
|
||||
package com.tencent.bugly.crashreport.crash.jni;
|
||||
|
||||
import com.tencent.bugly.crashreport.crash.CrashDetailBean;
|
||||
import java.util.Map;
|
||||
|
||||
/* compiled from: BUGLY */
|
||||
/* loaded from: classes.dex */
|
||||
public interface NativeExceptionHandler {
|
||||
void handleNativeException(int i, int i2, long j, long j2, String str, String str2, String str3, String str4, int i3, String str5, int i4, int i5, int i6, String str6, String str7);
|
||||
|
||||
void handleNativeException2(int i, int i2, long j, long j2, String str, String str2, String str3, String str4, int i3, String str5, int i4, int i5, int i6, String str6, String str7, String[] strArr);
|
||||
|
||||
CrashDetailBean packageCrashDatas(String str, String str2, long j, String str3, String str4, String str5, String str6, String str7, String str8, String str9, String str10, String str11, byte[] bArr, Map<String, String> map, boolean z, boolean z2);
|
||||
}
|
149
sources/com/tencent/bugly/crashreport/crash/jni/a.java
Normal file
149
sources/com/tencent/bugly/crashreport/crash/jni/a.java
Normal file
@@ -0,0 +1,149 @@
|
||||
package com.tencent.bugly.crashreport.crash.jni;
|
||||
|
||||
import android.content.Context;
|
||||
import com.tencent.bugly.crashreport.crash.CrashDetailBean;
|
||||
import com.tencent.bugly.crashreport.crash.c;
|
||||
import com.tencent.bugly.proguard.x;
|
||||
import com.tencent.bugly.proguard.y;
|
||||
import com.tencent.bugly.proguard.z;
|
||||
import java.util.Map;
|
||||
|
||||
/* compiled from: BUGLY */
|
||||
/* loaded from: classes.dex */
|
||||
public final class a implements NativeExceptionHandler {
|
||||
private final Context a;
|
||||
private final com.tencent.bugly.crashreport.crash.b b;
|
||||
private final com.tencent.bugly.crashreport.common.info.a c;
|
||||
private final com.tencent.bugly.crashreport.common.strategy.a d;
|
||||
|
||||
public a(Context context, com.tencent.bugly.crashreport.common.info.a aVar, com.tencent.bugly.crashreport.crash.b bVar, com.tencent.bugly.crashreport.common.strategy.a aVar2) {
|
||||
this.a = context;
|
||||
this.b = bVar;
|
||||
this.c = aVar;
|
||||
this.d = aVar2;
|
||||
}
|
||||
|
||||
@Override // com.tencent.bugly.crashreport.crash.jni.NativeExceptionHandler
|
||||
public final void handleNativeException(int i, int i2, long j, long j2, String str, String str2, String str3, String str4, int i3, String str5, int i4, int i5, int i6, String str6, String str7) {
|
||||
x.a("Native Crash Happen v1", new Object[0]);
|
||||
handleNativeException2(i, i2, j, j2, str, str2, str3, str4, i3, str5, i4, i5, i6, str6, str7, null);
|
||||
}
|
||||
|
||||
/* JADX WARN: Removed duplicated region for block: B:42:0x0122 A[Catch: all -> 0x029d, TryCatch #2 {all -> 0x029d, blocks: (B:3:0x0012, B:6:0x001e, B:7:0x006e, B:10:0x0076, B:12:0x0079, B:14:0x007d, B:16:0x0098, B:19:0x00a1, B:18:0x00ab, B:23:0x00b5, B:25:0x00bf, B:27:0x00c7, B:28:0x00d3, B:30:0x00dd, B:33:0x00e4, B:34:0x00f3, B:36:0x00ff, B:39:0x0106, B:40:0x011c, B:42:0x0122, B:45:0x0132, B:47:0x0152, B:49:0x0191, B:51:0x01b4, B:52:0x01bb, B:55:0x01c7, B:57:0x01cf, B:94:0x016d, B:95:0x00ef, B:97:0x00ae, B:100:0x0044, B:101:0x0048, B:103:0x0052), top: B:2:0x0012 }] */
|
||||
/* JADX WARN: Removed duplicated region for block: B:47:0x0152 A[Catch: all -> 0x029d, TryCatch #2 {all -> 0x029d, blocks: (B:3:0x0012, B:6:0x001e, B:7:0x006e, B:10:0x0076, B:12:0x0079, B:14:0x007d, B:16:0x0098, B:19:0x00a1, B:18:0x00ab, B:23:0x00b5, B:25:0x00bf, B:27:0x00c7, B:28:0x00d3, B:30:0x00dd, B:33:0x00e4, B:34:0x00f3, B:36:0x00ff, B:39:0x0106, B:40:0x011c, B:42:0x0122, B:45:0x0132, B:47:0x0152, B:49:0x0191, B:51:0x01b4, B:52:0x01bb, B:55:0x01c7, B:57:0x01cf, B:94:0x016d, B:95:0x00ef, B:97:0x00ae, B:100:0x0044, B:101:0x0048, B:103:0x0052), top: B:2:0x0012 }] */
|
||||
/* JADX WARN: Removed duplicated region for block: B:51:0x01b4 A[Catch: all -> 0x029d, TryCatch #2 {all -> 0x029d, blocks: (B:3:0x0012, B:6:0x001e, B:7:0x006e, B:10:0x0076, B:12:0x0079, B:14:0x007d, B:16:0x0098, B:19:0x00a1, B:18:0x00ab, B:23:0x00b5, B:25:0x00bf, B:27:0x00c7, B:28:0x00d3, B:30:0x00dd, B:33:0x00e4, B:34:0x00f3, B:36:0x00ff, B:39:0x0106, B:40:0x011c, B:42:0x0122, B:45:0x0132, B:47:0x0152, B:49:0x0191, B:51:0x01b4, B:52:0x01bb, B:55:0x01c7, B:57:0x01cf, B:94:0x016d, B:95:0x00ef, B:97:0x00ae, B:100:0x0044, B:101:0x0048, B:103:0x0052), top: B:2:0x0012 }] */
|
||||
/* JADX WARN: Removed duplicated region for block: B:55:0x01c7 A[Catch: all -> 0x029d, TRY_ENTER, TryCatch #2 {all -> 0x029d, blocks: (B:3:0x0012, B:6:0x001e, B:7:0x006e, B:10:0x0076, B:12:0x0079, B:14:0x007d, B:16:0x0098, B:19:0x00a1, B:18:0x00ab, B:23:0x00b5, B:25:0x00bf, B:27:0x00c7, B:28:0x00d3, B:30:0x00dd, B:33:0x00e4, B:34:0x00f3, B:36:0x00ff, B:39:0x0106, B:40:0x011c, B:42:0x0122, B:45:0x0132, B:47:0x0152, B:49:0x0191, B:51:0x01b4, B:52:0x01bb, B:55:0x01c7, B:57:0x01cf, B:94:0x016d, B:95:0x00ef, B:97:0x00ae, B:100:0x0044, B:101:0x0048, B:103:0x0052), top: B:2:0x0012 }] */
|
||||
/* JADX WARN: Removed duplicated region for block: B:65:0x022f A[Catch: all -> 0x0299, TryCatch #1 {all -> 0x0299, blocks: (B:63:0x0229, B:65:0x022f, B:67:0x0238), top: B:62:0x0229 }] */
|
||||
/* JADX WARN: Removed duplicated region for block: B:67:0x0238 A[Catch: all -> 0x0299, TRY_LEAVE, TryCatch #1 {all -> 0x0299, blocks: (B:63:0x0229, B:65:0x022f, B:67:0x0238), top: B:62:0x0229 }] */
|
||||
/* JADX WARN: Removed duplicated region for block: B:90:0x016a */
|
||||
/* JADX WARN: Removed duplicated region for block: B:92:0x014e A[SYNTHETIC] */
|
||||
@Override // com.tencent.bugly.crashreport.crash.jni.NativeExceptionHandler
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
||||
*/
|
||||
public final void handleNativeException2(int r28, int r29, long r30, long r32, java.lang.String r34, java.lang.String r35, java.lang.String r36, java.lang.String r37, int r38, java.lang.String r39, int r40, int r41, int r42, java.lang.String r43, java.lang.String r44, java.lang.String[] r45) {
|
||||
/*
|
||||
Method dump skipped, instructions count: 681
|
||||
To view this dump change 'Code comments level' option to 'DEBUG'
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: com.tencent.bugly.crashreport.crash.jni.a.handleNativeException2(int, int, long, long, java.lang.String, java.lang.String, java.lang.String, java.lang.String, int, java.lang.String, int, int, int, java.lang.String, java.lang.String, java.lang.String[]):void");
|
||||
}
|
||||
|
||||
@Override // com.tencent.bugly.crashreport.crash.jni.NativeExceptionHandler
|
||||
public final CrashDetailBean packageCrashDatas(String str, String str2, long j, String str3, String str4, String str5, String str6, String str7, String str8, String str9, String str10, String str11, byte[] bArr, Map<String, String> map, boolean z, boolean z2) {
|
||||
int i;
|
||||
String str12;
|
||||
int indexOf;
|
||||
boolean k = c.a().k();
|
||||
if (k) {
|
||||
x.e("This Crash Caused By ANR , PLS To Fix ANR , This Trace May Be Not Useful!", new Object[0]);
|
||||
}
|
||||
CrashDetailBean crashDetailBean = new CrashDetailBean();
|
||||
crashDetailBean.b = 1;
|
||||
crashDetailBean.e = this.c.h();
|
||||
com.tencent.bugly.crashreport.common.info.a aVar = this.c;
|
||||
crashDetailBean.f = aVar.j;
|
||||
crashDetailBean.g = aVar.w();
|
||||
crashDetailBean.m = this.c.g();
|
||||
crashDetailBean.n = str3;
|
||||
crashDetailBean.o = k ? " This Crash Caused By ANR , PLS To Fix ANR , This Trace May Be Not Useful![Bugly]" : "";
|
||||
crashDetailBean.p = str4;
|
||||
crashDetailBean.q = str5 != null ? str5 : "";
|
||||
crashDetailBean.r = j;
|
||||
crashDetailBean.u = z.b(crashDetailBean.q.getBytes());
|
||||
crashDetailBean.A = str;
|
||||
crashDetailBean.B = str2;
|
||||
crashDetailBean.I = this.c.y();
|
||||
crashDetailBean.h = this.c.v();
|
||||
crashDetailBean.i = this.c.J();
|
||||
crashDetailBean.v = str8;
|
||||
NativeCrashHandler nativeCrashHandler = NativeCrashHandler.getInstance();
|
||||
String dumpFilePath = nativeCrashHandler != null ? nativeCrashHandler.getDumpFilePath() : null;
|
||||
String a = b.a(dumpFilePath, str8);
|
||||
if (!z.a(a)) {
|
||||
crashDetailBean.U = a;
|
||||
}
|
||||
crashDetailBean.V = b.b(dumpFilePath);
|
||||
crashDetailBean.w = b.a(str9, c.e, null, false);
|
||||
crashDetailBean.x = b.a(str10, c.e, null, true);
|
||||
crashDetailBean.J = str7;
|
||||
crashDetailBean.K = str6;
|
||||
crashDetailBean.L = str11;
|
||||
crashDetailBean.F = this.c.p();
|
||||
crashDetailBean.G = this.c.o();
|
||||
crashDetailBean.H = this.c.q();
|
||||
if (z) {
|
||||
crashDetailBean.C = com.tencent.bugly.crashreport.common.info.b.k();
|
||||
crashDetailBean.D = com.tencent.bugly.crashreport.common.info.b.i();
|
||||
crashDetailBean.E = com.tencent.bugly.crashreport.common.info.b.m();
|
||||
if (crashDetailBean.w == null) {
|
||||
crashDetailBean.w = z.a(this.a, c.e, (String) null);
|
||||
}
|
||||
crashDetailBean.y = y.a();
|
||||
com.tencent.bugly.crashreport.common.info.a aVar2 = this.c;
|
||||
crashDetailBean.M = aVar2.a;
|
||||
crashDetailBean.N = aVar2.a();
|
||||
crashDetailBean.P = this.c.H();
|
||||
crashDetailBean.Q = this.c.I();
|
||||
crashDetailBean.R = this.c.B();
|
||||
crashDetailBean.S = this.c.G();
|
||||
crashDetailBean.z = z.a(c.f, false);
|
||||
int indexOf2 = crashDetailBean.q.indexOf("java:\n");
|
||||
if (indexOf2 > 0 && (i = indexOf2 + 6) < crashDetailBean.q.length()) {
|
||||
String str13 = crashDetailBean.q;
|
||||
String substring = str13.substring(i, str13.length() - 1);
|
||||
if (substring.length() > 0 && crashDetailBean.z.containsKey(crashDetailBean.B) && (indexOf = (str12 = crashDetailBean.z.get(crashDetailBean.B)).indexOf(substring)) > 0) {
|
||||
String substring2 = str12.substring(indexOf);
|
||||
crashDetailBean.z.put(crashDetailBean.B, substring2);
|
||||
crashDetailBean.q = crashDetailBean.q.substring(0, i);
|
||||
crashDetailBean.q += substring2;
|
||||
}
|
||||
}
|
||||
if (str == null) {
|
||||
crashDetailBean.A = this.c.d;
|
||||
}
|
||||
this.b.c(crashDetailBean);
|
||||
} else {
|
||||
crashDetailBean.C = -1L;
|
||||
crashDetailBean.D = -1L;
|
||||
crashDetailBean.E = -1L;
|
||||
if (crashDetailBean.w == null) {
|
||||
crashDetailBean.w = "this crash is occurred at last process! Log is miss, when get an terrible ABRT Native Exception etc.";
|
||||
}
|
||||
crashDetailBean.M = -1L;
|
||||
crashDetailBean.P = -1;
|
||||
crashDetailBean.Q = -1;
|
||||
crashDetailBean.R = map;
|
||||
crashDetailBean.S = this.c.G();
|
||||
crashDetailBean.z = null;
|
||||
if (str == null) {
|
||||
crashDetailBean.A = "unknown(record)";
|
||||
}
|
||||
if (bArr != null) {
|
||||
crashDetailBean.y = bArr;
|
||||
}
|
||||
}
|
||||
return crashDetailBean;
|
||||
}
|
||||
}
|
693
sources/com/tencent/bugly/crashreport/crash/jni/b.java
Normal file
693
sources/com/tencent/bugly/crashreport/crash/jni/b.java
Normal file
@@ -0,0 +1,693 @@
|
||||
package com.tencent.bugly.crashreport.crash.jni;
|
||||
|
||||
import android.content.Context;
|
||||
import com.ijm.dataencryption.de.DataDecryptTool;
|
||||
import com.tencent.bugly.crashreport.crash.CrashDetailBean;
|
||||
import com.tencent.bugly.proguard.x;
|
||||
import com.tencent.bugly.proguard.z;
|
||||
import com.ubt.jimu.diy.model.CategoryModel;
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/* compiled from: BUGLY */
|
||||
/* loaded from: classes.dex */
|
||||
public final class b {
|
||||
private static List<File> a = new ArrayList();
|
||||
|
||||
protected static String a(String str) {
|
||||
if (str == null) {
|
||||
return "";
|
||||
}
|
||||
String[] split = str.split("\n");
|
||||
if (split == null || split.length == 0) {
|
||||
return str;
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (String str2 : split) {
|
||||
if (!str2.contains("java.lang.Thread.getStackTrace(")) {
|
||||
sb.append(str2);
|
||||
sb.append("\n");
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/* JADX WARN: Code restructure failed: missing block: B:40:0x006d, code lost:
|
||||
|
||||
r9.close();
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:42:0x0071, code lost:
|
||||
|
||||
r9 = move-exception;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:43:0x0072, code lost:
|
||||
|
||||
com.tencent.bugly.proguard.x.a(r9);
|
||||
*/
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
||||
*/
|
||||
private static java.lang.String b(java.lang.String r9, java.lang.String r10) {
|
||||
/*
|
||||
java.lang.String r0 = "reg_record.txt"
|
||||
java.io.BufferedReader r9 = com.tencent.bugly.proguard.z.a(r9, r0)
|
||||
r0 = 0
|
||||
if (r9 != 0) goto La
|
||||
return r0
|
||||
La:
|
||||
java.lang.StringBuilder r1 = new java.lang.StringBuilder // Catch: java.lang.Throwable -> L76
|
||||
r1.<init>() // Catch: java.lang.Throwable -> L76
|
||||
java.lang.String r2 = r9.readLine() // Catch: java.lang.Throwable -> L76
|
||||
if (r2 == 0) goto L6b
|
||||
boolean r10 = r2.startsWith(r10) // Catch: java.lang.Throwable -> L76
|
||||
if (r10 != 0) goto L1c
|
||||
goto L6b
|
||||
L1c:
|
||||
java.lang.String r10 = " "
|
||||
r2 = 18
|
||||
r3 = 0
|
||||
r2 = 0
|
||||
r4 = 18
|
||||
r5 = 0
|
||||
L25:
|
||||
java.lang.String r6 = r9.readLine() // Catch: java.lang.Throwable -> L76
|
||||
java.lang.String r7 = "\n"
|
||||
if (r6 == 0) goto L59
|
||||
int r8 = r2 % 4
|
||||
if (r8 != 0) goto L3c
|
||||
if (r2 <= 0) goto L36
|
||||
r1.append(r7) // Catch: java.lang.Throwable -> L76
|
||||
L36:
|
||||
java.lang.String r5 = " "
|
||||
r1.append(r5) // Catch: java.lang.Throwable -> L76
|
||||
goto L4f
|
||||
L3c:
|
||||
int r7 = r6.length() // Catch: java.lang.Throwable -> L76
|
||||
r8 = 16
|
||||
if (r7 <= r8) goto L46
|
||||
r4 = 28
|
||||
L46:
|
||||
int r5 = r4 - r5
|
||||
java.lang.String r5 = r10.substring(r3, r5) // Catch: java.lang.Throwable -> L76
|
||||
r1.append(r5) // Catch: java.lang.Throwable -> L76
|
||||
L4f:
|
||||
int r5 = r6.length() // Catch: java.lang.Throwable -> L76
|
||||
r1.append(r6) // Catch: java.lang.Throwable -> L76
|
||||
int r2 = r2 + 1
|
||||
goto L25
|
||||
L59:
|
||||
r1.append(r7) // Catch: java.lang.Throwable -> L76
|
||||
java.lang.String r10 = r1.toString() // Catch: java.lang.Throwable -> L76
|
||||
if (r9 == 0) goto L6a
|
||||
r9.close() // Catch: java.lang.Exception -> L66
|
||||
goto L6a
|
||||
L66:
|
||||
r9 = move-exception
|
||||
com.tencent.bugly.proguard.x.a(r9)
|
||||
L6a:
|
||||
return r10
|
||||
L6b:
|
||||
if (r9 == 0) goto L75
|
||||
r9.close() // Catch: java.lang.Exception -> L71
|
||||
goto L75
|
||||
L71:
|
||||
r9 = move-exception
|
||||
com.tencent.bugly.proguard.x.a(r9)
|
||||
L75:
|
||||
return r0
|
||||
L76:
|
||||
r10 = move-exception
|
||||
com.tencent.bugly.proguard.x.a(r10) // Catch: java.lang.Throwable -> L85
|
||||
if (r9 == 0) goto L84
|
||||
r9.close() // Catch: java.lang.Exception -> L80
|
||||
goto L84
|
||||
L80:
|
||||
r9 = move-exception
|
||||
com.tencent.bugly.proguard.x.a(r9)
|
||||
L84:
|
||||
return r0
|
||||
L85:
|
||||
r10 = move-exception
|
||||
if (r9 == 0) goto L90
|
||||
r9.close() // Catch: java.lang.Exception -> L8c
|
||||
goto L90
|
||||
L8c:
|
||||
r9 = move-exception
|
||||
com.tencent.bugly.proguard.x.a(r9)
|
||||
L90:
|
||||
throw r10
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: com.tencent.bugly.crashreport.crash.jni.b.b(java.lang.String, java.lang.String):java.lang.String");
|
||||
}
|
||||
|
||||
/* JADX WARN: Code restructure failed: missing block: B:27:0x0041, code lost:
|
||||
|
||||
r3.close();
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:29:0x0045, code lost:
|
||||
|
||||
r3 = move-exception;
|
||||
*/
|
||||
/* JADX WARN: Code restructure failed: missing block: B:30:0x0046, code lost:
|
||||
|
||||
com.tencent.bugly.proguard.x.a(r3);
|
||||
*/
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
||||
*/
|
||||
private static java.lang.String c(java.lang.String r3, java.lang.String r4) {
|
||||
/*
|
||||
java.lang.String r0 = "map_record.txt"
|
||||
java.io.BufferedReader r3 = com.tencent.bugly.proguard.z.a(r3, r0)
|
||||
r0 = 0
|
||||
if (r3 != 0) goto La
|
||||
return r0
|
||||
La:
|
||||
java.lang.StringBuilder r1 = new java.lang.StringBuilder // Catch: java.lang.Throwable -> L4a
|
||||
r1.<init>() // Catch: java.lang.Throwable -> L4a
|
||||
java.lang.String r2 = r3.readLine() // Catch: java.lang.Throwable -> L4a
|
||||
if (r2 == 0) goto L3f
|
||||
boolean r4 = r2.startsWith(r4) // Catch: java.lang.Throwable -> L4a
|
||||
if (r4 != 0) goto L1c
|
||||
goto L3f
|
||||
L1c:
|
||||
java.lang.String r4 = r3.readLine() // Catch: java.lang.Throwable -> L4a
|
||||
if (r4 == 0) goto L30
|
||||
java.lang.String r2 = " "
|
||||
r1.append(r2) // Catch: java.lang.Throwable -> L4a
|
||||
r1.append(r4) // Catch: java.lang.Throwable -> L4a
|
||||
java.lang.String r4 = "\n"
|
||||
r1.append(r4) // Catch: java.lang.Throwable -> L4a
|
||||
goto L1c
|
||||
L30:
|
||||
java.lang.String r4 = r1.toString() // Catch: java.lang.Throwable -> L4a
|
||||
if (r3 == 0) goto L3e
|
||||
r3.close() // Catch: java.lang.Exception -> L3a
|
||||
goto L3e
|
||||
L3a:
|
||||
r3 = move-exception
|
||||
com.tencent.bugly.proguard.x.a(r3)
|
||||
L3e:
|
||||
return r4
|
||||
L3f:
|
||||
if (r3 == 0) goto L49
|
||||
r3.close() // Catch: java.lang.Exception -> L45
|
||||
goto L49
|
||||
L45:
|
||||
r3 = move-exception
|
||||
com.tencent.bugly.proguard.x.a(r3)
|
||||
L49:
|
||||
return r0
|
||||
L4a:
|
||||
r4 = move-exception
|
||||
com.tencent.bugly.proguard.x.a(r4) // Catch: java.lang.Throwable -> L59
|
||||
if (r3 == 0) goto L58
|
||||
r3.close() // Catch: java.lang.Exception -> L54
|
||||
goto L58
|
||||
L54:
|
||||
r3 = move-exception
|
||||
com.tencent.bugly.proguard.x.a(r3)
|
||||
L58:
|
||||
return r0
|
||||
L59:
|
||||
r4 = move-exception
|
||||
if (r3 == 0) goto L64
|
||||
r3.close() // Catch: java.lang.Exception -> L60
|
||||
goto L64
|
||||
L60:
|
||||
r3 = move-exception
|
||||
com.tencent.bugly.proguard.x.a(r3)
|
||||
L64:
|
||||
throw r4
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: com.tencent.bugly.crashreport.crash.jni.b.c(java.lang.String, java.lang.String):java.lang.String");
|
||||
}
|
||||
|
||||
private static Map<String, Integer> d(String str) {
|
||||
if (str == null) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
HashMap hashMap = new HashMap();
|
||||
for (String str2 : str.split(",")) {
|
||||
String[] split = str2.split(":");
|
||||
if (split.length != 2) {
|
||||
x.e("error format at %s", str2);
|
||||
return null;
|
||||
}
|
||||
hashMap.put(split[0], Integer.valueOf(Integer.parseInt(split[1])));
|
||||
}
|
||||
return hashMap;
|
||||
} catch (Exception e) {
|
||||
x.e("error format intStateStr %s", str);
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static CrashDetailBean a(Context context, Map<String, String> map, NativeExceptionHandler nativeExceptionHandler) {
|
||||
String str;
|
||||
String str2;
|
||||
HashMap hashMap;
|
||||
if (map == null) {
|
||||
return null;
|
||||
}
|
||||
if (com.tencent.bugly.crashreport.common.info.a.a(context) == null) {
|
||||
x.e("abnormal com info not created", new Object[0]);
|
||||
return null;
|
||||
}
|
||||
String str3 = map.get("intStateStr");
|
||||
if (str3 != null && str3.trim().length() > 0) {
|
||||
Map<String, Integer> d = d(str3);
|
||||
if (d == null) {
|
||||
x.e("parse intSateMap fail", Integer.valueOf(map.size()));
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
d.get("sino").intValue();
|
||||
d.get("sud").intValue();
|
||||
String str4 = map.get("soVersion");
|
||||
if (str4 == null) {
|
||||
x.e("error format at version", new Object[0]);
|
||||
return null;
|
||||
}
|
||||
String str5 = map.get("errorAddr");
|
||||
String str6 = CategoryModel.unknown;
|
||||
String str7 = str5 == null ? CategoryModel.unknown : str5;
|
||||
String str8 = map.get("codeMsg");
|
||||
if (str8 == null) {
|
||||
str8 = CategoryModel.unknown;
|
||||
}
|
||||
String str9 = map.get("tombPath");
|
||||
String str10 = str9 == null ? CategoryModel.unknown : str9;
|
||||
String str11 = map.get("signalName");
|
||||
if (str11 == null) {
|
||||
str11 = CategoryModel.unknown;
|
||||
}
|
||||
map.get("errnoMsg");
|
||||
String str12 = map.get("stack");
|
||||
if (str12 == null) {
|
||||
str12 = CategoryModel.unknown;
|
||||
}
|
||||
String str13 = map.get("jstack");
|
||||
if (str13 != null) {
|
||||
str12 = str12 + "java:\n" + str13;
|
||||
}
|
||||
Integer num = d.get("sico");
|
||||
if (num == null || num.intValue() <= 0) {
|
||||
str = str8;
|
||||
str2 = str11;
|
||||
} else {
|
||||
str2 = str11 + "(" + str8 + ")";
|
||||
str = "KERNEL";
|
||||
}
|
||||
String str14 = map.get("nativeLog");
|
||||
byte[] a2 = (str14 == null || str14.isEmpty()) ? null : z.a((File) null, str14, "BuglyNativeLog.txt");
|
||||
String str15 = map.get("sendingProcess");
|
||||
if (str15 == null) {
|
||||
str15 = CategoryModel.unknown;
|
||||
}
|
||||
Integer num2 = d.get("spd");
|
||||
if (num2 != null) {
|
||||
str15 = str15 + "(" + num2 + ")";
|
||||
}
|
||||
String str16 = str15;
|
||||
String str17 = map.get("threadName");
|
||||
if (str17 == null) {
|
||||
str17 = CategoryModel.unknown;
|
||||
}
|
||||
Integer num3 = d.get("et");
|
||||
if (num3 != null) {
|
||||
str17 = str17 + "(" + num3 + ")";
|
||||
}
|
||||
String str18 = str17;
|
||||
String str19 = map.get("processName");
|
||||
if (str19 != null) {
|
||||
str6 = str19;
|
||||
}
|
||||
Integer num4 = d.get("ep");
|
||||
if (num4 != null) {
|
||||
str6 = str6 + "(" + num4 + ")";
|
||||
}
|
||||
String str20 = str6;
|
||||
String str21 = map.get("key-value");
|
||||
if (str21 != null) {
|
||||
HashMap hashMap2 = new HashMap();
|
||||
String[] split = str21.split("\n");
|
||||
int length = split.length;
|
||||
int i = 0;
|
||||
while (i < length) {
|
||||
String[] split2 = split[i].split("=");
|
||||
String[] strArr = split;
|
||||
if (split2.length == 2) {
|
||||
hashMap2.put(split2[0], split2[1]);
|
||||
}
|
||||
i++;
|
||||
split = strArr;
|
||||
}
|
||||
hashMap = hashMap2;
|
||||
} else {
|
||||
hashMap = null;
|
||||
}
|
||||
CrashDetailBean packageCrashDatas = nativeExceptionHandler.packageCrashDatas(str20, str18, (d.get("etms").intValue() / 1000) + (d.get("ets").intValue() * 1000), str2, str7, a(str12), str, str16, str10, map.get("sysLogPath"), map.get("jniLogPath"), str4, a2, hashMap, false, false);
|
||||
if (packageCrashDatas != null) {
|
||||
String str22 = map.get("userId");
|
||||
if (str22 != null) {
|
||||
x.c("[Native record info] userId: %s", str22);
|
||||
packageCrashDatas.m = str22;
|
||||
}
|
||||
String str23 = map.get("sysLog");
|
||||
if (str23 != null) {
|
||||
packageCrashDatas.w = str23;
|
||||
}
|
||||
String str24 = map.get("appVersion");
|
||||
if (str24 != null) {
|
||||
x.c("[Native record info] appVersion: %s", str24);
|
||||
packageCrashDatas.f = str24;
|
||||
}
|
||||
String str25 = map.get("isAppForeground");
|
||||
if (str25 != null) {
|
||||
x.c("[Native record info] isAppForeground: %s", str25);
|
||||
packageCrashDatas.N = str25.equalsIgnoreCase("true");
|
||||
}
|
||||
String str26 = map.get("launchTime");
|
||||
if (str26 != null) {
|
||||
x.c("[Native record info] launchTime: %s", str26);
|
||||
try {
|
||||
packageCrashDatas.M = Long.parseLong(str26);
|
||||
} catch (NumberFormatException e) {
|
||||
if (!x.a(e)) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
packageCrashDatas.z = null;
|
||||
packageCrashDatas.k = true;
|
||||
}
|
||||
return packageCrashDatas;
|
||||
} catch (Throwable th) {
|
||||
x.e("error format", new Object[0]);
|
||||
th.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
x.e("no intStateStr", new Object[0]);
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void c(String str) {
|
||||
File[] listFiles;
|
||||
if (str == null) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
File file = new File(str);
|
||||
if (file.canRead() && file.isDirectory() && (listFiles = file.listFiles()) != null) {
|
||||
for (File file2 : listFiles) {
|
||||
if (file2.canRead() && file2.canWrite() && file2.length() == 0) {
|
||||
file2.delete();
|
||||
x.c("Delete empty record file %s", file2.getAbsoluteFile());
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Throwable th) {
|
||||
x.a(th);
|
||||
}
|
||||
}
|
||||
|
||||
public static String b(String str) {
|
||||
if (str == null) {
|
||||
return null;
|
||||
}
|
||||
File file = new File(str, "backup_record.txt");
|
||||
if (file.exists()) {
|
||||
return file.getAbsolutePath();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static String a(BufferedInputStream bufferedInputStream) throws IOException {
|
||||
ByteArrayOutputStream byteArrayOutputStream;
|
||||
if (bufferedInputStream == null) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
byteArrayOutputStream = new ByteArrayOutputStream(DataDecryptTool.DECRYPT_SP_FILE);
|
||||
while (true) {
|
||||
try {
|
||||
int read = bufferedInputStream.read();
|
||||
if (read == -1) {
|
||||
byteArrayOutputStream.close();
|
||||
break;
|
||||
}
|
||||
if (read == 0) {
|
||||
String str = new String(byteArrayOutputStream.toByteArray(), "UTf-8");
|
||||
byteArrayOutputStream.close();
|
||||
return str;
|
||||
}
|
||||
byteArrayOutputStream.write(read);
|
||||
} catch (Throwable th) {
|
||||
th = th;
|
||||
try {
|
||||
x.a(th);
|
||||
return null;
|
||||
} finally {
|
||||
if (byteArrayOutputStream != null) {
|
||||
byteArrayOutputStream.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Throwable th2) {
|
||||
th = th2;
|
||||
byteArrayOutputStream = null;
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX WARN: Multi-variable type inference failed */
|
||||
/* JADX WARN: Type inference failed for: r7v3, types: [boolean] */
|
||||
/* JADX WARN: Type inference failed for: r7v6 */
|
||||
public static CrashDetailBean a(Context context, String str, NativeExceptionHandler nativeExceptionHandler) {
|
||||
BufferedInputStream bufferedInputStream;
|
||||
String str2;
|
||||
String a2;
|
||||
if (context != null && str != null && nativeExceptionHandler != null) {
|
||||
File file = new File(str, "rqd_record.eup");
|
||||
if (file.exists()) {
|
||||
BufferedInputStream canRead = file.canRead();
|
||||
try {
|
||||
if (canRead != 0) {
|
||||
try {
|
||||
bufferedInputStream = new BufferedInputStream(new FileInputStream(file));
|
||||
} catch (IOException e) {
|
||||
e = e;
|
||||
bufferedInputStream = null;
|
||||
} catch (Throwable th) {
|
||||
th = th;
|
||||
canRead = 0;
|
||||
if (canRead != 0) {
|
||||
try {
|
||||
canRead.close();
|
||||
} catch (IOException e2) {
|
||||
e2.printStackTrace();
|
||||
}
|
||||
}
|
||||
throw th;
|
||||
}
|
||||
try {
|
||||
String a3 = a(bufferedInputStream);
|
||||
if (a3 != null && a3.equals("NATIVE_RQD_REPORT")) {
|
||||
HashMap hashMap = new HashMap();
|
||||
loop0: while (true) {
|
||||
str2 = null;
|
||||
while (true) {
|
||||
a2 = a(bufferedInputStream);
|
||||
if (a2 == null) {
|
||||
break loop0;
|
||||
}
|
||||
if (str2 == null) {
|
||||
str2 = a2;
|
||||
}
|
||||
}
|
||||
hashMap.put(str2, a2);
|
||||
}
|
||||
if (str2 != null) {
|
||||
x.e("record not pair! drop! %s", str2);
|
||||
try {
|
||||
bufferedInputStream.close();
|
||||
} catch (IOException e3) {
|
||||
e3.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
CrashDetailBean a4 = a(context, hashMap, nativeExceptionHandler);
|
||||
try {
|
||||
bufferedInputStream.close();
|
||||
} catch (IOException e4) {
|
||||
e4.printStackTrace();
|
||||
}
|
||||
return a4;
|
||||
}
|
||||
x.e("record read fail! %s", a3);
|
||||
try {
|
||||
bufferedInputStream.close();
|
||||
} catch (IOException e5) {
|
||||
e5.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
} catch (IOException e6) {
|
||||
e = e6;
|
||||
e.printStackTrace();
|
||||
if (bufferedInputStream != null) {
|
||||
try {
|
||||
bufferedInputStream.close();
|
||||
} catch (IOException e7) {
|
||||
e7.printStackTrace();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
} catch (Throwable th2) {
|
||||
th = th2;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
x.e("get eup record file args error", new Object[0]);
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String a(String str, String str2) {
|
||||
if (str == null || str2 == null) {
|
||||
return null;
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
String b = b(str, str2);
|
||||
if (b != null && !b.isEmpty()) {
|
||||
sb.append("Register infos:\n");
|
||||
sb.append(b);
|
||||
}
|
||||
String c = c(str, str2);
|
||||
if (c != null && !c.isEmpty()) {
|
||||
if (sb.length() > 0) {
|
||||
sb.append("\n");
|
||||
}
|
||||
sb.append("System SO infos:\n");
|
||||
sb.append(c);
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static void a(boolean z, String str) {
|
||||
if (str != null) {
|
||||
a.add(new File(str, "rqd_record.eup"));
|
||||
a.add(new File(str, "reg_record.txt"));
|
||||
a.add(new File(str, "map_record.txt"));
|
||||
a.add(new File(str, "backup_record.txt"));
|
||||
if (z) {
|
||||
c(str);
|
||||
}
|
||||
}
|
||||
List<File> list = a;
|
||||
if (list == null || list.size() <= 0) {
|
||||
return;
|
||||
}
|
||||
for (File file : a) {
|
||||
if (file.exists() && file.canWrite()) {
|
||||
file.delete();
|
||||
x.c("Delete record file %s", file.getAbsoluteFile());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX WARN: Multi-variable type inference failed */
|
||||
/* JADX WARN: Type inference failed for: r6v1, types: [java.lang.StringBuilder] */
|
||||
/* JADX WARN: Type inference failed for: r6v10 */
|
||||
/* JADX WARN: Type inference failed for: r6v11 */
|
||||
/* JADX WARN: Type inference failed for: r6v6, types: [java.lang.String] */
|
||||
public static String a(String str, int i, String str2, boolean z) {
|
||||
BufferedReader bufferedReader;
|
||||
if (str != null && i > 0) {
|
||||
File file = new File(str);
|
||||
if (file.exists() && file.canRead()) {
|
||||
x.a("Read system log from native record file(length: %s bytes): %s", Long.valueOf(file.length()), file.getAbsolutePath());
|
||||
a.add(file);
|
||||
x.c("Add this record file to list for cleaning lastly.", new Object[0]);
|
||||
if (str2 == null) {
|
||||
return z.a(new File(str), i, z);
|
||||
}
|
||||
String sb = new StringBuilder();
|
||||
try {
|
||||
try {
|
||||
bufferedReader = new BufferedReader(new InputStreamReader(new FileInputStream(file), "utf-8"));
|
||||
while (true) {
|
||||
try {
|
||||
String readLine = bufferedReader.readLine();
|
||||
if (readLine == null) {
|
||||
break;
|
||||
}
|
||||
if (Pattern.compile(str2 + "[ ]*:").matcher(readLine).find()) {
|
||||
sb.append(readLine);
|
||||
sb.append("\n");
|
||||
}
|
||||
if (i > 0 && sb.length() > i) {
|
||||
if (z) {
|
||||
sb.delete(i, sb.length());
|
||||
break;
|
||||
}
|
||||
sb.delete(0, sb.length() - i);
|
||||
}
|
||||
} catch (Throwable th) {
|
||||
th = th;
|
||||
try {
|
||||
x.a(th);
|
||||
sb.append("\n[error:" + th.toString() + "]");
|
||||
String sb2 = sb.toString();
|
||||
if (bufferedReader == null) {
|
||||
return sb2;
|
||||
}
|
||||
bufferedReader.close();
|
||||
sb = sb2;
|
||||
return sb;
|
||||
} catch (Throwable th2) {
|
||||
if (bufferedReader != null) {
|
||||
try {
|
||||
bufferedReader.close();
|
||||
} catch (Exception e) {
|
||||
x.a(e);
|
||||
}
|
||||
}
|
||||
throw th2;
|
||||
}
|
||||
}
|
||||
}
|
||||
String sb3 = sb.toString();
|
||||
bufferedReader.close();
|
||||
sb = sb3;
|
||||
} catch (Throwable th3) {
|
||||
th = th3;
|
||||
bufferedReader = null;
|
||||
}
|
||||
return sb;
|
||||
} catch (Exception e2) {
|
||||
x.a(e2);
|
||||
return sb;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
37
sources/com/tencent/bugly/crashreport/inner/InnerApi.java
Normal file
37
sources/com/tencent/bugly/crashreport/inner/InnerApi.java
Normal file
@@ -0,0 +1,37 @@
|
||||
package com.tencent.bugly.crashreport.inner;
|
||||
|
||||
import com.tencent.bugly.crashreport.crash.d;
|
||||
import com.tencent.bugly.proguard.x;
|
||||
import java.util.Map;
|
||||
|
||||
/* compiled from: BUGLY */
|
||||
/* loaded from: classes.dex */
|
||||
public class InnerApi {
|
||||
public static void postCocos2dxCrashAsync(int i, String str, String str2, String str3) {
|
||||
if (str == null || str2 == null || str3 == null) {
|
||||
x.e("post cocos2d-x fail args null", new Object[0]);
|
||||
} else if (i != 5 && i != 6) {
|
||||
x.e("post cocos2d-x fail category illeagle: %d", Integer.valueOf(i));
|
||||
} else {
|
||||
x.a("post cocos2d-x crash %s %s", str, str2);
|
||||
d.a(Thread.currentThread(), i, str, str2, str3, null);
|
||||
}
|
||||
}
|
||||
|
||||
public static void postH5CrashAsync(Thread thread, String str, String str2, String str3, Map<String, String> map) {
|
||||
if (str == null || str2 == null || str3 == null) {
|
||||
x.e("post h5 fail args null", new Object[0]);
|
||||
} else {
|
||||
x.a("post h5 crash %s %s", str, str2);
|
||||
d.a(thread, 8, str, str2, str3, map);
|
||||
}
|
||||
}
|
||||
|
||||
public static void postU3dCrashAsync(String str, String str2, String str3) {
|
||||
if (str == null || str2 == null || str3 == null) {
|
||||
x.e("post u3d fail args null", new Object[0]);
|
||||
}
|
||||
x.a("post u3d crash %s %s", str, str2);
|
||||
d.a(Thread.currentThread(), 4, str, str2, str3, null);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user