package com.huawei.hms.hatool; import android.content.Context; import android.util.Pair; import java.util.List; import java.util.Map; /* loaded from: classes2.dex */ public class v0 implements g { private Context a = q0.i(); private String b; private String c; private String d; @Override // java.lang.Runnable public void run() { Map> a; v.c("hmsSdk", "eventReportTask is running"); boolean a2 = c0.a(this.a); if (a2) { v.c("hmsSdk", "workKey is refresh,begin report all data"); this.c = "alltype"; } try { try { a = c1.a(this.a, this.b, this.c); } catch (IllegalArgumentException e) { StringBuilder sb = new StringBuilder(); sb.append("readEventRecords handData IllegalArgumentException:"); sb.append(e.getMessage()); v.e("hmsSdk", sb.toString()); if ("alltype".equals(this.c)) { d.a(this.a, "stat_v2_1", new String[0]); d.a(this.a, "cached_v2_1", new String[0]); } else { String a3 = n1.a(this.b, this.c); d.a(this.a, "stat_v2_1", a3); d.a(this.a, "cached_v2_1", a3); } } catch (Exception e2) { StringBuilder sb2 = new StringBuilder(); sb2.append("readEventRecords handData Exception:"); sb2.append(e2.getMessage()); v.e("hmsSdk", sb2.toString()); if ("alltype".equals(this.c)) { d.a(this.a, "stat_v2_1", new String[0]); d.a(this.a, "cached_v2_1", new String[0]); } else { String a4 = n1.a(this.b, this.c); d.a(this.a, "stat_v2_1", a4); d.a(this.a, "cached_v2_1", a4); } } if (a.size() == 0) { v.b("hmsSdk", "no have events to report: tag:%s : type:%s", this.b, this.c); if ("alltype".equals(this.c)) { d.a(this.a, "stat_v2_1", new String[0]); d.a(this.a, "cached_v2_1", new String[0]); return; } else { String a5 = n1.a(this.b, this.c); d.a(this.a, "stat_v2_1", a5); d.a(this.a, "cached_v2_1", a5); return; } } for (Map.Entry> entry : a.entrySet()) { a(entry.getKey(), entry.getValue()); } if ("alltype".equals(this.c)) { d.a(this.a, "stat_v2_1", new String[0]); d.a(this.a, "cached_v2_1", new String[0]); } else { String a6 = n1.a(this.b, this.c); d.a(this.a, "stat_v2_1", a6); d.a(this.a, "cached_v2_1", a6); } if (a2) { v.c("hmsSdk", "refresh local key"); o0.d().b(); } } catch (Throwable th) { if ("alltype".equals(this.c)) { d.a(this.a, "stat_v2_1", new String[0]); d.a(this.a, "cached_v2_1", new String[0]); } else { String a7 = n1.a(this.b, this.c); d.a(this.a, "stat_v2_1", a7); d.a(this.a, "cached_v2_1", a7); } throw th; } } private void a(String str, List list) { Pair a = n1.a(str); new u(list, (String) a.first, (String) a.second, this.d).a(); } public v0(String str, String str2, String str3) { this.b = str; this.c = str2; this.d = str3; } }