Initial commit

This commit is contained in:
2025-05-13 19:24:51 +02:00
commit a950f49678
10604 changed files with 932663 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
package com.tencent.wxop.stat;
import android.app.Activity;
/* loaded from: classes.dex */
public class EasyActivity extends Activity {
@Override // android.app.Activity
protected void onPause() {
super.onPause();
StatService.onPause(this);
}
@Override // android.app.Activity
protected void onResume() {
super.onResume();
StatService.onResume(this);
}
}

View File

@@ -0,0 +1,18 @@
package com.tencent.wxop.stat;
import android.app.ListActivity;
/* loaded from: classes.dex */
public class EasyListActivity extends ListActivity {
@Override // android.app.Activity
protected void onPause() {
super.onPause();
StatService.onPause(this);
}
@Override // android.app.Activity
protected void onResume() {
super.onResume();
StatService.onResume(this);
}
}

View File

@@ -0,0 +1,19 @@
package com.tencent.wxop.stat;
/* loaded from: classes.dex */
public class MtaSDkException extends Exception {
public MtaSDkException() {
}
public MtaSDkException(String str) {
super(str);
}
public MtaSDkException(String str, Throwable th) {
super(str, th);
}
public MtaSDkException(Throwable th) {
super(th);
}
}

View File

@@ -0,0 +1,71 @@
package com.tencent.wxop.stat;
import org.json.JSONException;
import org.json.JSONObject;
/* loaded from: classes.dex */
public class NetworkMonitor {
private long a = 0;
private int b = 0;
private String c = "";
private int d = 0;
private String e = "";
public String getDomain() {
return this.c;
}
public long getMillisecondsConsume() {
return this.a;
}
public int getPort() {
return this.d;
}
public String getRemoteIp() {
return this.e;
}
public int getStatusCode() {
return this.b;
}
public void setDomain(String str) {
this.c = str;
}
public void setMillisecondsConsume(long j) {
this.a = j;
}
public void setPort(int i) {
this.d = i;
}
public void setRemoteIp(String str) {
this.e = str;
}
public void setStatusCode(int i) {
this.b = i;
}
public JSONObject toJSONObject() {
JSONObject jSONObject = new JSONObject();
try {
jSONObject.put("tm", this.a);
jSONObject.put("st", this.b);
if (this.c != null) {
jSONObject.put("dm", this.c);
}
jSONObject.put("pt", this.d);
if (this.e != null) {
jSONObject.put("rip", this.e);
}
jSONObject.put("ts", System.currentTimeMillis() / 1000);
} catch (JSONException unused) {
}
return jSONObject;
}
}

View File

@@ -0,0 +1,88 @@
package com.tencent.wxop.stat;
import org.json.JSONException;
import org.json.JSONObject;
/* loaded from: classes.dex */
public class StatAccount {
public static final int CUSTOM_TYPE = 7;
public static final int DEFAULT_TYPE = 0;
public static final int EMAIL_TYPE = 6;
public static final int PHONE_NUM_TYPE = 5;
public static final int QQ_NUM_TYPE = 1;
public static final int QQ_OPENID_TYPE = 3;
public static final int WECHAT_ID_TYPE = 2;
public static final int WECHAT_OPENID_TYPE = 4;
private String a;
private int b;
private String c;
private String d;
public StatAccount(String str) {
this.a = "";
this.b = 0;
this.c = "";
this.d = "";
this.a = str;
}
public StatAccount(String str, int i) {
this.a = "";
this.b = 0;
this.c = "";
this.d = "";
this.a = str;
this.b = i;
}
public String getAccount() {
return this.a;
}
public int getAccountType() {
return this.b;
}
public String getExt() {
return this.c;
}
public String getExt1() {
return this.d;
}
public void setAccount(String str) {
this.a = str;
}
public void setAccountType(int i) {
this.b = i;
}
public void setExt(String str) {
this.c = str;
}
public void setExt1(String str) {
this.d = str;
}
public String toJsonString() {
JSONObject jSONObject = new JSONObject();
if (com.tencent.wxop.stat.common.l.c(this.a)) {
try {
com.tencent.wxop.stat.common.r.a(jSONObject, "a", this.a);
jSONObject.put("t", this.b);
com.tencent.wxop.stat.common.r.a(jSONObject, "e", this.c);
com.tencent.wxop.stat.common.r.a(jSONObject, "e1", this.d);
} catch (JSONException e) {
e.printStackTrace();
}
}
return jSONObject.toString();
}
public String toString() {
return "StatAccount [account=" + this.a + ", accountType=" + this.b + ", ext=" + this.c + ", ext1=" + this.d + "]";
}
}

View File

@@ -0,0 +1,111 @@
package com.tencent.wxop.stat;
/* loaded from: classes.dex */
public class StatAppMonitor implements Cloneable {
public static final int FAILURE_RESULT_TYPE = 1;
public static final int LOGIC_FAILURE_RESULT_TYPE = 2;
public static final int SUCCESS_RESULT_TYPE = 0;
private String a;
private long b;
private long c;
private int d;
private long e;
private int f;
private int g;
public StatAppMonitor(String str) {
this.a = null;
this.b = 0L;
this.c = 0L;
this.d = 0;
this.e = 0L;
this.f = 0;
this.g = 1;
this.a = str;
}
public StatAppMonitor(String str, int i, int i2, long j, long j2, long j3, int i3) {
this.a = null;
this.b = 0L;
this.c = 0L;
this.d = 0;
this.e = 0L;
this.f = 0;
this.g = 1;
this.a = str;
this.b = j;
this.c = j2;
this.d = i;
this.e = j3;
this.f = i2;
this.g = i3;
}
/* renamed from: clone, reason: merged with bridge method [inline-methods] */
public StatAppMonitor m17clone() {
try {
return (StatAppMonitor) super.clone();
} catch (CloneNotSupportedException unused) {
return null;
}
}
public String getInterfaceName() {
return this.a;
}
public long getMillisecondsConsume() {
return this.e;
}
public long getReqSize() {
return this.b;
}
public long getRespSize() {
return this.c;
}
public int getResultType() {
return this.d;
}
public int getReturnCode() {
return this.f;
}
public int getSampling() {
return this.g;
}
public void setInterfaceName(String str) {
this.a = str;
}
public void setMillisecondsConsume(long j) {
this.e = j;
}
public void setReqSize(long j) {
this.b = j;
}
public void setRespSize(long j) {
this.c = j;
}
public void setResultType(int i) {
this.d = i;
}
public void setReturnCode(int i) {
this.f = i;
}
public void setSampling(int i) {
if (i <= 0) {
i = 1;
}
this.g = i;
}
}

View File

@@ -0,0 +1,645 @@
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;
}
}

View File

@@ -0,0 +1,60 @@
package com.tencent.wxop.stat;
/* loaded from: classes.dex */
public class StatGameUser implements Cloneable {
private String a;
private String b;
private String c;
public StatGameUser() {
this.a = "";
this.b = "";
this.c = "";
}
public StatGameUser(String str, String str2, String str3) {
this.a = "";
this.b = "";
this.c = "";
this.b = str;
this.a = str2;
this.c = str3;
}
/* renamed from: clone, reason: merged with bridge method [inline-methods] */
public StatGameUser m18clone() {
try {
return (StatGameUser) super.clone();
} catch (CloneNotSupportedException unused) {
return null;
}
}
public String getAccount() {
return this.b;
}
public String getLevel() {
return this.c;
}
public String getWorldName() {
return this.a;
}
public void setAccount(String str) {
this.b = str;
}
public void setLevel(String str) {
this.c = str;
}
public void setWorldName(String str) {
this.a = str;
}
public String toString() {
return "StatGameUser [worldName=" + this.a + ", account=" + this.b + ", level=" + this.c + "]";
}
}

View File

@@ -0,0 +1,31 @@
package com.tencent.wxop.stat;
/* loaded from: classes.dex */
public enum StatReportStrategy {
INSTANT(1),
ONLY_WIFI(2),
BATCH(3),
APP_LAUNCH(4),
DEVELOPER(5),
PERIOD(6),
ONLY_WIFI_NO_CACHE(7);
int a;
StatReportStrategy(int i) {
this.a = i;
}
public static StatReportStrategy getStatReportStrategy(int i) {
for (StatReportStrategy statReportStrategy : values()) {
if (i == statReportStrategy.a()) {
return statReportStrategy;
}
}
return null;
}
public final int a() {
return this.a;
}
}

View File

@@ -0,0 +1,128 @@
package com.tencent.wxop.stat;
import android.content.Context;
import java.util.Map;
import java.util.Properties;
/* loaded from: classes.dex */
public class StatService {
public static void commitEvents(Context context, int i) {
StatServiceImpl.commitEvents(context, i);
}
public static void flushDataToDB(Context context) {
StatServiceImpl.flushDataToDB(context);
}
public static Properties getCommonKeyValueForKVEvent(String str) {
return StatServiceImpl.getCommonKeyValueForKVEvent(str);
}
public static void onLowMemory(Context context) {
StatServiceImpl.onLowMemory(context);
}
public static void onPause(Context context) {
StatServiceImpl.onPause(context, null);
}
public static void onResume(Context context) {
StatServiceImpl.onResume(context, null);
}
public static void onStop(Context context) {
StatServiceImpl.onStop(context, null);
}
public static void reportAccount(Context context, StatAccount statAccount) {
StatServiceImpl.reportAccount(context, statAccount, null);
}
public static void reportAppMonitorStat(Context context, StatAppMonitor statAppMonitor) {
StatServiceImpl.reportAppMonitorStat(context, statAppMonitor, null);
}
public static void reportError(Context context, String str) {
StatServiceImpl.reportError(context, str, null);
}
public static void reportException(Context context, Throwable th) {
StatServiceImpl.reportException(context, th, null);
}
public static void reportGameUser(Context context, StatGameUser statGameUser) {
StatServiceImpl.reportGameUser(context, statGameUser, null);
}
public static void reportQQ(Context context, String str) {
StatServiceImpl.reportQQ(context, str, null);
}
public static void setCommonKeyValueForKVEvent(String str, Properties properties) {
StatServiceImpl.setCommonKeyValueForKVEvent(str, properties);
}
public static void setContext(Context context) {
StatServiceImpl.setContext(context);
}
public static void setEnvAttributes(Context context, Map<String, String> map) {
StatServiceImpl.setEnvAttributes(context, map);
}
public static void startNewSession(Context context) {
StatServiceImpl.startNewSession(context, null);
}
public static boolean startStatService(Context context, String str, String str2) {
return StatServiceImpl.startStatService(context, str, str2, null);
}
public static void stopSession() {
StatServiceImpl.stopSession();
}
public static void testSpeed(Context context) {
StatServiceImpl.testSpeed(context);
}
public static void testSpeed(Context context, Map<String, Integer> map) {
StatServiceImpl.testSpeed(context, map, null);
}
public static void trackBeginPage(Context context, String str) {
StatServiceImpl.trackBeginPage(context, str, null);
}
public static void trackCustomBeginEvent(Context context, String str, String... strArr) {
StatServiceImpl.trackCustomBeginEvent(context, str, null, strArr);
}
public static void trackCustomBeginKVEvent(Context context, String str, Properties properties) {
StatServiceImpl.trackCustomBeginKVEvent(context, str, properties, null);
}
public static void trackCustomEndEvent(Context context, String str, String... strArr) {
StatServiceImpl.trackCustomEndEvent(context, str, null, strArr);
}
public static void trackCustomEndKVEvent(Context context, String str, Properties properties) {
StatServiceImpl.trackCustomEndKVEvent(context, str, properties, null);
}
public static void trackCustomEvent(Context context, String str, String... strArr) {
StatServiceImpl.trackCustomEvent(context, str, null, strArr);
}
public static void trackCustomKVEvent(Context context, String str, Properties properties) {
StatServiceImpl.trackCustomKVEvent(context, str, properties, null);
}
public static void trackCustomKVTimeIntervalEvent(Context context, int i, String str, Properties properties) {
StatServiceImpl.trackCustomKVTimeIntervalEvent(context, str, properties, i, null);
}
public static void trackEndPage(Context context, String str) {
StatServiceImpl.trackEndPage(context, str, null);
}
}

View File

@@ -0,0 +1,680 @@
package com.tencent.wxop.stat;
import android.content.Context;
import com.tencent.wxop.stat.common.StatConstants;
import com.tencent.wxop.stat.common.StatLogger;
import java.lang.Thread;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import java.util.concurrent.ConcurrentHashMap;
import org.json.JSONException;
import org.json.JSONObject;
/* loaded from: classes.dex */
public class StatServiceImpl {
private static com.tencent.wxop.stat.common.e d;
private static volatile Map<com.tencent.wxop.stat.event.c, Long> e = new ConcurrentHashMap();
private static volatile Map<String, Properties> f = new ConcurrentHashMap();
private static volatile Map<Integer, Integer> g = new ConcurrentHashMap(10);
private static volatile long h = 0;
private static volatile long i = 0;
private static volatile long j = 0;
private static String k = "";
private static volatile int l = 0;
private static volatile String m = "";
private static volatile String n = "";
private static Map<String, Long> o = new ConcurrentHashMap();
private static Map<String, Long> p = new ConcurrentHashMap();
private static StatLogger q = com.tencent.wxop.stat.common.l.b();
private static Thread.UncaughtExceptionHandler r = null;
private static volatile boolean s = true;
static volatile int a = 0;
static volatile long b = 0;
private static Context t = null;
static volatile long c = 0;
static int a(Context context, boolean z, StatSpecifyReportedInfo statSpecifyReportedInfo) {
long currentTimeMillis = System.currentTimeMillis();
boolean z2 = z && currentTimeMillis - i >= ((long) StatConfig.getSessionTimoutMillis());
i = currentTimeMillis;
if (j == 0) {
j = com.tencent.wxop.stat.common.l.c();
}
if (currentTimeMillis >= j) {
j = com.tencent.wxop.stat.common.l.c();
if (au.a(context).b(context).d() != 1) {
au.a(context).b(context).a(1);
}
StatConfig.b(0);
a = 0;
k = com.tencent.wxop.stat.common.l.a(0);
z2 = true;
}
String str = k;
if (com.tencent.wxop.stat.common.l.a(statSpecifyReportedInfo)) {
str = statSpecifyReportedInfo.getAppKey() + k;
}
if (!p.containsKey(str)) {
z2 = true;
}
if (z2) {
if (com.tencent.wxop.stat.common.l.a(statSpecifyReportedInfo)) {
a(context, statSpecifyReportedInfo);
} else if (StatConfig.c() < StatConfig.getMaxDaySessionNumbers()) {
com.tencent.wxop.stat.common.l.v(context);
a(context, (StatSpecifyReportedInfo) null);
} else {
q.e("Exceed StatConfig.getMaxDaySessionNumbers().");
}
p.put(str, 1L);
}
if (s) {
testSpeed(context);
s = false;
}
return l;
}
static synchronized void a(Context context) {
synchronized (StatServiceImpl.class) {
if (context == null) {
return;
}
if (d == null) {
if (!b(context)) {
return;
}
Context applicationContext = context.getApplicationContext();
t = applicationContext;
d = new com.tencent.wxop.stat.common.e();
k = com.tencent.wxop.stat.common.l.a(0);
h = System.currentTimeMillis() + StatConfig.i;
d.a(new l(applicationContext));
}
}
}
static void a(Context context, StatSpecifyReportedInfo statSpecifyReportedInfo) {
if (c(context) != null) {
if (StatConfig.isDebugEnable()) {
q.d("start new session.");
}
if (statSpecifyReportedInfo == null || l == 0) {
l = com.tencent.wxop.stat.common.l.a();
}
StatConfig.a(0);
StatConfig.b();
new aq(new com.tencent.wxop.stat.event.k(context, l, b(), statSpecifyReportedInfo)).a();
}
}
static void a(Context context, Throwable th) {
if (StatConfig.isEnableStatService()) {
Context context2 = getContext(context);
if (context2 == null) {
q.error("The Context of StatService.reportSdkSelfException() can not be null!");
} else if (c(context2) != null) {
d.a(new q(context2, th));
}
}
}
static boolean a() {
if (a < 2) {
return false;
}
b = System.currentTimeMillis();
return true;
}
static boolean a(String str) {
return str == null || str.length() == 0;
}
static JSONObject b() {
JSONObject jSONObject = new JSONObject();
try {
JSONObject jSONObject2 = new JSONObject();
if (StatConfig.b.d != 0) {
jSONObject2.put("v", StatConfig.b.d);
}
jSONObject.put(Integer.toString(StatConfig.b.a), jSONObject2);
JSONObject jSONObject3 = new JSONObject();
if (StatConfig.a.d != 0) {
jSONObject3.put("v", StatConfig.a.d);
}
jSONObject.put(Integer.toString(StatConfig.a.a), jSONObject3);
} catch (JSONException e2) {
q.e((Throwable) e2);
}
return jSONObject;
}
/* JADX INFO: Access modifiers changed from: private */
public static void b(Context context, StatAccount statAccount, StatSpecifyReportedInfo statSpecifyReportedInfo) {
try {
new aq(new com.tencent.wxop.stat.event.a(context, a(context, false, statSpecifyReportedInfo), statAccount, statSpecifyReportedInfo)).a();
} catch (Throwable th) {
q.e(th);
a(context, th);
}
}
static boolean b(Context context) {
boolean z;
long a2 = com.tencent.wxop.stat.common.q.a(context, StatConfig.c, 0L);
long b2 = com.tencent.wxop.stat.common.l.b(StatConstants.VERSION);
boolean z2 = false;
if (b2 <= a2) {
q.error("MTA is disable for current version:" + b2 + ",wakeup version:" + a2);
z = false;
} else {
z = true;
}
long a3 = com.tencent.wxop.stat.common.q.a(context, StatConfig.d, 0L);
if (a3 > System.currentTimeMillis()) {
q.error("MTA is disable for current time:" + System.currentTimeMillis() + ",wakeup time:" + a3);
} else {
z2 = z;
}
StatConfig.setEnableStatService(z2);
return z2;
}
static com.tencent.wxop.stat.common.e c(Context context) {
if (d == null) {
synchronized (StatServiceImpl.class) {
if (d == null) {
try {
a(context);
} catch (Throwable th) {
q.error(th);
StatConfig.setEnableStatService(false);
}
}
}
}
return d;
}
static void c() {
a = 0;
b = 0L;
}
public static void commitEvents(Context context, int i2) {
StatLogger statLogger;
String str;
if (StatConfig.isEnableStatService()) {
if (StatConfig.isDebugEnable()) {
q.i("commitEvents, maxNumber=" + i2);
}
Context context2 = getContext(context);
if (context2 == null) {
statLogger = q;
str = "The Context of StatService.commitEvents() can not be null!";
} else {
if (i2 >= -1 && i2 != 0) {
if (a.a(t).f() && c(context2) != null) {
d.a(new ad(context2, i2));
return;
}
return;
}
statLogger = q;
str = "The maxNumber of StatService.commitEvents() should be -1 or bigger than 0.";
}
statLogger.error(str);
}
}
static void d() {
a++;
b = System.currentTimeMillis();
flushDataToDB(t);
}
static void d(Context context) {
if (StatConfig.isEnableStatService()) {
Context context2 = getContext(context);
if (context2 == null) {
q.error("The Context of StatService.sendNetworkDetector() can not be null!");
return;
}
try {
i.b(context2).a(new com.tencent.wxop.stat.event.h(context2), new t());
} catch (Throwable th) {
q.e(th);
}
}
}
static void e(Context context) {
c = System.currentTimeMillis() + (StatConfig.getSendPeriodMinutes() * 60000);
com.tencent.wxop.stat.common.q.b(context, "last_period_ts", c);
commitEvents(context, -1);
}
public static void flushDataToDB(Context context) {
if (StatConfig.isEnableStatService() && StatConfig.m > 0) {
Context context2 = getContext(context);
if (context2 == null) {
q.error("The Context of StatService.testSpeed() can not be null!");
} else {
au.a(context2).c();
}
}
}
public static Properties getCommonKeyValueForKVEvent(String str) {
return f.get(str);
}
public static Context getContext(Context context) {
return context != null ? context : t;
}
public static void onLowMemory(Context context) {
if (StatConfig.isEnableStatService() && c(getContext(context)) != null) {
d.a(new o(context));
}
}
public static void onPause(Context context, StatSpecifyReportedInfo statSpecifyReportedInfo) {
if (StatConfig.isEnableStatService() && c(context) != null) {
d.a(new m(context, statSpecifyReportedInfo));
}
}
public static void onResume(Context context, StatSpecifyReportedInfo statSpecifyReportedInfo) {
if (StatConfig.isEnableStatService() && c(context) != null) {
d.a(new aj(context, statSpecifyReportedInfo));
}
}
public static void onStop(Context context, StatSpecifyReportedInfo statSpecifyReportedInfo) {
if (StatConfig.isEnableStatService()) {
Context context2 = getContext(context);
if (c(context2) != null) {
d.a(new n(context2));
}
}
}
public static void reportAccount(Context context, StatAccount statAccount, StatSpecifyReportedInfo statSpecifyReportedInfo) {
if (StatConfig.isEnableStatService()) {
Context context2 = getContext(context);
if (context2 == null) {
q.e("context is null in reportAccount.");
} else if (c(context2) != null) {
d.a(new al(statAccount, context2, statSpecifyReportedInfo));
}
}
}
public static void reportAppMonitorStat(Context context, StatAppMonitor statAppMonitor, StatSpecifyReportedInfo statSpecifyReportedInfo) {
StatLogger statLogger;
String str;
if (StatConfig.isEnableStatService()) {
Context context2 = getContext(context);
if (context2 == null) {
statLogger = q;
str = "The Context of StatService.reportAppMonitorStat() can not be null!";
} else if (statAppMonitor == null) {
statLogger = q;
str = "The StatAppMonitor of StatService.reportAppMonitorStat() can not be null!";
} else {
if (statAppMonitor.getInterfaceName() != null) {
StatAppMonitor m17clone = statAppMonitor.m17clone();
if (c(context2) != null) {
d.a(new aa(context2, statSpecifyReportedInfo, m17clone));
return;
}
return;
}
statLogger = q;
str = "The interfaceName of StatAppMonitor on StatService.reportAppMonitorStat() can not be null!";
}
statLogger.error(str);
}
}
public static void reportError(Context context, String str, StatSpecifyReportedInfo statSpecifyReportedInfo) {
if (StatConfig.isEnableStatService()) {
Context context2 = getContext(context);
if (context2 == null) {
q.error("The Context of StatService.reportError() can not be null!");
} else if (c(context2) != null) {
d.a(new p(str, context2, statSpecifyReportedInfo));
}
}
}
public static void reportException(Context context, Throwable th, StatSpecifyReportedInfo statSpecifyReportedInfo) {
if (StatConfig.isEnableStatService()) {
Context context2 = getContext(context);
if (context2 == null) {
q.error("The Context of StatService.reportException() can not be null!");
} else if (c(context2) != null) {
d.a(new r(th, context2, statSpecifyReportedInfo));
}
}
}
public static void reportGameUser(Context context, StatGameUser statGameUser, StatSpecifyReportedInfo statSpecifyReportedInfo) {
if (StatConfig.isEnableStatService()) {
Context context2 = getContext(context);
if (context2 == null) {
q.error("The Context of StatService.reportGameUser() can not be null!");
} else if (c(context2) != null) {
d.a(new am(statGameUser, context2, statSpecifyReportedInfo));
}
}
}
public static void reportQQ(Context context, String str, StatSpecifyReportedInfo statSpecifyReportedInfo) {
if (StatConfig.isEnableStatService()) {
Context context2 = getContext(context);
if (context2 == null) {
q.error("context is null in reportQQ()");
} else if (c(context2) != null) {
d.a(new ak(str, context2, statSpecifyReportedInfo));
}
}
}
public static void setCommonKeyValueForKVEvent(String str, Properties properties) {
if (!com.tencent.wxop.stat.common.l.c(str)) {
q.e("event_id or commonProp for setCommonKeyValueForKVEvent is invalid.");
} else if (properties == null || properties.size() <= 0) {
f.remove(str);
} else {
f.put(str, (Properties) properties.clone());
}
}
public static void setContext(Context context) {
if (context != null) {
t = context.getApplicationContext();
}
}
public static void setEnvAttributes(Context context, Map<String, String> map) {
if (map == null || map.size() > 512) {
q.error("The map in setEnvAttributes can't be null or its size can't exceed 512.");
return;
}
try {
com.tencent.wxop.stat.common.b.a(context, map);
} catch (JSONException e2) {
q.e((Throwable) e2);
}
}
public static void startNewSession(Context context, StatSpecifyReportedInfo statSpecifyReportedInfo) {
if (StatConfig.isEnableStatService()) {
Context context2 = getContext(context);
if (context2 == null) {
q.error("The Context of StatService.startNewSession() can not be null!");
} else if (c(context2) != null) {
d.a(new ai(context2, statSpecifyReportedInfo));
}
}
}
public static boolean startStatService(Context context, String str, String str2, StatSpecifyReportedInfo statSpecifyReportedInfo) {
try {
if (!StatConfig.isEnableStatService()) {
q.error("MTA StatService is disable.");
return false;
}
if (StatConfig.isDebugEnable()) {
q.d("MTA SDK version, current: " + StatConstants.VERSION + " ,required: " + str2);
}
if (context != null && str2 != null) {
if (com.tencent.wxop.stat.common.l.b(StatConstants.VERSION) >= com.tencent.wxop.stat.common.l.b(str2)) {
String installChannel = StatConfig.getInstallChannel(context);
if (installChannel == null || installChannel.length() == 0) {
StatConfig.setInstallChannel("-");
}
if (str != null) {
StatConfig.setAppKey(context, str);
}
if (c(context) == null) {
return true;
}
d.a(new an(context, statSpecifyReportedInfo));
return true;
}
q.error(("MTA SDK version conflicted, current: " + StatConstants.VERSION + ",required: " + str2) + ". please delete the current SDK and download the latest one. official website: http://mta.qq.com/ or http://mta.oa.com/");
StatConfig.setEnableStatService(false);
return false;
}
q.error("Context or mtaSdkVersion in StatService.startStatService() is null, please check it!");
StatConfig.setEnableStatService(false);
return false;
} catch (Throwable th) {
q.e(th);
return false;
}
}
public static void stopSession() {
i = 0L;
}
public static void testSpeed(Context context) {
if (StatConfig.isEnableStatService()) {
Context context2 = getContext(context);
if (context2 == null) {
q.error("The Context of StatService.testSpeed() can not be null!");
} else if (c(context2) != null) {
d.a(new ae(context2));
}
}
}
public static void testSpeed(Context context, Map<String, Integer> map, StatSpecifyReportedInfo statSpecifyReportedInfo) {
StatLogger statLogger;
String str;
if (StatConfig.isEnableStatService()) {
Context context2 = getContext(context);
if (context2 == null) {
statLogger = q;
str = "The Context of StatService.testSpeed() can not be null!";
} else {
if (map != null && map.size() != 0) {
HashMap hashMap = new HashMap(map);
if (c(context2) != null) {
d.a(new af(context2, hashMap, statSpecifyReportedInfo));
return;
}
return;
}
statLogger = q;
str = "The domainMap of StatService.testSpeed() can not be null or empty!";
}
statLogger.error(str);
}
}
public static void trackBeginPage(Context context, String str, StatSpecifyReportedInfo statSpecifyReportedInfo) {
if (StatConfig.isEnableStatService()) {
Context context2 = getContext(context);
if (context2 == null || str == null || str.length() == 0) {
q.error("The Context or pageName of StatService.trackBeginPage() can not be null or empty!");
return;
}
String str2 = new String(str);
if (c(context2) != null) {
d.a(new w(str2, context2, statSpecifyReportedInfo));
}
}
}
public static void trackCustomBeginEvent(Context context, String str, StatSpecifyReportedInfo statSpecifyReportedInfo, String... strArr) {
if (StatConfig.isEnableStatService()) {
Context context2 = getContext(context);
if (context2 == null) {
q.error("The Context of StatService.trackCustomBeginEvent() can not be null!");
return;
}
com.tencent.wxop.stat.event.c cVar = new com.tencent.wxop.stat.event.c(str, strArr, null);
if (c(context2) != null) {
d.a(new v(str, cVar, context2));
}
}
}
public static void trackCustomBeginKVEvent(Context context, String str, Properties properties, StatSpecifyReportedInfo statSpecifyReportedInfo) {
if (StatConfig.isEnableStatService()) {
Context context2 = getContext(context);
if (context2 == null) {
q.error("The Context of StatService.trackCustomBeginEvent() can not be null!");
return;
}
com.tencent.wxop.stat.event.c cVar = new com.tencent.wxop.stat.event.c(str, null, properties);
if (c(context2) != null) {
d.a(new y(str, cVar, context2));
}
}
}
public static void trackCustomEndEvent(Context context, String str, StatSpecifyReportedInfo statSpecifyReportedInfo, String... strArr) {
if (StatConfig.isEnableStatService()) {
Context context2 = getContext(context);
if (context2 == null) {
q.error("The Context of StatService.trackCustomEndEvent() can not be null!");
return;
}
com.tencent.wxop.stat.event.c cVar = new com.tencent.wxop.stat.event.c(str, strArr, null);
if (c(context2) != null) {
d.a(new x(str, cVar, context2, statSpecifyReportedInfo));
}
}
}
public static void trackCustomEndKVEvent(Context context, String str, Properties properties, StatSpecifyReportedInfo statSpecifyReportedInfo) {
if (StatConfig.isEnableStatService()) {
Context context2 = getContext(context);
if (context2 == null) {
q.error("The Context of StatService.trackCustomEndEvent() can not be null!");
return;
}
com.tencent.wxop.stat.event.c cVar = new com.tencent.wxop.stat.event.c(str, null, properties);
if (c(context2) != null) {
d.a(new z(str, cVar, context2, statSpecifyReportedInfo));
}
}
}
public static void trackCustomEvent(Context context, String str, StatSpecifyReportedInfo statSpecifyReportedInfo, String... strArr) {
StatLogger statLogger;
String str2;
if (StatConfig.isEnableStatService()) {
Context context2 = getContext(context);
if (context2 == null) {
statLogger = q;
str2 = "The Context of StatService.trackCustomEvent() can not be null!";
} else {
if (!a(str)) {
com.tencent.wxop.stat.event.c cVar = new com.tencent.wxop.stat.event.c(str, strArr, null);
if (c(context2) != null) {
d.a(new s(context2, statSpecifyReportedInfo, cVar));
return;
}
return;
}
statLogger = q;
str2 = "The event_id of StatService.trackCustomEvent() can not be null or empty.";
}
statLogger.error(str2);
}
}
public static void trackCustomKVEvent(Context context, String str, Properties properties, StatSpecifyReportedInfo statSpecifyReportedInfo) {
StatLogger statLogger;
String str2;
if (StatConfig.isEnableStatService()) {
Context context2 = getContext(context);
if (context2 == null) {
statLogger = q;
str2 = "The Context of StatService.trackCustomEvent() can not be null!";
} else {
if (!a(str)) {
com.tencent.wxop.stat.event.c cVar = new com.tencent.wxop.stat.event.c(str, null, properties);
if (c(context2) != null) {
d.a(new u(context2, statSpecifyReportedInfo, cVar));
return;
}
return;
}
statLogger = q;
str2 = "The event_id of StatService.trackCustomEvent() can not be null or empty.";
}
statLogger.error(str2);
}
}
public static void trackCustomKVTimeIntervalEvent(Context context, String str, Properties properties, int i2, StatSpecifyReportedInfo statSpecifyReportedInfo) {
StatLogger statLogger;
String str2;
if (StatConfig.isEnableStatService()) {
Context context2 = getContext(context);
if (context2 == null) {
statLogger = q;
str2 = "The Context of StatService.trackCustomEndEvent() can not be null!";
} else {
if (!a(str)) {
com.tencent.wxop.stat.event.c cVar = new com.tencent.wxop.stat.event.c(str, null, properties);
if (c(context2) != null) {
d.a(new ac(context2, statSpecifyReportedInfo, cVar, i2));
return;
}
return;
}
statLogger = q;
str2 = "The event_id of StatService.trackCustomEndEvent() can not be null or empty.";
}
statLogger.error(str2);
}
}
public static void trackCustomTimeIntervalEvent(Context context, int i2, String str, String... strArr) {
StatLogger statLogger;
String str2;
if (StatConfig.isEnableStatService()) {
if (i2 <= 0) {
statLogger = q;
str2 = "The intervalSecond of StatService.trackCustomTimeIntervalEvent() can must bigger than 0!";
} else {
Context context2 = getContext(context);
if (context2 != null) {
if (c(context2) != null) {
d.a(new ab());
return;
}
return;
}
statLogger = q;
str2 = "The Context of StatService.trackCustomTimeIntervalEvent() can not be null!";
}
statLogger.error(str2);
}
}
public static void trackEndPage(Context context, String str, StatSpecifyReportedInfo statSpecifyReportedInfo) {
if (StatConfig.isEnableStatService()) {
Context context2 = getContext(context);
if (context2 == null || str == null || str.length() == 0) {
q.error("The Context or pageName of StatService.trackEndPage() can not be null or empty!");
return;
}
String str2 = new String(str);
if (c(context2) != null) {
d.a(new ah(context2, str2, statSpecifyReportedInfo));
}
}
}
}

