package com.mbridge.msdk.tracker; import android.content.Context; import android.os.Handler; import android.os.Looper; import android.os.Message; import java.util.HashMap; import org.json.JSONObject; /* loaded from: classes4.dex */ public class t { private static volatile t d; private m b; private w c; private volatile boolean e = false; private int f = 30000; private final HashMap g = new HashMap<>(); Handler a = new Handler(Looper.getMainLooper()) { // from class: com.mbridge.msdk.tracker.t.1 @Override // android.os.Handler public final void handleMessage(Message message) { super.handleMessage(message); if (message.what != 1) { return; } try { t.this.c(); t.this.a.removeMessages(1); t.this.d(); } catch (Exception e) { e.printStackTrace(); } } }; private t() { } public final void a(Context context, w wVar, int i, JSONObject jSONObject) { this.c = wVar; this.f = i; m a = m.a("monitor", context, wVar); this.b = a; if (a != null) { a.a(jSONObject); this.b.a(); } b(); } public static t a() { if (d == null) { synchronized (t.class) { try { if (d == null) { d = new t(); } } finally { } } } return d; } public final synchronized void b() { if (this.e) { return; } this.e = true; d(); } /* JADX INFO: Access modifiers changed from: private */ public void d() { try { this.a.sendEmptyMessageDelayed(1, this.f); } catch (Exception e) { e.printStackTrace(); } } public final void c() { m[] d2 = m.d(); if (d2.length == 0) { return; } try { for (m mVar : d2) { String c = mVar.c(); if (!"monitor".equals(c)) { String b = mVar.b(); long[] h = mVar.h(); long j = h[1]; if (j != 0) { long j2 = h[0]; if (this.g.containsKey(c)) { if ((j2 + "").equals(this.g.get(c))) { } } this.g.put(c, j2 + ""); if (this.b != null) { try { e eVar = new e("event_lib_monitor"); eVar.b(1); JSONObject jSONObject = new JSONObject(); jSONObject.put("key", "m_report_rate"); jSONObject.put("task_name", c); jSONObject.put("task_count", j); jSONObject.put("task_session_id", b); jSONObject.put("task_ts", j2); eVar.a(jSONObject); this.b.a(eVar); } catch (Exception e) { e.printStackTrace(); } } } } } } catch (Exception e2) { e2.printStackTrace(); } } }