package com.fyber.inneractive.sdk.metrics; import android.text.TextUtils; import com.fyber.inneractive.sdk.config.global.s; import com.fyber.inneractive.sdk.external.InneractiveAdRequest; import com.fyber.inneractive.sdk.network.r; import com.fyber.inneractive.sdk.network.s; import com.fyber.inneractive.sdk.util.IAlog; import java.util.LinkedHashMap; import java.util.UUID; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; /* loaded from: classes2.dex */ public final class i implements h { public final LinkedHashMap a = new LinkedHashMap(); public final LinkedHashMap b = new LinkedHashMap(); public long c; public long d; public static class a { public final String a; public final String b; public /* synthetic */ a() { throw null; } public a(String str) { this.a = UUID.randomUUID().toString(); this.b = str; } public final boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || a.class != obj.getClass()) { return false; } return this.a.equals(((a) obj).a); } public final int hashCode() { return this.a.hashCode(); } } @Override // com.fyber.inneractive.sdk.metrics.h public final void a() { this.d = System.currentTimeMillis(); } @Override // com.fyber.inneractive.sdk.metrics.h public final void b() { this.c = System.currentTimeMillis(); } @Override // com.fyber.inneractive.sdk.metrics.h public final void a(String str) { this.b.put(new a(str), Long.valueOf(System.currentTimeMillis() - this.d)); } @Override // com.fyber.inneractive.sdk.metrics.h public final void b(String str) { this.a.put(new a(str), Long.valueOf(System.currentTimeMillis() - this.c)); } @Override // com.fyber.inneractive.sdk.metrics.h public final void a(s sVar, InneractiveAdRequest inneractiveAdRequest, com.fyber.inneractive.sdk.response.e eVar) { JSONObject jSONObject = new JSONObject(); LinkedHashMap linkedHashMap = this.b; JSONArray jSONArray = new JSONArray(); for (a aVar : linkedHashMap.keySet()) { JSONObject jSONObject2 = new JSONObject(); try { jSONObject2.putOpt("outcome", aVar.b); jSONObject2.putOpt("time", linkedHashMap.get(aVar)); jSONObject2.putOpt("idx", Integer.valueOf(jSONArray.length())); } catch (JSONException unused) { } jSONArray.put(jSONObject2); } try { jSONObject.put("adl", jSONArray); } catch (Exception unused2) { IAlog.f("Got exception adding param to json object: %s, %s", "adl", jSONArray); } LinkedHashMap linkedHashMap2 = this.a; JSONArray jSONArray2 = new JSONArray(); for (a aVar2 : linkedHashMap2.keySet()) { JSONObject jSONObject3 = new JSONObject(); try { jSONObject3.putOpt("outcome", aVar2.b); jSONObject3.putOpt("time", linkedHashMap2.get(aVar2)); jSONObject3.putOpt("idx", Integer.valueOf(jSONArray2.length())); } catch (JSONException unused3) { } jSONArray2.put(jSONObject3); } try { jSONObject.put("adml", jSONArray2); } catch (Exception unused4) { IAlog.f("Got exception adding param to json object: %s, %s", "adml", jSONArray2); } if (!TextUtils.isEmpty(null)) { try { jSONObject.put("dns_failed", (Object) null); } catch (Exception unused5) { IAlog.f("Got exception adding param to json object: %s, %s", "dns_failed", null); } } s.a aVar3 = new s.a(r.SDK_BIDDING_METRICS, inneractiveAdRequest, eVar, sVar.c()); aVar3.f.put(jSONObject); aVar3.a((String) null); } }