TIM v2.3.1版本的 MD5 值为:d6957e3ee7ce901ccc491cefdea0da8c
以下内容为反编译后的 CrashReport.java 源代码,内容仅作参考
package com.tencent.feedback.eup;
import android.annotation.SuppressLint;
import android.content.Context;
import android.text.TextUtils;
import android.util.Log;
import com.tencent.bugly.BuglyStrategy;
import com.tencent.bugly.b;
import com.tencent.bugly.crashreport.common.info.PlugInBean;
import com.tencent.bugly.crashreport.common.strategy.StrategyBean;
import com.tencent.bugly.crashreport.crash.c;
import com.tencent.bugly.crashreport.crash.e;
import com.tencent.bugly.crashreport.crash.jni.NativeCrashHandler;
import com.tencent.bugly.proguard.an;
import com.tencent.bugly.proguard.p;
import com.tencent.bugly.proguard.t;
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 com.tencent.commonsdk.soload.SoLoadCore;
import com.tencent.feedback.eup.jni.NativeExceptionHandlerRqdImp;
import com.tencent.feedback.eup.jni.NativeExceptionUpload;
import com.tencent.feedback.upload.UploadHandleListener;
import com.tencent.mobileqq.app.automator.StepFactory;
import com.tencent.mobileqq.msf.core.v;
import com.tencent.open.business.viareport.ReportConfig;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ScheduledExecutorService;
public class CrashReport extends com.tencent.bugly.a {
public static final int MODULE_ID = 1003;
private static boolean f84261a = false;
private static CrashStrategyBean f84262b = null;
private static e f84263c = null;
private static CrashHandleListener d = null;
private static t e = null;
private static CrashReport f = new CrashReport();
private static boolean g = false;
private static boolean h = false;
@Override
public void init(Context context, boolean z, BuglyStrategy buglyStrategy) {
c.a(1003, context, b.f83475c, (com.tencent.bugly.proguard.a) null, f84263c, (String) null);
c.a().c();
if (buglyStrategy == null || buglyStrategy.isEnableANRCrashMonitor()) {
c.a().f();
} else {
x.a("[crash] Closed ANR monitor!", new Object[0]);
c.a().g();
}
u.a().f83630a = e;
}
public static CrashReport getInstance() {
return f;
}
@Override
public void onServerStrategyChanged(StrategyBean strategyBean) {
c a2;
if (strategyBean != null && (a2 = c.a()) != null) {
a2.a(strategyBean);
}
}
@Override
public String[] getTables() {
return new String[]{"t_cr"};
}
public static void initCrashReport(Context context) {
initCrashReport(context, null, null, true, null);
}
public static void initCrashReport(Context context, boolean z) {
initCrashReport(context, null, null, z, null, 0L);
}
public static void initCrashReport(Context context, CrashHandleListener crashHandleListener, UploadHandleListener uploadHandleListener, boolean z, CrashStrategyBean crashStrategyBean) {
initCrashReport(context, crashHandleListener, uploadHandleListener, z, crashStrategyBean, 0L);
}
public static void initCrashReport(Context context, CrashHandleListener crashHandleListener, final UploadHandleListener uploadHandleListener, boolean z, CrashStrategyBean crashStrategyBean, long j) {
String str;
if (context != null && !f84261a) {
x.f83645b = "eup";
x.f83644a = "eup";
StrategyBean.f83505a = "http://monitor.uu.qq.com/analytics/rqdsync";
if (!h) {
StrategyBean.f83506b = "http://android.rqd.qq.com/analytics/async";
StrategyBean.f83507c = "http://android.rqd.qq.com/analytics/async";
}
f84262b = crashStrategyBean;
setCrashHandler(crashHandleListener);
if (uploadHandleListener != null) {
e = new t() {
@Override
public final void a(int i) {
UploadHandleListener.this.onUploadStart(i);
}
@Override
public final void a(int i, an anVar, long j2, long j3, boolean z2, String str2) {
UploadHandleListener.this.onUploadEnd(i, anVar == null ? -1 : anVar.f83584b, j2, j3, z2, str2);
}
};
u a2 = u.a();
if (a2 != null) {
a2.f83630a = e;
}
}
c.f83545c = 1;
BuglyStrategy buglyStrategy = new BuglyStrategy();
if (crashStrategyBean != null) {
c.g = crashStrategyBean.getRecordOverDays() * 24 * ReportConfig.f96238b * 1000;
c.h = crashStrategyBean.getOnlyLogTag();
c.i = crashStrategyBean.isStoreCrashSdcard();
c.j = crashStrategyBean.getStoreDirectoryPath();
c.k = crashStrategyBean.getCrashSdcardMaxSize();
c.e = crashStrategyBean.getMaxLogLength();
c.f = crashStrategyBean.getMaxStackLength();
c.d = crashStrategyBean.isMerged();
c.l = crashStrategyBean.isUploadSpotCrash();
buglyStrategy.setEnableANRCrashMonitor(crashStrategyBean.isOpenAnr());
}
buglyStrategy.setAppReportDelay(j);
if (z.a(com.tencent.bugly.crashreport.common.info.a.a(context).e)) {
com.tencent.bugly.crashreport.common.info.a.a(context).a(context.getPackageName());
}
if (!g && (str = com.tencent.bugly.crashreport.common.info.a.a(context).l) != null && !z.a(str)) {
int i = 0;
for (char c2 : str.toCharArray()) {
if (c2 == '.') {
i++;
}
}
if (i < 3) {
String str2 = str + "." + com.tencent.bugly.crashreport.common.info.a.a(context).x;
com.tencent.bugly.crashreport.common.info.a.a(context).l = str2;
x.a("rqdp{ RQD version: %s }", str2);
}
}
com.tencent.bugly.crashreport.common.info.a.a(context).f = z;
buglyStrategy.setUploadProcess(z);
com.tencent.bugly.crashreport.common.info.a.a(context).D = true;
c.f83544b = true;
com.tencent.bugly.crashreport.common.strategy.a.f83509b = v.i;
buglyStrategy.setEnableUserInfo(false);
b.a(getInstance());
b.a(context, context.getPackageName(), false, buglyStrategy);
f84261a = true;
}
}
public static void initNativeCrashReport(Context context, String str, boolean z) {
initNativeCrashReport(context, str, z, null, null);
}
public static void initNativeCrashReport(Context context, String str, boolean z, List<File> list) {
initNativeCrashReport(context, str, z, list, null);
}
@SuppressLint({"SdCardPath"})
public static void initNativeCrashReport(Context context, String str, boolean z, List<File> list, File file) {
if (f84261a) {
com.tencent.bugly.crashreport.common.info.a a2 = com.tencent.bugly.crashreport.common.info.a.a(context);
if (file != null) {
String absolutePath = file.getAbsolutePath();
if (!z.a(absolutePath)) {
a2.o = absolutePath;
}
}
if (file != null) {
if (list == null) {
list = new ArrayList<>();
}
list.add(file);
}
if (a2.H() == null && a2.f) {
x.c("no setted SO , query so!", new Object[0]);
w.a().a(new a(context, "/data/data/" + context.getPackageName() + SoLoadCore.PATH_LIB, list));
}
NativeCrashHandler nativeCrashHandler = NativeCrashHandler.getInstance();
if (nativeCrashHandler != null) {
if (!z.a(str)) {
nativeCrashHandler.setDumpFilePath(str);
}
NativeExceptionHandlerRqdImp nativeExceptionHandlerRqdImp = NativeExceptionHandlerRqdImp.getInstance(context);
nativeExceptionHandlerRqdImp.setTombDir(str);
NativeExceptionUpload.setmHandler(nativeExceptionHandlerRqdImp);
c.a().e();
}
c.a().a(0L);
}
}
public static CrashHandleListener getCrashHandler() {
return d;
}
public static void setCrashHandler(final CrashHandleListener crashHandleListener) {
if (crashHandleListener != null) {
d = crashHandleListener;
f84263c = new e() {
@Override
public final boolean a(boolean z, String str, String str2, String str3, int i, long j, String str4, String str5, String str6, String str7) {
return CrashHandleListener.this.onCrashSaving(z, str, str2, str3, i, j, str4, str5, str6, str7);
}
@Override
public final void a(boolean z) {
CrashHandleListener.this.onCrashHandleStart(z);
}
@Override
public final boolean b(boolean z) {
return CrashHandleListener.this.onCrashHandleEnd(z);
}
@Override
public final String b(boolean z, String str, String str2, String str3, int i, long j) {
return CrashHandleListener.this.getCrashExtraMessage(z, str, str2, str3, -1234567890, j);
}
@Override
public final byte[] a(boolean z, String str, String str2, String str3, int i, long j) {
return CrashHandleListener.this.getCrashExtraData(z, str, str2, str3, -1234567890, j);
}
};
c a2 = c.a();
if (a2 != null) {
a2.a(f84263c);
}
}
}
public static CrashStrategyBean getCrashRuntimeStrategy() {
return f84262b;
}
public static void setUserId(Context context, String str) {
if (str != null) {
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).f())) {
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 (com.tencent.bugly.crashreport.biz.b.f83491a) {
com.tencent.bugly.crashreport.biz.b.a();
}
}
}
}
public static boolean addPlugin(Context context, String str, String str2, String str3) {
return com.tencent.bugly.crashreport.common.info.a.a(context).a(str, str2, str3);
}
public static void removePlugin(Context context, String str) {
com.tencent.bugly.crashreport.common.info.a.a(context).f(str);
}
public static int countExceptionDatas(Context context) {
c a2 = c.a();
if (a2 != null) {
return a2.k();
}
return 0;
}
public static byte[] getExceptionDatas(Context context) {
if (c.a() != null) {
return c.a().j();
}
return null;
}
public static boolean doUploadExceptionDatas() {
c a2 = c.a();
if (a2 != null) {
a2.a(0L);
return true;
}
return false;
}
public static boolean needUploadCrash(Context context) {
return countExceptionDatas(context) > 0;
}
@Deprecated
public static int countStoredRecord(Context context) {
return countExceptionDatas(context);
}
public static boolean handleCatchException(Thread thread, Throwable th, String str, byte[] bArr) {
c a2 = c.a();
if (a2 != null) {
a2.a(thread, th, false, str, bArr, false);
return true;
}
return false;
}
public static void setCrashReportAble(boolean z) {
c a2 = c.a();
if (a2 != null) {
if (z) {
a2.c();
} else {
a2.b();
}
}
}
public static void setNativeCrashReportAble(boolean z) {
c a2 = c.a();
if (a2 != null) {
if (z) {
a2.e();
}
a2.d();
}
}
public static long getSDKTotalConsume(Context context, boolean z) {
u a2 = u.a();
if (a2 != null) {
return a2.a(false);
}
return -1L;
}
public static void clearSDKTotalConsume(Context context) {
u a2 = u.a();
if (a2 != null) {
a2.b();
a2.c();
}
}
public static void setLogAble(boolean z, boolean z2) {
if (z) {
x.f83645b = "eup";
x.f83644a = "eup";
x.f83646c = true;
b.f83475c = true;
x.d("'setLogAble(boolean)' is true , so running in debug model , close it when you release!", new Object[0]);
return;
}
x.f83646c = false;
}
public static void setThreadPoolService(ScheduledExecutorService scheduledExecutorService) {
if (scheduledExecutorService != null) {
w.a().a(scheduledExecutorService);
}
}
public static void setDeviceId(Context context, String str) {
if (str != null) {
com.tencent.bugly.crashreport.common.info.a.a(context).c(str);
}
}
public static void setCountryName(Context context, String str) {
com.tencent.bugly.crashreport.common.info.a.a(context).g(str);
}
public static void setAPKSHa1(Context context, String str) {
com.tencent.bugly.crashreport.common.info.a.a(context).j = str;
x.c("set sha1 %s", str);
}
public static void setSOFile(Context context, List<SoFile> list) {
if (list != null && list.size() != 0) {
com.tencent.bugly.crashreport.common.info.a a2 = com.tencent.bugly.crashreport.common.info.a.a(context);
HashMap hashMap = new HashMap(list.size());
for (SoFile soFile : list) {
hashMap.put("sosha1_" + soFile.sha1, new PlugInBean(soFile.fileName, soFile.arch, soFile.sha1));
}
a2.a(hashMap);
}
}
public static void setProductVersion(Context context, String str) {
if (!TextUtils.isEmpty(str)) {
if (str.length() > 100) {
String substring = str.substring(0, 100);
x.d("appVersion %s length is over limit %d substring to %s", str, 100, substring);
str = substring;
}
g = true;
com.tencent.bugly.crashreport.common.info.a.a(context).l = str;
}
}
public static void setDeviceRooted(Context context, boolean z) {
com.tencent.bugly.crashreport.common.info.a.a(context).a(Boolean.valueOf(z));
}
public static void setDengtaAppKey(Context context, String str) {
com.tencent.bugly.crashreport.common.info.a.a(context).e = str;
}
public static void setRdmUuid(String str) {
com.tencent.bugly.crashreport.common.info.a b2 = com.tencent.bugly.crashreport.common.info.a.b();
if (b2 == null) {
x.d("Can not set RDM UUID if RQD has not been initialized.", new Object[0]);
} else {
b2.y = str;
}
}
public static void setProductID(Context context, String str) {
com.tencent.bugly.crashreport.common.info.a.a(context).f83502c = str;
}
public static void setUserSceneTag(Context context, int i) {
if (context == null) {
x.d("setTag args context should not be null", new Object[0]);
} else if (i <= 0) {
x.d("setTag args tagId should > 0", new Object[0]);
} else {
com.tencent.bugly.crashreport.common.info.a.a(context).a(i);
x.b("[param] set user scene tag: %d", Integer.valueOf(i));
}
}
public static int getUserSceneTagId(Context context) {
if (context == null) {
x.d("getUserSceneTagId args context should not be null", new Object[0]);
return -1;
}
return com.tencent.bugly.crashreport.common.info.a.a(context).E();
}
public static String getUserData(Context context, String str) {
if (context == null) {
x.d("getUserDataValue args context should not be null", new Object[0]);
return null;
} else if (z.a(str)) {
return null;
} else {
return com.tencent.bugly.crashreport.common.info.a.a(context).i(str);
}
}
public static void putUserData(Context context, String str, String str2) {
if (context == null) {
x.d("putUserData args context should not be null", new Object[0]);
} else if (z.a(str)) {
x.d("putUserData args key should not be null", new Object[0]);
} else if (z.a(str2)) {
x.d("putUserData args value should not be null", new Object[0]);
} else if (!str.matches("[a-zA-Z[0-9]_]+")) {
x.d("putUserData args key should match [a-zA-Z[0-9]_]+ {" + str + StepFactory.f18881d, new Object[0]);
} else {
if (str2.length() > 200) {
x.d("user data value length over limit %d , has been 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.B().contains(str)) {
com.tencent.bugly.crashreport.common.info.a.a(context).a(str, str2);
x.c("replace KV %s %s", str, str2);
} else if (a2.A() >= 100) {
x.d("user data size is over limit %d , will drop this new key %s", 10, str);
} else if (str.length() > 50) {
x.d("user data key length over limit %d , will drop this new key %s", 50, str);
} else {
NativeCrashHandler nativeCrashHandler = NativeCrashHandler.getInstance();
if (nativeCrashHandler != null) {
nativeCrashHandler.putKeyValueToNative(str, str2);
}
com.tencent.bugly.crashreport.common.info.a.a(context).a(str, str2);
x.b("[param] set user data: %s - %s", str, str2);
}
}
}
public static void putUploadRequestData(Context context, String str, String str2) {
if (context == null) {
x.d("putUploadRequestData args context should not be null", new Object[0]);
} else if (z.a(str)) {
x.d("putUploadRequestData args key should not be null", new Object[0]);
} else if (z.a(str2)) {
x.d("putUploadRequestData args value should not be null", new Object[0]);
} else if (!str.matches("[a-zA-Z[0-9]]+")) {
x.d("putUploadRequestData args key should match [a-zA-Z[0-9]_]+ {" + str + StepFactory.f18881d, new Object[0]);
} else {
if (str2.length() > 200) {
x.d("upload request data value length over limit %d , has been cutted!", 200);
str2 = str2.substring(0, 200);
}
if (str.length() > 50) {
x.d("upload request data key length over limit %d , will drop this new key %s", 50, str);
return;
}
com.tencent.bugly.crashreport.common.info.a.a(context).b(str, str2);
x.b("[param] put upload request data: %s - %s", str, str2);
}
}
public static String removeUserData(Context context, String str) {
if (context == null) {
x.d("removeUserData args context should not be null", new Object[0]);
return null;
} else if (z.a(str)) {
return null;
} else {
x.b("[param] remove user data: %s", str);
return com.tencent.bugly.crashreport.common.info.a.a(context).h(str);
}
}
public static Set<String> getAllUserDataKeys(Context context) {
if (context == null) {
x.d("getAllUserDataKeys args context should not be null", new Object[0]);
return null;
}
return com.tencent.bugly.crashreport.common.info.a.a(context).B();
}
public static int getUserDatasSize(Context context) {
if (context == null) {
x.d("getUserDatasSize args context should not be null", new Object[0]);
return -1;
}
return com.tencent.bugly.crashreport.common.info.a.a(context).A();
}
public static void setDatabaseCloseAfterUse(boolean z) {
p.f83614a = z;
}
public static void testNativeCrash() {
if (!f84261a) {
Log.e(x.f83645b, "NativeCrashReport has not been initialed! pls to call method 'initNativeCrashReport' first!");
return;
}
x.a("start to create a native crash for test!", new Object[0]);
c.a().h();
}
public static void setIsDevelopmentDevice(Context context, boolean z) {
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).z = z;
}
public static void setServerUrl(String str) {
if (z.a(str)) {
x.d("URL should not be null.", new Object[0]);
return;
}
h = true;
StrategyBean.f83506b = str;
StrategyBean.f83507c = str;
}
public static void setAppChannel(Context context, String str) {
if (context == null) {
Log.w(x.f83645b, "setAppChannel args context should not be null");
} else if (str == null) {
Log.w(x.f83645b, "App channel is null, will not set");
} else {
com.tencent.bugly.crashreport.common.info.a.a(context).n = str;
NativeCrashHandler nativeCrashHandler = NativeCrashHandler.getInstance();
if (nativeCrashHandler != null) {
nativeCrashHandler.setNativeAppChannel(str);
}
}
}
public static void filterSigabrtSysLog() {
NativeCrashHandler nativeCrashHandler = NativeCrashHandler.getInstance();
if (nativeCrashHandler != null) {
nativeCrashHandler.filterSigabrtSysLog();
}
}
}