Aqara Home v2.4.1版本的 MD5 值为:529779ac2bc0131db52a1fc3098d2b35
以下内容为反编译后的 ei.java 源代码,内容仅作参考
package com.loc;
import android.content.Context;
import anet.channel.util.HttpConstant;
import com.amazonaws.services.s3.Headers;
import com.amazonaws.services.s3.util.Mimetypes;
import java.io.ByteArrayOutputStream;
import java.util.HashMap;
import java.util.Locale;
public final class ei {
public static ei b;
public aw a;
public Context c;
public int d = en.f6063g;
public boolean f6005e = false;
public int f6006f = 0;
public ei(Context context) {
this.a = null;
this.c = null;
try {
p.a().a(context);
} catch (Throwable unused) {
}
this.c = context;
this.a = aw.a();
}
public static ei a(Context context) {
if (b == null) {
b = new ei(context);
}
return b;
}
public final int a() {
return this.d;
}
public final ba a(ej ejVar) throws Throwable {
return aw.a(ejVar, this.f6005e || et.k(this.c));
}
public final ba a(ej ejVar, int i2) throws Throwable {
return aw.a(ejVar, this.f6005e || et.k(this.c), i2);
}
public final ej a(Context context, byte[] bArr, String str, String str2, boolean z2) {
String str3;
try {
HashMap hashMap = new HashMap(16);
ej ejVar = new ej(context, en.c());
try {
hashMap.put("Content-Type", Mimetypes.f4066e);
hashMap.put(HttpConstant.ACCEPT_ENCODING, "gzip");
hashMap.put("gzipped", "1");
hashMap.put(Headers.f3457m, "Keep-Alive");
hashMap.put("User-Agent", "AMAP_Location_SDK_Android 4.9.0");
hashMap.put("KEY", k.f(context));
hashMap.put("enginever", "5.1");
String a = m.a();
String a2 = m.a(context, a, "key=" + k.f(context));
hashMap.put("ts", a);
hashMap.put("scode", a2);
hashMap.put("encr", "1");
ejVar.f6007f = hashMap;
String str4 = z2 ? "loc" : "locf";
ejVar.f6015n = true;
ejVar.f6013l = String.format(Locale.US, "platform=Android&sdkversion=%s&product=%s&loc_channel=%s", "4.9.0", str4, 3);
ejVar.f6012k = z2;
ejVar.f6008g = str;
ejVar.f6009h = str2;
ejVar.f6010i = et.a(bArr);
ejVar.a(s.a(context));
HashMap hashMap2 = new HashMap(16);
hashMap2.put("output", "bin");
hashMap2.put("policy", "3103");
int i2 = this.f6006f;
if (i2 != 0) {
if (i2 != 1) {
str3 = i2 == 2 ? "language:en" : "language:cn";
}
hashMap2.put(p.a.t0.h.K0, str3);
ejVar.f6014m = hashMap2;
ejVar.a(this.d);
ejVar.b(this.d);
if ((!this.f6005e || et.k(context)) && str.startsWith("http:")) {
ejVar.f6008g = ejVar.c().replace("https:", "https:");
return ejVar;
}
return ejVar;
}
hashMap2.remove(p.a.t0.h.K0);
ejVar.f6014m = hashMap2;
ejVar.a(this.d);
ejVar.b(this.d);
if (this.f6005e) {
}
ejVar.f6008g = ejVar.c().replace("https:", "https:");
return ejVar;
} catch (Throwable unused) {
return ejVar;
}
} catch (Throwable unused2) {
return null;
}
}
public final String a(Context context, double d, double d2) {
byte[] b2;
byte[] bytes;
String str;
try {
HashMap hashMap = new HashMap(16);
ej ejVar = new ej(context, en.c());
hashMap.clear();
hashMap.put("Content-Type", "application/x-www-form-urlencoded");
hashMap.put(Headers.f3457m, "Keep-Alive");
hashMap.put("User-Agent", "AMAP_Location_SDK_Android 4.9.0");
HashMap hashMap2 = new HashMap(16);
hashMap2.put(p.a.t0.h.K0, "26260A1F00020002");
hashMap2.put("key", k.f(context));
int i2 = this.f6006f;
if (i2 != 0) {
if (i2 != 1) {
str = i2 == 2 ? "en" : "zh-CN";
}
hashMap2.put("language", str);
String a = m.a();
String a2 = m.a(context, a, u.b(hashMap2));
hashMap2.put("ts", a);
hashMap2.put("scode", a2);
bytes = ("output=json&radius=1000&extensions=all&location=" + d2 + "," + d).getBytes("UTF-8");
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
if (bytes != null) {
try {
byteArrayOutputStream.write(u.a(bytes.length));
byteArrayOutputStream.write(bytes);
} catch (Throwable th) {
th = th;
th.printStackTrace();
if (byteArrayOutputStream != null) {
byteArrayOutputStream.close();
}
ejVar.f6015n = false;
ejVar.f6012k = true;
ejVar.f6013l = String.format(Locale.US, "platform=Android&sdkversion=%s&product=%s&loc_channel=%s", "4.9.0", "loc", 3);
ejVar.f6014m = hashMap2;
ejVar.f6007f = hashMap;
ejVar.a(s.a(context));
ejVar.a(en.f6063g);
ejVar.b(en.f6063g);
ejVar.f6009h = "http://dualstack-restapi.amap.com/v3/geocode/regeo";
if (et.k(context)) {
}
return new String(b2, "utf-8");
}
}
ejVar.f6011j = byteArrayOutputStream.toByteArray();
byteArrayOutputStream.close();
ejVar.f6015n = false;
ejVar.f6012k = true;
ejVar.f6013l = String.format(Locale.US, "platform=Android&sdkversion=%s&product=%s&loc_channel=%s", "4.9.0", "loc", 3);
ejVar.f6014m = hashMap2;
ejVar.f6007f = hashMap;
ejVar.a(s.a(context));
ejVar.a(en.f6063g);
ejVar.b(en.f6063g);
ejVar.f6009h = "http://dualstack-restapi.amap.com/v3/geocode/regeo";
if (et.k(context)) {
ejVar.f6008g = "http://restapi.amap.com/v3/geocode/regeo".replace("http:", "https:");
b2 = aw.a(ejVar);
} else {
ejVar.f6008g = "http://restapi.amap.com/v3/geocode/regeo";
b2 = aw.b(ejVar);
}
return new String(b2, "utf-8");
}
hashMap2.remove("language");
String a3 = m.a();
String a22 = m.a(context, a3, u.b(hashMap2));
hashMap2.put("ts", a3);
hashMap2.put("scode", a22);
bytes = ("output=json&radius=1000&extensions=all&location=" + d2 + "," + d).getBytes("UTF-8");
ByteArrayOutputStream byteArrayOutputStream2 = new ByteArrayOutputStream();
if (bytes != null) {
}
ejVar.f6011j = byteArrayOutputStream2.toByteArray();
byteArrayOutputStream2.close();
ejVar.f6015n = false;
ejVar.f6012k = true;
ejVar.f6013l = String.format(Locale.US, "platform=Android&sdkversion=%s&product=%s&loc_channel=%s", "4.9.0", "loc", 3);
ejVar.f6014m = hashMap2;
ejVar.f6007f = hashMap;
ejVar.a(s.a(context));
ejVar.a(en.f6063g);
ejVar.b(en.f6063g);
ejVar.f6009h = "http://dualstack-restapi.amap.com/v3/geocode/regeo";
if (et.k(context)) {
}
return new String(b2, "utf-8");
} catch (Throwable unused) {
return null;
}
}
public final void a(long j2, boolean z2, int i2) {
try {
this.f6005e = z2;
try {
p.a().a(z2);
} catch (Throwable unused) {
}
this.d = Long.valueOf(j2).intValue();
this.f6006f = i2;
} catch (Throwable th) {
en.a(th, "LocNetManager", "setOption");
}
}
}