View File

@@ -0,0 +1,54 @@
package com.tencent.wxop.stat;
/* loaded from: classes.dex */
public class StatSpecifyReportedInfo {
private String a = null;
private String b = null;
private String c = null;
private boolean d = false;
private boolean e = false;
public String getAppKey() {
return this.a;
}
public String getInstallChannel() {
return this.b;
}
public String getVersion() {
return this.c;
}
public boolean isImportant() {
return this.e;
}
public boolean isSendImmediately() {
return this.d;
}
public void setAppKey(String str) {
this.a = str;
}
public void setImportant(boolean z) {
this.e = z;
}
public void setInstallChannel(String str) {
this.b = str;
}
public void setSendImmediately(boolean z) {
this.d = z;
}
public void setVersion(String str) {
this.c = str;
}
public String toString() {
return "StatSpecifyReportedInfo [appKey=" + this.a + ", installChannel=" + this.b + ", version=" + this.c + ", sendImmediately=" + this.d + ", isImportant=" + this.e + "]";
}
}

View File

@@ -0,0 +1,191 @@
package com.tencent.wxop.stat;
import android.content.Context;
import android.content.IntentFilter;
import com.tencent.wxop.stat.common.StatConstants;
import com.tencent.wxop.stat.common.StatLogger;
import java.net.InetAddress;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Random;
import java.util.regex.Pattern;
import org.apache.http.HttpHost;
import org.json.JSONObject;
/* loaded from: classes.dex */
public class a {
private static a g;
private com.tencent.wxop.stat.common.e e;
private Context h;
private StatLogger i;
private List<String> a = null;
private volatile int b = 2;
private volatile String c = "";
private volatile HttpHost d = null;
private int f = 0;
private a(Context context) {
this.e = null;
this.h = null;
this.i = null;
this.h = context.getApplicationContext();
this.e = new com.tencent.wxop.stat.common.e();
i.a(context);
this.i = com.tencent.wxop.stat.common.l.b();
l();
i();
g();
}
public static a a(Context context) {
if (g == null) {
synchronized (a.class) {
if (g == null) {
g = new a(context);
}
}
}
return g;
}
private boolean b(String str) {
return Pattern.compile("(2[5][0-5]|2[0-4]\\d|1\\d{2}|\\d{1,2})\\.(25[0-5]|2[0-4]\\d|1\\d{2}|\\d{1,2})\\.(25[0-5]|2[0-4]\\d|1\\d{2}|\\d{1,2})\\.(25[0-5]|2[0-4]\\d|1\\d{2}|\\d{1,2})").matcher(str).matches();
}
private void i() {
this.a = new ArrayList(10);
this.a.add("117.135.169.101");
this.a.add("140.207.54.125");
this.a.add("180.153.8.53");
this.a.add("120.198.203.175");
this.a.add("14.17.43.18");
this.a.add("163.177.71.186");
this.a.add("111.30.131.31");
this.a.add("123.126.121.167");
this.a.add("123.151.152.111");
this.a.add("113.142.45.79");
this.a.add("123.138.162.90");
this.a.add("103.7.30.94");
}
private String j() {
try {
return !b(StatConstants.MTA_SERVER_HOST) ? InetAddress.getByName(StatConstants.MTA_SERVER_HOST).getHostAddress() : "";
} catch (Exception e) {
this.i.e((Throwable) e);
return "";
}
}
private void k() {
String j = j();
if (StatConfig.isDebugEnable()) {
this.i.i("remoteIp ip is " + j);
}
if (com.tencent.wxop.stat.common.l.c(j)) {
if (!this.a.contains(j)) {
String str = this.a.get(this.f);
if (StatConfig.isDebugEnable()) {
this.i.w(j + " not in ip list, change to:" + str);
}
j = str;
}
StatConfig.setStatReportUrl("http://" + j + ":80/mstat/report");
}
}
private void l() {
this.b = 0;
this.d = null;
this.c = null;
}
public HttpHost a() {
return this.d;
}
public void a(String str) {
if (StatConfig.isDebugEnable()) {
this.i.i("updateIpList " + str);
}
try {
if (com.tencent.wxop.stat.common.l.c(str)) {
JSONObject jSONObject = new JSONObject(str);
if (jSONObject.length() > 0) {
Iterator<String> keys = jSONObject.keys();
while (keys.hasNext()) {
String string = jSONObject.getString(keys.next());
if (com.tencent.wxop.stat.common.l.c(string)) {
for (String str2 : string.split(";")) {
if (com.tencent.wxop.stat.common.l.c(str2)) {
String[] split = str2.split(":");
if (split.length > 1) {
String str3 = split[0];
if (b(str3) && !this.a.contains(str3)) {
if (StatConfig.isDebugEnable()) {
this.i.i("add new ip:" + str3);
}
this.a.add(str3);
}
}
}
}
}
}
}
}
} catch (Exception e) {
this.i.e((Throwable) e);
}
this.f = new Random().nextInt(this.a.size());
}
public String b() {
return this.c;
}
public int c() {
return this.b;
}
public void d() {
this.f = (this.f + 1) % this.a.size();
}
public boolean e() {
return this.b == 1;
}
public boolean f() {
return this.b != 0;
}
void g() {
if (!com.tencent.wxop.stat.common.r.f(this.h)) {
if (StatConfig.isDebugEnable()) {
this.i.i("NETWORK TYPE: network is close.");
}
l();
return;
}
if (StatConfig.g) {
k();
}
this.c = com.tencent.wxop.stat.common.l.j(this.h);
if (StatConfig.isDebugEnable()) {
this.i.i("NETWORK name:" + this.c);
}
if (com.tencent.wxop.stat.common.l.c(this.c)) {
this.b = "WIFI".equalsIgnoreCase(this.c) ? 1 : 2;
this.d = com.tencent.wxop.stat.common.l.a(this.h);
}
if (StatServiceImpl.a()) {
StatServiceImpl.d(this.h);
}
}
public void h() {
this.h.getApplicationContext().registerReceiver(new b(this), new IntentFilter("android.net.conn.CONNECTIVITY_CHANGE"));
}
}

View File

@@ -0,0 +1,29 @@
package com.tencent.wxop.stat;
import android.content.Context;
import com.tencent.wxop.stat.common.StatLogger;
/* loaded from: classes.dex */
final class aa implements Runnable {
final /* synthetic */ Context a;
final /* synthetic */ StatSpecifyReportedInfo b;
final /* synthetic */ StatAppMonitor c;
aa(Context context, StatSpecifyReportedInfo statSpecifyReportedInfo, StatAppMonitor statAppMonitor) {
this.a = context;
this.b = statSpecifyReportedInfo;
this.c = statAppMonitor;
}
@Override // java.lang.Runnable
public final void run() {
StatLogger statLogger;
try {
new aq(new com.tencent.wxop.stat.event.g(this.a, StatServiceImpl.a(this.a, false, this.b), this.c, this.b)).a();
} catch (Throwable th) {
statLogger = StatServiceImpl.q;
statLogger.e(th);
StatServiceImpl.a(this.a, th);
}
}
}

View File

@@ -0,0 +1,11 @@
package com.tencent.wxop.stat;
/* loaded from: classes.dex */
final class ab implements Runnable {
ab() {
}
@Override // java.lang.Runnable
public final void run() {
}
}

View File

@@ -0,0 +1,35 @@
package com.tencent.wxop.stat;
import android.content.Context;
import com.tencent.wxop.stat.common.StatLogger;
/* loaded from: classes.dex */
final class ac implements Runnable {
final /* synthetic */ Context a;
final /* synthetic */ StatSpecifyReportedInfo b;
final /* synthetic */ com.tencent.wxop.stat.event.c c;
final /* synthetic */ int d;
ac(Context context, StatSpecifyReportedInfo statSpecifyReportedInfo, com.tencent.wxop.stat.event.c cVar, int i) {
this.a = context;
this.b = statSpecifyReportedInfo;
this.c = cVar;
this.d = i;
}
@Override // java.lang.Runnable
public final void run() {
StatLogger statLogger;
try {
com.tencent.wxop.stat.event.b bVar = new com.tencent.wxop.stat.event.b(this.a, StatServiceImpl.a(this.a, false, this.b), this.c.a, this.b);
bVar.b().c = this.c.c;
Long valueOf = Long.valueOf(this.d);
bVar.a(Long.valueOf(valueOf.longValue() <= 0 ? 1L : valueOf.longValue()).longValue());
new aq(bVar).a();
} catch (Throwable th) {
statLogger = StatServiceImpl.q;
statLogger.e(th);
StatServiceImpl.a(this.a, th);
}
}
}

View File

@@ -0,0 +1,28 @@
package com.tencent.wxop.stat;
import android.content.Context;
import com.tencent.wxop.stat.common.StatLogger;
/* loaded from: classes.dex */
final class ad implements Runnable {
final /* synthetic */ Context a;
final /* synthetic */ int b;
ad(Context context, int i) {
this.a = context;
this.b = i;
}
@Override // java.lang.Runnable
public final void run() {
StatLogger statLogger;
try {
StatServiceImpl.flushDataToDB(this.a);
au.a(this.a).a(this.b);
} catch (Throwable th) {
statLogger = StatServiceImpl.q;
statLogger.e(th);
StatServiceImpl.a(this.a, th);
}
}
}

View File

@@ -0,0 +1,25 @@
package com.tencent.wxop.stat;
import android.content.Context;
import com.tencent.wxop.stat.common.StatLogger;
/* loaded from: classes.dex */
final class ae implements Runnable {
final /* synthetic */ Context a;
ae(Context context) {
this.a = context;
}
@Override // java.lang.Runnable
public final void run() {
StatLogger statLogger;
try {
new Thread(new ap(this.a, null, null), "NetworkMonitorTask").start();
} catch (Throwable th) {
statLogger = StatServiceImpl.q;
statLogger.e(th);
StatServiceImpl.a(this.a, th);
}
}
}

View File

@@ -0,0 +1,30 @@
package com.tencent.wxop.stat;
import android.content.Context;
import com.tencent.wxop.stat.common.StatLogger;
import java.util.Map;
/* loaded from: classes.dex */
final class af implements Runnable {
final /* synthetic */ Context a;
final /* synthetic */ Map b;
final /* synthetic */ StatSpecifyReportedInfo c;
af(Context context, Map map, StatSpecifyReportedInfo statSpecifyReportedInfo) {
this.a = context;
this.b = map;
this.c = statSpecifyReportedInfo;
}
@Override // java.lang.Runnable
public final void run() {
StatLogger statLogger;
try {
new Thread(new ap(this.a, this.b, this.c), "NetworkMonitorTask").start();
} catch (Throwable th) {
statLogger = StatServiceImpl.q;
statLogger.e(th);
StatServiceImpl.a(this.a, th);
}
}
}

View File

