工作空间 v3.6.5.2版本的 MD5 值为:58e65af156c65a63bf64ed2e64960853
以下内容为反编译后的 Ka.java 源代码,内容仅作参考
package com.loc;
import android.content.Context;
import android.content.SharedPreferences;
import android.net.Proxy;
import android.os.Build;
import android.text.TextUtils;
import com.uusafe.emm.uunetprotocol.base.SandboxSharedPref;
import com.xiaomi.mipush.sdk.Constants;
import com.zhizhangyi.platform.mdm.api.common.ResultConst;
import java.util.concurrent.ExecutorService;
public final class Ka {
private static Ka f5667a;
private Object f5668b;
private Context f5669c;
private ExecutorService f5670d = null;
private boolean f5671e = false;
private boolean f = true;
Oa g = null;
volatile int h = 0;
public class a implements Runnable {
Oa f5672a;
a(Oa oa) {
this.f5672a = null;
this.f5672a = oa;
}
@Override
public final void run() {
Ka.this.h++;
Ka.this.b(this.f5672a);
Ka ka = Ka.this;
ka.h--;
}
}
private Ka(Context context) {
this.f5668b = null;
this.f5669c = null;
int i = 0;
this.f5669c = context;
Context context2 = this.f5669c;
try {
if (Ra.t()) {
rb a2 = Sa.a("HttpDNS", "1.0.0");
if (Xa.a(context2, a2)) {
try {
this.f5668b = A.a(context2, a2, "com.autonavi.httpdns.HttpDnsManager", null, new Class[]{Context.class}, new Object[]{context2});
} catch (Throwable unused) {
}
if (this.f5668b != null) {
i = 1;
}
Xa.a(context2, "HttpDns", i);
}
}
} catch (Throwable th) {
Sa.a(th, "DNSManager", "initHttpDns");
}
}
public static Ka a(Context context) {
if (f5667a == null) {
f5667a = new Ka(context);
}
return f5667a;
}
private boolean c() {
return Ra.t() && this.f5668b != null && !e() && _a.b(this.f5669c, SandboxSharedPref.DEFAULT_SHARED_PREF_FILE_NAME, "dns_faile_count_total", 0L) < 2;
}
private String d() {
if (c()) {
try {
return (String) Va.a(this.f5668b, "getIpByHostAsync", "apilocatesrc.amap.com");
} catch (Throwable unused) {
Xa.a(this.f5669c, "HttpDns");
return null;
}
}
return null;
}
private boolean e() {
int i;
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";
}
i = Integer.parseInt(property);
} else {
str = Proxy.getHost(this.f5669c);
i = Proxy.getPort(this.f5669c);
}
} catch (Throwable th) {
th.printStackTrace();
i = -1;
}
return (str == null || i == -1) ? false : true;
}
public final void a() {
if (this.f5671e) {
_a.a(this.f5669c, SandboxSharedPref.DEFAULT_SHARED_PREF_FILE_NAME, "dns_faile_count_total", 0L);
}
}
public final void a(Oa oa) {
try {
this.f5671e = false;
if (c() && oa != null) {
this.g = oa;
String c2 = oa.c();
if (!c2.substring(0, c2.indexOf(Constants.COLON_SEPARATOR)).equalsIgnoreCase("https") && !"http://abroad.apilocate.amap.com/mobile/binary".equals(c2)) {
String d2 = d();
if (this.f && TextUtils.isEmpty(d2)) {
this.f = false;
d2 = _a.a(this.f5669c, "ip", "last_ip", "");
}
if (TextUtils.isEmpty(d2)) {
return;
}
SharedPreferences.Editor edit = this.f5669c.getSharedPreferences("ip", 0).edit();
edit.putString("last_ip", d2);
_a.a(edit);
oa.g = "http://apilocatesrc.amap.com/mobile/binary".replace("apilocatesrc.amap.com", d2);
oa.a().put(ResultConst.Key.sHost, "apilocatesrc.amap.com");
this.f5671e = true;
}
}
} catch (Throwable unused) {
}
}
public final void b() {
try {
if (c() && this.h <= 5 && this.f5671e) {
if (this.f5670d == null) {
this.f5670d = C0417d.b();
}
if (this.f5670d.isShutdown()) {
return;
}
this.f5670d.submit(new a(this.g));
}
} catch (Throwable unused) {
}
}
final synchronized void b(Oa oa) {
try {
oa.g = "http://apilocatesrc.amap.com/mobile/binary";
long b2 = _a.b(this.f5669c, SandboxSharedPref.DEFAULT_SHARED_PREF_FILE_NAME, "dns_faile_count_total", 0L);
if (b2 >= 2) {
return;
}
X.a();
X.a(oa, false);
long j = b2 + 1;
if (j >= 2) {
Ya.a(this.f5669c, "HttpDNS", "dns failed too much");
}
_a.a(this.f5669c, SandboxSharedPref.DEFAULT_SHARED_PREF_FILE_NAME, "dns_faile_count_total", j);
} catch (Throwable unused) {
_a.a(this.f5669c, SandboxSharedPref.DEFAULT_SHARED_PREF_FILE_NAME, "dns_faile_count_total", 0L);
}
}
}