package com.amap.api.col; import android.content.Context; import android.os.Bundle; import android.telephony.TelephonyManager; import android.util.SparseArray; import com.amap.api.col.fa; import com.amap.api.location.AMapLocation; import com.amap.api.location.AMapLocationClientOption; import com.amap.api.services.district.DistrictSearchQuery; import com.meizu.cloud.pushsdk.constants.PushConstants; import java.util.HashMap; import java.util.Locale; import org.json.JSONObject; /* compiled from: CoreUtil */ public class f { public static String a = null; public static String b = null; public static int c = 30000; /* renamed from: d reason: collision with root package name */ public static String f1013d = null; public static String e = null; public static int f = 20; public static boolean g = true; static String h = null; static HashMap<String, String> i = null; public static final SparseArray<String> j; public static boolean k = false; static boolean l = false; static boolean m = false; static boolean n = false; private static String o = "http://apilocate.amap.com/mobile/binary"; private static String p = "http://apilocatesrc.amap.com/mobile/binary"; private static String[] q = {"com.amap.api.location", "com.loc", "com.amap.api.fence"}; private static String r = "001;002;11B;11C;11E;11F;11G;11H;11I;11K;122;123;13A;135;13J;13S"; static { SparseArray<String> sparseArray = new SparseArray<>(); j = sparseArray; sparseArray.append(0, "UNKWN"); sparseArray.append(1, "GPRS"); sparseArray.append(2, "EDGE"); sparseArray.append(3, "UMTS"); sparseArray.append(4, "CDMA"); sparseArray.append(5, "EVDO_0"); sparseArray.append(6, "EVDO_A"); sparseArray.append(7, "1xRTT"); sparseArray.append(8, "HSDPA"); sparseArray.append(9, "HSUPA"); sparseArray.append(10, "HSPA"); sparseArray.append(11, "IDEN"); sparseArray.append(12, "EVDO_B"); sparseArray.append(13, "LTE"); sparseArray.append(14, "EHRPD"); sparseArray.append(15, "HSPAP"); } public static String a() { return o; } public static String b() { return p; } public static String[] c() { return (String[]) q.clone(); } public static boolean d() { if (!m) { m = true; n = false; } return n; } private static void e() { try { if (i == null) { i = new HashMap<>(); } i.clear(); i.put("a9a9d23668a1a7ea93de9b21d67e436a", "F13160D440C7D0229DA95450F66AF92154AC84DF088F8CA3100B2E8131D57F3DC67124D4C466056E7A3DFBE035E1B9A4B9DA4DB68AE65A43EDFD92F5C60EF0C9"); i.put("fe643c382e5c3b3962141f1a2e815a78", "FB923EE67A8B4032DAA517DD8CD7A26FF7C25B0C3663F92A0B61251C4FFFA858DF169D61321C3E7919CB67DF8EFEC827"); i.put("b2e8bd171989cb2c3c13bd89b4c1067a", "239CE372F804D4BE4EAFFD183668379BDF274440E6F246AB16BBE6F5D1D30DEACFBBF0C942485727FF12288228760A9E"); i.put("9a571aa113ad987d626c0457828962e6", "D2FF99A88BEB04683D89470D4FA72B1749DA456AB0D0F1A476477CE5A6874F53A9106423D905F9D808C0FCE8E7F1E04AC642F01FE41D0C7D933971F45CBA72B7"); i.put("668319f11506def6208d6afe320dfd52", "53E53D46011A6BBAEA4FAE5442E659E0577CDD336F930C28635C322FB3F51C3C63F7FBAC9EAE448DFA2E5E5D716C4807"); i.put("256b0f26bb2a9506be6cfdb84028ae08", "AF2228680EDC323FBA035362EB7E1E38A0C33E1CF6F6FB805EE553A230CBA754CD9552EB9B546542CBE619E8293151BE"); } catch (Throwable th) { a(th, "CoreUtil", "initUrlHash"); } } public static boolean a(double d2, double d3) { int i2 = (int) ((d3 - 73.0d) / 0.5d); int i3 = (int) ((d2 - 3.5d) / 0.5d); if (i3 < 0 || i3 >= 101 || i2 < 0 || i2 >= 124) { return false; } try { return "00000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001100000001011000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011101010111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000110111111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111101111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000110111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011010111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001110011100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000110000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001010011100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111100110001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011111000111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111110011000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111000000000111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111100000000000010111110100000011000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111110000000001111111111111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111111000000111111111111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011111111111101111111111111111111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000011111111111111111111111111111111111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000101111111111111111111111111111111111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000011111111111111111111111111111111111111111100000000000000000000000000000000000000000000000000000000000000000000000000000000001111111111111111111111111111111111111111111100000000000000000000000000000000000000000000000000000000000000000000000000000000111111111111111111111111111111111111111111111000000000000000000000000000000000000000000000000000000000000000000000000000000001111111111111111111111111111111111111111111100000000000000000000000000000000000000000000000000000000000000000000000000000000011111111111111111111111111111111111111111111100000000000000000000000000000000000000000000000000000000000000000011110000000001111111111111111111111111111111111111111111110000000000000000000000000000000000000000000000000000000000011000011111100000000111111111111111111111111111111111111111111111100000000000000000000000000000000000000000000000000001111111100111111111100110111111111111111111111111111111111111111111111110000000000000000000000000000000000000000000000000001111111111111111111111111111111111111111111111111111111111111111111111111100000000000000000000000000000000000000000000000011111111111111111111111111111111111111111111111111111111111111111111111111111000000000000000000000000000000000000000000000111111111111111111111111111111111111111111111111111111111111111111111111111111100000000000000000000000000000000000000000101111111111111111111111111111111111111111111111111111111111111111111111111111111111000000000000000000000000000000000000001111111111111111111111111111111111111111111111111111111111111111111111111111111111111100000000000000000000000000000000000011111111111111111111111111111111111111111111111111111111111111111111111111111111111111110000000000000000000000000000000000011111111111111111111111111111111111111111111111111111111111111111111111111111111111111110000000000000000000000000000000000001111111111111111111111111111111111111111111111111111111111111111111111111111111111111110000000000000000000000000000000000001111111111111111111111111111111111111111111111111111111111111111111111111111111111111111000000000000000000000000000000000000111111111111111111111111111111111111111111111111111111111111111111111111111111111111111000000000000000000000000000000000000001111111111111111111111111111111111111111111111111111111111111111111111111111111111111000000000000000000000000000000000000000111111111111111111111111111111111111111111111111111111111111111111111111111111111111100000000000000000000000000000000000000011111111111111111111111111111111111111111111111111111111111111111111111111111111111100000000000000000000000000000000000000011111111111111111111111111111111111111111111111111111111111111111111111111111111111100000000000000000000000000000000000000111111111111111111111111111111111111111111111111111111111111111111111111111111111111110000000000000000000000000000000000001111111111111111111111111111111111111111111111111111111111111111111111111111111111111111110000000000000000000000000000000001111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100000000000000000000000000000011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111110000000000000000000000000011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111000000000000000000000000000111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111011111000000000000000000000000000111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100100000000000000000000000000000111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100011100000000000000000000000000011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111000111110000000000000000000000001111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111110011111110000000000000000000000111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111110111111110000000000000000000000111011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111110000000000000000000000001111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100000000000000000000000011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111000000000000000000000000011111111111111111111111111111111111111111111111100001111111111111111111111111111111111111111111111111010000000000000000000000111111111111111111111111111111111111111111110000000000000001111111111111111111111111111111111111111111100000000000000000000011111111111111111111111111111111100000000000000000000000000001111111111111111111111111111111111111111110000000000000000000001111111111111111111111111111111100000000000000000000000000000001111111111111111111111111111111111111111000000000000000000000111111111111111111111111111111110000000000000000000000000000001111111111111111111111111111111111111111100000000000000000000111111111111111111111111111111000000000000000000000000000000000111111111111111111111111111111111111111111000000000000000000001111111111111111111111111110000000000000000000000000000000000001110011111111111111111111111111111111111111100000000000000000000011111111111111111100000000000000000000000000000000000000000000000001111111111111111111111111111111111111000000000000000000001111111111111111111000000000000000000000000000000000000000000000000011111111111111111111111111111111111100000000000000000000011111111111111111100000000000000000000000000000000000000000000000000011111111111111111111111111111111111000000000000000000001111111111111111100000000000000000000000000000000000000000000000000000000111111111111111111111111111111110000000000000000000000000111111111100000000000000000000000000000000000000000000000000111111111111111111111111111111111111111000000000000000000000000011111111100000000000000000000000000000000000000000000000000011111111111111111111111111111110001111100000000000000000000000000111110000000000000000000000000000000000000000000000000000001111111111111111111111111111111000000000000000000000000000000000001110000000000000000000000000000000000000000000000000000000011111111111111111111111111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111111111111111111111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111111111111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011111111111111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111111111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011111111111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011111111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011111111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010110000000000000000000000".charAt((i3 * 124) + i2) == '1'; } catch (Throwable th) { a(th, "CoreUtil", "isChina"); return true; } } public static String b(Context context) { try { return il.a((TelephonyManager) context.getSystemService("phone"))[0]; } catch (Throwable th) { a(th, "CoreUtil", "getMcc"); return ""; } } private static byte[] c(String str) { if (str == null || str.length() < 2) { return new byte[0]; } String lowerCase = str.toLowerCase(Locale.US); int length = lowerCase.length() / 2; byte[] bArr = new byte[length]; for (int i2 = 0; i2 < length; i2++) { int i3 = i2 * 2; bArr[i2] = (byte) (Integer.parseInt(lowerCase.substring(i3, i3 + 2), 16) & 255); } return bArr; } public static AMapLocation a(AMapLocation aMapLocation, AMapLocation aMapLocation2) { if (aMapLocation2 == null) { return aMapLocation; } try { aMapLocation.setCountry(aMapLocation2.getCountry()); aMapLocation.setRoad(aMapLocation2.getRoad()); aMapLocation.setPoiName(aMapLocation2.getPoiName()); aMapLocation.setStreet(aMapLocation2.getStreet()); aMapLocation.setNumber(aMapLocation2.getStreetNum()); String cityCode = aMapLocation2.getCityCode(); String adCode = aMapLocation2.getAdCode(); aMapLocation.setCityCode(cityCode); aMapLocation.setAdCode(adCode); aMapLocation.setCity(aMapLocation2.getCity()); aMapLocation.setDistrict(aMapLocation2.getDistrict()); aMapLocation.setProvince(aMapLocation2.getProvince()); aMapLocation.setAoiName(aMapLocation2.getAoiName()); aMapLocation.setAddress(aMapLocation2.getAddress()); if (aMapLocation.getExtras() != null) { aMapLocation.getExtras().putString("citycode", aMapLocation2.getCityCode()); aMapLocation.getExtras().putString("desc", aMapLocation2.getExtras().getString("desc")); aMapLocation.getExtras().putString("adcode", aMapLocation2.getAdCode()); } else { Bundle bundle = new Bundle(); bundle.putString("citycode", aMapLocation2.getCityCode()); bundle.putString("desc", aMapLocation2.getExtras().getString("desc")); bundle.putString("adcode", aMapLocation2.getAdCode()); aMapLocation.setExtras(bundle); } } catch (Throwable unused) { } return aMapLocation; } private static void b(String str) { if (str != null) { try { if (str.length() != 0) { HashMap<String, String> hashMap = i; if (hashMap != null && hashMap.containsKey(str)) { String str2 = i.get(str); String str3 = null; if (str2 != null && str2.length() > 0) { str3 = new String(hs.d(c(str2), str), "utf-8"); } if (str3 != null && str3.length() > 0 && str3.contains("http:")) { o = str3; } } } } catch (Throwable th) { a(th, "CoreUtil", "checkUrl"); } } } public static String d(Context context) { return ex.b(er.e(context)); } public static String c(Context context) { boolean b2 = ik.b(context, "pref", "ddex", false); if (b2) { k = b2; if (!r.contains("121")) { r += ";121"; } } boolean b3 = ik.b(context, "pref", "colde", false); if (b3) { l = b3; if (!r.contains("11Z")) { r += ";11Z"; } } return r; } public static void a(AMapLocation aMapLocation, JSONObject jSONObject) { if (jSONObject != null) { try { if (il.a(jSONObject, "provider")) { aMapLocation.setProvider(jSONObject.getString("provider")); } if (il.a(jSONObject, "lon")) { aMapLocation.setLongitude(jSONObject.getDouble("lon")); } if (il.a(jSONObject, "lat")) { aMapLocation.setLatitude(jSONObject.getDouble("lat")); } if (il.a(jSONObject, "altitude")) { aMapLocation.setAltitude(jSONObject.getDouble("altitude")); } if (il.a(jSONObject, "acc")) { aMapLocation.setAccuracy(Float.parseFloat(jSONObject.getString("acc"))); } if (il.a(jSONObject, "accuracy")) { aMapLocation.setAccuracy((float) jSONObject.getLong("accuracy")); } if (il.a(jSONObject, "speed")) { aMapLocation.setSpeed((float) jSONObject.getLong("speed")); } if (il.a(jSONObject, "dir")) { aMapLocation.setBearing((float) jSONObject.getLong("dir")); } if (il.a(jSONObject, "bearing")) { aMapLocation.setBearing((float) jSONObject.getLong("bearing")); } if (il.a(jSONObject, "citycode")) { aMapLocation.setCityCode(jSONObject.getString("citycode")); } if (il.a(jSONObject, "address")) { aMapLocation.setAddress(jSONObject.getString("address")); } String string = il.a(jSONObject, "desc") ? jSONObject.getString("desc") : ""; if (il.a(jSONObject, "adcode")) { aMapLocation.setAdCode(jSONObject.getString("adcode")); } Bundle bundle = new Bundle(); bundle.putString("citycode", aMapLocation.getCityCode()); bundle.putString("desc", string.toString()); bundle.putString("adcode", aMapLocation.getAdCode()); aMapLocation.setExtras(bundle); if (il.a(jSONObject, DistrictSearchQuery.KEYWORDS_COUNTRY)) { aMapLocation.setCountry(jSONObject.getString(DistrictSearchQuery.KEYWORDS_COUNTRY)); } if (il.a(jSONObject, DistrictSearchQuery.KEYWORDS_PROVINCE)) { aMapLocation.setProvince(jSONObject.getString(DistrictSearchQuery.KEYWORDS_PROVINCE)); } if (il.a(jSONObject, DistrictSearchQuery.KEYWORDS_CITY)) { aMapLocation.setCity(jSONObject.getString(DistrictSearchQuery.KEYWORDS_CITY)); } if (il.a(jSONObject, "road")) { aMapLocation.setRoad(jSONObject.getString("road")); } if (il.a(jSONObject, "street")) { aMapLocation.setStreet(jSONObject.getString("street")); } if (il.a(jSONObject, "number")) { aMapLocation.setNumber(jSONObject.getString("number")); } if (il.a(jSONObject, "poiname")) { aMapLocation.setPoiName(jSONObject.getString("poiname")); } if (il.a(jSONObject, "aoiname")) { aMapLocation.setAoiName(jSONObject.getString("aoiname")); } if (il.a(jSONObject, "errorCode")) { aMapLocation.setErrorCode(jSONObject.getInt("errorCode")); } if (il.a(jSONObject, "errorInfo")) { aMapLocation.setErrorInfo(jSONObject.getString("errorInfo")); } if (il.a(jSONObject, "locationType")) { aMapLocation.setLocationType(jSONObject.getInt("locationType")); } if (il.a(jSONObject, "locationDetail")) { aMapLocation.setLocationDetail(jSONObject.getString("locationDetail")); } if (il.a(jSONObject, "time")) { aMapLocation.setTime(jSONObject.getLong("time")); } if (il.a(jSONObject, DistrictSearchQuery.KEYWORDS_DISTRICT)) { aMapLocation.setDistrict(jSONObject.getString(DistrictSearchQuery.KEYWORDS_DISTRICT)); } if (il.a(jSONObject, "isOffset")) { aMapLocation.setOffset(jSONObject.getBoolean("isOffset")); } if (il.a(jSONObject, "poiid")) { aMapLocation.setBuildingId(jSONObject.getString("poiid")); } if (il.a(jSONObject, "floor")) { aMapLocation.setFloor(jSONObject.getString("floor")); } } catch (Throwable th) { a(th, "CoreUtil", "transformLocation"); } } } public static void a(Context context) { try { if (il.a(b(context))) { o = "http://abroad.apilocate.amap.com/mobile/binary"; return; } e(); String a2 = hs.a(er.f(context)); h = a2; b(a2); } catch (Throwable th) { a(th, "CoreUtil", "checkUrl"); } } public static fa a(String str) { try { return new fa.a(str, "3.2.1", "AMAP_Location_SDK_Android 3.2.1").a(c()).a("3.2.1").a(); } catch (Throwable th) { a(th, "CoreUtil", "getSDKInfo"); return null; } } public static fa a(String str, String str2) { try { return new fa.a(str, str2, "AMAP_Location_SDK_Android 3.2.1").a(c()).a(); } catch (Throwable th) { a(th, "CoreUtil", "getSDKInfo"); return null; } } public static void a(Throwable th, String str, String str2) { if (!"reportError".equals(str2)) { try { th.printStackTrace(); fi.b(th, str, str2); } catch (Throwable unused) { } } } static String a(AMapLocationClientOption aMapLocationClientOption, Context context) { String str = PushConstants.PUSH_TYPE_NOTIFY; JSONObject jSONObject = new JSONObject(); if (aMapLocationClientOption == null) { aMapLocationClientOption = new AMapLocationClientOption(); } try { jSONObject.put("nbssid", str); jSONObject.put("reversegeo", aMapLocationClientOption.isNeedAddress()); jSONObject.put("isOffset", aMapLocationClientOption.isOffset()); jSONObject.put("wifiactivescan", aMapLocationClientOption.isWifiActiveScan() ? "1" : str); jSONObject.put("httptimeout", aMapLocationClientOption.getHttpTimeOut()); jSONObject.put("isLocationCacheEnable", aMapLocationClientOption.isLocationCacheEnable()); jSONObject.put("isOnceLocationLatest", aMapLocationClientOption.isOnceLocationLatest()); if (aMapLocationClientOption.isKillProcess()) { str = "1"; } jSONObject.put("isKillProcess", str); boolean z = true; if (aMapLocationClientOption.getLocationProtocol().ordinal() != 1) { z = false; } jSONObject.put("locationProtocol", z); jSONObject.put("sensorEnable", aMapLocationClientOption.isSensorEnable()); jSONObject.put("isWifiPassiveScan", aMapLocationClientOption.isWifiScan()); jSONObject.put("isMock", aMapLocationClientOption.isMockEnable()); } catch (Throwable th) { a(th, "CoreUtil", "getExtraJsn"); } return jSONObject.toString(); } }