@@ -0,0 +1,37 @@
package com.tencent.wxop.stat;
/* loaded from: classes.dex */
/* synthetic */ class ag {
static final /* synthetic */ int[] a = new int[StatReportStrategy.values().length];
static {
try {
a[StatReportStrategy.INSTANT.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
a[StatReportStrategy.PERIOD.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
a[StatReportStrategy.APP_LAUNCH.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
try {
a[StatReportStrategy.DEVELOPER.ordinal()] = 4;
} catch (NoSuchFieldError unused4) {
}
try {
a[StatReportStrategy.BATCH.ordinal()] = 5;
} catch (NoSuchFieldError unused5) {
}
try {
a[StatReportStrategy.ONLY_WIFI.ordinal()] = 6;
} catch (NoSuchFieldError unused6) {
}
try {
a[StatReportStrategy.ONLY_WIFI_NO_CACHE.ordinal()] = 7;
} catch (NoSuchFieldError unused7) {
}
}
}

View File

@@ -0,0 +1,65 @@
package com.tencent.wxop.stat;
import android.content.Context;
import com.tencent.wxop.stat.common.StatLogger;
import java.util.Map;
/* loaded from: classes.dex */
final class ah implements Runnable {
final /* synthetic */ Context a;
final /* synthetic */ String b;
final /* synthetic */ StatSpecifyReportedInfo c;
ah(Context context, String str, StatSpecifyReportedInfo statSpecifyReportedInfo) {
this.a = context;
this.b = str;
this.c = statSpecifyReportedInfo;
}
@Override // java.lang.Runnable
public final void run() {
StatLogger statLogger;
Map map;
Map map2;
Long l;
StatLogger statLogger2;
String str;
String str2;
StatLogger statLogger3;
try {
StatServiceImpl.flushDataToDB(this.a);
map = StatServiceImpl.o;
synchronized (map) {
map2 = StatServiceImpl.o;
l = (Long) map2.remove(this.b);
}
if (l == null) {
statLogger2 = StatServiceImpl.q;
statLogger2.e("Starttime for PageID:" + this.b + " not found, lost onResume()?");
return;
}
Long valueOf = Long.valueOf((System.currentTimeMillis() - l.longValue()) / 1000);
if (valueOf.longValue() <= 0) {
valueOf = 1L;
}
Long l2 = valueOf;
str = StatServiceImpl.n;
if (str != null && str.equals(this.b)) {
str = "-";
}
com.tencent.wxop.stat.event.j jVar = new com.tencent.wxop.stat.event.j(this.a, str, this.b, StatServiceImpl.a(this.a, false, this.c), l2, this.c);
String str3 = this.b;
str2 = StatServiceImpl.m;
if (!str3.equals(str2)) {
statLogger3 = StatServiceImpl.q;
statLogger3.warn("Invalid invocation since previous onResume on diff page.");
}
new aq(jVar).a();
String unused = StatServiceImpl.n = this.b;
} catch (Throwable th) {
statLogger = StatServiceImpl.q;
statLogger.e(th);
StatServiceImpl.a(this.a, th);
}
}
}

View File

@@ -0,0 +1,28 @@
package com.tencent.wxop.stat;
import android.content.Context;
import com.tencent.wxop.stat.common.StatLogger;
/* loaded from: classes.dex */
final class ai implements Runnable {
final /* synthetic */ Context a;
final /* synthetic */ StatSpecifyReportedInfo b;
ai(Context context, StatSpecifyReportedInfo statSpecifyReportedInfo) {
this.a = context;
this.b = statSpecifyReportedInfo;
}
@Override // java.lang.Runnable
public final void run() {
StatLogger statLogger;
try {
StatServiceImpl.stopSession();
StatServiceImpl.a(this.a, true, this.b);
} catch (Throwable th) {
statLogger = StatServiceImpl.q;
statLogger.e(th);
StatServiceImpl.a(this.a, th);
}
}
}

View File

@@ -0,0 +1,27 @@
package com.tencent.wxop.stat;
import android.content.Context;
import com.tencent.wxop.stat.common.StatLogger;
/* loaded from: classes.dex */
final class aj implements Runnable {
final /* synthetic */ Context a;
final /* synthetic */ StatSpecifyReportedInfo b;
aj(Context context, StatSpecifyReportedInfo statSpecifyReportedInfo) {
this.a = context;
this.b = statSpecifyReportedInfo;
}
@Override // java.lang.Runnable
public final void run() {
StatLogger statLogger;
Context context = this.a;
if (context != null) {
StatServiceImpl.trackBeginPage(context, com.tencent.wxop.stat.common.l.f(context), this.b);
} else {
statLogger = StatServiceImpl.q;
statLogger.error("The Context of StatService.onResume() can not be null!");
}
}
}

View File

@@ -0,0 +1,31 @@
package com.tencent.wxop.stat;
import android.content.Context;
import com.tencent.wxop.stat.common.StatLogger;
/* loaded from: classes.dex */
final class ak implements Runnable {
final /* synthetic */ String a;
final /* synthetic */ Context b;
final /* synthetic */ StatSpecifyReportedInfo c;
ak(String str, Context context, StatSpecifyReportedInfo statSpecifyReportedInfo) {
this.a = str;
this.b = context;
this.c = statSpecifyReportedInfo;
}
@Override // java.lang.Runnable
public final void run() {
StatLogger statLogger;
String str = this.a;
if (str == null || str.trim().length() == 0) {
statLogger = StatServiceImpl.q;
statLogger.w("qq num is null or empty.");
} else {
String str2 = this.a;
StatConfig.f = str2;
StatServiceImpl.b(this.b, new StatAccount(str2), this.c);
}
}
}

View File

@@ -0,0 +1,30 @@
package com.tencent.wxop.stat;
import android.content.Context;
import com.tencent.wxop.stat.common.StatLogger;
/* loaded from: classes.dex */
final class al implements Runnable {
final /* synthetic */ StatAccount a;
final /* synthetic */ Context b;
final /* synthetic */ StatSpecifyReportedInfo c;
al(StatAccount statAccount, Context context, StatSpecifyReportedInfo statSpecifyReportedInfo) {
this.a = statAccount;
this.b = context;
this.c = statSpecifyReportedInfo;
}
@Override // java.lang.Runnable
public final void run() {
StatLogger statLogger;
StatAccount statAccount = this.a;
if (statAccount == null || statAccount.getAccount().trim().length() == 0) {
statLogger = StatServiceImpl.q;
statLogger.w("account is null or empty.");
} else {
StatConfig.setQQ(this.b, this.a.getAccount());
StatServiceImpl.b(this.b, this.a, this.c);
}
}
}

View File

@@ -0,0 +1,42 @@
package com.tencent.wxop.stat;
import android.content.Context;
import com.tencent.wxop.stat.common.StatLogger;
/* loaded from: classes.dex */
final class am implements Runnable {
final /* synthetic */ StatGameUser a;
final /* synthetic */ Context b;
final /* synthetic */ StatSpecifyReportedInfo c;
am(StatGameUser statGameUser, Context context, StatSpecifyReportedInfo statSpecifyReportedInfo) {
this.a = statGameUser;
this.b = context;
this.c = statSpecifyReportedInfo;
}
@Override // java.lang.Runnable
public final void run() {
StatLogger statLogger;
StatLogger statLogger2;
StatLogger statLogger3;
StatGameUser statGameUser = this.a;
if (statGameUser == null) {
statLogger3 = StatServiceImpl.q;
statLogger3.error("The gameUser of StatService.reportGameUser() can not be null!");
return;
}
if (statGameUser.getAccount() == null || this.a.getAccount().length() == 0) {
statLogger = StatServiceImpl.q;
statLogger.error("The account of gameUser on StatService.reportGameUser() can not be null or empty!");
return;
}
try {
new aq(new com.tencent.wxop.stat.event.f(this.b, StatServiceImpl.a(this.b, false, this.c), this.a, this.c)).a();
} catch (Throwable th) {
statLogger2 = StatServiceImpl.q;
statLogger2.e(th);
StatServiceImpl.a(this.b, th);
}
}
}

View File

@@ -0,0 +1,26 @@
package com.tencent.wxop.stat;
import android.content.Context;
import com.tencent.wxop.stat.common.StatLogger;
/* loaded from: classes.dex */
final class an implements Runnable {
final /* synthetic */ Context a;
final /* synthetic */ StatSpecifyReportedInfo b;
an(Context context, StatSpecifyReportedInfo statSpecifyReportedInfo) {
this.a = context;
this.b = statSpecifyReportedInfo;
}
@Override // java.lang.Runnable
public final void run() {
StatLogger statLogger;
try {
StatServiceImpl.a(this.a, false, this.b);
} catch (Throwable th) {
statLogger = StatServiceImpl.q;
statLogger.e(th);
}
}
}

View File

@@ -0,0 +1,56 @@
package com.tencent.wxop.stat;
import android.content.Context;
import com.tencent.wxop.stat.common.StatLogger;
import java.lang.Thread;
/* loaded from: classes.dex */
class ao implements Thread.UncaughtExceptionHandler {
ao() {
}
@Override // java.lang.Thread.UncaughtExceptionHandler
public void uncaughtException(Thread thread, Throwable th) {
Context context;
Context context2;
Thread.UncaughtExceptionHandler uncaughtExceptionHandler;
StatLogger statLogger;
Thread.UncaughtExceptionHandler uncaughtExceptionHandler2;
Thread.UncaughtExceptionHandler uncaughtExceptionHandler3;
Context context3;
Context context4;
Context context5;
StatLogger statLogger2;
StatLogger statLogger3;
if (StatConfig.isEnableStatService()) {
context = StatServiceImpl.t;
if (context == null) {
return;
}
if (StatConfig.isAutoExceptionCaught()) {
context3 = StatServiceImpl.t;
au a = au.a(context3);
context4 = StatServiceImpl.t;
context5 = StatServiceImpl.t;
a.a((com.tencent.wxop.stat.event.e) new com.tencent.wxop.stat.event.d(context4, StatServiceImpl.a(context5, false, (StatSpecifyReportedInfo) null), 2, th, thread, null), (h) null, false, true);
statLogger2 = StatServiceImpl.q;
statLogger2.debug("MTA has caught the following uncaught exception:");
statLogger3 = StatServiceImpl.q;
statLogger3.error(th);
}
context2 = StatServiceImpl.t;
StatServiceImpl.flushDataToDB(context2);
uncaughtExceptionHandler = StatServiceImpl.r;
if (uncaughtExceptionHandler != null) {
statLogger = StatServiceImpl.q;
statLogger.d("Call the original uncaught exception handler.");
uncaughtExceptionHandler2 = StatServiceImpl.r;
if (uncaughtExceptionHandler2 instanceof ao) {
return;
}
uncaughtExceptionHandler3 = StatServiceImpl.r;
uncaughtExceptionHandler3.uncaughtException(thread, th);
}
}
}
}

View File

@@ -0,0 +1,138 @@
package com.tencent.wxop.stat;
import android.content.Context;
import com.tencent.bugly.BuglyStrategy;
import com.tencent.wxop.stat.common.StatLogger;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.util.HashMap;
import java.util.Map;
import org.json.JSONArray;
/* loaded from: classes.dex */
class ap implements Runnable {
private Context a;
private Map<String, Integer> b;
private StatSpecifyReportedInfo c;
public ap(Context context, Map<String, Integer> map, StatSpecifyReportedInfo statSpecifyReportedInfo) {
this.a = null;
this.b = null;
this.c = null;
this.a = context;
this.c = statSpecifyReportedInfo;
if (map != null) {
this.b = map;
}
}
/* JADX WARN: Multi-variable type inference failed */
private NetworkMonitor a(String str, int i) {
StatLogger statLogger;
StatLogger statLogger2;
int i2;
StatLogger statLogger3;
StatLogger statLogger4;
NetworkMonitor networkMonitor = new NetworkMonitor();
Socket socket = new Socket();
try {
try {
networkMonitor.setDomain(str);
networkMonitor.setPort(i);
long currentTimeMillis = System.currentTimeMillis();
InetSocketAddress inetSocketAddress = new InetSocketAddress(str, i);
socket.connect(inetSocketAddress, BuglyStrategy.a.MAX_USERDATA_VALUE_LENGTH);
networkMonitor.setMillisecondsConsume(System.currentTimeMillis() - currentTimeMillis);
networkMonitor.setRemoteIp(inetSocketAddress.getAddress().getHostAddress());
socket.close();
try {
socket.close();
} catch (Throwable th) {
statLogger4 = StatServiceImpl.q;
statLogger4.e(th);
}
i2 = 0;
socket = socket;
} catch (IOException e) {
statLogger = StatServiceImpl.q;
statLogger.e((Throwable) e);
i2 = -1;
socket = statLogger2;
}
networkMonitor.setStatusCode(i2);
return networkMonitor;
} finally {
try {
socket.close();
} catch (Throwable th2) {
statLogger3 = StatServiceImpl.q;
statLogger3.e(th2);
}
}
}
private Map<String, Integer> a() {
String str;
StatLogger statLogger;
HashMap hashMap = new HashMap();
String a = StatConfig.a("__MTA_TEST_SPEED__", (String) null);
if (a != null && a.trim().length() != 0) {
for (String str2 : a.split(";")) {
String[] split = str2.split(",");
if (split != null && split.length == 2 && (str = split[0]) != null && str.trim().length() != 0) {
try {
hashMap.put(str, Integer.valueOf(Integer.valueOf(split[1]).intValue()));
} catch (NumberFormatException e) {
statLogger = StatServiceImpl.q;
statLogger.e((Throwable) e);
}
}
}
}
return hashMap;
}
@Override // java.lang.Runnable
public void run() {
StatLogger statLogger;
StatLogger statLogger2;
StatLogger statLogger3;
String str;
try {
if (this.b == null) {
this.b = a();
}
if (this.b != null && this.b.size() != 0) {
JSONArray jSONArray = new JSONArray();
for (Map.Entry<String, Integer> entry : this.b.entrySet()) {
String key = entry.getKey();
if (key != null && key.length() != 0) {
if (entry.getValue() == null) {
statLogger3 = StatServiceImpl.q;
str = "port is null for " + key;
statLogger3.w(str);
} else {
jSONArray.put(a(entry.getKey(), entry.getValue().intValue()).toJSONObject());
}
}
statLogger3 = StatServiceImpl.q;
str = "empty domain name.";
statLogger3.w(str);
}
if (jSONArray.length() == 0) {
return;
}
com.tencent.wxop.stat.event.i iVar = new com.tencent.wxop.stat.event.i(this.a, StatServiceImpl.a(this.a, false, this.c), this.c);
iVar.a(jSONArray.toString());
new aq(iVar).a();
return;
}
statLogger2 = StatServiceImpl.q;
statLogger2.i("empty domain list.");
} catch (Throwable th) {
statLogger = StatServiceImpl.q;
statLogger.e(th);
}
}
}

View File

@@ -0,0 +1,197 @@
package com.tencent.wxop.stat;
import android.content.Context;
import com.tencent.wxop.stat.common.StatLogger;
import java.util.Map;
/* loaded from: classes.dex */
class aq {
private static volatile long f;
private com.tencent.wxop.stat.event.e a;
private StatReportStrategy b;
private boolean c;
private Context d;
private long e = System.currentTimeMillis();
public aq(com.tencent.wxop.stat.event.e eVar) {
this.b = null;
this.c = false;
this.d = null;
this.a = eVar;
this.b = StatConfig.getStatSendStrategy();
this.c = eVar.f();
this.d = eVar.e();
}
private void a(h hVar) {
Context context;
context = StatServiceImpl.t;
i.b(context).a(this.a, hVar);
}
private void b() {
StatLogger statLogger;
StatLogger statLogger2;
Context context;
StatLogger statLogger3;
StatLogger statLogger4;
Context context2;
if (this.a.d() != null && this.a.d().isSendImmediately()) {
this.b = StatReportStrategy.INSTANT;
}
if (StatConfig.j) {
context2 = StatServiceImpl.t;
if (a.a(context2).e()) {
this.b = StatReportStrategy.INSTANT;
}
}
if (StatConfig.isDebugEnable()) {
statLogger4 = StatServiceImpl.q;
statLogger4.i("strategy=" + this.b.name());
}
switch (ag.a[this.b.ordinal()]) {
case 1:
c();
break;
case 2:
au.a(this.d).a(this.a, (h) null, this.c, false);
if (StatConfig.isDebugEnable()) {
statLogger2 = StatServiceImpl.q;
statLogger2.i("PERIOD currTime=" + this.e + ",nextPeriodSendTs=" + StatServiceImpl.c + ",difftime=" + (StatServiceImpl.c - this.e));
}
if (StatServiceImpl.c == 0) {
StatServiceImpl.c = com.tencent.wxop.stat.common.q.a(this.d, "last_period_ts", 0L);
if (this.e > StatServiceImpl.c) {
StatServiceImpl.e(this.d);
}
long sendPeriodMinutes = this.e + (StatConfig.getSendPeriodMinutes() * 60 * 1000);
if (StatServiceImpl.c > sendPeriodMinutes) {
StatServiceImpl.c = sendPeriodMinutes;
}
d.a(this.d).a();
}
if (StatConfig.isDebugEnable()) {
statLogger = StatServiceImpl.q;
statLogger.i("PERIOD currTime=" + this.e + ",nextPeriodSendTs=" + StatServiceImpl.c + ",difftime=" + (StatServiceImpl.c - this.e));
}
if (this.e > StatServiceImpl.c) {
StatServiceImpl.e(this.d);
break;
}
break;
case 3:
case 4:
au.a(this.d).a(this.a, (h) null, this.c, false);
break;
case 5:
au.a(this.d).a(this.a, (h) new ar(this), this.c, true);
break;
case 6:
context = StatServiceImpl.t;
if (a.a(context).c() != 1) {
au.a(this.d).a(this.a, (h) null, this.c, false);
break;
} else {
c();
break;
}
case 7:
if (com.tencent.wxop.stat.common.l.e(this.d)) {
a(new as(this));
break;
}
break;
default:
statLogger3 = StatServiceImpl.q;
statLogger3.error("Invalid stat strategy:" + StatConfig.getStatSendStrategy());
break;
}
}
private void c() {
if (au.b().a <= 0 || !StatConfig.l) {
a(new at(this));
} else {
au.b().a(this.a, (h) null, this.c, true);
au.b().a(-1);
}
}
private boolean d() {
long j;
Map map;
Map map2;
Map map3;
StatLogger statLogger;
Map map4;
StatLogger statLogger2;
long j2;
if (StatConfig.h <= 0) {
return false;
}
long j3 = this.e;
j = StatServiceImpl.h;
if (j3 > j) {
map4 = StatServiceImpl.g;
map4.clear();
long unused = StatServiceImpl.h = this.e + StatConfig.i;
if (StatConfig.isDebugEnable()) {
statLogger2 = StatServiceImpl.q;
StringBuilder sb = new StringBuilder("clear methodsCalledLimitMap, nextLimitCallClearTime=");
j2 = StatServiceImpl.h;
sb.append(j2);
statLogger2.i(sb.toString());
}
}
Integer valueOf = Integer.valueOf(this.a.a().a());
map = StatServiceImpl.g;
Integer num = (Integer) map.get(valueOf);
if (num == null) {
map2 = StatServiceImpl.g;
map2.put(valueOf, 1);
return false;
}
map3 = StatServiceImpl.g;
map3.put(valueOf, Integer.valueOf(num.intValue() + 1));
if (num.intValue() <= StatConfig.h) {
return false;
}
if (StatConfig.isDebugEnable()) {
statLogger = StatServiceImpl.q;
statLogger.e("event " + this.a.g() + " was discard, cause of called limit, current:" + num + ", limit:" + StatConfig.h + ", period:" + StatConfig.i + " ms");
}
return true;
}
public void a() {
StatLogger statLogger;
StatLogger statLogger2;
if (d()) {
return;
}
if (StatConfig.m > 0 && this.e >= f) {
StatServiceImpl.flushDataToDB(this.d);
f = this.e + StatConfig.n;
if (StatConfig.isDebugEnable()) {
statLogger2 = StatServiceImpl.q;
statLogger2.i("nextFlushTime=" + f);
}
}
if (!a.a(this.d).f()) {
au.a(this.d).a(this.a, (h) null, this.c, false);
return;
}
if (StatConfig.isDebugEnable()) {
statLogger = StatServiceImpl.q;
statLogger.i("sendFailedCount=" + StatServiceImpl.a);
}
if (!StatServiceImpl.a()) {
b();
return;
}
au.a(this.d).a(this.a, (h) null, this.c, false);
if (this.e - StatServiceImpl.b > 1800000) {
StatServiceImpl.d(this.d);
}
}
}

View File

@@ -0,0 +1,23 @@
package com.tencent.wxop.stat;
/* loaded from: classes.dex */
class ar implements h {
final /* synthetic */ aq a;
ar(aq aqVar) {
this.a = aqVar;
}
@Override // com.tencent.wxop.stat.h
public void a() {
StatServiceImpl.c();
if (au.b().a() >= StatConfig.getMaxBatchReportCount()) {
au.b().a(StatConfig.getMaxBatchReportCount());
}
}
@Override // com.tencent.wxop.stat.h
public void b() {
StatServiceImpl.d();
}
}

View File

@@ -0,0 +1,20 @@
package com.tencent.wxop.stat;
/* loaded from: classes.dex */
class as implements h {
final /* synthetic */ aq a;
as(aq aqVar) {
this.a = aqVar;
}
@Override // com.tencent.wxop.stat.h
public void a() {
StatServiceImpl.c();
}
@Override // com.tencent.wxop.stat.h
public void b() {
StatServiceImpl.d();
}
}

View File

@@ -0,0 +1,33 @@
package com.tencent.wxop.stat;
import android.content.Context;
/* loaded from: classes.dex */
class at implements h {
final /* synthetic */ aq a;
at(aq aqVar) {
this.a = aqVar;
}
@Override // com.tencent.wxop.stat.h
public void a() {
Context context;
StatServiceImpl.c();
if (au.b().a > 0) {
context = this.a.d;
StatServiceImpl.commitEvents(context, -1);
}
}
@Override // com.tencent.wxop.stat.h
public void b() {
com.tencent.wxop.stat.event.e eVar;
boolean z;
au b = au.b();
eVar = this.a.a;
z = this.a.c;
b.a(eVar, (h) null, z, true);
StatServiceImpl.d();
}
}

View File

@@ -0,0 +1,709 @@
package com.tencent.wxop.stat;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.DatabaseUtils;
import android.database.sqlite.SQLiteDatabase;
import com.liulishuo.filedownloader.model.FileDownloadModel;
import com.tencent.wxop.stat.common.StatLogger;
import com.unity3d.ads.metadata.MediationMetaData;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import org.json.JSONObject;
/* loaded from: classes.dex */
public class au {
private static StatLogger h = com.tencent.wxop.stat.common.l.b();
private static Context i = null;
private static au j = null;
private bc c;
private bc d;
private com.tencent.wxop.stat.common.e e;
private String f;
private String g;
private ConcurrentHashMap<com.tencent.wxop.stat.event.e, String> l;
volatile int a = 0;
com.tencent.wxop.stat.common.a b = null;
private int k = 0;
private boolean m = false;
private HashMap<String, String> n = new HashMap<>();
private au(Context context) {
this.c = null;
this.d = null;
this.e = null;
this.f = "";
this.g = "";
this.l = null;
try {
this.e = new com.tencent.wxop.stat.common.e();
i = context.getApplicationContext();
this.l = new ConcurrentHashMap<>();
this.f = com.tencent.wxop.stat.common.l.p(context);
this.g = "pri_" + com.tencent.wxop.stat.common.l.p(context);
this.c = new bc(i, this.f);
this.d = new bc(i, this.g);
a(true);
a(false);
f();
b(i);
d();
j();
} catch (Throwable th) {
h.e(th);
}
}
public static au a(Context context) {
if (j == null) {
synchronized (au.class) {
if (j == null) {
j = new au(context);
}
}
}
return j;
}
private String a(List<bd> list) {
StringBuilder sb = new StringBuilder(list.size() * 3);
sb.append("event_id in (");
int size = list.size();
Iterator<bd> it = list.iterator();
int i2 = 0;
while (it.hasNext()) {
sb.append(it.next().a);
if (i2 != size - 1) {
sb.append(",");
}
i2++;
}
sb.append(")");
return sb.toString();
}
private synchronized void a(int i2, boolean z) {
try {
if (this.a > 0 && i2 > 0 && !StatServiceImpl.a()) {
if (StatConfig.isDebugEnable()) {
h.i("Load " + this.a + " unsent events");
}
ArrayList arrayList = new ArrayList(i2);
b(arrayList, i2, z);
if (arrayList.size() > 0) {
if (StatConfig.isDebugEnable()) {
h.i("Peek " + arrayList.size() + " unsent events.");
}
a(arrayList, 2, z);
i.b(i).b(arrayList, new ba(this, arrayList, z));
}
}
} catch (Throwable th) {
h.e(th);
}
}
/* JADX WARN: Removed duplicated region for block: B:21:0x009f */
/* JADX WARN: Removed duplicated region for block: B:29:0x00c7 */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
private void a(com.tencent.wxop.stat.event.e r9, com.tencent.wxop.stat.h r10, boolean r11) {
/*
r8 = this;
r0 = 1
r1 = 0
android.database.sqlite.SQLiteDatabase r2 = r8.c(r11) // Catch: java.lang.Throwable -> L8b
r2.beginTransaction() // Catch: java.lang.Throwable -> L89
java.lang.String r3 = "events"
if (r11 != 0) goto L2d
int r11 = r8.a // Catch: java.lang.Throwable -> L89
int r4 = com.tencent.wxop.stat.StatConfig.getMaxStoreEventCount() // Catch: java.lang.Throwable -> L89
if (r11 <= r4) goto L2d
com.tencent.wxop.stat.common.StatLogger r11 = com.tencent.wxop.stat.au.h // Catch: java.lang.Throwable -> L89
java.lang.String r4 = "Too many events stored in db."
r11.warn(r4) // Catch: java.lang.Throwable -> L89
int r11 = r8.a // Catch: java.lang.Throwable -> L89
com.tencent.wxop.stat.bc r4 = r8.c // Catch: java.lang.Throwable -> L89
android.database.sqlite.SQLiteDatabase r4 = r4.getWritableDatabase() // Catch: java.lang.Throwable -> L89
java.lang.String r5 = "event_id in (select event_id from events where timestamp in (select min(timestamp) from events) limit 1)"
int r4 = r4.delete(r3, r5, r1) // Catch: java.lang.Throwable -> L89
int r11 = r11 - r4
r8.a = r11 // Catch: java.lang.Throwable -> L89
L2d:
android.content.ContentValues r11 = new android.content.ContentValues // Catch: java.lang.Throwable -> L89
r11.<init>() // Catch: java.lang.Throwable -> L89
java.lang.String r4 = r9.g() // Catch: java.lang.Throwable -> L89
boolean r5 = com.tencent.wxop.stat.StatConfig.isDebugEnable() // Catch: java.lang.Throwable -> L89
if (r5 == 0) goto L4f
com.tencent.wxop.stat.common.StatLogger r5 = com.tencent.wxop.stat.au.h // Catch: java.lang.Throwable -> L89
java.lang.StringBuilder r6 = new java.lang.StringBuilder // Catch: java.lang.Throwable -> L89
java.lang.String r7 = "insert 1 event, content:"
r6.<init>(r7) // Catch: java.lang.Throwable -> L89
r6.append(r4) // Catch: java.lang.Throwable -> L89
java.lang.String r6 = r6.toString() // Catch: java.lang.Throwable -> L89
r5.i(r6) // Catch: java.lang.Throwable -> L89
L4f:
java.lang.String r4 = com.tencent.wxop.stat.common.r.b(r4) // Catch: java.lang.Throwable -> L89
java.lang.String r5 = "content"
r11.put(r5, r4) // Catch: java.lang.Throwable -> L89
java.lang.String r4 = "send_count"
java.lang.String r5 = "0"
r11.put(r4, r5) // Catch: java.lang.Throwable -> L89
java.lang.String r4 = "status"
java.lang.String r5 = java.lang.Integer.toString(r0) // Catch: java.lang.Throwable -> L89
r11.put(r4, r5) // Catch: java.lang.Throwable -> L89
java.lang.String r4 = "timestamp"
long r5 = r9.c() // Catch: java.lang.Throwable -> L89
java.lang.Long r5 = java.lang.Long.valueOf(r5) // Catch: java.lang.Throwable -> L89
r11.put(r4, r5) // Catch: java.lang.Throwable -> L89
long r3 = r2.insert(r3, r1, r11) // Catch: java.lang.Throwable -> L89
r2.setTransactionSuccessful() // Catch: java.lang.Throwable -> L89
if (r2 == 0) goto L99
r2.endTransaction() // Catch: java.lang.Throwable -> L82
goto L99
L82:
r11 = move-exception
com.tencent.wxop.stat.common.StatLogger r1 = com.tencent.wxop.stat.au.h
r1.e(r11)
goto L99
L89:
r11 = move-exception
goto L8d
L8b:
r11 = move-exception
r2 = r1
L8d:
r3 = -1
com.tencent.wxop.stat.common.StatLogger r1 = com.tencent.wxop.stat.au.h // Catch: java.lang.Throwable -> Ldf
r1.e(r11) // Catch: java.lang.Throwable -> Ldf
if (r2 == 0) goto L99
r2.endTransaction() // Catch: java.lang.Throwable -> L82
L99:
r1 = 0
int r11 = (r3 > r1 ? 1 : (r3 == r1 ? 0 : -1))
if (r11 <= 0) goto Lc7
int r11 = r8.a
int r11 = r11 + r0
r8.a = r11
boolean r11 = com.tencent.wxop.stat.StatConfig.isDebugEnable()
if (r11 == 0) goto Lc1
com.tencent.wxop.stat.common.StatLogger r11 = com.tencent.wxop.stat.au.h
java.lang.StringBuilder r0 = new java.lang.StringBuilder
java.lang.String r1 = "directStoreEvent insert event to db, event:"
r0.<init>(r1)
java.lang.String r9 = r9.g()
r0.append(r9)
java.lang.String r9 = r0.toString()
r11.d(r9)
Lc1:
if (r10 == 0) goto Lde
r10.a()
return
Lc7:
com.tencent.wxop.stat.common.StatLogger r10 = com.tencent.wxop.stat.au.h
java.lang.StringBuilder r11 = new java.lang.StringBuilder
java.lang.String r0 = "Failed to store event:"
r11.<init>(r0)
java.lang.String r9 = r9.g()
r11.append(r9)
java.lang.String r9 = r11.toString()
r10.error(r9)
Lde:
return
Ldf:
r9 = move-exception
if (r2 == 0) goto Lec
r2.endTransaction() // Catch: java.lang.Throwable -> Le6
goto Lec
Le6:
r10 = move-exception
com.tencent.wxop.stat.common.StatLogger r11 = com.tencent.wxop.stat.au.h
r11.e(r10)
Lec:
throw r9
*/
throw new UnsupportedOperationException("Method not decompiled: com.tencent.wxop.stat.au.a(com.tencent.wxop.stat.event.e, com.tencent.wxop.stat.h, boolean):void");
}
/* JADX INFO: Access modifiers changed from: private */
public synchronized void a(List<bd> list, int i2, boolean z) {
SQLiteDatabase sQLiteDatabase;
String str;
if (list.size() == 0) {
return;
}
int b = b(z);
String str2 = null;
try {
sQLiteDatabase = c(z);
} catch (Throwable th) {
th = th;
sQLiteDatabase = null;
}
try {
if (i2 == 2) {
str = "update events set status=" + i2 + ", send_count=send_count+1 where " + a(list);
} else {
str = "update events set status=" + i2 + " where " + a(list);
if (this.k % 3 == 0) {
str2 = "delete from events where send_count>" + b;
}
this.k++;
}
if (StatConfig.isDebugEnable()) {
h.i("update sql:" + str);
}
sQLiteDatabase.beginTransaction();
sQLiteDatabase.execSQL(str);
if (str2 != null) {
h.i("update for delete sql:" + str2);
sQLiteDatabase.execSQL(str2);
f();
}
sQLiteDatabase.setTransactionSuccessful();
} catch (Throwable th2) {
th = th2;
try {
h.e(th);
if (sQLiteDatabase != null) {
try {
sQLiteDatabase.endTransaction();
} catch (Throwable th3) {
h.e(th3);
}
}
} finally {
if (sQLiteDatabase != null) {
try {
sQLiteDatabase.endTransaction();
} catch (Throwable th4) {
h.e(th4);
}
}
}
}
}
/* JADX INFO: Access modifiers changed from: private */
public synchronized void a(List<bd> list, boolean z) {
SQLiteDatabase sQLiteDatabase;
Throwable th;
if (list.size() == 0) {
return;
}
if (StatConfig.isDebugEnable()) {
h.i("Delete " + list.size() + " events, important:" + z);
}
StringBuilder sb = new StringBuilder(list.size() * 3);
sb.append("event_id in (");
int i2 = 0;
int size = list.size();
Iterator<bd> it = list.iterator();
while (it.hasNext()) {
sb.append(it.next().a);
if (i2 != size - 1) {
sb.append(",");
}
i2++;
}
sb.append(")");
try {
sQLiteDatabase = c(z);
} catch (Throwable th2) {
sQLiteDatabase = null;
th = th2;
}
try {
sQLiteDatabase.beginTransaction();
int delete = sQLiteDatabase.delete("events", sb.toString(), null);
if (StatConfig.isDebugEnable()) {
h.i("delete " + size + " event " + sb.toString() + ", success delete:" + delete);
}
this.a -= delete;
sQLiteDatabase.setTransactionSuccessful();
f();
} catch (Throwable th3) {
th = th3;
try {
h.e(th);
if (sQLiteDatabase != null) {
try {
sQLiteDatabase.endTransaction();
} catch (Throwable th4) {
h.e(th4);
}
}
} finally {
if (sQLiteDatabase != null) {
try {
sQLiteDatabase.endTransaction();
} catch (Throwable th5) {
h.e(th5);
}
}
}
}
}
private void a(boolean z) {
SQLiteDatabase sQLiteDatabase;
try {
try {
sQLiteDatabase = c(z);
} catch (Throwable th) {
th = th;
sQLiteDatabase = null;
}
try {
sQLiteDatabase.beginTransaction();
ContentValues contentValues = new ContentValues();
contentValues.put(FileDownloadModel.STATUS, (Integer) 1);
int update = sQLiteDatabase.update("events", contentValues, "status=?", new String[]{Long.toString(2L)});
if (StatConfig.isDebugEnable()) {
h.i("update " + update + " unsent events.");
}
sQLiteDatabase.setTransactionSuccessful();
if (sQLiteDatabase != null) {
sQLiteDatabase.endTransaction();
}
} catch (Throwable th2) {
th = th2;
try {
h.e(th);
if (sQLiteDatabase != null) {
sQLiteDatabase.endTransaction();
}
} catch (Throwable th3) {
if (sQLiteDatabase != null) {
try {
sQLiteDatabase.endTransaction();
} catch (Throwable th4) {
h.e(th4);
}
}
throw th3;
}
}
} catch (Throwable th5) {
h.e(th5);
}
}
private int b(boolean z) {
return !z ? StatConfig.getMaxSendRetryCount() : StatConfig.getMaxImportantDataSendRetryCount();
}
public static au b() {
return j;
}
/* JADX INFO: Access modifiers changed from: private */
public void b(int i2, boolean z) {
if (i2 == -1) {
i2 = !z ? g() : h();
}
if (i2 > 0) {
int sendPeriodMinutes = StatConfig.getSendPeriodMinutes() * 60 * StatConfig.getNumEventsCommitPerSec();
if (i2 > sendPeriodMinutes && sendPeriodMinutes > 0) {
i2 = sendPeriodMinutes;
}
int a = StatConfig.a();
int i3 = i2 / a;
int i4 = i2 % a;
if (StatConfig.isDebugEnable()) {
h.i("sentStoreEventsByDb sendNumbers=" + i2 + ",important=" + z + ",maxSendNumPerFor1Period=" + sendPeriodMinutes + ",maxCount=" + i3 + ",restNumbers=" + i4);
}
for (int i5 = 0; i5 < i3; i5++) {
a(a, z);
}
if (i4 > 0) {
a(i4, z);
}
}
}
/* JADX INFO: Access modifiers changed from: private */
public synchronized void b(com.tencent.wxop.stat.event.e eVar, h hVar, boolean z, boolean z2) {
if (StatConfig.getMaxStoreEventCount() > 0) {
if (StatConfig.m > 0 && !z && !z2) {
if (StatConfig.m > 0) {
if (StatConfig.isDebugEnable()) {
h.i("cacheEventsInMemory.size():" + this.l.size() + ",numEventsCachedInMemory:" + StatConfig.m + ",numStoredEvents:" + this.a);
StatLogger statLogger = h;
StringBuilder sb = new StringBuilder("cache event:");
sb.append(eVar.g());
statLogger.i(sb.toString());
}
this.l.put(eVar, "");
if (this.l.size() >= StatConfig.m) {
i();
}
if (hVar != null) {
if (this.l.size() > 0) {
i();
}
hVar.a();
}
}
}
a(eVar, hVar, z);
}
}
/* JADX INFO: Access modifiers changed from: private */
public synchronized void b(f fVar) {
Cursor cursor;
boolean z;
long insert;
try {
String a = fVar.a();
String a2 = com.tencent.wxop.stat.common.l.a(a);
ContentValues contentValues = new ContentValues();
contentValues.put("content", fVar.b.toString());
contentValues.put("md5sum", a2);
fVar.c = a2;
contentValues.put(MediationMetaData.KEY_VERSION, Integer.valueOf(fVar.d));
cursor = this.c.getReadableDatabase().query("config", null, null, null, null, null, null);
while (true) {
try {
if (!cursor.moveToNext()) {
z = false;
break;
} else if (cursor.getInt(0) == fVar.a) {
z = true;
break;
}
} catch (Throwable th) {
th = th;
try {
h.e(th);
if (cursor != null) {
cursor.close();
}
try {
this.c.getWritableDatabase().endTransaction();
return;
} catch (Exception unused) {
return;
}
} finally {
if (cursor != null) {
cursor.close();
}
try {
this.c.getWritableDatabase().endTransaction();
} catch (Exception unused2) {
}
}
}
}
this.c.getWritableDatabase().beginTransaction();
if (true == z) {
insert = this.c.getWritableDatabase().update("config", contentValues, "type=?", new String[]{Integer.toString(fVar.a)});
} else {
contentValues.put("type", Integer.valueOf(fVar.a));
insert = this.c.getWritableDatabase().insert("config", null, contentValues);
}
if (insert == -1) {
h.e("Failed to store cfg:" + a);
} else {
h.d("Sucessed to store cfg:" + a);
}
this.c.getWritableDatabase().setTransactionSuccessful();
try {
this.c.getWritableDatabase().endTransaction();
} catch (Exception unused3) {
}
} catch (Throwable th2) {
th = th2;
cursor = null;
}
}
private void b(List<bd> list, int i2, boolean z) {
Cursor cursor = null;
try {
cursor = d(z).query("events", null, "status=?", new String[]{Integer.toString(1)}, null, null, null, Integer.toString(i2));
while (cursor.moveToNext()) {
long j2 = cursor.getLong(0);
String string = cursor.getString(1);
if (!StatConfig.g) {
string = com.tencent.wxop.stat.common.r.a(string);
}
String str = string;
int i3 = cursor.getInt(2);
int i4 = cursor.getInt(3);
bd bdVar = new bd(j2, str, i3, i4);
if (StatConfig.isDebugEnable()) {
h.i("peek event, id=" + j2 + ",send_count=" + i4 + ",timestamp=" + cursor.getLong(4));
}
list.add(bdVar);
}
} catch (Throwable th) {
try {
h.e(th);
if (cursor != null) {
cursor.close();
}
} finally {
if (cursor != null) {
cursor.close();
}
}
}
}
private SQLiteDatabase c(boolean z) {
return (!z ? this.c : this.d).getWritableDatabase();
}
private SQLiteDatabase d(boolean z) {
return (!z ? this.c : this.d).getReadableDatabase();
}
private void f() {
this.a = g() + h();
}
private int g() {
return (int) DatabaseUtils.queryNumEntries(this.c.getReadableDatabase(), "events");
}
private int h() {
return (int) DatabaseUtils.queryNumEntries(this.d.getReadableDatabase(), "events");
}
/* JADX INFO: Access modifiers changed from: private */
/* JADX WARN: Removed duplicated region for block: B:33:0x00f1 A[Catch: all -> 0x0131, TryCatch #1 {, blocks: (B:8:0x0008, B:10:0x0010, B:12:0x0012, B:14:0x001b, B:31:0x00e8, B:33:0x00f1, B:34:0x011e, B:40:0x00cc, B:41:0x00ce, B:51:0x00e5, B:55:0x0130, B:60:0x012b, B:45:0x00d6, B:48:0x00dd, B:57:0x0123, B:37:0x00c4), top: B:7:0x0008, inners: #0, #3, #5, #6 }] */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
public void i() {
/*
Method dump skipped, instructions count: 308
To view this dump change 'Code comments level' option to 'DEBUG'
*/
throw new UnsupportedOperationException("Method not decompiled: com.tencent.wxop.stat.au.i():void");
}
private void j() {
Cursor cursor = null;
try {
cursor = this.c.getReadableDatabase().query("keyvalues", null, null, null, null, null, null);
while (cursor.moveToNext()) {
this.n.put(cursor.getString(0), cursor.getString(1));
}
} catch (Throwable th) {
try {
h.e(th);
if (cursor != null) {
cursor.close();
}
} finally {
if (cursor != null) {
cursor.close();
}
}
}
}
public int a() {
return this.a;
}
void a(int i2) {
this.e.a(new bb(this, i2));
}
void a(com.tencent.wxop.stat.event.e eVar, h hVar, boolean z, boolean z2) {
com.tencent.wxop.stat.common.e eVar2 = this.e;
if (eVar2 != null) {
eVar2.a(new ay(this, eVar, hVar, z, z2));
}
}
void a(f fVar) {
if (fVar == null) {
return;
}
this.e.a(new az(this, fVar));
}
void a(List<bd> list, int i2, boolean z, boolean z2) {
com.tencent.wxop.stat.common.e eVar = this.e;
if (eVar != null) {
eVar.a(new av(this, list, i2, z, z2));
}
}
void a(List<bd> list, boolean z, boolean z2) {
com.tencent.wxop.stat.common.e eVar = this.e;
if (eVar != null) {
eVar.a(new aw(this, list, z, z2));
}
}
/* JADX WARN: Removed duplicated region for block: B:36:0x00b3 A[Catch: all -> 0x01cb, TryCatch #4 {all -> 0x01cb, blocks: (B:15:0x0039, B:17:0x0043, B:19:0x0060, B:22:0x0075, B:24:0x007f, B:25:0x0081, B:27:0x0089, B:29:0x008c, B:31:0x0090, B:36:0x00b3, B:38:0x00b6, B:39:0x00ee, B:41:0x0120, B:43:0x0133, B:45:0x0143, B:47:0x014d, B:49:0x0153, B:50:0x0169, B:52:0x01ac, B:65:0x00cd, B:67:0x00d3, B:69:0x00d9, B:70:0x009b, B:72:0x00a1, B:76:0x00ab), top: B:14:0x0039 }] */
/* JADX WARN: Removed duplicated region for block: B:41:0x0120 A[Catch: all -> 0x01cb, TryCatch #4 {all -> 0x01cb, blocks: (B:15:0x0039, B:17:0x0043, B:19:0x0060, B:22:0x0075, B:24:0x007f, B:25:0x0081, B:27:0x0089, B:29:0x008c, B:31:0x0090, B:36:0x00b3, B:38:0x00b6, B:39:0x00ee, B:41:0x0120, B:43:0x0133, B:45:0x0143, B:47:0x014d, B:49:0x0153, B:50:0x0169, B:52:0x01ac, B:65:0x00cd, B:67:0x00d3, B:69:0x00d9, B:70:0x009b, B:72:0x00a1, B:76:0x00ab), top: B:14:0x0039 }] */
/* JADX WARN: Removed duplicated region for block: B:43:0x0133 A[Catch: all -> 0x01cb, TryCatch #4 {all -> 0x01cb, blocks: (B:15:0x0039, B:17:0x0043, B:19:0x0060, B:22:0x0075, B:24:0x007f, B:25:0x0081, B:27:0x0089, B:29:0x008c, B:31:0x0090, B:36:0x00b3, B:38:0x00b6, B:39:0x00ee, B:41:0x0120, B:43:0x0133, B:45:0x0143, B:47:0x014d, B:49:0x0153, B:50:0x0169, B:52:0x01ac, B:65:0x00cd, B:67:0x00d3, B:69:0x00d9, B:70:0x009b, B:72:0x00a1, B:76:0x00ab), top: B:14:0x0039 }] */
/* JADX WARN: Removed duplicated region for block: B:67:0x00d3 A[Catch: all -> 0x01cb, TryCatch #4 {all -> 0x01cb, blocks: (B:15:0x0039, B:17:0x0043, B:19:0x0060, B:22:0x0075, B:24:0x007f, B:25:0x0081, B:27:0x0089, B:29:0x008c, B:31:0x0090, B:36:0x00b3, B:38:0x00b6, B:39:0x00ee, B:41:0x0120, B:43:0x0133, B:45:0x0143, B:47:0x014d, B:49:0x0153, B:50:0x0169, B:52:0x01ac, B:65:0x00cd, B:67:0x00d3, B:69:0x00d9, B:70:0x009b, B:72:0x00a1, B:76:0x00ab), top: B:14:0x0039 }] */
/* JADX WARN: Removed duplicated region for block: B:87:0x01d7 A[EXC_TOP_SPLITTER, SYNTHETIC] */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
public synchronized com.tencent.wxop.stat.common.a b(android.content.Context r19) {
/*
Method dump skipped, instructions count: 519
To view this dump change 'Code comments level' option to 'DEBUG'
*/
throw new UnsupportedOperationException("Method not decompiled: com.tencent.wxop.stat.au.b(android.content.Context):com.tencent.wxop.stat.common.a");
}
void c() {
if (StatConfig.isEnableStatService()) {
try {
this.e.a(new ax(this));
} catch (Throwable th) {
h.e(th);
}
}
}
void d() {
Cursor cursor = null;
try {
cursor = this.c.getReadableDatabase().query("config", null, null, null, null, null, null);
while (cursor.moveToNext()) {
int i2 = cursor.getInt(0);
String string = cursor.getString(1);
String string2 = cursor.getString(2);
int i3 = cursor.getInt(3);
f fVar = new f(i2);
fVar.a = i2;
fVar.b = new JSONObject(string);
fVar.c = string2;
fVar.d = i3;
StatConfig.a(i, fVar);
}
} catch (Throwable th) {
try {
h.e(th);
if (cursor != null) {
cursor.close();
}
} finally {
if (cursor != null) {
cursor.close();
}
}
}
}
}

View File

@@ -0,0 +1,28 @@
package com.tencent.wxop.stat;
import java.util.List;
/* loaded from: classes.dex */
class av implements Runnable {
final /* synthetic */ List a;
final /* synthetic */ int b;
final /* synthetic */ boolean c;
final /* synthetic */ boolean d;
final /* synthetic */ au e;
av(au auVar, List list, int i, boolean z, boolean z2) {
this.e = auVar;
this.a = list;
this.b = i;
this.c = z;
this.d = z2;
}
@Override // java.lang.Runnable
public void run() {
this.e.a((List<bd>) this.a, this.b, this.c);
if (this.d) {
this.a.clear();
}
}
}

View File

@@ -0,0 +1,26 @@
package com.tencent.wxop.stat;
import java.util.List;
/* loaded from: classes.dex */
class aw implements Runnable {
final /* synthetic */ List a;
final /* synthetic */ boolean b;
final /* synthetic */ boolean c;
final /* synthetic */ au d;
aw(au auVar, List list, boolean z, boolean z2) {
this.d = auVar;
this.a = list;
this.b = z;
this.c = z2;
}
@Override // java.lang.Runnable
public void run() {
this.d.a((List<bd>) this.a, this.b);
if (this.c) {
this.a.clear();
}
}
}

View File

@@ -0,0 +1,15 @@
package com.tencent.wxop.stat;
/* loaded from: classes.dex */
class ax implements Runnable {
final /* synthetic */ au a;
ax(au auVar) {
this.a = auVar;
}
@Override // java.lang.Runnable
public void run() {
this.a.i();
}
}

View File

@@ -0,0 +1,23 @@
package com.tencent.wxop.stat;
/* loaded from: classes.dex */
class ay implements Runnable {
final /* synthetic */ com.tencent.wxop.stat.event.e a;
final /* synthetic */ h b;
final /* synthetic */ boolean c;
final /* synthetic */ boolean d;
final /* synthetic */ au e;
ay(au auVar, com.tencent.wxop.stat.event.e eVar, h hVar, boolean z, boolean z2) {
this.e = auVar;
this.a = eVar;
this.b = hVar;
this.c = z;
this.d = z2;
}
@Override // java.lang.Runnable
public void run() {
this.e.b(this.a, this.b, this.c, this.d);
}
}

View File

@@ -0,0 +1,17 @@
package com.tencent.wxop.stat;
/* loaded from: classes.dex */
class az implements Runnable {
final /* synthetic */ f a;
final /* synthetic */ au b;
az(au auVar, f fVar) {
this.b = auVar;
this.a = fVar;
}
@Override // java.lang.Runnable
public void run() {
this.b.b(this.a);
}
}

View File

@@ -0,0 +1,25 @@
package com.tencent.wxop.stat;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
/* loaded from: classes.dex */
class b extends BroadcastReceiver {
final /* synthetic */ a a;
b(a aVar) {
this.a = aVar;
}
@Override // android.content.BroadcastReceiver
public void onReceive(Context context, Intent intent) {
com.tencent.wxop.stat.common.e eVar;
com.tencent.wxop.stat.common.e eVar2;
eVar = this.a.e;
if (eVar != null) {
eVar2 = this.a.e;
eVar2.a(new c(this));
}
}
}

View File

@@ -0,0 +1,28 @@
package com.tencent.wxop.stat;
import java.util.List;
/* loaded from: classes.dex */
class ba implements h {
final /* synthetic */ List a;
final /* synthetic */ boolean b;
final /* synthetic */ au c;
ba(au auVar, List list, boolean z) {
this.c = auVar;
this.a = list;
this.b = z;
}
@Override // com.tencent.wxop.stat.h
public void a() {
StatServiceImpl.c();
this.c.a(this.a, this.b, true);
}
@Override // com.tencent.wxop.stat.h
public void b() {
StatServiceImpl.d();
this.c.a(this.a, 1, this.b, true);
}
}

View File

@@ -0,0 +1,18 @@
package com.tencent.wxop.stat;
/* loaded from: classes.dex */
class bb implements Runnable {
final /* synthetic */ int a;
final /* synthetic */ au b;
bb(au auVar, int i) {
this.b = auVar;
this.a = i;
}
@Override // java.lang.Runnable
public void run() {
this.b.b(this.a, true);
this.b.b(this.a, false);
}
}

View File

@@ -0,0 +1,125 @@
package com.tencent.wxop.stat;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import com.tencent.wxop.stat.common.StatLogger;
import java.util.ArrayList;
/* loaded from: classes.dex */
class bc extends SQLiteOpenHelper {
private String a;
private Context b;
public bc(Context context, String str) {
super(context, str, (SQLiteDatabase.CursorFactory) null, 3);
StatLogger statLogger;
this.a = "";
this.b = null;
this.a = str;
this.b = context.getApplicationContext();
if (StatConfig.isDebugEnable()) {
statLogger = au.h;
statLogger.i("SQLiteOpenHelper " + this.a);
}
}
private void a(SQLiteDatabase sQLiteDatabase) {
Cursor cursor;
StatLogger statLogger;
String str = null;
try {
cursor = sQLiteDatabase.query("user", null, null, null, null, null, null);
} catch (Throwable th) {
th = th;
cursor = null;
}
try {
ContentValues contentValues = new ContentValues();
if (cursor.moveToNext()) {
str = cursor.getString(0);
cursor.getInt(1);
cursor.getString(2);
cursor.getLong(3);
contentValues.put("uid", com.tencent.wxop.stat.common.r.b(str));
}
if (str != null) {
sQLiteDatabase.update("user", contentValues, "uid=?", new String[]{str});
}
} catch (Throwable th2) {
th = th2;
try {
statLogger = au.h;
statLogger.e(th);
if (cursor != null) {
cursor.close();
}
} finally {
if (cursor != null) {
cursor.close();
}
}
}
}
private void b(SQLiteDatabase sQLiteDatabase) {
StatLogger statLogger;
Cursor cursor = null;
try {
cursor = sQLiteDatabase.query("events", null, null, null, null, null, null);
ArrayList<bd> arrayList = new ArrayList();
while (cursor.moveToNext()) {
arrayList.add(new bd(cursor.getLong(0), cursor.getString(1), cursor.getInt(2), cursor.getInt(3)));
}
ContentValues contentValues = new ContentValues();
for (bd bdVar : arrayList) {
contentValues.put("content", com.tencent.wxop.stat.common.r.b(bdVar.b));
sQLiteDatabase.update("events", contentValues, "event_id=?", new String[]{Long.toString(bdVar.a)});
}
} catch (Throwable th) {
try {
statLogger = au.h;
statLogger.e(th);
if (cursor != null) {
cursor.close();
}
} finally {
if (cursor != null) {
cursor.close();
}
}
}
}
@Override // android.database.sqlite.SQLiteOpenHelper, java.lang.AutoCloseable
public synchronized void close() {
super.close();
}
@Override // android.database.sqlite.SQLiteOpenHelper
public void onCreate(SQLiteDatabase sQLiteDatabase) {
sQLiteDatabase.execSQL("create table if not exists events(event_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, content TEXT, status INTEGER, send_count INTEGER, timestamp LONG)");
sQLiteDatabase.execSQL("create table if not exists user(uid TEXT PRIMARY KEY, user_type INTEGER, app_ver TEXT, ts INTEGER)");
sQLiteDatabase.execSQL("create table if not exists config(type INTEGER PRIMARY KEY NOT NULL, content TEXT, md5sum TEXT, version INTEGER)");
sQLiteDatabase.execSQL("create table if not exists keyvalues(key TEXT PRIMARY KEY NOT NULL, value TEXT)");
sQLiteDatabase.execSQL("CREATE INDEX if not exists status_idx ON events(status)");
}
@Override // android.database.sqlite.SQLiteOpenHelper
public void onUpgrade(SQLiteDatabase sQLiteDatabase, int i, int i2) {
StatLogger statLogger;
statLogger = au.h;
statLogger.debug("upgrade DB from oldVersion " + i + " to newVersion " + i2);
if (i == 1) {
sQLiteDatabase.execSQL("create table if not exists keyvalues(key TEXT PRIMARY KEY NOT NULL, value TEXT)");
a(sQLiteDatabase);
b(sQLiteDatabase);
}
if (i == 2) {
a(sQLiteDatabase);
b(sQLiteDatabase);
}
}
}

View File

@@ -0,0 +1,20 @@
package com.tencent.wxop.stat;
/* loaded from: classes.dex */
class bd {
long a;
String b;
int c;
int d;
public bd(long j, String str, int i, int i2) {
this.a = j;
this.b = str;
this.c = i;
this.d = i2;
}
public String toString() {
return this.b;
}
}

View File

@@ -0,0 +1,15 @@
package com.tencent.wxop.stat;
/* loaded from: classes.dex */
class c implements Runnable {
final /* synthetic */ b a;
c(b bVar) {
this.a = bVar;
}
@Override // java.lang.Runnable
public void run() {
this.a.a.g();
}
}

View File

@@ -0,0 +1,21 @@
package com.tencent.wxop.stat.common;
import java.io.File;
/* loaded from: classes.dex */
public class StatConstants {
public static final String LOG_TAG = "MtaSDK";
public static final String MTA_COOPERATION_TAG = "wxop_";
public static final String MTA_REPORT_FULL_URL = "http://pingma.qq.com:80/mstat/report";
public static final String MTA_SERVER = "pingma.qq.com:80";
public static final String MTA_SERVER_HOST = "pingma.qq.com";
public static final int MTA_SERVER_PORT = 80;
public static final String MTA_STAT_URL = "/mstat/report";
public static final int SDK_ONLINE_CONFIG_TYPE = 1;
public static final int STAT_DB_VERSION = 3;
public static final int USER_ONLINE_CONFIG_TYPE = 2;
public static final String VERSION = "2.0.4";
public static final int XG_PRO_VERSION = 1;
public static final String MTA_STORAGE_PRE_TAG = "tencent.mta" + File.separator + "datawxop_";
public static String DATABASE_NAME = "wxop_tencent_analysis.db";
}

View File

@@ -0,0 +1,188 @@
package com.tencent.wxop.stat.common;
import android.util.Log;
import com.tencent.wxop.stat.StatConfig;
/* loaded from: classes.dex */
public final class StatLogger {
private String a;
private boolean b;
private int c;
public StatLogger() {
this.a = "default";
this.b = true;
this.c = 2;
}
public StatLogger(String str) {
this.a = "default";
this.b = true;
this.c = 2;
this.a = str;
}
private String a() {
StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace();
if (stackTrace == null) {
return null;
}
for (StackTraceElement stackTraceElement : stackTrace) {
if (!stackTraceElement.isNativeMethod() && !stackTraceElement.getClassName().equals(Thread.class.getName()) && !stackTraceElement.getClassName().equals(StatLogger.class.getName())) {
return "[" + Thread.currentThread().getName() + "(" + Thread.currentThread().getId() + "): " + stackTraceElement.getFileName() + ":" + stackTraceElement.getLineNumber() + "]";
}
}
return null;
}
public final void d(Object obj) {
if (isDebugEnable()) {
debug(obj);
}
}
public final void debug(Object obj) {
String str;
if (this.c <= 3) {
String a = a();
if (a == null) {
str = obj.toString();
} else {
str = a + " - " + obj;
}
Log.d(this.a, str);
com.tencent.wxop.stat.g customLogger = StatConfig.getCustomLogger();
if (customLogger != null) {
customLogger.e(str);
}
}
}
public final void e(Object obj) {
if (isDebugEnable()) {
error(obj);
}
}
public final void e(Throwable th) {
if (isDebugEnable()) {
error(th);
}
}
public final void error(Object obj) {
String str;
if (this.c <= 6) {
String a = a();
if (a == null) {
str = obj.toString();
} else {
str = a + " - " + obj;
}
Log.e(this.a, str);
com.tencent.wxop.stat.g customLogger = StatConfig.getCustomLogger();
if (customLogger != null) {
customLogger.d(str);
}
}
}
public final void error(Throwable th) {
if (this.c <= 6) {
Log.e(this.a, "", th);
com.tencent.wxop.stat.g customLogger = StatConfig.getCustomLogger();
if (customLogger != null) {
customLogger.d(th);
}
}
}
public final int getLogLevel() {
return this.c;
}
public final void i(Object obj) {
if (isDebugEnable()) {
info(obj);
}
}
public final void info(Object obj) {
String str;
if (this.c <= 4) {
String a = a();
if (a == null) {
str = obj.toString();
} else {
str = a + " - " + obj;
}
Log.i(this.a, str);
com.tencent.wxop.stat.g customLogger = StatConfig.getCustomLogger();
if (customLogger != null) {
customLogger.a(str);
}
}
}
public final boolean isDebugEnable() {
return this.b;
}
public final void setDebugEnable(boolean z) {
this.b = z;
}
public final void setLogLevel(int i) {
this.c = i;
}
public final void setTag(String str) {
this.a = str;
}
public final void v(Object obj) {
if (isDebugEnable()) {
verbose(obj);
}
}
public final void verbose(Object obj) {
String str;
if (this.c <= 2) {
String a = a();
if (a == null) {
str = obj.toString();
} else {
str = a + " - " + obj;
}
Log.v(this.a, str);
com.tencent.wxop.stat.g customLogger = StatConfig.getCustomLogger();
if (customLogger != null) {
customLogger.b(str);
}
}
}
public final void w(Object obj) {
if (isDebugEnable()) {
warn(obj);
}
}
public final void warn(Object obj) {
String str;
if (this.c <= 5) {
String a = a();
if (a == null) {
str = obj.toString();
} else {
str = a + " - " + obj;
}
Log.w(this.a, str);
com.tencent.wxop.stat.g customLogger = StatConfig.getCustomLogger();
if (customLogger != null) {
customLogger.c(str);
}
}
}
}

View File

@@ -0,0 +1,70 @@
package com.tencent.wxop.stat.common;
import org.json.JSONException;
import org.json.JSONObject;
/* loaded from: classes.dex */
public class a {
private String a;
private String b;
private String c;
private String d;
private int e;
private int f;
private long g;
public a() {
this.a = null;
this.b = null;
this.c = null;
this.d = "0";
this.f = 0;
this.g = 0L;
}
public a(String str, String str2, int i) {
this.a = null;
this.b = null;
this.c = null;
this.d = "0";
this.f = 0;
this.g = 0L;
this.a = str;
this.b = str2;
this.e = i;
}
JSONObject a() {
JSONObject jSONObject = new JSONObject();
try {
r.a(jSONObject, "ui", this.a);
r.a(jSONObject, "mc", this.b);
r.a(jSONObject, "mid", this.d);
r.a(jSONObject, "aid", this.c);
jSONObject.put("ts", this.g);
jSONObject.put("ver", this.f);
} catch (JSONException unused) {
}
return jSONObject;
}
public void a(int i) {
this.e = i;
}
public String b() {
return this.a;
}
public String c() {
return this.b;
}
public int d() {
return this.e;
}
public String toString() {
return a().toString();
}
}

View File

@@ -0,0 +1,76 @@
package com.tencent.wxop.stat.common;
import android.content.Context;
import java.util.HashMap;
import java.util.Map;
import org.json.JSONObject;
/* loaded from: classes.dex */
public class b {
static d a;
private static StatLogger d = l.b();
private static JSONObject e = new JSONObject();
Integer b;
String c;
public b(Context context) {
this.b = null;
this.c = null;
try {
a(context);
this.b = l.k(context.getApplicationContext());
this.c = com.tencent.wxop.stat.a.a(context).b();
} catch (Throwable th) {
d.e(th);
}
}
static synchronized d a(Context context) {
d dVar;
synchronized (b.class) {
if (a == null) {
a = new d(context.getApplicationContext());
}
dVar = a;
}
return dVar;
}
public static void a(Context context, Map<String, String> map) {
if (map == null) {
return;
}
for (Map.Entry entry : new HashMap(map).entrySet()) {
e.put((String) entry.getKey(), entry.getValue());
}
}
public void a(JSONObject jSONObject, Thread thread) {
String str;
String str2;
JSONObject jSONObject2 = new JSONObject();
try {
if (a != null) {
a.a(jSONObject2, thread);
}
r.a(jSONObject2, "cn", this.c);
if (this.b != null) {
jSONObject2.put("tn", this.b);
}
if (thread == null) {
str = "ev";
str2 = jSONObject2;
} else {
str = "errkv";
str2 = jSONObject2.toString();
}
jSONObject.put(str, str2);
if (e == null || e.length() <= 0) {
return;
}
jSONObject.put("eva", e);
} catch (Throwable th) {
d.e(th);
}
}
}

View File

@@ -0,0 +1,138 @@
package com.tencent.wxop.stat.common;
import android.content.Context;
import android.os.Build;
import android.util.DisplayMetrics;
import com.tencent.wxop.stat.StatConfig;
import com.tencent.wxop.stat.au;
import com.ubt.jimu.controller.data.widget.JockstickDataConverter;
import com.ubt.jimu.unity.bluetooth.MyUnityListener;
import java.util.Locale;
import java.util.TimeZone;
import org.json.JSONArray;
import org.json.JSONObject;
/* loaded from: classes.dex */
class d {
String a;
String b;
DisplayMetrics c;
int d;
String e;
String f;
String g;
String h;
String i;
String j;
String k;
int l;
String m;
String n;
Context o;
private String p;
private String q;
private String r;
private String s;
private d(Context context) {
this.b = StatConstants.VERSION;
this.d = Build.VERSION.SDK_INT;
this.e = Build.MODEL;
this.f = Build.MANUFACTURER;
this.g = Locale.getDefault().getLanguage();
this.l = 0;
this.m = null;
this.n = null;
this.o = null;
this.p = null;
this.q = null;
this.r = null;
this.s = null;
this.o = context.getApplicationContext();
this.c = l.d(this.o);
this.a = l.h(this.o);
this.h = StatConfig.getInstallChannel(this.o);
this.i = l.g(this.o);
this.j = TimeZone.getDefault().getID();
this.l = l.m(this.o);
this.k = l.n(this.o);
this.m = this.o.getPackageName();
if (this.d >= 14) {
this.p = l.t(this.o);
}
this.q = l.s(this.o).toString();
this.r = l.r(this.o);
this.s = l.d();
this.n = l.A(this.o);
}
void a(JSONObject jSONObject, Thread thread) {
String localMidOnly;
String str;
if (thread == null) {
if (this.c != null) {
jSONObject.put("sr", this.c.widthPixels + "*" + this.c.heightPixels);
jSONObject.put("dpi", this.c.xdpi + "*" + this.c.ydpi);
}
if (com.tencent.wxop.stat.a.a(this.o).e()) {
JSONObject jSONObject2 = new JSONObject();
r.a(jSONObject2, "bs", r.d(this.o));
r.a(jSONObject2, "ss", r.e(this.o));
if (jSONObject2.length() > 0) {
r.a(jSONObject, "wf", jSONObject2.toString());
}
}
JSONArray a = r.a(this.o, 10);
if (a != null && a.length() > 0) {
r.a(jSONObject, "wflist", a.toString());
}
localMidOnly = this.p;
str = "sen";
} else {
r.a(jSONObject, "thn", thread.getName());
r.a(jSONObject, "qq", StatConfig.getQQ(this.o));
r.a(jSONObject, "cui", StatConfig.getCustomUserId(this.o));
if (l.c(this.r) && this.r.split("/").length == 2) {
r.a(jSONObject, "fram", this.r.split("/")[0]);
}
if (l.c(this.s) && this.s.split("/").length == 2) {
r.a(jSONObject, MyUnityListener.CALLER, this.s.split("/")[0]);
}
if (au.a(this.o).b(this.o) != null) {
jSONObject.put("ui", au.a(this.o).b(this.o).b());
}
localMidOnly = StatConfig.getLocalMidOnly(this.o);
str = "mid";
}
r.a(jSONObject, str, localMidOnly);
r.a(jSONObject, "pcn", l.o(this.o));
r.a(jSONObject, "osn", Build.VERSION.RELEASE);
r.a(jSONObject, "av", this.a);
r.a(jSONObject, "ch", this.h);
r.a(jSONObject, "mf", this.f);
r.a(jSONObject, "sv", this.b);
r.a(jSONObject, "osd", Build.DISPLAY);
r.a(jSONObject, "prod", Build.PRODUCT);
r.a(jSONObject, "tags", Build.TAGS);
r.a(jSONObject, JockstickDataConverter.ID, Build.ID);
r.a(jSONObject, "fng", Build.FINGERPRINT);
r.a(jSONObject, "lch", this.n);
r.a(jSONObject, "ov", Integer.toString(this.d));
jSONObject.put("os", 1);
r.a(jSONObject, "op", this.i);
r.a(jSONObject, "lg", this.g);
r.a(jSONObject, "md", this.e);
r.a(jSONObject, "tz", this.j);
int i = this.l;
if (i != 0) {
jSONObject.put("jb", i);
}
r.a(jSONObject, "sd", this.k);
r.a(jSONObject, "apn", this.m);
r.a(jSONObject, "cpu", this.q);
r.a(jSONObject, "abi", Build.CPU_ABI);
r.a(jSONObject, "abi2", Build.CPU_ABI2);
r.a(jSONObject, "ram", this.r);
r.a(jSONObject, "rom", this.s);
}
}

View File

@@ -0,0 +1,18 @@
package com.tencent.wxop.stat.common;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/* loaded from: classes.dex */
public class e {
ExecutorService a;
public e() {
this.a = null;
this.a = Executors.newSingleThreadExecutor();
}
public void a(Runnable runnable) {
this.a.execute(runnable);
}
}

View File

@@ -0,0 +1,55 @@
package com.tencent.wxop.stat.common;
import android.util.Base64;
import com.ijm.dataencryption.de.DataDecryptTool;
/* loaded from: classes.dex */
public class f {
static byte[] a() {
return Base64.decode("MDNhOTc2NTExZTJjYmUzYTdmMjY4MDhmYjdhZjNjMDU=", 0);
}
public static byte[] a(byte[] bArr) {
return a(bArr, a());
}
static byte[] a(byte[] bArr, byte[] bArr2) {
int[] iArr = new int[DataDecryptTool.DECRYPT_ALL_FILE];
int[] iArr2 = new int[DataDecryptTool.DECRYPT_ALL_FILE];
int length = bArr2.length;
if (length <= 0 || length > 256) {
throw new IllegalArgumentException("key must be between 1 and 256 bytes");
}
for (int i = 0; i < 256; i++) {
iArr[i] = i;
iArr2[i] = bArr2[i % length];
}
int i2 = 0;
for (int i3 = 0; i3 < 256; i3++) {
i2 = (i2 + iArr[i3] + iArr2[i3]) & 255;
int i4 = iArr[i3];
iArr[i3] = iArr[i2];
iArr[i2] = i4;
}
byte[] bArr3 = new byte[bArr.length];
int i5 = 0;
int i6 = 0;
for (int i7 = 0; i7 < bArr.length; i7++) {
i5 = (i5 + 1) & 255;
i6 = (i6 + iArr[i5]) & 255;
int i8 = iArr[i5];
iArr[i5] = iArr[i6];
iArr[i6] = i8;
bArr3[i7] = (byte) (iArr[(iArr[i5] + iArr[i6]) & 255] ^ bArr[i7]);
}
return bArr3;
}
public static byte[] b(byte[] bArr) {
return b(bArr, a());
}
static byte[] b(byte[] bArr, byte[] bArr2) {
return a(bArr, bArr2);
}
}

View File

@@ -0,0 +1,79 @@
package com.tencent.wxop.stat.common;
import android.content.Context;
import android.os.Build;
import android.provider.Settings;
import java.lang.reflect.Method;
/* loaded from: classes.dex */
public class g {
private static volatile g c;
private int a = 10;
private int b;
private Context d;
private boolean e;
private g(Context context) {
this.b = 0;
this.d = null;
this.e = false;
this.d = context.getApplicationContext();
try {
this.e = r.a(this.d, "android.permission.WRITE_SETTINGS");
if (!this.e || Build.VERSION.SDK_INT < 23) {
return;
}
Method declaredMethod = Settings.System.class.getDeclaredMethod("canWrite", Context.class);
declaredMethod.setAccessible(true);
this.e = ((Boolean) declaredMethod.invoke(null, this.d)).booleanValue();
} catch (Throwable th) {
int i = this.b;
this.b = i + 1;
if (i < this.a) {
th.printStackTrace();
}
}
}
public static g a(Context context) {
if (c == null) {
synchronized (g.class) {
if (c == null) {
c = new g(context);
}
}
}
return c;
}
public String a(String str) {
try {
return Settings.System.getString(this.d.getContentResolver(), str);
} catch (Throwable th) {
int i = this.b;
this.b = i + 1;
if (i >= this.a) {
return null;
}
th.printStackTrace();
return null;
}
}
public boolean a(String str, String str2) {
if (!this.e) {
return false;
}
try {
return Settings.System.putString(this.d.getContentResolver(), str, str2);
} catch (Throwable th) {
int i = this.b;
this.b = i + 1;
if (i >= this.a) {
return false;
}
th.printStackTrace();
return false;
}
}
}

View File

@@ -0,0 +1,58 @@
package com.tencent.wxop.stat.common;
/* loaded from: classes.dex */
public class h {
static final /* synthetic */ boolean a = !h.class.desiredAssertionStatus();
private h() {
}
public static byte[] a(byte[] bArr, int i) {
return a(bArr, 0, bArr.length, i);
}
public static byte[] a(byte[] bArr, int i, int i2, int i3) {
j jVar = new j(i3, new byte[(i2 * 3) / 4]);
if (!jVar.a(bArr, i, i2, true)) {
throw new IllegalArgumentException("bad base-64");
}
int i4 = jVar.b;
byte[] bArr2 = jVar.a;
if (i4 == bArr2.length) {
return bArr2;
}
byte[] bArr3 = new byte[i4];
System.arraycopy(bArr2, 0, bArr3, 0, i4);
return bArr3;
}
public static byte[] b(byte[] bArr, int i) {
return b(bArr, 0, bArr.length, i);
}
public static byte[] b(byte[] bArr, int i, int i2, int i3) {
k kVar = new k(i3, null);
int i4 = (i2 / 3) * 4;
if (!kVar.d) {
int i5 = i2 % 3;
if (i5 != 0) {
if (i5 == 1) {
i4 += 2;
} else if (i5 == 2) {
i4 += 3;
}
}
} else if (i2 % 3 > 0) {
i4 += 4;
}
if (kVar.e && i2 > 0) {
i4 += (((i2 - 1) / 57) + 1) * (kVar.f ? 2 : 1);
}
kVar.a = new byte[i4];
kVar.a(bArr, i, i2, true);
if (a || kVar.b == i4) {
return kVar.a;
}
throw new AssertionError();
}
}

View File

@@ -0,0 +1,10 @@
package com.tencent.wxop.stat.common;
/* loaded from: classes.dex */
abstract class i {
public byte[] a;
public int b;
i() {
}
}

View File

@@ -0,0 +1,33 @@
package com.tencent.wxop.stat.common;
/* loaded from: classes.dex */
class j extends i {
private static final int[] c = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -2, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1};
private static final int[] d = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -2, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, 63, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1};
private int e;
private int f;
private final int[] g;
public j(int i, byte[] bArr) {
this.a = bArr;
this.g = (i & 8) == 0 ? c : d;
this.e = 0;
this.f = 0;
}
/* JADX WARN: Code restructure failed: missing block: B:27:0x0107, code lost:
if (r5 != 4) goto L72;
*/
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
public boolean a(byte[] r18, int r19, int r20, boolean r21) {
/*
Method dump skipped, instructions count: 292
To view this dump change 'Code comments level' option to 'DEBUG'
*/
throw new UnsupportedOperationException("Method not decompiled: com.tencent.wxop.stat.common.j.a(byte[], int, int, boolean):boolean");
}
}

View File

@@ -0,0 +1,46 @@
package com.tencent.wxop.stat.common;
/* loaded from: classes.dex */
class k extends i {
static final /* synthetic */ boolean g = !h.class.desiredAssertionStatus();
private static final byte[] h = {65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47};
private static final byte[] i = {65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 45, 95};
int c;
public final boolean d;
public final boolean e;
public final boolean f;
private final byte[] j;
private int k;
private final byte[] l;
public k(int i2, byte[] bArr) {
this.a = bArr;
this.d = (i2 & 1) == 0;
this.e = (i2 & 2) == 0;
this.f = (i2 & 4) != 0;
this.l = (i2 & 8) == 0 ? h : i;
this.j = new byte[2];
this.c = 0;
this.k = this.e ? 19 : -1;
}
/* JADX ERROR: JadxOverflowException in pass: RegionMakerVisitor
jadx.core.utils.exceptions.JadxOverflowException: Regions count limit reached
at jadx.core.utils.ErrorsCounter.addError(ErrorsCounter.java:59)
at jadx.core.utils.ErrorsCounter.error(ErrorsCounter.java:31)
at jadx.core.dex.attributes.nodes.NotificationAttrNode.addError(NotificationAttrNode.java:19)
*/
/* JADX WARN: Removed duplicated region for block: B:20:0x0097 */
/* JADX WARN: Removed duplicated region for block: B:30:0x00e9 A[SYNTHETIC] */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
public boolean a(byte[] r18, int r19, int r20, boolean r21) {
/*
Method dump skipped, instructions count: 529
To view this dump change 'Code comments level' option to 'DEBUG'
*/
throw new UnsupportedOperationException("Method not decompiled: com.tencent.wxop.stat.common.k.a(byte[], int, int, boolean):boolean");
}
}

View File

@@ -0,0 +1,657 @@
package com.tencent.wxop.stat.common;
import android.app.ActivityManager;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.pm.ResolveInfo;
import android.hardware.Sensor;
import android.hardware.SensorManager;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.Proxy;
import android.os.Environment;
import android.os.Process;
import android.os.StatFs;
import android.telephony.TelephonyManager;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.WindowManager;
import com.ijm.dataencryption.de.DataDecryptTool;
import com.tencent.wxop.stat.StatConfig;
import com.tencent.wxop.stat.StatSpecifyReportedInfo;
import com.ubt.jimu.base.util.FileUtil;
import com.ubt.jimu.diy.model.CategoryModel;
import com.ubt.jimu.unity.bluetooth.UnityActivity;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.FileReader;
import java.security.MessageDigest;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.Random;
import java.util.zip.GZIPInputStream;
import org.apache.http.HttpHost;
import org.json.JSONObject;
/* loaded from: classes.dex */
public class l {
private static String a = null;
private static String b = null;
private static String c = null;
private static String d = null;
private static Random e = null;
private static DisplayMetrics f = null;
private static String g = null;
private static String h = "";
private static String i = "";
private static int j = -1;
private static StatLogger k = null;
private static String l = null;
private static String m = null;
private static volatile int n = -1;
private static String o = null;
private static String p = null;
private static long q = -1;
private static String r = "";
private static o s = null;
private static String t = "__MTA_FIRST_ACTIVATE__";
private static int u = -1;
private static long v = -1;
private static int w = 0;
private static String x = "";
public static String A(Context context) {
if (context == null) {
return null;
}
Intent intent = new Intent("android.intent.action.MAIN");
intent.addCategory("android.intent.category.HOME");
ResolveInfo resolveActivity = context.getPackageManager().resolveActivity(intent, 0);
ActivityInfo activityInfo = resolveActivity.activityInfo;
if (activityInfo == null || activityInfo.packageName.equals("android")) {
return null;
}
return resolveActivity.activityInfo.packageName;
}
private static long B(Context context) {
ActivityManager activityManager = (ActivityManager) context.getSystemService("activity");
ActivityManager.MemoryInfo memoryInfo = new ActivityManager.MemoryInfo();
activityManager.getMemoryInfo(memoryInfo);
return memoryInfo.availMem;
}
public static int a() {
return g().nextInt(Integer.MAX_VALUE);
}
public static int a(Context context, boolean z) {
if (z) {
w = y(context);
}
return w;
}
public static Long a(String str, String str2, int i2, int i3, Long l2) {
if (str != null && str2 != null) {
if (str2.equalsIgnoreCase(".") || str2.equalsIgnoreCase("|")) {
str2 = "\\" + str2;
}
String[] split = str.split(str2);
if (split.length == i3) {
try {
Long l3 = 0L;
for (String str3 : split) {
l3 = Long.valueOf(i2 * (l3.longValue() + Long.valueOf(str3).longValue()));
}
return l3;
} catch (NumberFormatException unused) {
}
}
}
return l2;
}
public static String a(int i2) {
Calendar calendar = Calendar.getInstance();
calendar.roll(6, i2);
return new SimpleDateFormat("yyyyMMdd").format(calendar.getTime());
}
public static String a(long j2) {
return new SimpleDateFormat("yyyyMMdd").format(new Date(j2));
}
public static String a(Context context, String str) {
if (StatConfig.isEnableConcurrentProcess()) {
if (m == null) {
m = o(context);
}
if (m != null) {
return str + "_" + m;
}
}
return str;
}
public static String a(String str) {
if (str == null) {
return "0";
}
try {
MessageDigest messageDigest = MessageDigest.getInstance("MD5");
messageDigest.update(str.getBytes());
byte[] digest = messageDigest.digest();
StringBuffer stringBuffer = new StringBuffer();
for (byte b2 : digest) {
int i2 = b2 & 255;
if (i2 < 16) {
stringBuffer.append("0");
}
stringBuffer.append(Integer.toHexString(i2));
}
return stringBuffer.toString();
} catch (Throwable unused) {
return "0";
}
}
public static HttpHost a(Context context) {
NetworkInfo activeNetworkInfo;
String extraInfo;
if (context == null) {
return null;
}
try {
} catch (Throwable th) {
k.e(th);
}
if (context.getPackageManager().checkPermission("android.permission.ACCESS_NETWORK_STATE", context.getPackageName()) != 0 || (activeNetworkInfo = ((ConnectivityManager) context.getSystemService("connectivity")).getActiveNetworkInfo()) == null) {
return null;
}
if ((activeNetworkInfo.getTypeName() != null && activeNetworkInfo.getTypeName().equalsIgnoreCase("WIFI")) || (extraInfo = activeNetworkInfo.getExtraInfo()) == null) {
return null;
}
if (!extraInfo.equals("cmwap") && !extraInfo.equals("3gwap") && !extraInfo.equals("uniwap")) {
if (extraInfo.equals("ctwap")) {
return new HttpHost("10.0.0.200", 80);
}
String defaultHost = Proxy.getDefaultHost();
if (defaultHost != null && defaultHost.trim().length() > 0) {
return new HttpHost(defaultHost, Proxy.getDefaultPort());
}
return null;
}
return new HttpHost("10.0.0.172", 80);
}
public static void a(Context context, int i2) {
w = i2;
q.b(context, "mta.qq.com.difftime", i2);
}
public static boolean a(StatSpecifyReportedInfo statSpecifyReportedInfo) {
if (statSpecifyReportedInfo == null) {
return false;
}
return c(statSpecifyReportedInfo.getAppKey());
}
public static byte[] a(byte[] bArr) {
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bArr);
GZIPInputStream gZIPInputStream = new GZIPInputStream(byteArrayInputStream);
byte[] bArr2 = new byte[FileUtil.ZIP_BUFFER_SIZE];
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(bArr.length * 2);
while (true) {
int read = gZIPInputStream.read(bArr2);
if (read == -1) {
byte[] byteArray = byteArrayOutputStream.toByteArray();
byteArrayInputStream.close();
gZIPInputStream.close();
byteArrayOutputStream.close();
return byteArray;
}
byteArrayOutputStream.write(bArr2, 0, read);
}
}
public static long b(String str) {
return a(str, ".", 100, 3, 0L).longValue();
}
public static synchronized StatLogger b() {
StatLogger statLogger;
synchronized (l.class) {
if (k == null) {
StatLogger statLogger2 = new StatLogger(StatConstants.LOG_TAG);
k = statLogger2;
statLogger2.setDebugEnable(false);
}
statLogger = k;
}
return statLogger;
}
public static synchronized String b(Context context) {
synchronized (l.class) {
if (a != null && a.trim().length() != 0) {
return a;
}
String a2 = r.a(context);
a = a2;
if (a2 == null || a.trim().length() == 0) {
a = Integer.toString(g().nextInt(Integer.MAX_VALUE));
}
return a;
}
}
public static long c() {
try {
Calendar calendar = Calendar.getInstance();
calendar.set(11, 0);
calendar.set(12, 0);
calendar.set(13, 0);
calendar.set(14, 0);
return calendar.getTimeInMillis() + 86400000;
} catch (Throwable th) {
k.e(th);
return System.currentTimeMillis() + 86400000;
}
}
public static synchronized String c(Context context) {
String str;
synchronized (l.class) {
if (c == null || c.trim().length() == 0) {
c = r.b(context);
}
str = c;
}
return str;
}
public static boolean c(String str) {
return (str == null || str.trim().length() == 0) ? false : true;
}
public static DisplayMetrics d(Context context) {
if (f == null) {
f = new DisplayMetrics();
((WindowManager) context.getApplicationContext().getSystemService("window")).getDefaultDisplay().getMetrics(f);
}
return f;
}
public static String d() {
if (c(p)) {
return p;
}
long e2 = e() / 1000000;
StatFs statFs = new StatFs(Environment.getDataDirectory().getPath());
String str = String.valueOf((statFs.getBlockSize() * statFs.getAvailableBlocks()) / 1000000) + "/" + String.valueOf(e2);
p = str;
return str;
}
public static long e() {
StatFs statFs = new StatFs(Environment.getDataDirectory().getPath());
return statFs.getBlockCount() * statFs.getBlockSize();
}
public static boolean e(Context context) {
NetworkInfo[] allNetworkInfo;
try {
} catch (Throwable th) {
k.e(th);
}
if (!r.a(context, "android.permission.ACCESS_WIFI_STATE")) {
k.warn("can not get the permission of android.permission.ACCESS_WIFI_STATE");
return false;
}
ConnectivityManager connectivityManager = (ConnectivityManager) context.getApplicationContext().getSystemService("connectivity");
if (connectivityManager != null && (allNetworkInfo = connectivityManager.getAllNetworkInfo()) != null) {
for (int i2 = 0; i2 < allNetworkInfo.length; i2++) {
if (allNetworkInfo[i2].getTypeName().equalsIgnoreCase("WIFI") && allNetworkInfo[i2].isConnected()) {
return true;
}
}
}
return false;
}
public static String f(Context context) {
if (context == null) {
return null;
}
return context.getClass().getName();
}
public static String g(Context context) {
TelephonyManager telephonyManager;
String str = g;
if (str != null) {
return str;
}
try {
if (!r.a(context, "android.permission.READ_PHONE_STATE")) {
k.e("Could not get permission of android.permission.READ_PHONE_STATE");
} else if (i(context) && (telephonyManager = (TelephonyManager) context.getSystemService("phone")) != null) {
g = telephonyManager.getSimOperator();
}
} catch (Throwable th) {
k.e(th);
}
return g;
}
private static synchronized Random g() {
Random random;
synchronized (l.class) {
if (e == null) {
e = new Random();
}
random = e;
}
return random;
}
private static long h() {
long j2 = q;
if (j2 > 0) {
return j2;
}
long j3 = 1;
try {
BufferedReader bufferedReader = new BufferedReader(new FileReader("/proc/meminfo"), UnityActivity.BLOCKLY_TYPE_NONE);
j3 = Integer.valueOf(bufferedReader.readLine().split("\\s+")[1]).intValue() * DataDecryptTool.DECRYPT_SP_FILE;
bufferedReader.close();
} catch (Exception unused) {
}
q = j3;
return j3;
}
public static String h(Context context) {
if (c(h)) {
return h;
}
try {
String str = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionName;
h = str;
if (str == null) {
return "";
}
} catch (Throwable th) {
k.e(th);
}
return h;
}
public static boolean i(Context context) {
return context.getPackageManager().checkPermission("android.permission.READ_PHONE_STATE", context.getPackageName()) == 0;
}
public static String j(Context context) {
try {
if (r.a(context, "android.permission.INTERNET") && r.a(context, "android.permission.ACCESS_NETWORK_STATE")) {
NetworkInfo activeNetworkInfo = ((ConnectivityManager) context.getSystemService("connectivity")).getActiveNetworkInfo();
if (activeNetworkInfo != null && activeNetworkInfo.isConnected()) {
String typeName = activeNetworkInfo.getTypeName();
String extraInfo = activeNetworkInfo.getExtraInfo();
if (typeName != null) {
if (typeName.equalsIgnoreCase("WIFI")) {
return "WIFI";
}
if (typeName.equalsIgnoreCase("MOBILE")) {
if (extraInfo == null) {
return "MOBILE";
}
} else if (extraInfo == null) {
return typeName;
}
return extraInfo;
}
}
} else {
k.e("can not get the permission of android.permission.ACCESS_WIFI_STATE");
}
} catch (Throwable th) {
k.e(th);
}
return "";
}
public static Integer k(Context context) {
try {
TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService("phone");
if (telephonyManager != null) {
return Integer.valueOf(telephonyManager.getNetworkType());
}
return null;
} catch (Throwable unused) {
return null;
}
}
public static String l(Context context) {
String str;
if (c(i)) {
return i;
}
try {
str = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionName;
i = str;
} catch (Throwable th) {
k.e(th);
}
if (str == null) {
return CategoryModel.unknown;
}
if (i.length() == 0) {
return CategoryModel.unknown;
}
return i;
}
public static int m(Context context) {
int i2 = j;
if (i2 != -1) {
return i2;
}
try {
if (p.a()) {
j = 1;
}
} catch (Throwable th) {
k.e(th);
}
j = 0;
return 0;
}
public static String n(Context context) {
String path;
if (c(l)) {
return l;
}
try {
} catch (Throwable th) {
k.e(th);
}
if (!r.a(context, "android.permission.WRITE_EXTERNAL_STORAGE")) {
k.warn("can not get the permission of android.permission.WRITE_EXTERNAL_STORAGE");
return null;
}
String externalStorageState = Environment.getExternalStorageState();
if (externalStorageState != null && externalStorageState.equals("mounted") && (path = Environment.getExternalStorageDirectory().getPath()) != null) {
StatFs statFs = new StatFs(path);
long availableBlocks = (statFs.getAvailableBlocks() * statFs.getBlockSize()) / 1000000;
String str = String.valueOf(availableBlocks) + "/" + String.valueOf((statFs.getBlockCount() * statFs.getBlockSize()) / 1000000);
l = str;
return str;
}
return null;
}
static String o(Context context) {
if (m != null) {
return m;
}
int myPid = Process.myPid();
Iterator<ActivityManager.RunningAppProcessInfo> it = ((ActivityManager) context.getSystemService("activity")).getRunningAppProcesses().iterator();
while (true) {
if (!it.hasNext()) {
break;
}
ActivityManager.RunningAppProcessInfo next = it.next();
if (next.pid == myPid) {
m = next.processName;
break;
}
}
return m;
}
public static String p(Context context) {
return a(context, StatConstants.DATABASE_NAME);
}
public static synchronized Integer q(Context context) {
Integer valueOf;
synchronized (l.class) {
if (n <= 0) {
n = q.a(context, "MTA_EVENT_INDEX", 0);
q.b(context, "MTA_EVENT_INDEX", n + 1000);
} else if (n % 1000 == 0) {
try {
int i2 = n + 1000;
if (n >= 2147383647) {
i2 = 0;
}
q.b(context, "MTA_EVENT_INDEX", i2);
} catch (Throwable th) {
k.w(th);
}
}
int i3 = n + 1;
n = i3;
valueOf = Integer.valueOf(i3);
}
return valueOf;
}
public static String r(Context context) {
try {
return String.valueOf(B(context) / 1000000) + "/" + String.valueOf(h() / 1000000);
} catch (Throwable th) {
th.printStackTrace();
return null;
}
}
public static JSONObject s(Context context) {
JSONObject jSONObject = new JSONObject();
try {
jSONObject.put("n", m.a());
String d2 = m.d();
if (d2 != null && d2.length() > 0) {
jSONObject.put("na", d2);
}
int b2 = m.b();
if (b2 > 0) {
jSONObject.put("fx", b2 / 1000000);
}
int c2 = m.c();
if (c2 > 0) {
jSONObject.put("fn", c2 / 1000000);
}
} catch (Throwable th) {
Log.w(StatConstants.LOG_TAG, "get cpu error", th);
}
return jSONObject;
}
public static String t(Context context) {
List<Sensor> sensorList;
if (c(r)) {
return r;
}
try {
SensorManager sensorManager = (SensorManager) context.getSystemService("sensor");
if (sensorManager != null && (sensorList = sensorManager.getSensorList(-1)) != null) {
StringBuilder sb = new StringBuilder(sensorList.size() * 10);
for (int i2 = 0; i2 < sensorList.size(); i2++) {
sb.append(sensorList.get(i2).getType());
if (i2 != sensorList.size() - 1) {
sb.append(",");
}
}
r = sb.toString();
}
} catch (Throwable th) {
k.e(th);
}
return r;
}
public static synchronized int u(Context context) {
synchronized (l.class) {
if (u != -1) {
return u;
}
v(context);
return u;
}
}
public static void v(Context context) {
int a2 = q.a(context, t, 1);
u = a2;
if (a2 == 1) {
q.b(context, t, 0);
}
}
public static boolean w(Context context) {
if (v < 0) {
v = q.a(context, "mta.qq.com.checktime", 0L);
}
return Math.abs(System.currentTimeMillis() - v) > 86400000;
}
public static void x(Context context) {
v = System.currentTimeMillis();
q.b(context, "mta.qq.com.checktime", v);
}
public static int y(Context context) {
return q.a(context, "mta.qq.com.difftime", 0);
}
public static boolean z(Context context) {
ActivityManager activityManager;
if (context == null || (activityManager = (ActivityManager) context.getSystemService("activity")) == null) {
return false;
}
String packageName = context.getPackageName();
Iterator<ActivityManager.RunningAppProcessInfo> it = activityManager.getRunningAppProcesses().iterator();
while (true) {
if (!it.hasNext()) {
break;
}
ActivityManager.RunningAppProcessInfo next = it.next();
if (next.processName.startsWith(packageName)) {
if (next.importance == 400) {
return true;
}
}
}
return false;
}
}

View File

@@ -0,0 +1,78 @@
package com.tencent.wxop.stat.common;
import com.ubt.jimu.unity.bluetooth.UnityActivity;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
/* loaded from: classes.dex */
class m {
static int a() {
try {
return new File("/sys/devices/system/cpu/").listFiles(new n()).length;
} catch (Exception e) {
e.printStackTrace();
return 1;
}
}
static int b() {
StatLogger statLogger;
int i = 0;
try {
String str = "";
InputStream inputStream = new ProcessBuilder("/system/bin/cat", "/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq").start().getInputStream();
byte[] bArr = new byte[24];
while (inputStream.read(bArr) != -1) {
str = str + new String(bArr);
}
inputStream.close();
String trim = str.trim();
if (trim.length() > 0) {
i = Integer.valueOf(trim).intValue();
}
} catch (Exception e) {
statLogger = l.k;
statLogger.e((Throwable) e);
}
return i * 1000;
}
static int c() {
StatLogger statLogger;
int i = 0;
try {
String str = "";
InputStream inputStream = new ProcessBuilder("/system/bin/cat", "/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq").start().getInputStream();
byte[] bArr = new byte[24];
while (inputStream.read(bArr) != -1) {
str = str + new String(bArr);
}
inputStream.close();
String trim = str.trim();
if (trim.length() > 0) {
i = Integer.valueOf(trim).intValue();
}
} catch (Throwable th) {
statLogger = l.k;
statLogger.e(th);
}
return i * 1000;
}
static String d() {
String[] strArr = {"", ""};
try {
BufferedReader bufferedReader = new BufferedReader(new FileReader("/proc/cpuinfo"), UnityActivity.BLOCKLY_TYPE_NONE);
String[] split = bufferedReader.readLine().split("\\s+");
for (int i = 2; i < split.length; i++) {
strArr[0] = strArr[0] + split[i] + " ";
}
bufferedReader.close();
} catch (IOException unused) {
}
return strArr[0];
}
}

View File

@@ -0,0 +1,16 @@
package com.tencent.wxop.stat.common;
import java.io.File;
import java.io.FileFilter;
import java.util.regex.Pattern;
/* loaded from: classes.dex */
class n implements FileFilter {
n() {
}
@Override // java.io.FileFilter
public boolean accept(File file) {
return Pattern.matches("cpu[0-9]", file.getName());
}
}

View File

@@ -0,0 +1,5 @@
package com.tencent.wxop.stat.common;
/* loaded from: classes.dex */
class o {
}

View File

@@ -0,0 +1,30 @@
package com.tencent.wxop.stat.common;
import java.io.File;
/* loaded from: classes.dex */
class p {
private static int a = -1;
public static boolean a() {
int i = a;
if (i == 1) {
return true;
}
if (i == 0) {
return false;
}
String[] strArr = {"/bin", "/system/bin/", "/system/xbin/", "/system/sbin/", "/sbin/", "/vendor/bin/"};
for (int i2 = 0; i2 < 6; i2++) {
try {
if (new File(strArr[i2] + "su").exists()) {
a = 1;
return true;
}
} catch (Exception unused) {
}
}
a = 0;
return false;
}
}

View File

@@ -0,0 +1,56 @@
package com.tencent.wxop.stat.common;
import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
/* loaded from: classes.dex */
public class q {
private static SharedPreferences a;
public static int a(Context context, String str, int i) {
return a(context).getInt(l.a(context, StatConstants.MTA_COOPERATION_TAG + str), i);
}
public static long a(Context context, String str, long j) {
return a(context).getLong(l.a(context, StatConstants.MTA_COOPERATION_TAG + str), j);
}
static synchronized SharedPreferences a(Context context) {
SharedPreferences sharedPreferences;
synchronized (q.class) {
SharedPreferences sharedPreferences2 = context.getSharedPreferences(".mta-wxop", 0);
a = sharedPreferences2;
if (sharedPreferences2 == null) {
a = PreferenceManager.getDefaultSharedPreferences(context);
}
sharedPreferences = a;
}
return sharedPreferences;
}
public static String a(Context context, String str, String str2) {
return a(context).getString(l.a(context, StatConstants.MTA_COOPERATION_TAG + str), str2);
}
public static void b(Context context, String str, int i) {
String a2 = l.a(context, StatConstants.MTA_COOPERATION_TAG + str);
SharedPreferences.Editor edit = a(context).edit();
edit.putInt(a2, i);
edit.commit();
}
public static void b(Context context, String str, long j) {
String a2 = l.a(context, StatConstants.MTA_COOPERATION_TAG + str);
SharedPreferences.Editor edit = a(context).edit();
edit.putLong(a2, j);
edit.commit();
}
public static void b(Context context, String str, String str2) {
String a2 = l.a(context, StatConstants.MTA_COOPERATION_TAG + str);
SharedPreferences.Editor edit = a(context).edit();
edit.putString(a2, str2);
edit.commit();
}
}

View File

@@ -0,0 +1,158 @@
package com.tencent.wxop.stat.common;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import android.os.Build;
import android.telephony.TelephonyManager;
import android.util.Log;
import org.json.JSONArray;
import org.json.JSONObject;
/* loaded from: classes.dex */
public class r {
private static String a = "";
public static String a(Context context) {
try {
if (a(context, "android.permission.READ_PHONE_STATE")) {
String deviceId = ((TelephonyManager) context.getSystemService("phone")).getDeviceId();
if (deviceId != null) {
return deviceId;
}
} else {
Log.e(StatConstants.LOG_TAG, "Could not get permission of android.permission.READ_PHONE_STATE");
}
return null;
} catch (Throwable th) {
Log.e(StatConstants.LOG_TAG, "get device id error", th);
return null;
}
}
public static String a(String str) {
if (str == null) {
return null;
}
if (Build.VERSION.SDK_INT < 8) {
return str;
}
try {
return new String(f.b(h.a(str.getBytes("UTF-8"), 0)), "UTF-8");
} catch (Throwable th) {
Log.e(StatConstants.LOG_TAG, "decode error", th);
return str;
}
}
public static JSONArray a(Context context, int i) {
return null;
}
public static void a(JSONObject jSONObject, String str, String str2) {
if (str2 != null) {
try {
if (str2.length() > 0) {
jSONObject.put(str, str2);
}
} catch (Throwable th) {
Log.e(StatConstants.LOG_TAG, "jsonPut error", th);
}
}
}
public static boolean a(Context context, String str) {
try {
return context.getPackageManager().checkPermission(str, context.getPackageName()) == 0;
} catch (Throwable th) {
Log.e(StatConstants.LOG_TAG, "checkPermission error", th);
return false;
}
}
public static String b(Context context) {
if (!a(context, "android.permission.ACCESS_WIFI_STATE")) {
Log.e(StatConstants.LOG_TAG, "Could not get permission of android.permission.ACCESS_WIFI_STATE");
return "";
}
try {
WifiManager wifiManager = (WifiManager) context.getSystemService("wifi");
return wifiManager == null ? "" : wifiManager.getConnectionInfo().getMacAddress();
} catch (Exception e) {
Log.e(StatConstants.LOG_TAG, "get wifi address error", e);
return "";
}
}
public static String b(String str) {
if (str == null) {
return null;
}
if (Build.VERSION.SDK_INT < 8) {
return str;
}
try {
return new String(h.b(f.a(str.getBytes("UTF-8")), 0), "UTF-8");
} catch (Throwable th) {
Log.e(StatConstants.LOG_TAG, "encode error", th);
return str;
}
}
public static WifiInfo c(Context context) {
WifiManager wifiManager;
if (!a(context, "android.permission.ACCESS_WIFI_STATE") || (wifiManager = (WifiManager) context.getApplicationContext().getSystemService("wifi")) == null) {
return null;
}
return wifiManager.getConnectionInfo();
}
public static String d(Context context) {
try {
WifiInfo c = c(context);
if (c != null) {
return c.getBSSID();
}
return null;
} catch (Throwable th) {
Log.e(StatConstants.LOG_TAG, "encode error", th);
return null;
}
}
public static String e(Context context) {
try {
WifiInfo c = c(context);
if (c != null) {
return c.getSSID();
}
return null;
} catch (Throwable th) {
Log.e(StatConstants.LOG_TAG, "encode error", th);
return null;
}
}
public static boolean f(Context context) {
try {
if (a(context, "android.permission.INTERNET") && a(context, "android.permission.ACCESS_NETWORK_STATE")) {
ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService("connectivity");
if (connectivityManager != null) {
NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
if (activeNetworkInfo != null && activeNetworkInfo.isAvailable()) {
return true;
}
Log.w(StatConstants.LOG_TAG, "Network error");
return false;
}
} else {
Log.e(StatConstants.LOG_TAG, "can not get the permisson of android.permission.INTERNET");
}
} catch (Throwable th) {
Log.e(StatConstants.LOG_TAG, "isNetworkAvailable error", th);
}
return false;
}
}

View File

@@ -0,0 +1,53 @@
package com.tencent.wxop.stat;
import android.content.Context;
import java.util.Timer;
import java.util.TimerTask;
/* loaded from: classes.dex */
public class d {
private static volatile d b;
private Timer a;
private Context c;
private d(Context context) {
this.a = null;
this.c = null;
this.c = context.getApplicationContext();
this.a = new Timer(false);
}
public static d a(Context context) {
if (b == null) {
synchronized (d.class) {
if (b == null) {
b = new d(context);
}
}
}
return b;
}
public void a() {
if (StatConfig.getStatSendStrategy() == StatReportStrategy.PERIOD) {
long sendPeriodMinutes = StatConfig.getSendPeriodMinutes() * 60 * 1000;
if (StatConfig.isDebugEnable()) {
com.tencent.wxop.stat.common.l.b().i("setupPeriodTimer delay:" + sendPeriodMinutes);
}
a(new e(this), sendPeriodMinutes);
}
}
public void a(TimerTask timerTask, long j) {
if (this.a == null) {
if (StatConfig.isDebugEnable()) {
com.tencent.wxop.stat.common.l.b().w("setupPeriodTimer schedule timer == null");
}
} else {
if (StatConfig.isDebugEnable()) {
com.tencent.wxop.stat.common.l.b().i("setupPeriodTimer schedule delay:" + j);
}
this.a.schedule(timerTask, j);
}
}
}

View File

@@ -0,0 +1,25 @@
package com.tencent.wxop.stat;
import android.content.Context;
import java.util.TimerTask;
/* loaded from: classes.dex */
class e extends TimerTask {
final /* synthetic */ d a;
e(d dVar) {
this.a = dVar;
}
@Override // java.util.TimerTask, java.lang.Runnable
public void run() {
Context context;
if (StatConfig.isDebugEnable()) {
com.tencent.wxop.stat.common.l.b().i("TimerTask run");
}
context = this.a.c;
StatServiceImpl.e(context);
cancel();
this.a.a();
}
}

View File

@@ -0,0 +1,24 @@
package com.tencent.wxop.stat.event;
/* loaded from: classes.dex */
public enum EventType {
PAGE_VIEW(1),
SESSION_ENV(2),
ERROR(3),
CUSTOM(1000),
ADDITION(1001),
MONITOR_STAT(1002),
MTA_GAME_USER(1003),
NETWORK_MONITOR(1004),
NETWORK_DETECTOR(1005);
private int a;
EventType(int i) {
this.a = i;
}
public final int a() {
return this.a;
}
}

View File

@@ -0,0 +1,30 @@
package com.tencent.wxop.stat.event;
import android.content.Context;
import com.tencent.wxop.stat.StatAccount;
import com.tencent.wxop.stat.StatSpecifyReportedInfo;
import com.tencent.wxop.stat.common.r;
import org.json.JSONObject;
/* loaded from: classes.dex */
public class a extends e {
private StatAccount a;
public a(Context context, int i, StatAccount statAccount, StatSpecifyReportedInfo statSpecifyReportedInfo) {
super(context, i, statSpecifyReportedInfo);
this.a = null;
this.a = statAccount;
}
@Override // com.tencent.wxop.stat.event.e
public EventType a() {
return EventType.ADDITION;
}
@Override // com.tencent.wxop.stat.event.e
public boolean a(JSONObject jSONObject) {
r.a(jSONObject, "qq", this.a.getAccount());
jSONObject.put("acc", this.a.toJsonString());
return true;
}
}

View File

@@ -0,0 +1,75 @@
package com.tencent.wxop.stat.event;
import android.content.Context;
import com.tencent.wxop.stat.StatServiceImpl;
import com.tencent.wxop.stat.StatSpecifyReportedInfo;
import java.util.Map;
import java.util.Properties;
import org.json.JSONException;
import org.json.JSONObject;
/* loaded from: classes.dex */
public class b extends e {
protected c a;
private long m;
public b(Context context, int i, String str, StatSpecifyReportedInfo statSpecifyReportedInfo) {
super(context, i, statSpecifyReportedInfo);
this.a = new c();
this.m = -1L;
this.a.a = str;
}
private void h() {
Properties commonKeyValueForKVEvent;
String str = this.a.a;
if (str == null || (commonKeyValueForKVEvent = StatServiceImpl.getCommonKeyValueForKVEvent(str)) == null || commonKeyValueForKVEvent.size() <= 0) {
return;
}
JSONObject jSONObject = this.a.c;
if (jSONObject == null || jSONObject.length() == 0) {
this.a.c = new JSONObject(commonKeyValueForKVEvent);
return;
}
for (Map.Entry entry : commonKeyValueForKVEvent.entrySet()) {
try {
this.a.c.put(entry.getKey().toString(), entry.getValue());
} catch (JSONException e) {
e.printStackTrace();
}
}
}
@Override // com.tencent.wxop.stat.event.e
public EventType a() {
return EventType.CUSTOM;
}
public void a(long j) {
this.m = j;
}
@Override // com.tencent.wxop.stat.event.e
public boolean a(JSONObject jSONObject) {
String str;
jSONObject.put("ei", this.a.a);
long j = this.m;
if (j > 0) {
jSONObject.put("du", j);
}
Object obj = this.a.b;
if (obj == null) {
h();
obj = this.a.c;
str = "kv";
} else {
str = "ar";
}
jSONObject.put(str, obj);
return true;
}
public c b() {
return this.a;
}
}

View File

@@ -0,0 +1,67 @@
package com.tencent.wxop.stat.event;
import java.util.Properties;
import org.json.JSONArray;
import org.json.JSONObject;
/* loaded from: classes.dex */
public class c {
public String a;
public JSONArray b;
public JSONObject c;
public c() {
this.c = null;
}
public c(String str, String[] strArr, Properties properties) {
JSONObject jSONObject;
this.c = null;
this.a = str;
if (properties != null) {
jSONObject = new JSONObject(properties);
} else {
if (strArr != null) {
this.b = new JSONArray();
for (String str2 : strArr) {
this.b.put(str2);
}
return;
}
jSONObject = new JSONObject();
}
this.c = jSONObject;
}
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (this == obj) {
return true;
}
if (obj instanceof c) {
return toString().equals(((c) obj).toString());
}
return false;
}
public int hashCode() {
return toString().hashCode();
}
public String toString() {
StringBuilder sb = new StringBuilder(32);
sb.append(this.a);
sb.append(",");
JSONArray jSONArray = this.b;
if (jSONArray != null) {
sb.append(jSONArray.toString());
}
JSONObject jSONObject = this.c;
if (jSONObject != null) {
sb.append(jSONObject.toString());
}
return sb.toString();
}
}

