移除大部分第三方SDK

This commit is contained in:
chenjuntao
2020-10-21 17:12:46 +08:00
parent 20f8ba0de5
commit ebb279c42f
92 changed files with 3259 additions and 1635 deletions

View File

@ -6,7 +6,6 @@ import android.content.Context;
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.gid.GidCallback;
@ -14,13 +13,6 @@ import com.gh.gid.GidHelper;
import com.halo.assistant.HaloApp;
import com.lightgame.config.CommonDebug;
import com.lightgame.utils.Utils;
import com.tencent.bugly.crashreport.CrashReport;
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 com.tendcloud.tenddata.TCAgent;
import java.util.HashMap;
import java.util.Map;
@ -44,71 +36,71 @@ public class DataUtils {
return;
}
//TalkingData
try {
TCAgent.LOG_ON = false;
TCAgent.init(context, Config.TALKINGDATA_APPID, channel);
/**
*
* 不要启用!!!!不要启用,全部由{@link com.gh.base.AppUncaughtHandler}处理
*/
TCAgent.setReportUncaughtExceptions(false);
} catch (Exception e) {
e.printStackTrace();
}
// try {
// TCAgent.LOG_ON = false;
// TCAgent.init(context, Config.TALKINGDATA_APPID, channel);
// /**
// *
// * 不要启用!!!!不要启用,全部由{@link com.gh.base.AppUncaughtHandler}处理
// */
// TCAgent.setReportUncaughtExceptions(false);
// } catch (Exception e) {
// e.printStackTrace();
// }
//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 {
CrashReport.setIsDevelopmentDevice(context, Config.DEFAULT_CHANNEL.equals(channel));
CrashReport.UserStrategy strategy = new CrashReport.UserStrategy(context);
strategy.setEnableANRCrashMonitor(false);
strategy.setEnableNativeCrashMonitor(false);
strategy.setAppChannel(channel);
strategy.setAppVersion(PackageUtils.getVersionName());
CrashReport.initCrashReport(context, Config.BUGLY_APPID, false, strategy);
} catch (Exception e) {
e.printStackTrace();
}
// try {
// CrashReport.setIsDevelopmentDevice(context, Config.DEFAULT_CHANNEL.equals(channel));
//
// CrashReport.UserStrategy strategy = new CrashReport.UserStrategy(context);
// strategy.setEnableANRCrashMonitor(false);
// strategy.setEnableNativeCrashMonitor(false);
// strategy.setAppChannel(channel);
// strategy.setAppVersion(PackageUtils.getVersionName());
//
// CrashReport.initCrashReport(context, Config.BUGLY_APPID, false, strategy);
//
// } catch (Exception e) {
// e.printStackTrace();
// }
}
@ -121,8 +113,7 @@ public class DataUtils {
}
public static void getGid() {
GidHelper.getInstance().init(HaloApp.getInstance().getApplication());
GidHelper.getInstance().registerDevice(new GidCallback() {
GidHelper.getInstance().registerDevice(HaloApp.getInstance().getApplication(), new GidCallback() {
@Override
public void onSuccess(String gid) {
Utils.log("Gid", gid);
@ -150,15 +141,15 @@ 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);
// 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);
}
// 游戏启动
@ -175,7 +166,7 @@ public class DataUtils {
for (String key : var3.keySet()) {
prop.setProperty(key, var3.get(key) + "");
}
StatService.trackCustomKVEvent(var0, var1, prop);
// StatService.trackCustomKVEvent(var0, var1, prop);
}
public static void trackTimeEvent(Context context, String eventId, int costTime, String... kv) {
@ -193,7 +184,7 @@ public class DataUtils {
if (prop.size() == 0) return;
StatService.trackCustomKVTimeIntervalEvent(context, costTime, eventId, prop);
// StatService.trackCustomKVTimeIntervalEvent(context, costTime, eventId, prop);
}
// 游戏下载
@ -241,13 +232,13 @@ public class DataUtils {
public static void onError(Context context, Throwable throwable) {
//bugly 作为默认处理异常的类库,已经上报了,此处不重复上报
try {
CrashReport.postCatchedException(throwable);
// CrashReport.postCatchedException(throwable);
} catch (Exception e) {
}
//talkingdata
try {
TCAgent.onError(context, throwable);
// TCAgent.onError(context, throwable);
} catch (Exception e) {
}
}