package com.fyber.inneractive.sdk.network; import android.text.TextUtils; import com.fyber.inneractive.sdk.bidder.adm.AdmParametersOuterClass$AdmParameters; import com.fyber.inneractive.sdk.config.IAConfigManager; import com.fyber.inneractive.sdk.config.enums.UnitDisplayType; import com.fyber.inneractive.sdk.util.IAlog; import java.io.InputStream; import java.net.SocketTimeoutException; import java.net.UnknownHostException; import java.util.List; import java.util.Locale; import java.util.Map; /* loaded from: classes2.dex */ public final class o0 extends f0 { public final String p; public final com.fyber.inneractive.sdk.bidder.adm.f q; public int r; public final com.fyber.inneractive.sdk.response.e s; public final com.fyber.inneractive.sdk.config.global.s t; public final com.fyber.inneractive.sdk.network.timeouts.request.a u; public o0(com.fyber.inneractive.sdk.bidder.adm.c cVar, String str, com.fyber.inneractive.sdk.bidder.adm.f fVar, com.fyber.inneractive.sdk.config.global.s sVar, com.fyber.inneractive.sdk.response.e eVar) { super(cVar, x.a().b(), sVar); this.r = 0; this.o = true; this.p = str; this.q = fVar; this.s = eVar; this.t = sVar; this.u = a(eVar, fVar, sVar); } /* JADX WARN: Type inference failed for: r0v8, types: [T, com.fyber.inneractive.sdk.response.e] */ @Override // com.fyber.inneractive.sdk.network.c0 public final b0 a(j jVar, Map> map, int i) throws Exception { b0 b0Var = new b0(); try { InputStream inputStream = jVar.c; if (inputStream != null) { d(System.currentTimeMillis()); StringBuffer a = com.fyber.inneractive.sdk.util.t.a(inputStream); c(System.currentTimeMillis()); String stringBuffer = a.toString(); AdmParametersOuterClass$AdmParameters admParametersOuterClass$AdmParameters = this.q.a; int a2 = admParametersOuterClass$AdmParameters != null ? admParametersOuterClass$AdmParameters.getAdType().a() : AdmParametersOuterClass$AdmParameters.a.OTHER.a(); com.fyber.inneractive.sdk.bidder.adm.f fVar = this.q; fVar.c = stringBuffer; ?? a3 = a(a2, null, fVar, null); a3.h = stringBuffer; b0Var.a = a3; } return b0Var; } catch (b e) { e = e; IAlog.a("failed parse adm network request but will re-try", e, new Object[0]); c(System.currentTimeMillis()); throw new a1(e); } catch (SocketTimeoutException e2) { e = e2; IAlog.a("failed parse adm network request but will re-try", e, new Object[0]); c(System.currentTimeMillis()); throw new a1(e); } catch (UnknownHostException e3) { e = e3; IAlog.a("failed parse adm network request but will re-try", e, new Object[0]); c(System.currentTimeMillis()); throw new a1(e); } catch (Exception e4) { c(System.currentTimeMillis()); IAlog.a("failed parse adm network request", e4, new Object[0]); throw new a0(e4); } } @Override // com.fyber.inneractive.sdk.network.f0, com.fyber.inneractive.sdk.network.c0 public final void b(long j) { super.b(j); IAlog.a("%s : NetworkRequestMarkup : set start connection timestamp", IAlog.a(this)); } @Override // com.fyber.inneractive.sdk.network.f0, com.fyber.inneractive.sdk.network.c0 public final void c() { super.c(); IAlog.a("%s : NetworkRequestMarkup cancel by timeout at retry: %d", IAlog.a(this), Integer.valueOf(this.r)); y yVar = IAConfigManager.L.r; this.a = true; o0 o0Var = new o0(this); if ((yVar instanceof y) && yVar.b(o0Var)) { return; } IAlog.a("%s : NetworkRequestMarkup won't retry - resolve request with `Bidding ad request passed allowed time` at retry: %d", IAlog.a(this), Integer.valueOf(this.r)); a((o0) null, new Exception("Bidding ad request passed allowed time"), false); } @Override // com.fyber.inneractive.sdk.network.c0 public final p0 d() { return p0.HIGH; } @Override // com.fyber.inneractive.sdk.network.f0, com.fyber.inneractive.sdk.network.c0 public final u0 f() { com.fyber.inneractive.sdk.network.timeouts.request.a aVar = this.u; return new u0(aVar.i, aVar.h); } @Override // com.fyber.inneractive.sdk.network.c0 public final z getMethod() { return z.GET; } @Override // com.fyber.inneractive.sdk.network.c0 public final String getUrl() { return this.p; } @Override // com.fyber.inneractive.sdk.network.f0, com.fyber.inneractive.sdk.network.c0 public final com.fyber.inneractive.sdk.config.global.s p() { return this.t; } @Override // com.fyber.inneractive.sdk.network.c0 public final int s() { return this.u.c(); } @Override // com.fyber.inneractive.sdk.network.f0 public final int t() { int u = super.u(); com.fyber.inneractive.sdk.network.timeouts.request.a aVar = this.u; return ((aVar.c() + aVar.f) * this.r) + u; } @Override // com.fyber.inneractive.sdk.network.f0 public final int u() { throw null; } public final void d(long j) { synchronized (this.n) { try { if (!this.m) { this.m = true; this.i = j; } } catch (Throwable th) { throw th; } } IAlog.a("%s : NetworkRequestMarkup : set start read timestamp", IAlog.a(this)); } @Override // com.fyber.inneractive.sdk.network.f0, com.fyber.inneractive.sdk.network.c0 public final int m() { return this.u.f; } @Override // com.fyber.inneractive.sdk.network.c0 public final boolean g() { if (this.a) { return false; } int i = this.r + 1; this.r = i; if (i > this.u.b()) { IAlog.a("%s : NetworkRequestMarkup Should enable retry - FALSE, current retry: %d total retries: %d, request id: %s", IAlog.a(this), Integer.valueOf(this.r - 1), Integer.valueOf(this.u.b()), this.g); return false; } IAlog.a("%s : NetworkRequestMarkup Should enable retry - TRUE, current retry: %d total retries: %d, request id: %s", IAlog.a(this), Integer.valueOf(this.r - 1), Integer.valueOf(this.u.b()), this.g); this.u.a(this.r); return true; } @Override // com.fyber.inneractive.sdk.network.f0 public final void c(long j) { super.c(j); IAlog.a("%s : NetworkRequestMarkup : set end read timestamp, total execution time: %d", IAlog.a(this), Integer.valueOf(super.u())); } public o0(o0 o0Var) { super(o0Var); this.r = 0; this.o = true; this.p = o0Var.p; this.q = o0Var.q; this.s = o0Var.s; this.t = o0Var.t; this.u = o0Var.u; this.r = o0Var.r; } public static com.fyber.inneractive.sdk.network.timeouts.request.a a(com.fyber.inneractive.sdk.response.e eVar, com.fyber.inneractive.sdk.bidder.adm.f fVar, com.fyber.inneractive.sdk.config.global.s sVar) { UnitDisplayType unitDisplayType; UnitDisplayType unitDisplayType2 = UnitDisplayType.BANNER; String name = unitDisplayType2.name(); Locale locale = Locale.US; String lowerCase = name.toLowerCase(locale); if (eVar != null && (unitDisplayType = eVar.n) != null) { if (unitDisplayType != UnitDisplayType.INTERSTITIAL && unitDisplayType != UnitDisplayType.REWARDED) { lowerCase = unitDisplayType2.name().toLowerCase(locale); } else { lowerCase = unitDisplayType.name().toLowerCase(locale); } } else { AdmParametersOuterClass$AdmParameters admParametersOuterClass$AdmParameters = fVar.a; if (admParametersOuterClass$AdmParameters != null) { lowerCase = com.fyber.inneractive.sdk.util.x0.a(String.valueOf(admParametersOuterClass$AdmParameters.getSpotId())); } } String str = IAConfigManager.L.l; com.fyber.inneractive.sdk.config.global.features.j jVar = (com.fyber.inneractive.sdk.config.global.features.j) sVar.a(com.fyber.inneractive.sdk.config.global.features.j.class); if (TextUtils.isEmpty(str)) { return new com.fyber.inneractive.sdk.network.timeouts.request.b(jVar, lowerCase); } return new com.fyber.inneractive.sdk.network.timeouts.request.d(lowerCase, jVar, str); } @Override // com.fyber.inneractive.sdk.network.f0, com.fyber.inneractive.sdk.network.c0 public final j a(String str) throws Exception { IAlog.a("%s : NetworkRequestMarkup Ad request execution started, retry number: %d, timeouts(connection: %d read: %d)", IAlog.a(this), Integer.valueOf(this.r), Integer.valueOf(f().a), Integer.valueOf(f().b)); return super.a(str); } @Override // com.fyber.inneractive.sdk.network.f0, com.fyber.inneractive.sdk.network.c0 public final void a(long j) { super.a(j); IAlog.a("%s : NetworkRequestMarkup : set end connection timestamp, total execution time: %d", IAlog.a(this), Integer.valueOf(super.u())); } }