View File

@@ -0,0 +1,76 @@
package com.tencent.wxop.stat.event;
import android.content.Context;
import com.tencent.wxop.stat.StatConfig;
import com.tencent.wxop.stat.StatSpecifyReportedInfo;
import com.tencent.wxop.stat.common.r;
import java.io.PrintWriter;
import java.io.StringWriter;
import org.json.JSONObject;
/* loaded from: classes.dex */
public class d extends e {
private String a;
private int m;
private int n;
private Thread o;
public d(Context context, int i, int i2, Throwable th, StatSpecifyReportedInfo statSpecifyReportedInfo) {
super(context, i, statSpecifyReportedInfo);
this.n = 100;
this.o = null;
a(i2, th);
}
public d(Context context, int i, int i2, Throwable th, Thread thread, StatSpecifyReportedInfo statSpecifyReportedInfo) {
super(context, i, statSpecifyReportedInfo);
this.n = 100;
this.o = null;
a(i2, th);
this.o = thread;
}
public d(Context context, int i, String str, int i2, int i3, Thread thread, StatSpecifyReportedInfo statSpecifyReportedInfo) {
super(context, i, statSpecifyReportedInfo);
this.n = 100;
this.o = null;
if (str != null) {
i3 = i3 <= 0 ? StatConfig.getMaxReportEventLength() : i3;
if (str.length() <= i3) {
this.a = str;
} else {
this.a = str.substring(0, i3);
}
}
this.o = thread;
this.m = i2;
}
private void a(int i, Throwable th) {
if (th != null) {
StringWriter stringWriter = new StringWriter();
PrintWriter printWriter = new PrintWriter(stringWriter);
th.printStackTrace(printWriter);
this.a = stringWriter.toString();
this.m = i;
printWriter.close();
}
}
@Override // com.tencent.wxop.stat.event.e
public EventType a() {
return EventType.ERROR;
}
@Override // com.tencent.wxop.stat.event.e
public boolean a(JSONObject jSONObject) {
r.a(jSONObject, "er", this.a);
jSONObject.put("ea", this.m);
int i = this.m;
if (i != 2 && i != 3) {
return true;
}
new com.tencent.wxop.stat.common.b(this.l).a(jSONObject, this.o);
return true;
}
}

