- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
186 lines
6.9 KiB
Java
186 lines
6.9 KiB
Java
package com.applovin.impl;
|
|
|
|
import com.applovin.impl.sdk.AppLovinError;
|
|
import com.applovin.impl.sdk.network.a;
|
|
import com.applovin.impl.sdk.utils.CollectionUtils;
|
|
import com.applovin.impl.sdk.utils.JsonUtils;
|
|
import com.applovin.impl.sdk.utils.StringUtils;
|
|
import com.applovin.impl.vi;
|
|
import com.applovin.mediation.adapter.MaxAdapterError;
|
|
import com.applovin.sdk.AppLovinWebViewActivity;
|
|
import java.util.HashMap;
|
|
import java.util.Map;
|
|
import java.util.UUID;
|
|
import java.util.concurrent.TimeUnit;
|
|
import org.json.JSONObject;
|
|
|
|
/* loaded from: classes.dex */
|
|
public abstract class hm extends yl {
|
|
protected final h0 h;
|
|
private final String i;
|
|
|
|
public abstract yl a(JSONObject jSONObject);
|
|
|
|
public abstract String e();
|
|
|
|
public abstract String f();
|
|
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
vi.a a2;
|
|
Map map;
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
this.c.a(this.b, "Fetching next ad of zone: " + this.h);
|
|
}
|
|
if (((Boolean) this.a.a(sj.h4)).booleanValue() && yp.j() && com.applovin.impl.sdk.n.a()) {
|
|
this.c.a(this.b, "User is connected to a VPN");
|
|
}
|
|
yp.a(this.a, this.b);
|
|
JSONObject jSONObject = null;
|
|
this.a.E().a(la.f, this.h, (AppLovinError) null);
|
|
da D = this.a.D();
|
|
D.c(ca.d);
|
|
ca caVar = ca.g;
|
|
if (D.b(caVar) == 0) {
|
|
D.b(caVar, System.currentTimeMillis());
|
|
}
|
|
try {
|
|
JSONObject andResetCustomPostBody = this.a.i().getAndResetCustomPostBody();
|
|
String str = "POST";
|
|
if (((Boolean) this.a.a(sj.z3)).booleanValue()) {
|
|
vi.a a3 = vi.a.a(((Integer) this.a.a(sj.w5)).intValue());
|
|
JSONObject jSONObject2 = new JSONObject(this.a.y().a(h(), false, true));
|
|
map = new HashMap();
|
|
if (!((Boolean) this.a.a(sj.F5)).booleanValue() && !((Boolean) this.a.a(sj.B5)).booleanValue()) {
|
|
map.put("rid", UUID.randomUUID().toString());
|
|
}
|
|
if (!((Boolean) this.a.a(sj.o5)).booleanValue()) {
|
|
map.put(AppLovinWebViewActivity.INTENT_EXTRA_KEY_SDK_KEY, this.a.b0());
|
|
}
|
|
JsonUtils.putAll(jSONObject2, andResetCustomPostBody);
|
|
a2 = a3;
|
|
jSONObject = jSONObject2;
|
|
} else {
|
|
a2 = vi.a.a(((Integer) this.a.a(sj.x5)).intValue());
|
|
Map a4 = yp.a(this.a.y().a(h(), false, false));
|
|
if (andResetCustomPostBody != null) {
|
|
jSONObject = andResetCustomPostBody;
|
|
} else {
|
|
str = "GET";
|
|
}
|
|
map = a4;
|
|
}
|
|
if (yp.f(a())) {
|
|
map.putAll(this.a.i().getAndResetCustomQueryParams());
|
|
}
|
|
if (StringUtils.isValidString(this.i)) {
|
|
map.put("sts", this.i);
|
|
}
|
|
a(D);
|
|
a.C0040a f = com.applovin.impl.sdk.network.a.a(this.a).b(f()).a(e()).b(map).c(str).a(g()).a((Object) new JSONObject()).a(((Integer) this.a.a(sj.o3)).intValue()).c(((Boolean) this.a.a(sj.p3)).booleanValue()).d(((Boolean) this.a.a(sj.q3)).booleanValue()).c(((Integer) this.a.a(sj.n3)).intValue()).a(a2).f(true);
|
|
if (jSONObject != null) {
|
|
f.a(jSONObject);
|
|
f.b(((Boolean) this.a.a(sj.P5)).booleanValue());
|
|
}
|
|
a aVar = new a(f.a(), this.a);
|
|
aVar.c(sj.L0);
|
|
aVar.b(sj.M0);
|
|
this.a.j0().a(aVar);
|
|
} catch (Throwable th) {
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
this.c.a(this.b, "Unable to fetch ad for zone id: " + this.h, th);
|
|
}
|
|
a(0, th.getMessage());
|
|
}
|
|
}
|
|
|
|
public hm(h0 h0Var, String str, com.applovin.impl.sdk.j jVar) {
|
|
super(str, jVar);
|
|
this.h = h0Var;
|
|
this.i = jVar.b();
|
|
}
|
|
|
|
public class a extends dn {
|
|
public a(com.applovin.impl.sdk.network.a aVar, com.applovin.impl.sdk.j jVar) {
|
|
super(aVar, jVar);
|
|
}
|
|
|
|
@Override // com.applovin.impl.dn, com.applovin.impl.d4.e
|
|
public void a(String str, int i, String str2, JSONObject jSONObject) {
|
|
hm.this.a(i, str2);
|
|
this.a.E().a("fetchAd", str, i, CollectionUtils.hashMap("error_message", str2));
|
|
}
|
|
|
|
@Override // com.applovin.impl.dn, com.applovin.impl.d4.e
|
|
public void a(String str, JSONObject jSONObject, int i) {
|
|
if (i == 200) {
|
|
JsonUtils.putLong(jSONObject, "ad_fetch_latency_millis", this.m.a());
|
|
JsonUtils.putLong(jSONObject, "ad_fetch_response_size", this.m.b());
|
|
HashMap hashMap = new HashMap(5);
|
|
CollectionUtils.putStringIfValid("url", StringUtils.getHost(str), hashMap);
|
|
CollectionUtils.putStringIfValid("code", String.valueOf(i), hashMap);
|
|
CollectionUtils.putStringIfValid("ad_zone_id", hm.this.h.e(), hashMap);
|
|
CollectionUtils.putStringIfValid("latency_ms", String.valueOf(this.m.a()), hashMap);
|
|
CollectionUtils.putStringIfValid("response_size", String.valueOf(this.m.b()), hashMap);
|
|
this.a.E().a(la.g, (Map) hashMap);
|
|
hm.this.b(jSONObject);
|
|
return;
|
|
}
|
|
hm.this.a(i, MaxAdapterError.NO_FILL.getErrorMessage());
|
|
}
|
|
}
|
|
|
|
private Map g() {
|
|
HashMap hashMap = new HashMap(3);
|
|
hashMap.put("AppLovin-Zone-Id", this.h.e());
|
|
if (this.h.f() != null) {
|
|
hashMap.put("AppLovin-Ad-Size", this.h.f().getLabel());
|
|
}
|
|
if (this.h.g() != null) {
|
|
hashMap.put("AppLovin-Ad-Type", this.h.g().getLabel());
|
|
}
|
|
return hashMap;
|
|
}
|
|
|
|
public Map h() {
|
|
HashMap hashMap = new HashMap(4);
|
|
hashMap.put("zone_id", this.h.e());
|
|
if (this.h.f() != null) {
|
|
hashMap.put("size", this.h.f().getLabel());
|
|
}
|
|
if (this.h.g() != null) {
|
|
hashMap.put("require", this.h.g().getLabel());
|
|
}
|
|
return hashMap;
|
|
}
|
|
|
|
public void b(JSONObject jSONObject) {
|
|
e4.c(jSONObject, this.a);
|
|
e4.b(jSONObject, this.a);
|
|
e4.a(jSONObject, this.a);
|
|
h0.a(jSONObject);
|
|
this.a.j0().a(a(jSONObject));
|
|
}
|
|
|
|
private void a(da daVar) {
|
|
ca caVar = ca.g;
|
|
long b = daVar.b(caVar);
|
|
long currentTimeMillis = System.currentTimeMillis();
|
|
if (currentTimeMillis - b > TimeUnit.MINUTES.toMillis(((Integer) this.a.a(sj.K3)).intValue())) {
|
|
daVar.b(caVar, currentTimeMillis);
|
|
daVar.a(ca.h);
|
|
daVar.a(ca.i);
|
|
}
|
|
}
|
|
|
|
public void a(int i, String str) {
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
this.c.b(this.b, "Unable to fetch " + this.h + " ad: server returned " + i);
|
|
}
|
|
if (i == -800) {
|
|
this.a.D().c(ca.m);
|
|
}
|
|
this.a.E().a(la.h, this.h, new AppLovinError(i, str));
|
|
}
|
|
}
|