[3.2.0][APM] APM初始化在读是否是Debug时,切换到子线程
This commit is contained in:
@@ -27,6 +27,10 @@ import com.mogo.test.crashreport.ITestCrashReportProvider;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import rx.Observable;
|
||||
import rx.android.schedulers.AndroidSchedulers;
|
||||
import rx.schedulers.Schedulers;
|
||||
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -50,16 +54,24 @@ public class ApmCrashReportProvider implements ITestCrashReportProvider {
|
||||
|
||||
@Override
|
||||
public void init(Context context) {
|
||||
IApmEnvProvider provider = CallerDevaToolsManager.INSTANCE.apmEnvProvider();
|
||||
boolean isDebug = DebugConfig.isDebug();
|
||||
if (provider != null) {
|
||||
Boolean enabled = provider.isDebugEnabled();
|
||||
if (enabled != null) {
|
||||
isDebug = enabled;
|
||||
}
|
||||
}
|
||||
initCrash(context, isDebug);
|
||||
initApmInsight(context, isDebug);
|
||||
Observable.defer(() -> {
|
||||
IApmEnvProvider provider = CallerDevaToolsManager.INSTANCE.apmEnvProvider();
|
||||
boolean isDebug = DebugConfig.isDebug();
|
||||
if (provider != null) {
|
||||
Boolean enabled = provider.isDebugEnabled();
|
||||
if (enabled != null) {
|
||||
isDebug = enabled;
|
||||
}
|
||||
}
|
||||
return Observable.just(isDebug);
|
||||
})
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.doOnNext(isDebug -> {
|
||||
initCrash(context, isDebug);
|
||||
initApmInsight(context, isDebug);
|
||||
}).subscribe();
|
||||
|
||||
}
|
||||
|
||||
private void initCrash(final Context context, boolean isDebug) {
|
||||
|
||||
Reference in New Issue
Block a user