View File

@@ -0,0 +1,130 @@
package com.tencent.wxop.stat.event;
import android.content.Context;
import com.tencent.wxop.stat.StatConfig;
import com.tencent.wxop.stat.StatSpecifyReportedInfo;
import com.tencent.wxop.stat.au;
import com.tencent.wxop.stat.common.l;
import com.tencent.wxop.stat.common.r;
import org.json.JSONObject;
/* loaded from: classes.dex */
public abstract class e {
protected static String j;
private StatSpecifyReportedInfo a;
protected String b;
protected long c = System.currentTimeMillis() / 1000;
protected int d;
protected com.tencent.wxop.stat.common.a e;
protected int f;
protected String g;
protected String h;
protected String i;
protected boolean k;
protected Context l;
e(Context context, int i, StatSpecifyReportedInfo statSpecifyReportedInfo) {
this.b = null;
this.e = null;
this.g = null;
this.h = null;
this.i = null;
this.k = false;
this.a = null;
this.l = context;
this.d = i;
this.h = StatConfig.getInstallChannel(context);
this.i = l.h(context);
this.b = StatConfig.getAppKey(context);
if (statSpecifyReportedInfo != null) {
this.a = statSpecifyReportedInfo;
if (l.c(statSpecifyReportedInfo.getAppKey())) {
this.b = statSpecifyReportedInfo.getAppKey();
}
if (l.c(statSpecifyReportedInfo.getInstallChannel())) {
this.h = statSpecifyReportedInfo.getInstallChannel();
}
if (l.c(statSpecifyReportedInfo.getVersion())) {
this.i = statSpecifyReportedInfo.getVersion();
}
this.k = statSpecifyReportedInfo.isImportant();
}
this.g = StatConfig.getCustomUserId(context);
this.e = au.a(context).b(context);
EventType a = a();
EventType eventType = EventType.NETWORK_DETECTOR;
this.f = a != eventType ? l.q(context).intValue() : -eventType.a();
if (com.tencent.a.a.a.a.h.b(j)) {
return;
}
String localMidOnly = StatConfig.getLocalMidOnly(context);
j = localMidOnly;
if (l.c(localMidOnly)) {
return;
}
j = "0";
}
public abstract EventType a();
public abstract boolean a(JSONObject jSONObject);
public boolean b(JSONObject jSONObject) {
try {
r.a(jSONObject, "ky", this.b);
jSONObject.put("et", a().a());
if (this.e != null) {
jSONObject.put("ui", this.e.b());
r.a(jSONObject, "mc", this.e.c());
int d = this.e.d();
jSONObject.put("ut", d);
if (d == 0 && l.u(this.l) == 1) {
jSONObject.put("ia", 1);
}
}
r.a(jSONObject, "cui", this.g);
if (a() != EventType.SESSION_ENV) {
r.a(jSONObject, "av", this.i);
r.a(jSONObject, "ch", this.h);
}
if (this.k) {
jSONObject.put("impt", 1);
}
r.a(jSONObject, "mid", j);
jSONObject.put("cch", "wxop");
jSONObject.put("idx", this.f);
jSONObject.put("si", this.d);
jSONObject.put("ts", this.c);
jSONObject.put("dts", l.a(this.l, false));
return a(jSONObject);
} catch (Throwable unused) {
return false;
}
}
public long c() {
return this.c;
}
public StatSpecifyReportedInfo d() {
return this.a;
}
public Context e() {
return this.l;
}
public boolean f() {
return this.k;
}
public String g() {
try {
JSONObject jSONObject = new JSONObject();
b(jSONObject);
return jSONObject.toString();
} catch (Throwable unused) {
return "";
}
}
}

