package com.loc; import android.content.Context; import com.amap.api.maps.AMap; import com.loc.bl; import com.meizu.cloud.pushsdk.notification.model.TimeDisplaySetting; import io.dcloud.common.DHInterface.IApp; import io.dcloud.common.DHInterface.IWebview; import io.dcloud.common.util.net.NetWork; import java.util.HashMap; import java.util.Locale; import java.util.Map; /* compiled from: LocNetManager */ public final class fe { /* renamed from: b reason: collision with root package name */ private static fe f6644b; /* renamed from: a reason: collision with root package name */ bg f6645a = null; /* renamed from: c reason: collision with root package name */ private Context f6646c = null; /* renamed from: d reason: collision with root package name */ private int f6647d = fj.i; /* renamed from: e reason: collision with root package name */ private boolean f6648e = false; /* renamed from: f reason: collision with root package name */ private int f6649f = 0; private fe(Context context) { try { q.a().a(context); } catch (Throwable unused) { } this.f6646c = context; this.f6645a = bg.a(); } public static fe a(Context context) { if (f6644b == null) { f6644b = new fe(context); } return f6644b; } public final bm a(ff ffVar) throws Throwable { if (this.f6648e) { ffVar.a(bl.c.HTTPS); } return bg.a(ffVar); } /* JADX WARNING: Removed duplicated region for block: B:22:0x0101 */ /* JADX WARNING: Removed duplicated region for block: B:27:? A[RETURN, SYNTHETIC] */ public final ff a(Context context, byte[] bArr, String str, String str2, boolean z) { String str3; try { HashMap hashMap = new HashMap(16); ff ffVar = new ff(context, fj.c()); try { hashMap.put(NetWork.CONTENT_TYPE, "application/octet-stream"); hashMap.put("Accept-Encoding", "gzip"); hashMap.put("gzipped", "1"); hashMap.put("Connection", "Keep-Alive"); hashMap.put(IWebview.USER_AGENT, "AMAP_Location_SDK_Android 6.0.1"); hashMap.put("KEY", l.f(context)); hashMap.put("enginever", fj.f6667a); String a2 = n.a(); String a3 = n.a(context, a2, "key=" + l.f(context)); hashMap.put(TimeDisplaySetting.TIME_DISPLAY_SETTING, a2); hashMap.put("scode", a3); if (Double.valueOf(fj.f6667a).doubleValue() >= 5.3d) { hashMap.put("aps_s_src", "openapi"); } hashMap.put("encr", "1"); ffVar.b(hashMap); String str4 = "loc"; if (!z) { str4 = "locf"; } ffVar.c(true); ffVar.b(String.format(Locale.US, "platform=Android&sdkversion=%s&product=%s&loc_channel=%s", "6.0.1", str4, 3)); ffVar.b(z); ffVar.c(str); ffVar.d(str2); ffVar.c(fq.a(bArr)); ffVar.a(v.a(context)); HashMap hashMap2 = new HashMap(16); hashMap2.put("output", "bin"); hashMap2.put("policy", "3103"); int i = this.f6649f; if (i != 0) { if (i == 1) { str3 = "language:cn"; } else if (i == 2) { str3 = "language:en"; } hashMap2.put(AMap.CUSTOM, str3); ffVar.a((Map<String, String>) hashMap2); ffVar.a(this.f6647d); ffVar.b(this.f6647d); if (this.f6648e) { return ffVar; } ffVar.a(bl.c.HTTPS); return ffVar; } hashMap2.remove(AMap.CUSTOM); ffVar.a((Map<String, String>) hashMap2); ffVar.a(this.f6647d); ffVar.b(this.f6647d); if (this.f6648e) { } } catch (Throwable unused) { return ffVar; } } catch (Throwable unused2) { return null; } } /* JADX WARNING: Removed duplicated region for block: B:12:0x0060 */ /* JADX WARNING: Removed duplicated region for block: B:13:0x0063 */ /* JADX WARNING: Removed duplicated region for block: B:18:0x00e5 A[Catch:{ all -> 0x00f8 }] */ public final String a(Context context, double d2, double d3) { String str; try { HashMap hashMap = new HashMap(16); ff ffVar = new ff(context, fj.c()); hashMap.clear(); hashMap.put(NetWork.CONTENT_TYPE, "application/x-www-form-urlencoded"); hashMap.put("Connection", "Keep-Alive"); hashMap.put(IWebview.USER_AGENT, "AMAP_Location_SDK_Android 6.0.1"); HashMap hashMap2 = new HashMap(16); hashMap2.put(AMap.CUSTOM, "26260A1F00020002"); hashMap2.put(IApp.ConfigProperty.CONFIG_KEY, l.f(context)); int i = this.f6649f; if (i != 0) { if (i == 1) { str = "zh-CN"; } else if (i == 2) { str = "en"; } hashMap2.put(IApp.ConfigProperty.CONFIG_LANGUAGE, str); hashMap2.put("curLocationType", !fq.m(this.f6646c) ? "coarseLoc" : "fineLoc"); String a2 = n.a(); String a3 = n.a(context, a2, x.b(hashMap2)); hashMap2.put(TimeDisplaySetting.TIME_DISPLAY_SETTING, a2); hashMap2.put("scode", a3); ffVar.b(("output=json&radius=1000&extensions=all&location=" + d3 + "," + d2).getBytes("UTF-8")); ffVar.c(false); ffVar.b(true); ffVar.b(String.format(Locale.US, "platform=Android&sdkversion=%s&product=%s&loc_channel=%s", "6.0.1", "loc", 3)); ffVar.a((Map<String, String>) hashMap2); ffVar.b(hashMap); ffVar.a(v.a(context)); ffVar.a(fj.i); ffVar.b(fj.i); ffVar.d("http://dualstack-arestapi.amap.com/v3/geocode/regeo"); ffVar.c("http://restsdk.amap.com/v3/geocode/regeo"); if (this.f6648e) { ffVar.a(bl.c.HTTPS); } return new String(bg.a(ffVar).f6289a, "utf-8"); } hashMap2.remove(IApp.ConfigProperty.CONFIG_LANGUAGE); hashMap2.put("curLocationType", !fq.m(this.f6646c) ? "coarseLoc" : "fineLoc"); String a22 = n.a(); String a32 = n.a(context, a22, x.b(hashMap2)); hashMap2.put(TimeDisplaySetting.TIME_DISPLAY_SETTING, a22); hashMap2.put("scode", a32); ffVar.b(("output=json&radius=1000&extensions=all&location=" + d3 + "," + d2).getBytes("UTF-8")); ffVar.c(false); ffVar.b(true); ffVar.b(String.format(Locale.US, "platform=Android&sdkversion=%s&product=%s&loc_channel=%s", "6.0.1", "loc", 3)); ffVar.a((Map<String, String>) hashMap2); ffVar.b(hashMap); ffVar.a(v.a(context)); ffVar.a(fj.i); ffVar.b(fj.i); try { ffVar.d("http://dualstack-arestapi.amap.com/v3/geocode/regeo"); ffVar.c("http://restsdk.amap.com/v3/geocode/regeo"); if (this.f6648e) { } return new String(bg.a(ffVar).f6289a, "utf-8"); } catch (Throwable th) { fj.a(th, "LocNetManager", "post"); return null; } } catch (Throwable unused) { return null; } } public final void a(long j, boolean z, int i) { try { this.f6648e = z; this.f6647d = Long.valueOf(j).intValue(); this.f6649f = i; } catch (Throwable th) { fj.a(th, "LocNetManager", "setOption"); } } }