package com.amap.api.col; import android.content.Context; import android.util.Log; import com.meizu.cloud.pushsdk.notification.model.TimeDisplaySetting; import java.util.HashMap; import java.util.Map; import org.json.JSONException; import org.json.JSONObject; @Deprecated /* compiled from: AuthManager */ public class et { public static int a = -1; public static String b = ""; private static fa c = null; /* renamed from: d reason: collision with root package name */ private static String f1009d = "http://apiinit.amap.com/v3/log/init"; private static String e; private static boolean a(Context context, fa faVar, boolean z) { c = faVar; try { String a2 = a(); HashMap hashMap = new HashMap(); hashMap.put("Content-Type", "application/x-www-form-urlencoded"); hashMap.put("Accept-Encoding", "gzip"); hashMap.put("Connection", "Keep-Alive"); hashMap.put("User-Agent", c.d()); hashMap.put("X-INFO", eu.a(context, c, null, z)); hashMap.put("logversion", "2.1"); hashMap.put("platinfo", String.format("platform=Android&sdkversion=%s&product=%s", c.b(), c.a())); gr a3 = gr.a(); fc fcVar = new fc(); fcVar.a(ey.a(context)); fcVar.a(hashMap); fcVar.b(a(context)); fcVar.a(a2); return a(a3.b(fcVar)); } catch (Throwable th) { ff.a(th, "Auth", "getAuth"); return true; } } @Deprecated public static synchronized boolean a(Context context, fa faVar) { boolean a2; synchronized (et.class) { a2 = a(context, faVar, false); } return a2; } public static void a(String str) { er.b(str); } private static String a() { return f1009d; } private static boolean a(byte[] bArr) { if (bArr == null) { return true; } try { JSONObject jSONObject = new JSONObject(fb.a(bArr)); if (jSONObject.has("status")) { int i = jSONObject.getInt("status"); if (i == 1) { a = 1; } else if (i == 0) { a = 0; } } if (jSONObject.has("info")) { b = jSONObject.getString("info"); } if (a == 0) { Log.i("AuthFailure", b); } return a == 1; } catch (JSONException e2) { ff.a(e2, "Auth", "lData"); return false; } catch (Throwable th) { ff.a(th, "Auth", "lData"); return false; } } private static Map<String, String> a(Context context) { HashMap hashMap = new HashMap(); try { hashMap.put("resType", "json"); hashMap.put("encode", "UTF-8"); String a2 = eu.a(); hashMap.put(TimeDisplaySetting.TIME_DISPLAY_SETTING, a2); hashMap.put("key", er.f(context)); hashMap.put("scode", eu.a(context, a2, fb.d("resType=json&encode=UTF-8&key=" + er.f(context)))); } catch (Throwable th) { ff.a(th, "Auth", "gParams"); } return hashMap; } }