Aqara Home v2.4.1版本的 MD5 值为:529779ac2bc0131db52a1fc3098d2b35
以下内容为反编译后的 a.java 源代码,内容仅作参考
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;
public class a {
public static a f13916g;
public com.tencent.wxop.stat.common.e f13917e;
public Context f13919h;
public StatLogger f13920i;
public List<String> a = null;
public volatile int b = 2;
public volatile String c = "";
public volatile HttpHost d = null;
public int f13918f = 0;
public a(Context context) {
this.f13917e = null;
this.f13919h = null;
this.f13920i = null;
this.f13919h = context.getApplicationContext();
this.f13917e = new com.tencent.wxop.stat.common.e();
i.a(context);
this.f13920i = com.tencent.wxop.stat.common.l.b();
l();
i();
g();
}
public static a a(Context context) {
if (f13916g == null) {
synchronized (a.class) {
if (f13916g == null) {
f13916g = new a(context);
}
}
}
return f13916g;
}
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() {
ArrayList arrayList = new ArrayList(10);
this.a = arrayList;
arrayList.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 e2) {
this.f13920i.e((Throwable) e2);
return "";
}
}
private void k() {
String j2 = j();
if (StatConfig.isDebugEnable()) {
StatLogger statLogger = this.f13920i;
statLogger.i("remoteIp ip is " + j2);
}
if (com.tencent.wxop.stat.common.l.c(j2)) {
if (!this.a.contains(j2)) {
String str = this.a.get(this.f13918f);
if (StatConfig.isDebugEnable()) {
StatLogger statLogger2 = this.f13920i;
statLogger2.w(j2 + " not in ip list, change to:" + str);
}
j2 = str;
}
StatConfig.setStatReportUrl("http://" + j2 + ":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) {
String[] split;
if (StatConfig.isDebugEnable()) {
this.f13920i.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[] split2 = str2.split(":");
if (split2.length > 1) {
String str3 = split2[0];
if (b(str3) && !this.a.contains(str3)) {
if (StatConfig.isDebugEnable()) {
this.f13920i.i("add new ip:" + str3);
}
this.a.add(str3);
}
}
}
}
}
}
}
}
} catch (Exception e2) {
this.f13920i.e((Throwable) e2);
}
this.f13918f = new Random().nextInt(this.a.size());
}
public String b() {
return this.c;
}
public int c() {
return this.b;
}
public void d() {
this.f13918f = (this.f13918f + 1) % this.a.size();
}
public boolean e() {
return this.b == 1;
}
public boolean f() {
return this.b != 0;
}
public void g() {
if (!com.tencent.wxop.stat.common.r.f(this.f13919h)) {
if (StatConfig.isDebugEnable()) {
this.f13920i.i("NETWORK TYPE: network is close.");
}
l();
return;
}
if (StatConfig.f13879g) {
k();
}
this.c = com.tencent.wxop.stat.common.l.j(this.f13919h);
if (StatConfig.isDebugEnable()) {
StatLogger statLogger = this.f13920i;
statLogger.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.f13919h);
}
if (StatServiceImpl.a()) {
StatServiceImpl.d(this.f13919h);
}
}
public void h() {
this.f13919h.getApplicationContext().registerReceiver(new b(this), new IntentFilter("android.net.conn.CONNECTIVITY_CHANGE"));
}
}