646 lines
18 KiB
Java
646 lines
18 KiB
Java
package com.tencent.wxop.stat;
|
|
|
|
import android.content.Context;
|
|
import com.ijm.dataencryption.de.DataDecryptTool;
|
|
import com.tencent.bugly.BuglyStrategy;
|
|
import com.tencent.wxop.stat.common.StatConstants;
|
|
import com.tencent.wxop.stat.common.StatLogger;
|
|
import com.ubt.jimu.base.util.FileUtil;
|
|
import java.net.URI;
|
|
import java.util.Iterator;
|
|
import org.json.JSONException;
|
|
import org.json.JSONObject;
|
|
|
|
/* loaded from: classes.dex */
|
|
public class StatConfig {
|
|
private static String B;
|
|
private static String C;
|
|
private static StatLogger p = com.tencent.wxop.stat.common.l.b();
|
|
static f a = new f(2);
|
|
static f b = new f(1);
|
|
private static StatReportStrategy q = StatReportStrategy.APP_LAUNCH;
|
|
private static boolean r = false;
|
|
private static boolean s = true;
|
|
private static int t = BuglyStrategy.a.MAX_USERDATA_VALUE_LENGTH;
|
|
private static int u = 100000;
|
|
private static int v = 30;
|
|
private static int w = 10;
|
|
private static int x = 100;
|
|
private static int y = 30;
|
|
private static int z = 1;
|
|
static String c = "__HIBERNATE__";
|
|
static String d = "__HIBERNATE__TIME";
|
|
static String e = "__MTA_KILL__";
|
|
private static String A = null;
|
|
private static String D = "mta_channel";
|
|
static String f = "";
|
|
private static int E = 180;
|
|
static boolean g = false;
|
|
static int h = 100;
|
|
static long i = 10000;
|
|
private static int F = DataDecryptTool.DECRYPT_SP_FILE;
|
|
static boolean j = true;
|
|
private static long G = 0;
|
|
private static long H = 300000;
|
|
public static boolean isAutoExceptionCaught = true;
|
|
static volatile String k = StatConstants.MTA_SERVER;
|
|
private static volatile String I = StatConstants.MTA_REPORT_FULL_URL;
|
|
private static int J = 0;
|
|
private static volatile int K = 0;
|
|
private static int L = 20;
|
|
private static int M = 0;
|
|
private static boolean N = false;
|
|
private static int O = FileUtil.ZIP_BUFFER_SIZE;
|
|
private static boolean P = false;
|
|
private static String Q = null;
|
|
private static boolean R = false;
|
|
private static g S = null;
|
|
static boolean l = true;
|
|
static int m = 0;
|
|
static long n = 10000;
|
|
static int o = DataDecryptTool.DECRYPT_DB_FILE;
|
|
|
|
static int a() {
|
|
return v;
|
|
}
|
|
|
|
static String a(String str, String str2) {
|
|
String string;
|
|
try {
|
|
string = b.b.getString(str);
|
|
} catch (Throwable unused) {
|
|
p.w("can't find custom key:" + str);
|
|
}
|
|
return string != null ? string : str2;
|
|
}
|
|
|
|
static synchronized void a(int i2) {
|
|
synchronized (StatConfig.class) {
|
|
K = i2;
|
|
}
|
|
}
|
|
|
|
static void a(long j2) {
|
|
com.tencent.wxop.stat.common.q.b(i.a(), c, j2);
|
|
setEnableStatService(false);
|
|
p.warn("MTA is disable for current SDK version");
|
|
}
|
|
|
|
static void a(Context context, f fVar) {
|
|
int i2 = fVar.a;
|
|
if (i2 != b.a) {
|
|
if (i2 == a.a) {
|
|
a = fVar;
|
|
}
|
|
} else {
|
|
b = fVar;
|
|
a(fVar.b);
|
|
if (b.b.isNull("iplist")) {
|
|
return;
|
|
}
|
|
a.a(context).a(b.b.getString("iplist"));
|
|
}
|
|
}
|
|
|
|
static void a(Context context, f fVar, JSONObject jSONObject) {
|
|
boolean z2 = false;
|
|
try {
|
|
Iterator<String> keys = jSONObject.keys();
|
|
while (keys.hasNext()) {
|
|
String next = keys.next();
|
|
if (next.equalsIgnoreCase("v")) {
|
|
int i2 = jSONObject.getInt(next);
|
|
if (fVar.d != i2) {
|
|
z2 = true;
|
|
}
|
|
fVar.d = i2;
|
|
} else if (next.equalsIgnoreCase("c")) {
|
|
String string = jSONObject.getString("c");
|
|
if (string.length() > 0) {
|
|
fVar.b = new JSONObject(string);
|
|
}
|
|
} else if (next.equalsIgnoreCase("m")) {
|
|
fVar.c = jSONObject.getString("m");
|
|
}
|
|
}
|
|
if (z2) {
|
|
au a2 = au.a(i.a());
|
|
if (a2 != null) {
|
|
a2.a(fVar);
|
|
}
|
|
if (fVar.a == b.a) {
|
|
a(fVar.b);
|
|
b(fVar.b);
|
|
}
|
|
}
|
|
a(context, fVar);
|
|
} catch (JSONException e2) {
|
|
p.e((Throwable) e2);
|
|
}
|
|
}
|
|
|
|
static void a(Context context, JSONObject jSONObject) {
|
|
JSONObject jSONObject2;
|
|
f fVar;
|
|
try {
|
|
Iterator<String> keys = jSONObject.keys();
|
|
while (keys.hasNext()) {
|
|
String next = keys.next();
|
|
if (next.equalsIgnoreCase(Integer.toString(b.a))) {
|
|
jSONObject2 = jSONObject.getJSONObject(next);
|
|
fVar = b;
|
|
} else if (next.equalsIgnoreCase(Integer.toString(a.a))) {
|
|
jSONObject2 = jSONObject.getJSONObject(next);
|
|
fVar = a;
|
|
} else {
|
|
if (!next.equalsIgnoreCase("rs")) {
|
|
return;
|
|
}
|
|
StatReportStrategy statReportStrategy = StatReportStrategy.getStatReportStrategy(jSONObject.getInt(next));
|
|
if (statReportStrategy != null) {
|
|
q = statReportStrategy;
|
|
if (isDebugEnable()) {
|
|
p.d("Change to ReportStrategy:" + statReportStrategy.name());
|
|
}
|
|
}
|
|
}
|
|
a(context, fVar, jSONObject2);
|
|
}
|
|
} catch (JSONException e2) {
|
|
p.e((Throwable) e2);
|
|
}
|
|
}
|
|
|
|
static void a(JSONObject jSONObject) {
|
|
try {
|
|
StatReportStrategy statReportStrategy = StatReportStrategy.getStatReportStrategy(jSONObject.getInt("rs"));
|
|
if (statReportStrategy != null) {
|
|
setStatSendStrategy(statReportStrategy);
|
|
}
|
|
} catch (JSONException unused) {
|
|
if (isDebugEnable()) {
|
|
p.i("rs not found.");
|
|
}
|
|
}
|
|
}
|
|
|
|
static boolean a(int i2, int i3, int i4) {
|
|
return i2 >= i3 && i2 <= i4;
|
|
}
|
|
|
|
static boolean a(JSONObject jSONObject, String str, String str2) {
|
|
if (jSONObject.isNull(str)) {
|
|
return false;
|
|
}
|
|
String optString = jSONObject.optString(str);
|
|
return com.tencent.wxop.stat.common.l.c(str2) && com.tencent.wxop.stat.common.l.c(optString) && str2.equalsIgnoreCase(optString);
|
|
}
|
|
|
|
static void b() {
|
|
M++;
|
|
}
|
|
|
|
static void b(int i2) {
|
|
if (i2 < 0) {
|
|
return;
|
|
}
|
|
M = i2;
|
|
}
|
|
|
|
/* JADX WARN: Removed duplicated region for block: B:16:0x0040 A[Catch: Exception -> 0x01b1, TryCatch #0 {Exception -> 0x01b1, blocks: (B:3:0x0004, B:5:0x0010, B:9:0x001c, B:11:0x0023, B:13:0x002b, B:14:0x002d, B:16:0x0040, B:18:0x0046, B:19:0x005e, B:20:0x0032, B:22:0x0036, B:24:0x0077, B:26:0x0080, B:27:0x0088, B:29:0x0092, B:30:0x00a8, B:32:0x00b4, B:33:0x00cc, B:35:0x00e2, B:36:0x00f8, B:39:0x0110, B:40:0x0124, B:42:0x013a, B:43:0x014e, B:45:0x0162, B:46:0x0182, B:48:0x018e, B:50:0x01a9), top: B:2:0x0004 }] */
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
|
*/
|
|
static void b(android.content.Context r8, org.json.JSONObject r9) {
|
|
/*
|
|
Method dump skipped, instructions count: 440
|
|
To view this dump change 'Code comments level' option to 'DEBUG'
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: com.tencent.wxop.stat.StatConfig.b(android.content.Context, org.json.JSONObject):void");
|
|
}
|
|
|
|
static void b(JSONObject jSONObject) {
|
|
if (jSONObject == null || jSONObject.length() == 0) {
|
|
return;
|
|
}
|
|
try {
|
|
b(i.a(), jSONObject);
|
|
String string = jSONObject.getString(c);
|
|
if (isDebugEnable()) {
|
|
p.d("hibernateVer:" + string + ", current version:2.0.4");
|
|
}
|
|
long b2 = com.tencent.wxop.stat.common.l.b(string);
|
|
if (com.tencent.wxop.stat.common.l.b(StatConstants.VERSION) <= b2) {
|
|
a(b2);
|
|
}
|
|
} catch (JSONException unused) {
|
|
p.d("__HIBERNATE__ not found.");
|
|
}
|
|
}
|
|
|
|
static int c() {
|
|
return M;
|
|
}
|
|
|
|
public static synchronized String getAppKey(Context context) {
|
|
String str;
|
|
synchronized (StatConfig.class) {
|
|
str = B;
|
|
}
|
|
return str;
|
|
}
|
|
|
|
public static int getCurSessionStatReportCount() {
|
|
return K;
|
|
}
|
|
|
|
public static g getCustomLogger() {
|
|
return S;
|
|
}
|
|
|
|
public static String getCustomProperty(String str) {
|
|
try {
|
|
return a.b.getString(str);
|
|
} catch (Throwable th) {
|
|
p.e(th);
|
|
return null;
|
|
}
|
|
}
|
|
|
|
public static String getCustomProperty(String str, String str2) {
|
|
String string;
|
|
try {
|
|
string = a.b.getString(str);
|
|
} catch (Throwable th) {
|
|
p.e(th);
|
|
}
|
|
return string != null ? string : str2;
|
|
}
|
|
|
|
public static String getCustomUserId(Context context) {
|
|
if (context == null) {
|
|
p.error("Context for getCustomUid is null.");
|
|
return null;
|
|
}
|
|
if (Q == null) {
|
|
Q = com.tencent.wxop.stat.common.q.a(context, "MTA_CUSTOM_UID", "");
|
|
}
|
|
return Q;
|
|
}
|
|
|
|
public static long getFlushDBSpaceMS() {
|
|
return n;
|
|
}
|
|
|
|
public static synchronized String getInstallChannel(Context context) {
|
|
String str;
|
|
synchronized (StatConfig.class) {
|
|
str = C;
|
|
}
|
|
return str;
|
|
}
|
|
|
|
public static String getLocalMidOnly(Context context) {
|
|
return context != null ? com.tencent.a.a.a.a.g.a(context).a().a() : "0";
|
|
}
|
|
|
|
public static int getMaxBatchReportCount() {
|
|
return y;
|
|
}
|
|
|
|
public static int getMaxDaySessionNumbers() {
|
|
return L;
|
|
}
|
|
|
|
public static int getMaxImportantDataSendRetryCount() {
|
|
return x;
|
|
}
|
|
|
|
public static int getMaxParallelTimmingEvents() {
|
|
return F;
|
|
}
|
|
|
|
public static int getMaxReportEventLength() {
|
|
return O;
|
|
}
|
|
|
|
public static int getMaxSendRetryCount() {
|
|
return w;
|
|
}
|
|
|
|
public static int getMaxSessionStatReportCount() {
|
|
return J;
|
|
}
|
|
|
|
public static int getMaxStoreEventCount() {
|
|
return u;
|
|
}
|
|
|
|
public static String getMid(Context context) {
|
|
return getLocalMidOnly(context);
|
|
}
|
|
|
|
public static long getMsPeriodForMethodsCalledLimitClear() {
|
|
return i;
|
|
}
|
|
|
|
public static int getNumEventsCachedInMemory() {
|
|
return m;
|
|
}
|
|
|
|
public static int getNumEventsCommitPerSec() {
|
|
return z;
|
|
}
|
|
|
|
public static int getNumOfMethodsCalledLimit() {
|
|
return h;
|
|
}
|
|
|
|
public static String getQQ(Context context) {
|
|
return com.tencent.wxop.stat.common.q.a(context, "mta.acc.qq", f);
|
|
}
|
|
|
|
public static int getReportCompressedSize() {
|
|
return o;
|
|
}
|
|
|
|
public static int getSendPeriodMinutes() {
|
|
return E;
|
|
}
|
|
|
|
public static int getSessionTimoutMillis() {
|
|
return t;
|
|
}
|
|
|
|
public static String getStatReportHost() {
|
|
return k;
|
|
}
|
|
|
|
public static String getStatReportUrl() {
|
|
return I;
|
|
}
|
|
|
|
public static StatReportStrategy getStatSendStrategy() {
|
|
return q;
|
|
}
|
|
|
|
public static boolean isAutoExceptionCaught() {
|
|
return isAutoExceptionCaught;
|
|
}
|
|
|
|
public static boolean isDebugEnable() {
|
|
return r;
|
|
}
|
|
|
|
public static boolean isEnableConcurrentProcess() {
|
|
return P;
|
|
}
|
|
|
|
public static boolean isEnableSmartReporting() {
|
|
return j;
|
|
}
|
|
|
|
public static boolean isEnableStatService() {
|
|
return s;
|
|
}
|
|
|
|
public static boolean isReportEventsByOrder() {
|
|
return l;
|
|
}
|
|
|
|
public static boolean isXGProMode() {
|
|
return R;
|
|
}
|
|
|
|
public static void setAppKey(Context context, String str) {
|
|
StatLogger statLogger;
|
|
String str2;
|
|
if (context == null) {
|
|
statLogger = p;
|
|
str2 = "ctx in StatConfig.setAppKey() is null";
|
|
} else if (str != null && str.length() <= 256) {
|
|
B = str;
|
|
return;
|
|
} else {
|
|
statLogger = p;
|
|
str2 = "appkey in StatConfig.setAppKey() is null or exceed 256 bytes";
|
|
}
|
|
statLogger.error(str2);
|
|
}
|
|
|
|
public static void setAppKey(String str) {
|
|
StatLogger statLogger;
|
|
String str2;
|
|
if (str == null) {
|
|
statLogger = p;
|
|
str2 = "appkey in StatConfig.setAppKey() is null";
|
|
} else if (str.length() <= 256) {
|
|
B = str;
|
|
return;
|
|
} else {
|
|
statLogger = p;
|
|
str2 = "The length of appkey cann't exceed 256 bytes.";
|
|
}
|
|
statLogger.error(str2);
|
|
}
|
|
|
|
public static void setAutoExceptionCaught(boolean z2) {
|
|
isAutoExceptionCaught = z2;
|
|
}
|
|
|
|
public static void setCustomLogger(g gVar) {
|
|
S = gVar;
|
|
}
|
|
|
|
public static void setCustomUserId(Context context, String str) {
|
|
if (context == null) {
|
|
p.error("Context for setCustomUid is null.");
|
|
} else {
|
|
com.tencent.wxop.stat.common.q.b(context, "MTA_CUSTOM_UID", str);
|
|
Q = str;
|
|
}
|
|
}
|
|
|
|
public static void setDebugEnable(boolean z2) {
|
|
r = z2;
|
|
com.tencent.wxop.stat.common.l.b().setDebugEnable(z2);
|
|
}
|
|
|
|
public static void setEnableConcurrentProcess(boolean z2) {
|
|
P = z2;
|
|
}
|
|
|
|
public static void setEnableSmartReporting(boolean z2) {
|
|
j = z2;
|
|
}
|
|
|
|
public static void setEnableStatService(boolean z2) {
|
|
s = z2;
|
|
if (z2) {
|
|
return;
|
|
}
|
|
p.warn("!!!!!!MTA StatService has been disabled!!!!!!");
|
|
}
|
|
|
|
public static void setFlushDBSpaceMS(long j2) {
|
|
if (j2 > 0) {
|
|
n = j2;
|
|
}
|
|
}
|
|
|
|
public static void setInstallChannel(Context context, String str) {
|
|
if (str.length() > 128) {
|
|
p.error("the length of installChannel can not exceed the range of 128 bytes.");
|
|
} else {
|
|
C = str;
|
|
}
|
|
}
|
|
|
|
public static void setInstallChannel(String str) {
|
|
C = str;
|
|
}
|
|
|
|
public static void setMaxBatchReportCount(int i2) {
|
|
if (a(i2, 2, 1000)) {
|
|
y = i2;
|
|
} else {
|
|
p.error("setMaxBatchReportCount can not exceed the range of [2,1000].");
|
|
}
|
|
}
|
|
|
|
public static void setMaxDaySessionNumbers(int i2) {
|
|
if (i2 <= 0) {
|
|
p.e("maxDaySessionNumbers must be greater than 0.");
|
|
} else {
|
|
L = i2;
|
|
}
|
|
}
|
|
|
|
public static void setMaxImportantDataSendRetryCount(int i2) {
|
|
if (i2 > 100) {
|
|
x = i2;
|
|
}
|
|
}
|
|
|
|
public static void setMaxParallelTimmingEvents(int i2) {
|
|
if (a(i2, 1, FileUtil.ZIP_BUFFER_SIZE)) {
|
|
F = i2;
|
|
} else {
|
|
p.error("setMaxParallelTimmingEvents can not exceed the range of [1, 4096].");
|
|
}
|
|
}
|
|
|
|
public static void setMaxReportEventLength(int i2) {
|
|
if (i2 <= 0) {
|
|
p.error("maxReportEventLength on setMaxReportEventLength() must greater than 0.");
|
|
} else {
|
|
O = i2;
|
|
}
|
|
}
|
|
|
|
public static void setMaxSendRetryCount(int i2) {
|
|
if (a(i2, 1, 1000)) {
|
|
w = i2;
|
|
} else {
|
|
p.error("setMaxSendRetryCount can not exceed the range of [1,1000].");
|
|
}
|
|
}
|
|
|
|
public static void setMaxSessionStatReportCount(int i2) {
|
|
if (i2 < 0) {
|
|
p.error("maxSessionStatReportCount cannot be less than 0.");
|
|
} else {
|
|
J = i2;
|
|
}
|
|
}
|
|
|
|
public static void setMaxStoreEventCount(int i2) {
|
|
if (a(i2, 0, 500000)) {
|
|
u = i2;
|
|
} else {
|
|
p.error("setMaxStoreEventCount can not exceed the range of [0, 500000].");
|
|
}
|
|
}
|
|
|
|
public static void setNumEventsCachedInMemory(int i2) {
|
|
if (i2 >= 0) {
|
|
m = i2;
|
|
}
|
|
}
|
|
|
|
public static void setNumEventsCommitPerSec(int i2) {
|
|
if (i2 > 0) {
|
|
z = i2;
|
|
}
|
|
}
|
|
|
|
public static void setNumOfMethodsCalledLimit(int i2, long j2) {
|
|
h = i2;
|
|
if (j2 >= 1000) {
|
|
i = j2;
|
|
}
|
|
}
|
|
|
|
public static void setQQ(Context context, String str) {
|
|
com.tencent.wxop.stat.common.q.b(context, "mta.acc.qq", str);
|
|
f = str;
|
|
}
|
|
|
|
public static void setReportCompressedSize(int i2) {
|
|
if (i2 > 0) {
|
|
o = i2;
|
|
}
|
|
}
|
|
|
|
public static void setReportEventsByOrder(boolean z2) {
|
|
l = z2;
|
|
}
|
|
|
|
public static void setSendPeriodMinutes(int i2) {
|
|
if (a(i2, 1, 10080)) {
|
|
E = i2;
|
|
} else {
|
|
p.error("setSendPeriodMinutes can not exceed the range of [1, 7*24*60] minutes.");
|
|
}
|
|
}
|
|
|
|
public static void setSessionTimoutMillis(int i2) {
|
|
if (a(i2, 1000, 86400000)) {
|
|
t = i2;
|
|
} else {
|
|
p.error("setSessionTimoutMillis can not exceed the range of [1000, 24 * 60 * 60 * 1000].");
|
|
}
|
|
}
|
|
|
|
public static void setStatReportUrl(String str) {
|
|
if (str == null || str.length() == 0) {
|
|
p.error("statReportUrl cannot be null or empty.");
|
|
return;
|
|
}
|
|
I = str;
|
|
try {
|
|
k = new URI(I).getHost();
|
|
} catch (Exception e2) {
|
|
p.w(e2);
|
|
}
|
|
if (isDebugEnable()) {
|
|
p.i("url:" + I + ", domain:" + k);
|
|
}
|
|
}
|
|
|
|
public static void setStatSendStrategy(StatReportStrategy statReportStrategy) {
|
|
q = statReportStrategy;
|
|
if (statReportStrategy != StatReportStrategy.PERIOD) {
|
|
StatServiceImpl.c = 0L;
|
|
}
|
|
if (isDebugEnable()) {
|
|
p.d("Change to statSendStrategy: " + statReportStrategy);
|
|
}
|
|
}
|
|
|
|
public static void setXGProMode(boolean z2) {
|
|
R = z2;
|
|
}
|
|
}
|