- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
231 lines
9.2 KiB
Java
231 lines
9.2 KiB
Java
package com.fyber.inneractive.sdk.flow;
|
|
|
|
import android.os.Handler;
|
|
import android.os.HandlerThread;
|
|
import com.fyber.inneractive.sdk.config.IAConfigManager;
|
|
import com.fyber.inneractive.sdk.config.enums.UnitDisplayType;
|
|
import com.fyber.inneractive.sdk.external.InneractiveAdRequest;
|
|
import com.fyber.inneractive.sdk.external.InneractiveErrorCode;
|
|
import com.fyber.inneractive.sdk.external.InneractiveInfrastructureError;
|
|
import com.fyber.inneractive.sdk.flow.q;
|
|
import com.fyber.inneractive.sdk.interfaces.a;
|
|
import com.fyber.inneractive.sdk.response.e;
|
|
import com.fyber.inneractive.sdk.util.IAlog;
|
|
import java.util.Locale;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public abstract class h<Response extends com.fyber.inneractive.sdk.response.e, Content extends q> implements com.fyber.inneractive.sdk.interfaces.a, a.b {
|
|
public InneractiveAdRequest a;
|
|
public Response b;
|
|
public Content c;
|
|
public a.InterfaceC0074a d;
|
|
public a.b e;
|
|
public com.fyber.inneractive.sdk.config.e0 f;
|
|
public com.fyber.inneractive.sdk.config.global.s g;
|
|
public com.fyber.inneractive.sdk.network.timeouts.content.a j;
|
|
public boolean h = false;
|
|
public int i = 0;
|
|
public final a l = new a();
|
|
public b k = new b(this);
|
|
|
|
public class a implements Runnable {
|
|
public a() {
|
|
}
|
|
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
h hVar = h.this;
|
|
hVar.getClass();
|
|
IAlog.a("%s : IAAdContentLoaderImpl : retry load ad task started execution", IAlog.a(hVar));
|
|
h.this.a();
|
|
}
|
|
}
|
|
|
|
public final void b(InneractiveInfrastructureError inneractiveInfrastructureError) {
|
|
com.fyber.inneractive.sdk.util.p.a(new c(new d(this.b, this.a, d(), this.g.c()), inneractiveInfrastructureError));
|
|
}
|
|
|
|
public InneractiveInfrastructureError c() {
|
|
g gVar = g.WEBVIEW_LOAD_TIMEOUT;
|
|
Response response = this.b;
|
|
if ("video".equalsIgnoreCase((response == null || com.fyber.inneractive.sdk.response.a.a(response.g) != com.fyber.inneractive.sdk.response.a.RETURNED_ADTYPE_VAST) ? "display" : "video")) {
|
|
gVar = g.VIDEO_AD_LOAD_TIMEOUT;
|
|
}
|
|
return new InneractiveInfrastructureError(InneractiveErrorCode.LOAD_TIMEOUT, gVar);
|
|
}
|
|
|
|
@Override // com.fyber.inneractive.sdk.interfaces.a
|
|
public abstract void cancel();
|
|
|
|
public abstract String d();
|
|
|
|
public final com.fyber.inneractive.sdk.config.f0 e() {
|
|
InneractiveAdRequest inneractiveAdRequest = this.a;
|
|
return inneractiveAdRequest == null ? this.f : inneractiveAdRequest.getSelectedUnitConfig();
|
|
}
|
|
|
|
public final void f() {
|
|
String str;
|
|
this.k.a();
|
|
InneractiveAdRequest inneractiveAdRequest = this.a;
|
|
if (inneractiveAdRequest != null) {
|
|
str = inneractiveAdRequest.b;
|
|
} else {
|
|
Response response = this.b;
|
|
if (response == null || (str = response.z) == null) {
|
|
str = null;
|
|
}
|
|
}
|
|
com.fyber.inneractive.sdk.metrics.d.d.a(str).f();
|
|
Content content = this.c;
|
|
if (content != null) {
|
|
content.a(str);
|
|
}
|
|
a.InterfaceC0074a interfaceC0074a = this.d;
|
|
if (interfaceC0074a != null) {
|
|
interfaceC0074a.a(this.a);
|
|
}
|
|
}
|
|
|
|
public abstract void g();
|
|
|
|
public final void h() {
|
|
int i = this.i;
|
|
this.i = i + 1;
|
|
com.fyber.inneractive.sdk.network.timeouts.content.a aVar = this.j;
|
|
if (aVar != null) {
|
|
if (aVar.g) {
|
|
i = aVar.a - i;
|
|
}
|
|
r2 = (i == aVar.a ? aVar.i : 0) + (aVar.b * i) + aVar.d;
|
|
}
|
|
IAlog.a("%s : IAAdContentLoaderImpl : Start timeout: %d, attempt number: %d", IAlog.a(this), Integer.valueOf(r2), Integer.valueOf(this.i - 1));
|
|
b bVar = this.k;
|
|
if (bVar.a == null) {
|
|
HandlerThread handlerThread = new HandlerThread("TimeoutHandlerThread");
|
|
handlerThread.start();
|
|
bVar.a = new Handler(handlerThread.getLooper());
|
|
}
|
|
bVar.a.postDelayed(bVar.d, r2);
|
|
g();
|
|
}
|
|
|
|
public void b() {
|
|
int i;
|
|
InneractiveInfrastructureError inneractiveInfrastructureError;
|
|
Object[] objArr = new Object[3];
|
|
objArr[0] = IAlog.a(this);
|
|
objArr[1] = Integer.valueOf(this.i - 1);
|
|
int i2 = this.i - 1;
|
|
com.fyber.inneractive.sdk.network.timeouts.content.a aVar = this.j;
|
|
if (aVar != null) {
|
|
if (aVar.g) {
|
|
i2 = aVar.a - i2;
|
|
}
|
|
i = (aVar.b * i2) + aVar.d + (i2 == aVar.a ? aVar.i : 0);
|
|
} else {
|
|
i = 0;
|
|
}
|
|
objArr[2] = Integer.valueOf(i);
|
|
IAlog.a("%s : IAAdContentLoaderImpl : onTimeout() attempt: %d timeout: %d", objArr);
|
|
a.b bVar = this.e;
|
|
if (bVar != null) {
|
|
bVar.b();
|
|
}
|
|
com.fyber.inneractive.sdk.network.timeouts.content.a aVar2 = this.j;
|
|
if (this.i <= (aVar2 != null ? aVar2.a : 0)) {
|
|
inneractiveInfrastructureError = c();
|
|
} else {
|
|
inneractiveInfrastructureError = new InneractiveInfrastructureError(InneractiveErrorCode.IN_FLIGHT_TIMEOUT, g.NO_TIME_TO_LOAD_AD_CONTENT);
|
|
}
|
|
b(inneractiveInfrastructureError);
|
|
a(inneractiveInfrastructureError);
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
public final void a(InneractiveAdRequest inneractiveAdRequest, com.fyber.inneractive.sdk.response.e eVar, com.fyber.inneractive.sdk.config.global.s sVar, a.InterfaceC0074a interfaceC0074a, k kVar) {
|
|
String lowerCase;
|
|
this.a = inneractiveAdRequest;
|
|
this.b = eVar;
|
|
this.d = interfaceC0074a;
|
|
this.e = kVar;
|
|
this.k = new b(this);
|
|
this.g = sVar;
|
|
UnitDisplayType unitDisplayType = eVar.n;
|
|
if (unitDisplayType != UnitDisplayType.INTERSTITIAL && unitDisplayType != UnitDisplayType.REWARDED) {
|
|
lowerCase = UnitDisplayType.BANNER.name().toLowerCase(Locale.US);
|
|
} else {
|
|
lowerCase = unitDisplayType.name().toLowerCase(Locale.US);
|
|
}
|
|
this.j = new com.fyber.inneractive.sdk.network.timeouts.content.a(lowerCase, com.fyber.inneractive.sdk.response.a.a(eVar.g) == com.fyber.inneractive.sdk.response.a.RETURNED_ADTYPE_VAST ? "video" : "display", (int) eVar.I, eVar.B, IAConfigManager.L.l, this.g);
|
|
if (this.a == null) {
|
|
this.f = com.fyber.inneractive.sdk.config.a.a(eVar.m);
|
|
}
|
|
try {
|
|
h();
|
|
} catch (Throwable th) {
|
|
IAlog.f("Failed to start ContentLoader", IAlog.a(this));
|
|
com.fyber.inneractive.sdk.network.t.a(th, inneractiveAdRequest, eVar);
|
|
this.k.a();
|
|
a(new InneractiveInfrastructureError(InneractiveErrorCode.SDK_INTERNAL_ERROR, g.CONTENT_LOADER_START_FAILED));
|
|
}
|
|
}
|
|
|
|
@Override // com.fyber.inneractive.sdk.interfaces.a.b
|
|
public final void a() {
|
|
Object[] objArr = new Object[3];
|
|
objArr[0] = IAlog.a(this);
|
|
objArr[1] = Integer.valueOf(this.i - 1);
|
|
int i = this.i - 1;
|
|
com.fyber.inneractive.sdk.network.timeouts.content.a aVar = this.j;
|
|
if (aVar != null) {
|
|
if (aVar.g) {
|
|
i = aVar.a - i;
|
|
}
|
|
r2 = (i == aVar.a ? aVar.i : 0) + (aVar.b * i) + aVar.d;
|
|
}
|
|
objArr[2] = Integer.valueOf(r2);
|
|
IAlog.a("%s : IAAdContentLoaderImpl : onRetry() attempt: %d timeout: %d", objArr);
|
|
a.b bVar = this.e;
|
|
if (bVar != null) {
|
|
bVar.a();
|
|
}
|
|
h();
|
|
}
|
|
|
|
public final void a(InneractiveInfrastructureError inneractiveInfrastructureError) {
|
|
IAlog.a("%s : IAAdContentLoaderImpl : Handle Retry for error: %s", IAlog.a(this), inneractiveInfrastructureError.getErrorCode().toString());
|
|
b bVar = this.k;
|
|
bVar.getClass();
|
|
IAlog.a("%s : ContentLoadTimeoutHandler stopping timeout handler", IAlog.a(bVar));
|
|
Handler handler = bVar.a;
|
|
if (handler != null) {
|
|
handler.removeCallbacks(bVar.d);
|
|
}
|
|
com.fyber.inneractive.sdk.network.timeouts.content.a aVar = this.j;
|
|
boolean z = this.i <= (aVar != null ? aVar.a : 0);
|
|
IAlog.a("%s : IAAdContentLoaderImpl : should retry: %s", IAlog.a(this), Boolean.valueOf(z));
|
|
if (z) {
|
|
Content content = this.c;
|
|
if (content != null) {
|
|
content.a();
|
|
this.c = null;
|
|
}
|
|
com.fyber.inneractive.sdk.network.timeouts.content.a aVar2 = this.j;
|
|
int i = aVar2 != null ? aVar2.e : 0;
|
|
IAlog.a("%s : IAAdContentLoaderImpl : retryLoad : post load ad content retry task with delay: %d", IAlog.a(this), Integer.valueOf(i));
|
|
com.fyber.inneractive.sdk.util.p.b.postDelayed(this.l, i);
|
|
return;
|
|
}
|
|
a.InterfaceC0074a interfaceC0074a = this.d;
|
|
if (interfaceC0074a != null) {
|
|
interfaceC0074a.a(inneractiveInfrastructureError);
|
|
}
|
|
cancel();
|
|
InneractiveAdRequest inneractiveAdRequest = this.a;
|
|
Response response = this.b;
|
|
com.fyber.inneractive.sdk.config.global.s sVar = this.g;
|
|
com.fyber.inneractive.sdk.flow.a.a(inneractiveAdRequest, inneractiveInfrastructureError, this.c, response, sVar != null ? sVar.c() : null);
|
|
}
|
|
}
|