View File

@@ -0,0 +1,35 @@
package com.tencent.wxop.stat.event;
import android.content.Context;
import com.tencent.wxop.stat.StatGameUser;
import com.tencent.wxop.stat.StatSpecifyReportedInfo;
import com.tencent.wxop.stat.common.r;
import org.json.JSONObject;
/* loaded from: classes.dex */
public class f extends e {
private StatGameUser a;
public f(Context context, int i, StatGameUser statGameUser, StatSpecifyReportedInfo statSpecifyReportedInfo) {
super(context, i, statSpecifyReportedInfo);
this.a = null;
this.a = statGameUser.m18clone();
}
@Override // com.tencent.wxop.stat.event.e
public EventType a() {
return EventType.MTA_GAME_USER;
}
@Override // com.tencent.wxop.stat.event.e
public boolean a(JSONObject jSONObject) {
StatGameUser statGameUser = this.a;
if (statGameUser == null) {
return false;
}
r.a(jSONObject, "wod", statGameUser.getWorldName());
r.a(jSONObject, "gid", this.a.getAccount());
r.a(jSONObject, "lev", this.a.getLevel());
return true;
}
}

View File

@@ -0,0 +1,51 @@
package com.tencent.wxop.stat.event;
import android.content.Context;
import com.tencent.wxop.stat.StatAppMonitor;
import com.tencent.wxop.stat.StatSpecifyReportedInfo;
import com.tencent.wxop.stat.common.l;
import com.tencent.wxop.stat.common.r;
import org.json.JSONObject;
/* loaded from: classes.dex */
public class g extends e {
private static String m;
private static String n;
private StatAppMonitor a;
public g(Context context, int i, StatAppMonitor statAppMonitor, StatSpecifyReportedInfo statSpecifyReportedInfo) {
super(context, i, statSpecifyReportedInfo);
this.a = null;
this.a = statAppMonitor.m17clone();
}
@Override // com.tencent.wxop.stat.event.e
public EventType a() {
return EventType.MONITOR_STAT;
}
@Override // com.tencent.wxop.stat.event.e
public boolean a(JSONObject jSONObject) {
StatAppMonitor statAppMonitor = this.a;
if (statAppMonitor == null) {
return false;
}
jSONObject.put("na", statAppMonitor.getInterfaceName());
jSONObject.put("rq", this.a.getReqSize());
jSONObject.put("rp", this.a.getRespSize());
jSONObject.put("rt", this.a.getResultType());
jSONObject.put("tm", this.a.getMillisecondsConsume());
jSONObject.put("rc", this.a.getReturnCode());
jSONObject.put("sp", this.a.getSampling());
if (n == null) {
n = l.l(this.l);
}
r.a(jSONObject, "av", n);
if (m == null) {
m = l.g(this.l);
}
r.a(jSONObject, "op", m);
jSONObject.put("cn", com.tencent.wxop.stat.a.a(this.l).b());
return true;
}
}

