..
This commit is contained in:
@@ -11,7 +11,6 @@ import com.bytedance.boost_multidex.BoostMultiDex;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.commons.network.Utils;
|
||||
import com.mogo.launcher.performance.MogoMonitorIO;
|
||||
import com.mogo.module.authorize.authprovider.invoke.AuthorizeConstant;
|
||||
import com.mogo.module.back.BackToLauncherConst;
|
||||
import com.mogo.module.carchatting.card.CallChatConstant;
|
||||
@@ -196,7 +195,6 @@ public class MogoApplication extends AbsMogoApplication {
|
||||
@Override
|
||||
protected void attachBaseContext( Context base ) {
|
||||
super.attachBaseContext( base );
|
||||
MogoMonitorIO.getInstance().init(this);
|
||||
BoostMultiDex.install( base );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
package com.mogo.launcher.performance;
|
||||
|
||||
import com.tencent.mrs.plugin.IDynamicConfig;
|
||||
|
||||
public class DynamicConfigImpl implements IDynamicConfig {
|
||||
|
||||
public boolean isFPSEnable(){
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isTraceEnable(){
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isMatrixEnable(){
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String get(String key, String defStr) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int get(String key, int defInt) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long get(String key, long defLong) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean get(String key, boolean defBool) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float get(String key, float defFloat) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
package com.mogo.launcher.performance;
|
||||
|
||||
import android.app.Application;
|
||||
|
||||
import com.tencent.matrix.Matrix;
|
||||
import com.tencent.matrix.iocanary.IOCanaryPlugin;
|
||||
import com.tencent.matrix.iocanary.config.IOConfig;
|
||||
import com.tencent.matrix.trace.TracePlugin;
|
||||
import com.tencent.matrix.trace.config.TraceConfig;
|
||||
|
||||
public class MogoMonitorIO {
|
||||
|
||||
public static MogoMonitorIO getInstance() {
|
||||
return Holder.mogoMonitorIO;
|
||||
}
|
||||
|
||||
private static class Holder {
|
||||
private static final MogoMonitorIO mogoMonitorIO = new MogoMonitorIO();
|
||||
}
|
||||
|
||||
public void init(Application application) {
|
||||
|
||||
Matrix.Builder builder = new Matrix.Builder(application);
|
||||
builder.patchListener(new PluginListenerImpl(application));
|
||||
|
||||
DynamicConfigImpl dynamicConfig = new DynamicConfigImpl();
|
||||
boolean fpsEnable = dynamicConfig.isFPSEnable();
|
||||
boolean matrixEnable = dynamicConfig.isMatrixEnable();
|
||||
boolean traceEnable = dynamicConfig.isTraceEnable();
|
||||
|
||||
TraceConfig traceConfig = new TraceConfig.Builder()
|
||||
.dynamicConfig(dynamicConfig)
|
||||
.enableFPS(fpsEnable)
|
||||
.enableEvilMethodTrace(traceEnable)
|
||||
.enableAnrTrace(traceEnable)
|
||||
.enableStartup(traceEnable)
|
||||
.isDebug(true)
|
||||
.isDevEnv(true)
|
||||
.build();
|
||||
|
||||
TracePlugin tracePlugin = new TracePlugin(traceConfig);
|
||||
builder.plugin(tracePlugin);
|
||||
|
||||
if (matrixEnable) {
|
||||
IOCanaryPlugin ioCanaryPlugin = new IOCanaryPlugin(
|
||||
new IOConfig.Builder().dynamicConfig(dynamicConfig).build());
|
||||
builder.plugin(ioCanaryPlugin);
|
||||
}
|
||||
Matrix.init(builder.build());
|
||||
tracePlugin.start();
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
package com.mogo.launcher.performance;
|
||||
|
||||
import com.tencent.matrix.report.Issue;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
public class ParseIssueUtil {
|
||||
|
||||
public static String parseIssue(Issue issue, boolean onlyShowContent) {
|
||||
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
if (!onlyShowContent) {
|
||||
stringBuilder.append(Issue.ISSUE_REPORT_TAG).append(" : ").append(issue.getTag()).append("\n");
|
||||
stringBuilder.append(Issue.ISSUE_REPORT_TYPE).append(" : ").append(issue.getType()).append("\n");
|
||||
stringBuilder.append("key").append(" : ").append(issue.getKey()).append("\n");
|
||||
}
|
||||
|
||||
stringBuilder.append("content :").append("\n");
|
||||
|
||||
return pauseJsonObj(stringBuilder, issue.getContent()).toString();
|
||||
}
|
||||
|
||||
public static StringBuilder pauseJsonObj(StringBuilder builder, JSONObject object) {
|
||||
Iterator<String> iterator = object.keys();
|
||||
while (iterator.hasNext()) {
|
||||
String key = iterator.next();
|
||||
String val = object.optString(key);
|
||||
builder.append("\t").append(key).append(" : ").append(val).append("\n");
|
||||
}
|
||||
return builder;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package com.mogo.launcher.performance;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import com.tencent.matrix.plugin.DefaultPluginListener;
|
||||
import com.tencent.matrix.report.Issue;
|
||||
|
||||
public class PluginListenerImpl extends DefaultPluginListener {
|
||||
|
||||
private static final String TAG = "PluginListenerImpl";
|
||||
|
||||
|
||||
public PluginListenerImpl(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReportIssue(Issue issue) {
|
||||
printIssue(issue);
|
||||
}
|
||||
|
||||
private void printIssue(Issue issue) {
|
||||
String issueMsg = ParseIssueUtil.parseIssue(issue, true);
|
||||
Log.i(TAG,"issueMsg : " + issueMsg);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user