再次屏蔽 MTA

This commit is contained in:
juntao
2020-12-10 16:54:27 +08:00
parent 9873ae8946
commit 6b533c8d09
4 changed files with 126 additions and 142 deletions

View File

@ -7,7 +7,6 @@ import android.os.Build;
import android.preference.PreferenceManager;
import android.text.TextUtils;
import com.gh.common.constant.Config;
import com.gh.common.constant.Constants;
import com.gh.common.exposure.meta.MetaUtil;
import com.gh.gamecenter.BuildConfig;
@ -16,15 +15,9 @@ import com.gh.gid.GidHelper;
import com.halo.assistant.HaloApp;
import com.lightgame.config.CommonDebug;
import com.lightgame.utils.Utils;
import com.tencent.stat.MtaSDkException;
import com.tencent.stat.StatConfig;
import com.tencent.stat.StatCrashReporter;
import com.tencent.stat.StatReportStrategy;
import com.tencent.stat.StatService;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import io.sentry.android.core.SentryAndroid;
import io.sentry.core.Sentry;
@ -90,42 +83,42 @@ public class DataUtils {
// }
//MTA
try {
/**
*
* 不要启用!!!!全部由{@link com.gh.base.AppUncaughtHandler}处理
*/
StatConfig.setAutoExceptionCaught(false);
StatCrashReporter crashReporter = StatCrashReporter.getStatCrashReporter(context);
crashReporter.setJavaCrashHandlerStatus(false);
// crashReporter.setEnableInstantReporting(true);
StatConfig.setDebugEnable(false);
// 设置数据上报策略
// 测试渠道的时候即时上传,方便查看日志
if (Config.DEFAULT_CHANNEL.equals(HaloApp.getInstance().getChannel())) {
StatConfig.setStatSendStrategy(StatReportStrategy.INSTANT);
} else {
StatConfig.setStatSendStrategy(StatReportStrategy.PERIOD);
StatConfig.setSendPeriodMinutes(5);
}
// 设置启用Tlink
StatConfig.setTLinkStatus(true);
StatConfig.init(context);
StatConfig.setInstallChannel(channel);
StatConfig.setAntoActivityLifecycleStat(true);
StatConfig.setAppVersion(PackageUtils.getVersionName());
// 开启收集服务
StatService.startStatService(context, Config.MTA_APPKEY, com.tencent.stat.common.StatConstants.VERSION);
StatService.registerActivityLifecycleCallbacks(context);
} catch (MtaSDkException e) {
e.printStackTrace();
}
// try {
// /**
// *
// * 不要启用!!!!全部由{@link com.gh.base.AppUncaughtHandler}处理
// */
// StatConfig.setAutoExceptionCaught(false);
//
// StatCrashReporter crashReporter = StatCrashReporter.getStatCrashReporter(context);
// crashReporter.setJavaCrashHandlerStatus(false);
//// crashReporter.setEnableInstantReporting(true);
//
// StatConfig.setDebugEnable(false);
//
// // 设置数据上报策略
// // 测试渠道的时候即时上传,方便查看日志
// if (Config.DEFAULT_CHANNEL.equals(HaloApp.getInstance().getChannel())) {
// StatConfig.setStatSendStrategy(StatReportStrategy.INSTANT);
// } else {
// StatConfig.setStatSendStrategy(StatReportStrategy.PERIOD);
// StatConfig.setSendPeriodMinutes(5);
// }
//
// // 设置启用Tlink
// StatConfig.setTLinkStatus(true);
//
// StatConfig.init(context);
// StatConfig.setInstallChannel(channel);
// StatConfig.setAntoActivityLifecycleStat(true);
// StatConfig.setAppVersion(PackageUtils.getVersionName());
//
// // 开启收集服务
// StatService.startStatService(context, Config.MTA_APPKEY, com.tencent.stat.common.StatConstants.VERSION);
// StatService.registerActivityLifecycleCallbacks(context);
// } catch (MtaSDkException e) {
// e.printStackTrace();
// }
// init bugly
// try {
@ -180,17 +173,17 @@ public class DataUtils {
}
public static void onEvent(Context var0, String var1, String var2) {
Properties prop = new Properties();
prop.setProperty(var1, var2);
StatService.trackCustomKVEvent(var0, var1, prop);
// Properties prop = new Properties();
// prop.setProperty(var1, var2);
// StatService.trackCustomKVEvent(var0, var1, prop);
}
public static void onPause(Activity var0) {
StatService.onPause(var0);
// StatService.onPause(var0);
}
public static void onResume(Activity var0) {
StatService.onResume(var0);
// StatService.onResume(var0);
}
// 游戏启动
@ -202,30 +195,30 @@ public class DataUtils {
}
public static void onEvent(Context var0, String var1, String var2, Map<String, Object> var3) {
Properties prop = new Properties();
prop.setProperty("label", var2);
for (String key : var3.keySet()) {
prop.setProperty(key, var3.get(key) + "");
}
StatService.trackCustomKVEvent(var0, var1, prop);
// Properties prop = new Properties();
// prop.setProperty("label", var2);
// for (String key : var3.keySet()) {
// prop.setProperty(key, var3.get(key) + "");
// }
// StatService.trackCustomKVEvent(var0, var1, prop);
}
public static void trackTimeEvent(Context context, String eventId, int costTime, String... kv) {
Properties prop = new Properties();
for (int i = 0; i < kv.length; i++) {
if (i % 2 != 0 || i != 0) {
String key = kv[i - 1];
String value = kv[i];
if (!TextUtils.isEmpty(key) && !TextUtils.isEmpty(value)) {
prop.setProperty(key, value);
}
}
}
if (prop.size() == 0) return;
StatService.trackCustomKVTimeIntervalEvent(context, costTime, eventId, prop);
//
// Properties prop = new Properties();
// for (int i = 0; i < kv.length; i++) {
// if (i % 2 != 0 || i != 0) {
// String key = kv[i - 1];
// String value = kv[i];
// if (!TextUtils.isEmpty(key) && !TextUtils.isEmpty(value)) {
// prop.setProperty(key, value);
// }
// }
// }
//
// if (prop.size() == 0) return;
//
// StatService.trackCustomKVTimeIntervalEvent(context, costTime, eventId, prop);
}
// 游戏下载