View File

@@ -0,0 +1,33 @@
package com.tencent.wxop.stat.event;
import android.content.Context;
import com.tencent.wxop.stat.StatConfig;
import com.tencent.wxop.stat.StatSpecifyReportedInfo;
import com.tencent.wxop.stat.common.r;
import org.json.JSONObject;
/* loaded from: classes.dex */
public class h extends e {
public static final StatSpecifyReportedInfo a;
static {
StatSpecifyReportedInfo statSpecifyReportedInfo = new StatSpecifyReportedInfo();
a = statSpecifyReportedInfo;
statSpecifyReportedInfo.setAppKey("A9VH9B8L4GX4");
}
public h(Context context) {
super(context, 0, a);
}
@Override // com.tencent.wxop.stat.event.e
public EventType a() {
return EventType.NETWORK_DETECTOR;
}
@Override // com.tencent.wxop.stat.event.e
public boolean a(JSONObject jSONObject) {
r.a(jSONObject, "actky", StatConfig.getAppKey(this.l));
return true;
}
}

View File

@@ -0,0 +1,41 @@
package com.tencent.wxop.stat.event;
import android.content.Context;
import com.tencent.wxop.stat.StatSpecifyReportedInfo;
import com.tencent.wxop.stat.common.l;
import com.tencent.wxop.stat.common.r;
import org.json.JSONObject;
/* loaded from: classes.dex */
public class i extends e {
private static String a;
private String m;
private String n;
public i(Context context, int i, StatSpecifyReportedInfo statSpecifyReportedInfo) {
super(context, i, statSpecifyReportedInfo);
this.m = null;
this.n = null;
this.m = com.tencent.wxop.stat.a.a(context).b();
if (a == null) {
a = l.g(context);
}
}
@Override // com.tencent.wxop.stat.event.e
public EventType a() {
return EventType.NETWORK_MONITOR;
}
public void a(String str) {
this.n = str;
}
@Override // com.tencent.wxop.stat.event.e
public boolean a(JSONObject jSONObject) {
r.a(jSONObject, "op", a);
r.a(jSONObject, "cn", this.m);
jSONObject.put("sp", this.n);
return true;
}
}

View File

@@ -0,0 +1,38 @@
package com.tencent.wxop.stat.event;
import android.content.Context;
import com.tencent.wxop.stat.StatSpecifyReportedInfo;
import com.tencent.wxop.stat.common.r;
import org.json.JSONObject;
/* loaded from: classes.dex */
public class j extends e {
Long a;
String m;
String n;
public j(Context context, String str, String str2, int i, Long l, StatSpecifyReportedInfo statSpecifyReportedInfo) {
super(context, i, statSpecifyReportedInfo);
this.a = null;
this.n = str;
this.m = str2;
this.a = l;
}
@Override // com.tencent.wxop.stat.event.e
public EventType a() {
return EventType.PAGE_VIEW;
}
@Override // com.tencent.wxop.stat.event.e
public boolean a(JSONObject jSONObject) {
r.a(jSONObject, "pi", this.m);
r.a(jSONObject, "rf", this.n);
Long l = this.a;
if (l == null) {
return true;
}
jSONObject.put("du", l);
return true;
}
}

View File

@@ -0,0 +1,41 @@
package com.tencent.wxop.stat.event;
import android.content.Context;
import com.tencent.wxop.stat.StatSpecifyReportedInfo;
import com.tencent.wxop.stat.common.l;
import org.json.JSONObject;
/* loaded from: classes.dex */
public class k extends e {
private com.tencent.wxop.stat.common.b a;
private JSONObject m;
public k(Context context, int i, JSONObject jSONObject, StatSpecifyReportedInfo statSpecifyReportedInfo) {
super(context, i, statSpecifyReportedInfo);
this.m = null;
this.a = new com.tencent.wxop.stat.common.b(context);
this.m = jSONObject;
}
@Override // com.tencent.wxop.stat.event.e
public EventType a() {
return EventType.SESSION_ENV;
}
@Override // com.tencent.wxop.stat.event.e
public boolean a(JSONObject jSONObject) {
com.tencent.wxop.stat.common.a aVar = this.e;
if (aVar != null) {
jSONObject.put("ut", aVar.d());
}
JSONObject jSONObject2 = this.m;
if (jSONObject2 != null) {
jSONObject.put("cfg", jSONObject2);
}
if (l.w(this.l)) {
jSONObject.put("ncts", 1);
}
this.a.a(jSONObject, (Thread) null);
return true;
}
}

View File

@@ -0,0 +1,19 @@
package com.tencent.wxop.stat;
import org.json.JSONObject;
/* loaded from: classes.dex */
class f {
int a;
JSONObject b = new JSONObject();
String c = "";
int d = 0;
public f(int i) {
this.a = i;
}
String a() {
return this.b.toString();
}
}

View File

@@ -0,0 +1,14 @@
package com.tencent.wxop.stat;
/* loaded from: classes.dex */
public interface g {
void a(Object obj);
void b(Object obj);
void c(Object obj);
void d(Object obj);
void e(Object obj);
}

View File

@@ -0,0 +1,8 @@
package com.tencent.wxop.stat;
/* loaded from: classes.dex */
public interface h {
void a();
void b();
}

View File

