package c.t.m.sapp.c; import android.content.Context; import com.tencent.tinker.loader.shareutil.ShareConstants; import java.io.File; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import org.json.JSONArray; import org.json.JSONObject; public class i implements Runnable { /* renamed from: a reason: collision with root package name */ public Context f45678a; /* renamed from: b reason: collision with root package name */ public List<a> f45679b = null; /* renamed from: c reason: collision with root package name */ public boolean f45680c = false; /* renamed from: d reason: collision with root package name */ public List<a> f45681d = null; /* renamed from: e reason: collision with root package name */ public c f45682e = null; /* renamed from: f reason: collision with root package name */ public boolean f45683f; public i(Context context, List<a> list, boolean z15) { this.f45678a = context; this.f45683f = z15; ArrayList arrayList = new ArrayList(); this.f45679b = arrayList; arrayList.addAll(list); this.f45682e = new c(this.f45678a); } public final boolean a(String str) { String c15 = r.c(m.a(str, "sE0zy%DVqLnXA$hmNZ8NBwcg7FDrvi!q")); if (c15 == null) { return false; } this.f45681d = r.d(c15); List<a> d15 = r.d(r.c(this.f45678a, "__bad_dex_info___sapp", "preference_default_sapp")); boolean a15 = !d15.isEmpty() ? l.a(d15, this.f45681d) : false; boolean a16 = a(this.f45679b, this.f45681d); List<a> d16 = r.d(r.c(this.f45678a, "__SP_UPDATE_TencentLoc_COMP_INFO__sapp_", "preference_default_sapp")); boolean a17 = !d16.isEmpty() ? l.a(d16, this.f45681d) : false; e a18 = e.a(this.f45678a); a18.a("DRG", "need and samebad:" + a16 + "," + a15); if (a16 || a15 || a17) { return false; } e a19 = e.a(this.f45678a); a19.a("DRG", "to download:" + c15); this.f45682e.b(this.f45681d); return true; } public final boolean b() { if (System.currentTimeMillis() - r.a(this.f45678a, "__last_check_update_time___sapp", (Long) 0L).longValue() > 3600000) { return true; } return false; } public final boolean c() { byte[] bytes; String a15 = a(); if (a15 != null && (bytes = a15.getBytes()) != null) { new HashMap(); int i15 = 0; while (true) { int i16 = i15 + 1; if (i15 >= 3) { break; } byte[] a16 = p.a("https://lhp.map.qq.com?desc_c", bytes); if (a16 != null) { String str = new String(a16); e.a(this.f45678a).a("DRG", "response suc,try:" + i16); return a(str); } r.a(10000L); i15 = i16; } } return false; } public void run() { boolean b15 = b(); e a15 = e.a(this.f45678a); a15.a("DRG", "t:" + b15 + ",i:" + this.f45683f); c(); r.b(this.f45678a, "__last_check_update_time___sapp", Long.valueOf(System.currentTimeMillis())); e.a(this.f45678a).d(); } public final boolean a(List<a> list, List<a> list2) { boolean z15; boolean z16 = true; for (a aVar : list) { Iterator<a> it = list2.iterator(); while (true) { if (!it.hasNext()) { z15 = false; break; } a next = it.next(); if (!next.f45641c.contains(ShareConstants.DEX_SUFFIX)) { next.f45641c += ShareConstants.DEX_SUFFIX; } if (aVar.f45641c.equals(next.f45641c) && aVar.f45642d == next.f45642d && aVar.f45643e.equals(next.f45643e)) { z15 = true; break; } } if (!z15) { z16 = false; } } return z16; } public final String a() { JSONObject jSONObject = new JSONObject(); String str = this.f45678a.getFilesDir().getAbsolutePath() + File.separator + r.f45700b; try { jSONObject.put("appkey", r.k(this.f45678a)); jSONObject.put("appversion", r.b(this.f45678a)); jSONObject.put("imei", r.g(this.f45678a)); jSONObject.put("coverSDKver", h.f45674a); jSONObject.put("model", r.e() + "_" + r.f()); jSONObject.put("APILevel", r.b()); JSONArray jSONArray = new JSONArray(); List<a> list = this.f45679b; if (list != null) { for (a aVar : list) { if (aVar != null) { JSONObject jSONObject2 = new JSONObject(); jSONObject2.put("compId", aVar.f45639a); jSONObject2.put("compVer", aVar.f45640b); jSONObject2.put("size", aVar.f45642d); jSONObject2.put("md5", r.a(new File(str, aVar.f45641c))); jSONArray.put(jSONObject2); } } } jSONObject.put("compList", jSONArray); String jSONObject3 = jSONObject.toString(); e.a(this.f45678a).a("DRG", "req:" + jSONObject3); return m.b(jSONObject3, "sE0zy%DVqLnXA$hmNZ8NBwcg7FDrvi!q"); } catch (Exception e15) { e.a(this.f45678a).a("DRG", "reqDerror:" + e15.toString()); return null; } } }