我的app崩溃太多了,线程数不够用,逆向给他补充下,希望腾讯放过我
try {
//暴力反射,给bugly增加线程池的数量
//先提前初始化下
w.a();
//反射修改
Field b = w.class.getDeclaredField("b");
b.setAccessible(true);
Object objB = b.get(null);
Field c = objB.getClass().getDeclaredField("c");
c.setAccessible(true);
ThreadFactory var1 = var11 -> {
Thread var2;
//获取a
Field a = null;
try {
a = w.class.getDeclaredField("a");
a.setAccessible(true);
AtomicInteger objA = (AtomicInteger) a.get(null);
(var2 = new Thread(var11)).setName("BuglyThread-" + objA.getAndIncrement());
return var2;
} catch (Exception e) {
YZJLog.Df("bugly-mo",Log.getStackTraceString(e));
(var2 = new Thread(var11)).setName("BuglyThread-" + ATOMIC_INTEGER.getAndIncrement());
return var2;
}
};
c.set(objB, Executors.newCachedThreadPool(var1));
} catch (Exception e) {
YZJLog.Df("bugly-mo",Log.getStackTraceString(e));
}
接下来,我就可以为所欲为把日志往bugly上报
val throwable = Throwable("db 耗时$md5")//db.traceCallback#onSQLExecuted
CrashReport.postCatchedException(throwable)