@@ -0,0 +1,277 @@
package com.tencent.wxop.stat;
import android.content.Context;
import com.tencent.wxop.stat.common.StatLogger;
import com.thoughtworks.xstream.XStream;
import com.ubt.jimu.base.util.FileUtil;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.InputStream;
import java.nio.ByteBuffer;
import java.util.Arrays;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.zip.GZIPOutputStream;
import org.apache.http.Header;
import org.apache.http.HttpEntity;
import org.apache.http.HttpHost;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ByteArrayEntity;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.params.BasicHttpParams;
import org.apache.http.params.HttpConnectionParams;
import org.apache.http.util.EntityUtils;
import org.json.JSONObject;
/* loaded from: classes.dex */
class i {
private static StatLogger d = com.tencent.wxop.stat.common.l.b();
private static i e = null;
private static Context f = null;
DefaultHttpClient a;
com.tencent.wxop.stat.common.e b;
StringBuilder c = new StringBuilder(FileUtil.ZIP_BUFFER_SIZE);
private long g;
private i(Context context) {
this.a = null;
this.b = null;
this.g = 0L;
try {
f = context.getApplicationContext();
this.g = System.currentTimeMillis() / 1000;
this.b = new com.tencent.wxop.stat.common.e();
if (StatConfig.isDebugEnable()) {
try {
Logger.getLogger("org.apache.http.wire").setLevel(Level.FINER);
Logger.getLogger("org.apache.http.headers").setLevel(Level.FINER);
System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.SimpleLog");
System.setProperty("org.apache.commons.logging.simplelog.showdatetime", "true");
System.setProperty("org.apache.commons.logging.simplelog.log.httpclient.wire", "debug");
System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.http", "debug");
System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.http.headers", "debug");
} catch (Throwable unused) {
}
}
BasicHttpParams basicHttpParams = new BasicHttpParams();
HttpConnectionParams.setStaleCheckingEnabled(basicHttpParams, false);
HttpConnectionParams.setConnectionTimeout(basicHttpParams, XStream.PRIORITY_VERY_HIGH);
HttpConnectionParams.setSoTimeout(basicHttpParams, XStream.PRIORITY_VERY_HIGH);
this.a = new DefaultHttpClient(basicHttpParams);
this.a.setKeepAliveStrategy(new j(this));
} catch (Throwable th) {
d.e(th);
}
}
static Context a() {
return f;
}
static void a(Context context) {
f = context.getApplicationContext();
}
private void a(JSONObject jSONObject) {
try {
String optString = jSONObject.optString("mid");
if (com.tencent.a.a.a.a.h.b(optString)) {
if (StatConfig.isDebugEnable()) {
d.i("update mid:" + optString);
}
com.tencent.a.a.a.a.g.a(f).a(optString);
}
if (!jSONObject.isNull("cfg")) {
StatConfig.a(f, jSONObject.getJSONObject("cfg"));
}
if (jSONObject.isNull("ncts")) {
return;
}
int i = jSONObject.getInt("ncts");
int currentTimeMillis = (int) (i - (System.currentTimeMillis() / 1000));
if (StatConfig.isDebugEnable()) {
d.i("server time:" + i + ", diff time:" + currentTimeMillis);
}
com.tencent.wxop.stat.common.l.x(f);
com.tencent.wxop.stat.common.l.a(f, currentTimeMillis);
} catch (Throwable th) {
d.w(th);
}
}
static i b(Context context) {
if (e == null) {
synchronized (i.class) {
if (e == null) {
e = new i(context);
}
}
}
return e;
}
void a(com.tencent.wxop.stat.event.e eVar, h hVar) {
b(Arrays.asList(eVar.g()), hVar);
}
void a(List<?> list, h hVar) {
Throwable th;
ByteArrayOutputStream byteArrayOutputStream;
HttpResponse execute;
HttpEntity entity;
int statusCode;
long contentLength;
if (list == null || list.isEmpty()) {
return;
}
int size = list.size();
list.get(0);
try {
this.c.delete(0, this.c.length());
this.c.append("[");
for (int i = 0; i < size; i++) {
this.c.append(list.get(i).toString());
if (i != size - 1) {
this.c.append(",");
}
}
this.c.append("]");
String sb = this.c.toString();
int length = sb.length();
String str = StatConfig.getStatReportUrl() + "/?index=" + this.g;
this.g++;
if (StatConfig.isDebugEnable()) {
d.i("[" + str + "]Send request(" + length + "bytes), content:" + sb);
}
HttpPost httpPost = new HttpPost(str);
httpPost.addHeader("Accept-Encoding", "gzip");
httpPost.setHeader("Connection", "Keep-Alive");
httpPost.removeHeaders("Cache-Control");
HttpHost a = a.a(f).a();
httpPost.addHeader("Content-Encoding", "rc4");
if (a == null) {
this.a.getParams().removeParameter("http.route.default-proxy");
} else {
if (StatConfig.isDebugEnable()) {
d.d("proxy:" + a.toHostString());
}
httpPost.addHeader("X-Content-Encoding", "rc4");
this.a.getParams().setParameter("http.route.default-proxy", a);
httpPost.addHeader("X-Online-Host", StatConfig.k);
httpPost.addHeader("Accept", "*/*");
httpPost.addHeader("Content-Type", "json");
}
byteArrayOutputStream = new ByteArrayOutputStream(length);
byte[] bytes = sb.getBytes("UTF-8");
int length2 = bytes.length;
if (length > StatConfig.o) {
httpPost.removeHeaders("Content-Encoding");
String str2 = "rc4,gzip";
httpPost.addHeader("Content-Encoding", str2);
if (a != null) {
httpPost.removeHeaders("X-Content-Encoding");
httpPost.addHeader("X-Content-Encoding", str2);
}
byteArrayOutputStream.write(new byte[4]);
GZIPOutputStream gZIPOutputStream = new GZIPOutputStream(byteArrayOutputStream);
gZIPOutputStream.write(bytes);
gZIPOutputStream.close();
bytes = byteArrayOutputStream.toByteArray();
ByteBuffer.wrap(bytes, 0, 4).putInt(length2);
if (StatConfig.isDebugEnable()) {
d.d("before Gzip:" + length2 + " bytes, after Gzip:" + bytes.length + " bytes");
}
}
httpPost.setEntity(new ByteArrayEntity(com.tencent.wxop.stat.common.f.a(bytes)));
execute = this.a.execute(httpPost);
entity = execute.getEntity();
statusCode = execute.getStatusLine().getStatusCode();
contentLength = entity.getContentLength();
if (StatConfig.isDebugEnable()) {
d.i("http recv response status code:" + statusCode + ", content length:" + contentLength);
}
} catch (Throwable th2) {
th = th2;
}
if (contentLength <= 0) {
d.e("Server response no data.");
if (hVar != null) {
hVar.b();
}
EntityUtils.toString(entity);
return;
}
if (contentLength > 0) {
InputStream content = entity.getContent();
DataInputStream dataInputStream = new DataInputStream(content);
byte[] bArr = new byte[(int) entity.getContentLength()];
dataInputStream.readFully(bArr);
content.close();
dataInputStream.close();
Header firstHeader = execute.getFirstHeader("Content-Encoding");
if (firstHeader != null) {
if (firstHeader.getValue().equalsIgnoreCase("gzip,rc4")) {
bArr = com.tencent.wxop.stat.common.f.b(com.tencent.wxop.stat.common.l.a(bArr));
} else if (firstHeader.getValue().equalsIgnoreCase("rc4,gzip")) {
bArr = com.tencent.wxop.stat.common.l.a(com.tencent.wxop.stat.common.f.b(bArr));
} else if (firstHeader.getValue().equalsIgnoreCase("gzip")) {
bArr = com.tencent.wxop.stat.common.l.a(bArr);
} else if (firstHeader.getValue().equalsIgnoreCase("rc4")) {
bArr = com.tencent.wxop.stat.common.f.b(bArr);
}
}
String str3 = new String(bArr, "UTF-8");
if (StatConfig.isDebugEnable()) {
d.i("http get response data:" + str3);
}
JSONObject jSONObject = new JSONObject(str3);
if (statusCode == 200) {
a(jSONObject);
if (hVar != null) {
if (jSONObject.optInt("ret") == 0) {
hVar.a();
} else {
d.error("response error data.");
hVar.b();
}
}
content.close();
} else {
d.error("Server response error code:" + statusCode + ", error:" + new String(bArr, "UTF-8"));
if (hVar != null) {
hVar.b();
}
content.close();
}
} else {
EntityUtils.toString(entity);
}
byteArrayOutputStream.close();
th = null;
if (th != null) {
d.error(th);
if (hVar != null) {
try {
hVar.b();
} catch (Throwable th3) {
d.e(th3);
}
}
if (th instanceof OutOfMemoryError) {
System.gc();
this.c = null;
this.c = new StringBuilder(2048);
}
a.a(f).d();
}
}
void b(List<?> list, h hVar) {
com.tencent.wxop.stat.common.e eVar = this.b;
if (eVar != null) {
eVar.a(new k(this, list, hVar));
}
}
}

View File

@@ -0,0 +1,23 @@
package com.tencent.wxop.stat;
import org.apache.http.HttpResponse;
import org.apache.http.impl.client.DefaultConnectionKeepAliveStrategy;
import org.apache.http.protocol.HttpContext;
/* loaded from: classes.dex */
class j extends DefaultConnectionKeepAliveStrategy {
final /* synthetic */ i a;
j(i iVar) {
this.a = iVar;
}
@Override // org.apache.http.impl.client.DefaultConnectionKeepAliveStrategy, org.apache.http.conn.ConnectionKeepAliveStrategy
public long getKeepAliveDuration(HttpResponse httpResponse, HttpContext httpContext) {
long keepAliveDuration = super.getKeepAliveDuration(httpResponse, httpContext);
if (keepAliveDuration == -1) {
return 30000L;
}
return keepAliveDuration;
}
}

View File

@@ -0,0 +1,21 @@
package com.tencent.wxop.stat;
import java.util.List;
/* loaded from: classes.dex */
class k implements Runnable {
final /* synthetic */ List a;
final /* synthetic */ h b;
final /* synthetic */ i c;
k(i iVar, List list, h hVar) {
this.c = iVar;
this.a = list;
this.b = hVar;
}
@Override // java.lang.Runnable
public void run() {
this.c.a(this.a, this.b);
}
}

View File

@@ -0,0 +1,34 @@
package com.tencent.wxop.stat;
import android.content.Context;
import com.tencent.wxop.stat.common.StatLogger;
import java.lang.Thread;
/* loaded from: classes.dex */
final class l implements Runnable {
final /* synthetic */ Context a;
l(Context context) {
this.a = context;
}
@Override // java.lang.Runnable
public final void run() {
Context context;
StatLogger statLogger;
context = StatServiceImpl.t;
a.a(context).h();
com.tencent.wxop.stat.common.l.a(this.a, true);
au.a(this.a);
i.b(this.a);
Thread.UncaughtExceptionHandler unused = StatServiceImpl.r = Thread.getDefaultUncaughtExceptionHandler();
Thread.setDefaultUncaughtExceptionHandler(new ao());
if (StatConfig.getStatSendStrategy() == StatReportStrategy.APP_LAUNCH) {
StatServiceImpl.commitEvents(this.a, -1);
}
if (StatConfig.isDebugEnable()) {
statLogger = StatServiceImpl.q;
statLogger.d("Init MTA StatService success.");
}
}
}

View File

@@ -0,0 +1,27 @@
package com.tencent.wxop.stat;
import android.content.Context;
import com.tencent.wxop.stat.common.StatLogger;
/* loaded from: classes.dex */
final class m implements Runnable {
final /* synthetic */ Context a;
final /* synthetic */ StatSpecifyReportedInfo b;
m(Context context, StatSpecifyReportedInfo statSpecifyReportedInfo) {
this.a = context;
this.b = statSpecifyReportedInfo;
}
@Override // java.lang.Runnable
public final void run() {
StatLogger statLogger;
Context context = this.a;
if (context != null) {
StatServiceImpl.trackEndPage(context, com.tencent.wxop.stat.common.l.f(context), this.b);
} else {
statLogger = StatServiceImpl.q;
statLogger.error("The Context of StatService.onPause() can not be null!");
}
}
}

View File

@@ -0,0 +1,41 @@
package com.tencent.wxop.stat;
import android.content.Context;
import com.tencent.wxop.stat.common.StatLogger;
/* loaded from: classes.dex */
final class n implements Runnable {
final /* synthetic */ Context a;
n(Context context) {
this.a = context;
}
@Override // java.lang.Runnable
public final void run() {
StatLogger statLogger;
StatLogger statLogger2;
Context context = this.a;
if (context == null) {
statLogger2 = StatServiceImpl.q;
statLogger2.error("The Context of StatService.onStop() can not be null!");
return;
}
StatServiceImpl.flushDataToDB(context);
if (StatServiceImpl.a()) {
return;
}
try {
Thread.sleep(100L);
} catch (InterruptedException e) {
e.printStackTrace();
}
if (com.tencent.wxop.stat.common.l.z(this.a)) {
if (StatConfig.isDebugEnable()) {
statLogger = StatServiceImpl.q;
statLogger.i("onStop isBackgroundRunning flushDataToDB");
}
StatServiceImpl.commitEvents(this.a, -1);
}
}
}

View File

@@ -0,0 +1,17 @@
package com.tencent.wxop.stat;
import android.content.Context;
/* loaded from: classes.dex */
final class o implements Runnable {
final /* synthetic */ Context a;
o(Context context) {
this.a = context;
}
@Override // java.lang.Runnable
public final void run() {
StatServiceImpl.flushDataToDB(this.a);
}
}

View File

@@ -0,0 +1,35 @@
package com.tencent.wxop.stat;
import android.content.Context;
import com.tencent.wxop.stat.common.StatLogger;
/* loaded from: classes.dex */
final class p implements Runnable {
final /* synthetic */ String a;
final /* synthetic */ Context b;
final /* synthetic */ StatSpecifyReportedInfo c;
p(String str, Context context, StatSpecifyReportedInfo statSpecifyReportedInfo) {
this.a = str;
this.b = context;
this.c = statSpecifyReportedInfo;
}
@Override // java.lang.Runnable
public final void run() {
StatLogger statLogger;
StatLogger statLogger2;
try {
if (!StatServiceImpl.a(this.a)) {
new aq(new com.tencent.wxop.stat.event.d(this.b, StatServiceImpl.a(this.b, false, this.c), this.a, 0, StatConfig.getMaxReportEventLength(), null, this.c)).a();
} else {
statLogger2 = StatServiceImpl.q;
statLogger2.error("Error message in StatService.reportError() is empty.");
}
} catch (Throwable th) {
statLogger = StatServiceImpl.q;
statLogger.e(th);
StatServiceImpl.a(this.b, th);
}
}
}

View File

@@ -0,0 +1,28 @@
package com.tencent.wxop.stat;
import android.content.Context;
import com.tencent.wxop.stat.common.StatLogger;
/* loaded from: classes.dex */
final class q implements Runnable {
final /* synthetic */ Context a;
final /* synthetic */ Throwable b;
q(Context context, Throwable th) {
this.a = context;
this.b = th;
}
@Override // java.lang.Runnable
public final void run() {
StatLogger statLogger;
try {
if (StatConfig.isEnableStatService()) {
new aq(new com.tencent.wxop.stat.event.d(this.a, StatServiceImpl.a(this.a, false, (StatSpecifyReportedInfo) null), 99, this.b, com.tencent.wxop.stat.event.h.a)).a();
}
} catch (Throwable th) {
statLogger = StatServiceImpl.q;
statLogger.e("reportSdkSelfException error: " + th);
}
}
}

View File

@@ -0,0 +1,29 @@
package com.tencent.wxop.stat;
import android.content.Context;
import com.tencent.wxop.stat.common.StatLogger;
/* loaded from: classes.dex */
final class r implements Runnable {
final /* synthetic */ Throwable a;
final /* synthetic */ Context b;
final /* synthetic */ StatSpecifyReportedInfo c;
r(Throwable th, Context context, StatSpecifyReportedInfo statSpecifyReportedInfo) {
this.a = th;
this.b = context;
this.c = statSpecifyReportedInfo;
}
@Override // java.lang.Runnable
public final void run() {
StatLogger statLogger;
if (this.a == null) {
statLogger = StatServiceImpl.q;
statLogger.error("The Throwable error message of StatService.reportException() can not be null!");
} else {
Context context = this.b;
new aq(new com.tencent.wxop.stat.event.d(context, StatServiceImpl.a(context, false, this.c), 1, this.a, this.c)).a();
}
}
}

View File

@@ -0,0 +1,31 @@
package com.tencent.wxop.stat;
import android.content.Context;
import com.tencent.wxop.stat.common.StatLogger;
/* loaded from: classes.dex */
final class s implements Runnable {
final /* synthetic */ Context a;
final /* synthetic */ StatSpecifyReportedInfo b;
final /* synthetic */ com.tencent.wxop.stat.event.c c;
s(Context context, StatSpecifyReportedInfo statSpecifyReportedInfo, com.tencent.wxop.stat.event.c cVar) {
this.a = context;
this.b = statSpecifyReportedInfo;
this.c = cVar;
}
@Override // java.lang.Runnable
public final void run() {
StatLogger statLogger;
try {
com.tencent.wxop.stat.event.b bVar = new com.tencent.wxop.stat.event.b(this.a, StatServiceImpl.a(this.a, false, this.b), this.c.a, this.b);
bVar.b().b = this.c.b;
new aq(bVar).a();
} catch (Throwable th) {
statLogger = StatServiceImpl.q;
statLogger.e(th);
StatServiceImpl.a(this.a, th);
}
}
}

View File

@@ -0,0 +1,17 @@
package com.tencent.wxop.stat;
/* loaded from: classes.dex */
final class t implements h {
t() {
}
@Override // com.tencent.wxop.stat.h
public final void a() {
StatServiceImpl.c();
}
@Override // com.tencent.wxop.stat.h
public final void b() {
StatServiceImpl.d();
}
}

View File

@@ -0,0 +1,31 @@
package com.tencent.wxop.stat;
import android.content.Context;
import com.tencent.wxop.stat.common.StatLogger;
/* loaded from: classes.dex */
final class u implements Runnable {
final /* synthetic */ Context a;
final /* synthetic */ StatSpecifyReportedInfo b;
final /* synthetic */ com.tencent.wxop.stat.event.c c;
u(Context context, StatSpecifyReportedInfo statSpecifyReportedInfo, com.tencent.wxop.stat.event.c cVar) {
this.a = context;
this.b = statSpecifyReportedInfo;
this.c = cVar;
}
@Override // java.lang.Runnable
public final void run() {
StatLogger statLogger;
try {
com.tencent.wxop.stat.event.b bVar = new com.tencent.wxop.stat.event.b(this.a, StatServiceImpl.a(this.a, false, this.b), this.c.a, this.b);
bVar.b().c = this.c.c;
new aq(bVar).a();
} catch (Throwable th) {
statLogger = StatServiceImpl.q;
statLogger.e(th);
StatServiceImpl.a(this.a, th);
}
}
}

View File

@@ -0,0 +1,59 @@
package com.tencent.wxop.stat;
import android.content.Context;
import com.tencent.wxop.stat.common.StatLogger;
import java.util.Map;
/* loaded from: classes.dex */
final class v implements Runnable {
final /* synthetic */ String a;
final /* synthetic */ com.tencent.wxop.stat.event.c b;
final /* synthetic */ Context c;
v(String str, com.tencent.wxop.stat.event.c cVar, Context context) {
this.a = str;
this.b = cVar;
this.c = context;
}
@Override // java.lang.Runnable
public final void run() {
StatLogger statLogger;
Map map;
Map map2;
StatLogger statLogger2;
Map map3;
StatLogger statLogger3;
StatLogger statLogger4;
StatLogger statLogger5;
try {
if (StatServiceImpl.a(this.a)) {
statLogger5 = StatServiceImpl.q;
statLogger5.error("The event_id of StatService.trackCustomBeginEvent() can not be null or empty.");
return;
}
if (StatConfig.isDebugEnable()) {
statLogger4 = StatServiceImpl.q;
statLogger4.i("add begin key:" + this.b.toString());
}
map = StatServiceImpl.e;
if (map.containsKey(this.b)) {
statLogger3 = StatServiceImpl.q;
statLogger3.error("Duplicate CustomEvent key: " + this.b.toString() + ", trackCustomBeginEvent() repeated?");
return;
}
map2 = StatServiceImpl.e;
if (map2.size() <= StatConfig.getMaxParallelTimmingEvents()) {
map3 = StatServiceImpl.e;
map3.put(this.b, Long.valueOf(System.currentTimeMillis()));
} else {
statLogger2 = StatServiceImpl.q;
statLogger2.error("The number of timedEvent exceeds the maximum value " + Integer.toString(StatConfig.getMaxParallelTimmingEvents()));
}
} catch (Throwable th) {
statLogger = StatServiceImpl.q;
statLogger.e(th);
StatServiceImpl.a(this.c, th);
}
}
}

View File

@@ -0,0 +1,63 @@
package com.tencent.wxop.stat;
import android.content.Context;
import com.tencent.wxop.stat.common.StatLogger;
import java.util.Map;
/* loaded from: classes.dex */
final class w implements Runnable {
final /* synthetic */ String a;
final /* synthetic */ Context b;
final /* synthetic */ StatSpecifyReportedInfo c;
w(String str, Context context, StatSpecifyReportedInfo statSpecifyReportedInfo) {
this.a = str;
this.b = context;
this.c = statSpecifyReportedInfo;
}
@Override // java.lang.Runnable
public final void run() {
StatLogger statLogger;
Map map;
Map map2;
Map map3;
String str;
Map map4;
String str2;
StatLogger statLogger2;
String str3;
StatLogger statLogger3;
try {
map = StatServiceImpl.o;
synchronized (map) {
map2 = StatServiceImpl.o;
if (map2.size() >= StatConfig.getMaxParallelTimmingEvents()) {
statLogger3 = StatServiceImpl.q;
statLogger3.error("The number of page events exceeds the maximum value " + Integer.toString(StatConfig.getMaxParallelTimmingEvents()));
return;
}
String unused = StatServiceImpl.m = this.a;
map3 = StatServiceImpl.o;
str = StatServiceImpl.m;
if (!map3.containsKey(str)) {
map4 = StatServiceImpl.o;
str2 = StatServiceImpl.m;
map4.put(str2, Long.valueOf(System.currentTimeMillis()));
StatServiceImpl.a(this.b, true, this.c);
return;
}
statLogger2 = StatServiceImpl.q;
StringBuilder sb = new StringBuilder("Duplicate PageID : ");
str3 = StatServiceImpl.m;
sb.append(str3);
sb.append(", onResume() repeated?");
statLogger2.e(sb.toString());
}
} catch (Throwable th) {
statLogger = StatServiceImpl.q;
statLogger.e(th);
StatServiceImpl.a(this.b, th);
}
}
}

View File

@@ -0,0 +1,51 @@
package com.tencent.wxop.stat;
import android.content.Context;
import com.tencent.wxop.stat.common.StatLogger;
import java.util.Map;
/* loaded from: classes.dex */
final class x implements Runnable {
final /* synthetic */ String a;
final /* synthetic */ com.tencent.wxop.stat.event.c b;
final /* synthetic */ Context c;
final /* synthetic */ StatSpecifyReportedInfo d;
x(String str, com.tencent.wxop.stat.event.c cVar, Context context, StatSpecifyReportedInfo statSpecifyReportedInfo) {
this.a = str;
this.b = cVar;
this.c = context;
this.d = statSpecifyReportedInfo;
}
@Override // java.lang.Runnable
public final void run() {
StatLogger statLogger;
Map map;
StatLogger statLogger2;
StatLogger statLogger3;
try {
if (StatServiceImpl.a(this.a)) {
statLogger3 = StatServiceImpl.q;
statLogger3.error("The event_id of StatService.trackCustomEndEvent() can not be null or empty.");
return;
}
map = StatServiceImpl.e;
Long l = (Long) map.remove(this.b);
if (l != null) {
com.tencent.wxop.stat.event.b bVar = new com.tencent.wxop.stat.event.b(this.c, StatServiceImpl.a(this.c, false, this.d), this.b.a, this.d);
bVar.b().b = this.b.b;
Long valueOf = Long.valueOf((System.currentTimeMillis() - l.longValue()) / 1000);
bVar.a(Long.valueOf(valueOf.longValue() == 0 ? 1L : valueOf.longValue()).longValue());
new aq(bVar).a();
return;
}
statLogger2 = StatServiceImpl.q;
statLogger2.error("No start time found for custom event: " + this.b.toString() + ", lost trackCustomBeginEvent()?");
} catch (Throwable th) {
statLogger = StatServiceImpl.q;
statLogger.e(th);
StatServiceImpl.a(this.c, th);
}
}
}

View File

@@ -0,0 +1,59 @@
package com.tencent.wxop.stat;
import android.content.Context;
import com.tencent.wxop.stat.common.StatLogger;
import java.util.Map;
/* loaded from: classes.dex */
final class y implements Runnable {
final /* synthetic */ String a;
final /* synthetic */ com.tencent.wxop.stat.event.c b;
final /* synthetic */ Context c;
y(String str, com.tencent.wxop.stat.event.c cVar, Context context) {
this.a = str;
this.b = cVar;
this.c = context;
}
@Override // java.lang.Runnable
public final void run() {
StatLogger statLogger;
Map map;
Map map2;
StatLogger statLogger2;
Map map3;
StatLogger statLogger3;
StatLogger statLogger4;
StatLogger statLogger5;
try {
if (StatServiceImpl.a(this.a)) {
statLogger5 = StatServiceImpl.q;
statLogger5.error("The event_id of StatService.trackCustomBeginEvent() can not be null or empty.");
return;
}
if (StatConfig.isDebugEnable()) {
statLogger4 = StatServiceImpl.q;
statLogger4.i("add begin key:" + this.b);
}
map = StatServiceImpl.e;
if (map.containsKey(this.b)) {
statLogger3 = StatServiceImpl.q;
statLogger3.warn("Duplicate CustomEvent key: " + this.b.toString() + ", trackCustomBeginKVEvent() repeated?");
return;
}
map2 = StatServiceImpl.e;
if (map2.size() <= StatConfig.getMaxParallelTimmingEvents()) {
map3 = StatServiceImpl.e;
map3.put(this.b, Long.valueOf(System.currentTimeMillis()));
} else {
statLogger2 = StatServiceImpl.q;
statLogger2.error("The number of timedEvent exceeds the maximum value " + Integer.toString(StatConfig.getMaxParallelTimmingEvents()));
}
} catch (Throwable th) {
statLogger = StatServiceImpl.q;
statLogger.e(th);
StatServiceImpl.a(this.c, th);
}
}
}

View File

@@ -0,0 +1,51 @@
package com.tencent.wxop.stat;
import android.content.Context;
import com.tencent.wxop.stat.common.StatLogger;
import java.util.Map;
/* loaded from: classes.dex */
final class z implements Runnable {
final /* synthetic */ String a;
final /* synthetic */ com.tencent.wxop.stat.event.c b;
final /* synthetic */ Context c;
final /* synthetic */ StatSpecifyReportedInfo d;
z(String str, com.tencent.wxop.stat.event.c cVar, Context context, StatSpecifyReportedInfo statSpecifyReportedInfo) {
this.a = str;
this.b = cVar;
this.c = context;
this.d = statSpecifyReportedInfo;
}
@Override // java.lang.Runnable
public final void run() {
StatLogger statLogger;
Map map;
StatLogger statLogger2;
StatLogger statLogger3;
try {
if (StatServiceImpl.a(this.a)) {
statLogger3 = StatServiceImpl.q;
statLogger3.error("The event_id of StatService.trackCustomEndEvent() can not be null or empty.");
return;
}
map = StatServiceImpl.e;
Long l = (Long) map.remove(this.b);
if (l != null) {
com.tencent.wxop.stat.event.b bVar = new com.tencent.wxop.stat.event.b(this.c, StatServiceImpl.a(this.c, false, this.d), this.b.a, this.d);
bVar.b().c = this.b.c;
Long valueOf = Long.valueOf((System.currentTimeMillis() - l.longValue()) / 1000);
bVar.a(Long.valueOf(valueOf.longValue() <= 0 ? 1L : valueOf.longValue()).longValue());
new aq(bVar).a();
return;
}
statLogger2 = StatServiceImpl.q;
statLogger2.warn("No start time found for custom event: " + this.b.toString() + ", lost trackCustomBeginKVEvent()?");
} catch (Throwable th) {
statLogger = StatServiceImpl.q;
statLogger.e(th);
StatServiceImpl.a(this.c, th);
}
}
}