package cn.jiguang.ao; import android.content.Context; import android.os.Bundle; import android.text.TextUtils; import cn.jiguang.an.d; import cn.jiguang.ba.a; import cn.jiguang.f.j; import cn.jiguang.g.b; import cn.jiguang.internal.JConstants; import java.util.LinkedHashSet; import java.util.concurrent.ExecutionException; import java.util.concurrent.FutureTask; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; public final class i { /* renamed from: a reason: collision with root package name */ private static j f829a; private static volatile FutureTask<?> b; private static final Object c = new Object(); private static final LinkedHashSet<String> d; private static final LinkedHashSet<String> e = new LinkedHashSet<>(); static { LinkedHashSet<String> linkedHashSet = new LinkedHashSet<>(); d = linkedHashSet; linkedHashSet.add("https://tsis.jpush.cn"); } public static LinkedHashSet<String> a() { return (!JConstants.a() || e.isEmpty()) ? d : e; } public static void a(Context context, boolean z) { String str; StringBuilder sb; if (f829a == null) { f829a = new j(context, (byte) 0); } if (b == null || b.isCancelled() || b.isDone()) { synchronized (c) { if (b == null || b.isCancelled() || b.isDone()) { try { b = new FutureTask<>(f829a, null); a.a("ASYNC", b); } catch (Throwable th) { d.f("ReportSis", "new sis task e:" + th); } } } } if (z) { try { b.get(10, TimeUnit.SECONDS); } catch (InterruptedException e2) { e = e2; str = "ReportSis"; sb = new StringBuilder("sis task e:"); sb.append(e); d.f(str, sb.toString()); } catch (ExecutionException e3) { e = e3; str = "ReportSis"; sb = new StringBuilder("sis task e:"); sb.append(e); d.f(str, sb.toString()); } catch (TimeoutException e4) { e = e4; str = "ReportSis"; sb = new StringBuilder("sis task e:"); sb.append(e); d.f(str, sb.toString()); } catch (Throwable th2) { d.f("ReportSis", "sis task e:" + th2); } } } /* access modifiers changed from: private */ public static boolean b(Context context, String str, String str2) { n a2 = b.a(str, str2, context, true, 3, 2); d.b("ReportSis", "report sis code[" + a2.a() + "] from url=" + str + "\n body=" + a2.b()); if (a2.a() != 0) { return false; } String b2 = a2.b(); if (TextUtils.isEmpty(b2)) { return false; } try { a.a().a(context, new JSONObject(b2).getJSONObject("ret")); return true; } catch (Throwable th) { d.f("ReportSis", "getUrls e:" + th); return false; } } /* access modifiers changed from: private */ public static String c(Context context) { double d2; JSONObject jSONObject = new JSONObject(); try { String a2 = cn.jiguang.am.a.a(context); long longValue = ((Long) b.a(context, cn.jiguang.g.a.c())).longValue(); int a3 = j.a(context); String b2 = j.b(context); jSONObject.put("type", a3); jSONObject.put("appkey", a2); jSONObject.put("sdkver", cn.jiguang.a.a.b); jSONObject.put("platform", 0); long j = 0; if (longValue != 0) { jSONObject.put("uid", longValue); } if (b2 != null) { jSONObject.put("opera", b2); } Object a4 = cn.jiguang.at.d.a(context, "get_loc_info", null); double d3 = 200.0d; if (a4 instanceof Bundle) { try { Bundle bundle = (Bundle) a4; double d4 = bundle.getDouble("lat"); try { d2 = bundle.getDouble("lot"); try { j = bundle.getLong("time"); } catch (Throwable unused) { } } catch (Throwable unused2) { d2 = 200.0d; } d3 = d4; } catch (Throwable unused3) { } if (d3 > -90.0d && d3 < 90.0d && d2 > -180.0d && d2 < 180.0d) { jSONObject.put("lat", d3); jSONObject.put("lng", d2); jSONObject.put("time", j); } return jSONObject.toString(); } d2 = 200.0d; jSONObject.put("lat", d3); jSONObject.put("lng", d2); jSONObject.put("time", j); } catch (Throwable unused4) { } return jSONObject.toString(); } /* access modifiers changed from: private */ public static LinkedHashSet<String> d(Context context) { LinkedHashSet<String> linkedHashSet = new LinkedHashSet<>(); String str = (String) b.a(context, cn.jiguang.g.a.s()); if (TextUtils.isEmpty(str)) { return linkedHashSet; } try { JSONArray jSONArray = new JSONArray(str); for (int i = 0; i < jSONArray.length(); i++) { linkedHashSet.add(jSONArray.optString(i)); } } catch (JSONException unused) { } return linkedHashSet; } }