湘游汇 v1.0版本的 MD5 值为:85338391d88b5d57da66e240ece801c7
以下内容为反编译后的 dg.java 源代码,内容仅作参考
package com.b;
import android.content.Context;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.HashMap;
import java.util.Locale;
public final class dg {
private static dg b;
q f564a;
private Context c;
private int d = dl.g;
private boolean e = false;
private int f = 0;
private dg(Context context) {
this.f564a = null;
this.c = null;
try {
ef.a().a(context);
} catch (Throwable unused) {
}
this.c = context;
this.f564a = q.a();
}
public static dg a(Context context) {
if (b == null) {
b = new dg(context);
}
return b;
}
public final int a() {
return this.d;
}
public final dh a(Context context, byte[] bArr, String str, String str2, boolean z) {
String str3;
String str4;
try {
HashMap hashMap = new HashMap(16);
dh dhVar = new dh(context, dl.c());
try {
hashMap.put("Content-Type", "application/octet-stream");
hashMap.put("Accept-Encoding", "gzip");
hashMap.put("gzipped", "1");
hashMap.put("Connection", "Keep-Alive");
hashMap.put("User-Agent", "AMAP_Location_SDK_Android 5.2.0");
hashMap.put("KEY", ea.f(context));
hashMap.put("enginever", "5.1");
String a2 = ec.a();
String a3 = ec.a(context, a2, "key=" + ea.f(context));
hashMap.put("ts", a2);
hashMap.put("scode", a3);
hashMap.put("encr", "1");
dhVar.f = hashMap;
String str5 = z ? "loc" : "locf";
dhVar.n = true;
dhVar.l = String.format(Locale.US, "platform=Android&sdkversion=%s&product=%s&loc_channel=%s", "5.2.0", str5, 3);
dhVar.k = z;
dhVar.g = str;
dhVar.h = str2;
dhVar.i = dr.a(bArr);
dhVar.a(ei.a(context));
HashMap hashMap2 = new HashMap(16);
hashMap2.put("output", "bin");
hashMap2.put("policy", "3103");
switch (this.f) {
case 0:
hashMap2.remove("custom");
break;
case 1:
str3 = "custom";
str4 = "language:cn";
hashMap2.put(str3, str4);
break;
case 2:
str3 = "custom";
str4 = "language:en";
hashMap2.put(str3, str4);
break;
default:
hashMap2.remove("custom");
break;
}
dhVar.m = hashMap2;
dhVar.a(this.d);
dhVar.b(this.d);
if ((this.e || dr.k(context)) && str.startsWith("http:")) {
dhVar.g = dhVar.c().replace("https:", "https:");
return dhVar;
}
return dhVar;
} catch (Throwable unused) {
return dhVar;
}
} catch (Throwable unused2) {
return null;
}
}
public final w a(dh dhVar) {
return q.a(dhVar, this.e || dr.k(this.c));
}
public final w a(dh dhVar, int i) {
return q.a(dhVar, this.e || dr.k(this.c), i);
}
public final String a(Context context, double d, double d2) {
String str;
String str2;
byte[] b2;
ByteArrayOutputStream byteArrayOutputStream;
try {
HashMap hashMap = new HashMap(16);
dh dhVar = new dh(context, dl.c());
hashMap.clear();
hashMap.put("Content-Type", "application/x-www-form-urlencoded");
hashMap.put("Connection", "Keep-Alive");
hashMap.put("User-Agent", "AMAP_Location_SDK_Android 5.2.0");
HashMap hashMap2 = new HashMap(16);
hashMap2.put("custom", "26260A1F00020002");
hashMap2.put("key", ea.f(context));
switch (this.f) {
case 0:
hashMap2.remove("language");
break;
case 1:
str = "language";
str2 = "zh-CN";
hashMap2.put(str, str2);
break;
case 2:
str = "language";
str2 = "en";
hashMap2.put(str, str2);
break;
default:
hashMap2.remove("language");
break;
}
try {
String a2 = ec.a();
String a3 = ec.a(context, a2, ek.b(hashMap2));
hashMap2.put("ts", a2);
hashMap2.put("scode", a3);
byte[] bytes = ("output=json&radius=1000&extensions=all&location=" + d2 + "," + d).getBytes("UTF-8");
try {
byteArrayOutputStream = new ByteArrayOutputStream();
if (bytes != null) {
try {
byteArrayOutputStream.write(ek.a(bytes.length));
byteArrayOutputStream.write(bytes);
} catch (Throwable th) {
th = th;
th.printStackTrace();
if (byteArrayOutputStream != null) {
byteArrayOutputStream.close();
}
dhVar.n = false;
dhVar.k = true;
dhVar.l = String.format(Locale.US, "platform=Android&sdkversion=%s&product=%s&loc_channel=%s", "5.2.0", "loc", 3);
dhVar.m = hashMap2;
dhVar.f = hashMap;
dhVar.a(ei.a(context));
dhVar.a(dl.g);
dhVar.b(dl.g);
dhVar.h = "http://dualstack-restsdk.amap.com/v3/geocode/regeo";
if (dr.k(context)) {
}
return new String(b2, "utf-8");
}
}
dhVar.j = byteArrayOutputStream.toByteArray();
byteArrayOutputStream.close();
} catch (Throwable th2) {
th = th2;
byteArrayOutputStream = null;
}
} catch (IOException e) {
e.printStackTrace();
}
dhVar.n = false;
dhVar.k = true;
dhVar.l = String.format(Locale.US, "platform=Android&sdkversion=%s&product=%s&loc_channel=%s", "5.2.0", "loc", 3);
dhVar.m = hashMap2;
dhVar.f = hashMap;
dhVar.a(ei.a(context));
dhVar.a(dl.g);
dhVar.b(dl.g);
dhVar.h = "http://dualstack-restsdk.amap.com/v3/geocode/regeo";
if (dr.k(context)) {
dhVar.g = "http://restsdk.amap.com/v3/geocode/regeo";
b2 = q.b(dhVar);
} else {
dhVar.g = "http://restsdk.amap.com/v3/geocode/regeo".replace("http:", "https:");
b2 = q.a(dhVar);
}
return new String(b2, "utf-8");
} catch (Throwable unused) {
return null;
}
}
public final void a(long j, boolean z, int i) {
try {
this.e = z;
try {
ef.a().a(z);
} catch (Throwable unused) {
}
this.d = Long.valueOf(j).intValue();
this.f = i;
} catch (Throwable th) {
dl.a(th, "LocNetManager", "setOption");
}
}
}