米多多 v3.0.1版本的 MD5 值为:f69e79dbe1787218a397ad907fb8f3ab
以下内容为反编译后的 p1.java 源代码,内容仅作参考
package c.i;
import android.content.Context;
import android.content.SharedPreferences;
import android.net.Proxy;
import android.os.Build;
import android.text.TextUtils;
import com.alibaba.sdk.android.oss.common.OSSConstants;
import com.alibaba.sdk.android.oss.common.utils.HttpHeaders;
import com.dtf.face.verify.BuildConfig;
import java.util.HashMap;
import java.util.Locale;
import java.util.concurrent.ExecutorService;
import org.json.JSONObject;
public final class p1 {
public static p1 l;
public k0 f5441a;
public Object f5442b;
public Context f5445e;
public boolean f5451k;
public String f5443c = "apilocatesrc.amap.com";
public boolean f5444d = false;
public volatile int f5446f = 0;
public String f5447g = "com.autonavi.httpdns.HttpDnsManager";
public int f5448h = 0;
public ExecutorService f5449i = null;
public int f5450j = e2.f5262g;
public class a implements Runnable {
public q1 f5452a;
public a(q1 q1Var) {
this.f5452a = null;
this.f5452a = q1Var;
}
@Override
public final void run() {
p1.this.f5446f++;
p1.this.f(this.f5452a);
p1 p1Var = p1.this;
p1Var.f5446f--;
}
}
public p1(Context context) {
this.f5441a = null;
this.f5442b = null;
int i2 = 0;
this.f5445e = null;
this.f5451k = false;
this.f5445e = context;
try {
if (this.f5442b == null && 0 == 0) {
q2 c2 = e2.c("HttpDNS", BuildConfig.VERSION_NAME);
boolean l2 = x1.l(context, c2);
this.f5451k = l2;
if (l2) {
try {
this.f5442b = v.a(context, c2, this.f5447g, null, new Class[]{Context.class}, new Object[]{context});
} catch (Throwable unused) {
}
if (this.f5442b != null) {
i2 = 1;
}
x1.h(context, "HttpDns", i2);
} else {
this.f5451k = true;
}
}
} catch (Throwable th) {
e2.h(th, "APS", "initHttpDns");
}
this.f5441a = k0.a();
}
public static p1 c(Context context) {
if (l == null) {
l = new p1(context);
}
return l;
}
public static boolean h(Context context) {
int i2;
String str = null;
try {
if (Build.VERSION.SDK_INT >= 14) {
str = System.getProperty("http.proxyHost");
String property = System.getProperty("http.proxyPort");
if (property == null) {
property = "-1";
}
i2 = Integer.parseInt(property);
} else {
str = Proxy.getHost(context);
i2 = Proxy.getPort(context);
}
} catch (Throwable th) {
th.printStackTrace();
i2 = -1;
}
return (str == null || i2 == -1) ? false : true;
}
public final int a() {
return this.f5448h;
}
public final q0 b(Context context, JSONObject jSONObject, byte[] bArr, String str, boolean z) {
if (a2.t(jSONObject, "httptimeout")) {
try {
this.f5450j = jSONObject.getInt("httptimeout");
} catch (Throwable th) {
e2.h(th, "LocNetManager", "req");
}
}
if (a2.h(a2.L(context)) == -1) {
return null;
}
HashMap hashMap = new HashMap();
q1 q1Var = new q1(context, e2.b("loc"));
hashMap.clear();
hashMap.put(HttpHeaders.CONTENT_TYPE, OSSConstants.DEFAULT_OBJECT_CONTENT_TYPE);
hashMap.put("Accept-Encoding", "gzip");
hashMap.put("gzipped", "1");
hashMap.put("Connection", "Keep-Alive");
hashMap.put(HttpHeaders.USER_AGENT, "AMAP_Location_SDK_Android 3.3.0");
hashMap.put("KEY", i2.h(context));
hashMap.put("enginever", "4.7");
String a2 = k2.a();
String b2 = k2.b(context, a2, "key=" + i2.h(context));
hashMap.put("ts", a2);
hashMap.put("scode", b2);
String str2 = z ? "loc" : "locf";
hashMap.put("encr", "1");
q1Var.f5471j = z;
q1Var.f5472k = String.format(Locale.US, "platform=Android&sdkversion=%s&product=%s&loc_channel=%s", "3.3.0", str2, 3);
q1Var.f5467f = hashMap;
q1Var.f5468g = str;
q1Var.f5469h = a2.w(bArr);
q1Var.c(o2.b(context));
HashMap hashMap2 = new HashMap();
hashMap2.put("output", "bin");
hashMap2.put("policy", "3103");
q1Var.l = hashMap2;
q1Var.b(this.f5450j);
q1Var.e(this.f5450j);
this.f5444d = false;
boolean optBoolean = jSONObject.optBoolean("locationProtocol", false);
if (optBoolean) {
q1Var.f5468g = q1Var.d().replace("http", "https");
} else {
if ((z1.a(context, "pref", "dns_faile_count_total") < 2) && i(context) && !"http://abroad.apilocate.amap.com/mobile/binary".equals(q1Var.d())) {
String d2 = d(context, this.f5443c);
if (!z && TextUtils.isEmpty(d2)) {
d2 = z1.b(context, "ip", "last_ip", "");
}
if (!TextUtils.isEmpty(d2)) {
this.f5444d = true;
try {
SharedPreferences.Editor edit = context.getSharedPreferences("ip", 0).edit();
edit.putString("last_ip", d2);
z1.f(edit);
} catch (Throwable th2) {
e2.h(th2, "SPUtil", "setPrefsInt");
}
q1Var.f5468g = e2.j().replace("apilocatesrc.amap.com", d2);
q1Var.a().put("host", "apilocatesrc.amap.com");
}
}
}
long z2 = a2.z();
try {
q0 b3 = k0.b(q1Var, optBoolean);
this.f5448h = Long.valueOf(a2.z() - z2).intValue();
if (this.f5444d) {
z1.d(context, "pref", "dns_faile_count_total", 0L);
}
return b3;
} catch (Throwable th3) {
if (this.f5444d) {
try {
if (this.f5446f <= 5) {
if (this.f5449i == null) {
this.f5449i = x2.h();
}
if (!this.f5449i.isShutdown()) {
this.f5449i.submit(new a(q1Var));
}
}
} catch (Throwable unused) {
}
}
throw th3;
}
}
public final String d(Context context, String str) {
if (i(context)) {
try {
return (String) v1.b(this.f5442b, "getIpByHostAsync", str);
} catch (Throwable unused) {
x1.g(context, "HttpDns");
return null;
}
}
return null;
}
public final String e(byte[] bArr, Context context, String str) {
if (a2.h(a2.L(context)) == -1) {
return null;
}
HashMap hashMap = new HashMap();
q1 q1Var = new q1(context, e2.b("loc"));
hashMap.clear();
hashMap.put(HttpHeaders.CONTENT_TYPE, "application/x-www-form-urlencoded");
hashMap.put("Connection", "Keep-Alive");
hashMap.put(HttpHeaders.USER_AGENT, "AMAP_Location_SDK_Android 3.3.0");
HashMap hashMap2 = new HashMap();
hashMap2.put("custom", "26260A1F00020002");
hashMap2.put(faceverify.g.KEY_RES_9_KEY, i2.h(context));
String a2 = k2.a();
String b2 = k2.b(context, a2, r2.l(hashMap2));
hashMap2.put("ts", a2);
hashMap2.put("scode", b2);
q1Var.r(bArr);
q1Var.f5471j = true;
q1Var.f5472k = String.format(Locale.US, "platform=Android&sdkversion=%s&product=%s&loc_channel=%s", "3.3.0", "loc", 3);
q1Var.l = hashMap2;
q1Var.f5467f = hashMap;
q1Var.f5468g = str;
q1Var.c(o2.b(context));
q1Var.b(e2.f5262g);
q1Var.e(e2.f5262g);
try {
return new String(k0.c(q1Var), "utf-8");
} catch (Throwable th) {
e2.h(th, "LocNetManager", "post");
return null;
}
}
public final synchronized void f(q1 q1Var) {
try {
q1Var.f5468g = e2.j();
long a2 = z1.a(this.f5445e, "pref", "dns_faile_count_total");
if (a2 >= 2) {
return;
}
k0.b(q1Var, false);
long j2 = a2 + 1;
if (j2 >= 2) {
y1.d(this.f5445e, "HttpDNS", "dns faile too much");
}
z1.d(this.f5445e, "pref", "dns_faile_count_total", j2);
} catch (Throwable unused) {
z1.d(this.f5445e, "pref", "dns_faile_count_total", 0L);
}
}
public final String g(byte[] bArr, Context context, String str) {
if (a2.h(a2.L(context)) == -1) {
return null;
}
HashMap hashMap = new HashMap();
o1 o1Var = new o1();
hashMap.clear();
hashMap.put(HttpHeaders.CONTENT_TYPE, "application/x-www-form-urlencoded");
hashMap.put("Connection", "Keep-Alive");
o1Var.f5431d = hashMap;
o1Var.f5433f = str;
o1Var.f5434g = bArr;
o1Var.c(o2.b(context));
o1Var.b(e2.f5262g);
o1Var.e(e2.f5262g);
try {
return new String(k0.c(o1Var), "utf-8");
} catch (Throwable th) {
e2.h(th, "LocNetManager", "post");
return null;
}
}
public final boolean i(Context context) {
return (this.f5442b == null || h(context)) ? false : true;
}
}