Files
rr3-apk/decompiled-community/sources/com/ironsource/mediationsdk/d.java
Daniel Elliott c080f0d97f Add Discord community version (64-bit only)
- Added realracing3-community.apk (71.57 MB)
- Removed 32-bit support (armeabi-v7a)
- Only includes arm64-v8a libraries
- Decompiled source code included
- Added README-community.md with analysis
2026-02-18 15:48:36 -08:00

421 lines
15 KiB
Java

package com.ironsource.mediationsdk;
import android.os.Build;
import android.security.NetworkSecurityPolicy;
import android.text.TextUtils;
import com.google.firebase.perf.network.FirebasePerfUrlConnection;
import com.ironsource.ad;
import com.ironsource.ce;
import com.ironsource.el;
import com.ironsource.environment.ContextProvider;
import com.ironsource.environment.thread.IronSourceThreadManager;
import com.ironsource.f5;
import com.ironsource.hj;
import com.ironsource.i9;
import com.ironsource.kb;
import com.ironsource.mediationsdk.IronSource;
import com.ironsource.mediationsdk.demandOnly.p;
import com.ironsource.mediationsdk.logger.IronLog;
import com.ironsource.mediationsdk.utils.IronSourceConstants;
import com.ironsource.mediationsdk.utils.IronSourceUtils;
import com.ironsource.o4;
import com.ironsource.q2;
import com.ironsource.rp;
import com.ironsource.u4;
import com.ironsource.y4;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
/* loaded from: classes4.dex */
public class d {
private static d A = new d();
public static final String c = "auctionId";
public static final String d = "armData";
public static final String e = "isAdUnitCapped";
public static final String f = "settings";
public static final String g = "waterfall";
public static final String h = "genericParams";
public static final String i = "configurations";
public static final String j = "instances";
public static final String k = "${AUCTION_LOSS}";
public static final String l = "${AUCTION_MBR}";
public static final String m = "${AUCTION_PRICE}";
public static final String n = "${DYNAMIC_DEMAND_SOURCE}";
public static final String o = "${INSTANCE}";
public static final String p = "${INSTANCE_TYPE}";
public static final String q = "${PLACEMENT_NAME}";
private static final String r = "adMarkup";
private static final String s = "dynamicDemandSource";
private static final String t = "params";
public static final String u = "dlpl";
public static final String v = "adUnit";
public static final String w = "parallelLoad";
public static final String x = "bidderExclusive";
public static final String y = "showPriorityEnabled";
public static final boolean z = false;
private final AtomicBoolean a = new AtomicBoolean(false);
private final ce b = el.N().f();
public static class a {
private String a;
private List<f5> b;
private f5 c;
private JSONObject d;
private JSONObject e;
private int f;
private String g;
private o4 h;
public a(String str) {
this.a = str;
}
public com.ironsource.mediationsdk.demandOnly.p a(String str) {
o4 o4Var = this.h;
return o4Var != null ? o4Var.a(str) : new p.b();
}
public String a() {
return this.a;
}
public JSONObject b() {
return this.e;
}
public int c() {
return this.f;
}
public String d() {
return this.g;
}
public f5 e() {
return this.c;
}
public JSONObject f() {
return this.d;
}
public o4 g() {
return this.h;
}
public List<f5> h() {
return this.b;
}
}
public static class b implements Runnable {
private static final int d = 15000;
private String a;
private String b;
private String c;
public b(String str, String str2, String str3) {
this.a = str;
this.b = str2;
this.c = str3;
}
@Override // java.lang.Runnable
public void run() {
String str = this.a + ";" + this.b + ";" + this.c;
try {
HttpURLConnection httpURLConnection = (HttpURLConnection) ((URLConnection) FirebasePerfUrlConnection.instrument(new URL(this.c).openConnection()));
httpURLConnection.setRequestMethod("GET");
httpURLConnection.setReadTimeout(15000);
httpURLConnection.setConnectTimeout(15000);
httpURLConnection.connect();
int responseCode = httpURLConnection.getResponseCode();
String responseMessage = httpURLConnection.getResponseMessage();
httpURLConnection.disconnect();
if (responseCode != 200 && responseCode != 204) {
JSONObject jSONObject = new JSONObject();
jSONObject.put(IronSourceConstants.EVENTS_PROVIDER, "Mediation");
jSONObject.put(IronSourceConstants.EVENTS_PROGRAMMATIC, 1);
jSONObject.put(IronSourceConstants.EVENTS_EXT1, str);
jSONObject.put("errorCode", responseCode);
jSONObject.put("reason", responseMessage);
rp.i().a(new kb(IronSourceConstants.TROUBLESHOOTING_FAILED_TO_SEND_AUCTION_URL, jSONObject));
}
} catch (Exception e) {
i9.d().a(e);
IronLog.INTERNAL.error("Send auction url failed with params - " + str + ";" + e.getMessage());
}
}
}
public enum c {
NOT_SECURE,
SECURE
}
private c a() {
c cVar = c.SECURE;
if (Build.VERSION.SDK_INT >= 28) {
if (!NetworkSecurityPolicy.getInstance().isCleartextTrafficPermitted()) {
return cVar;
}
} else if ((ContextProvider.getInstance().getApplicationContext().getApplicationInfo().flags & 134217728) == 0) {
return cVar;
}
return c.NOT_SECURE;
}
private String a(String str, String str2) {
if (TextUtils.isEmpty(str) || TextUtils.isEmpty(str2)) {
return "";
}
double parseDouble = Double.parseDouble(str);
return Double.parseDouble(str2) == 0.0d ? "" : String.valueOf(Math.round((parseDouble / r7) * 1000.0d) / 1000.0d);
}
public static d b() {
return A;
}
public a a(JSONObject jSONObject) throws JSONException {
String optString = jSONObject.optString("auctionId");
if (TextUtils.isEmpty(optString)) {
throw new JSONException("Invalid auction response - auction id is missing");
}
a aVar = new a(optString);
if (jSONObject.has("settings")) {
JSONObject jSONObject2 = jSONObject.getJSONObject("settings");
aVar.c = new f5(jSONObject2);
r3 = jSONObject2.has(d) ? jSONObject2.optJSONObject(d) : null;
if (jSONObject2.has("genericParams")) {
aVar.d = jSONObject2.optJSONObject("genericParams");
}
if (jSONObject2.has("configurations")) {
aVar.e = jSONObject2.optJSONObject("configurations");
}
if (jSONObject2.has(j)) {
aVar.h = new o4.a(jSONObject2.optJSONObject(j));
}
}
aVar.b = new ArrayList();
if (jSONObject.has(g)) {
JSONArray jSONArray = jSONObject.getJSONArray(g);
for (int i2 = 0; i2 < jSONArray.length(); i2++) {
f5 f5Var = new f5(jSONArray.getJSONObject(i2), i2, r3);
if (!f5Var.l()) {
aVar.f = 1002;
aVar.g = "waterfall " + i2;
IronLog.INTERNAL.verbose("AuctionResponseItem " + i2 + " not valid - parsing error");
throw new JSONException("invalid response");
}
aVar.b.add(f5Var);
}
}
return aVar;
}
public String a(String str) {
try {
if (TextUtils.isEmpty(str)) {
return str;
}
JSONObject jSONObject = new JSONObject(str);
return jSONObject.has("adMarkup") ? jSONObject.getString("adMarkup") : str;
} catch (JSONException e2) {
i9.d().a(e2);
IronLog.INTERNAL.error("exception " + e2.getMessage());
return str;
}
}
public String a(String str, int i2, f5 f5Var, String str2, String str3, String str4) {
String h2 = f5Var.h();
return a(str, f5Var.c(), i2, b().c(f5Var.j()), h2, b().a(h2, str2), str3, str4);
}
public String a(String str, String str2, int i2, String str3, String str4, String str5, String str6, String str7) {
return str.replace(m, str4).replace(k, str6).replace(l, str5).replace(o, str2).replace(p, Integer.toString(i2)).replace(n, str3).replace(q, str7);
}
public JSONObject a(i iVar) throws JSONException {
boolean z2;
boolean z3;
ISBannerSize iSBannerSize;
IronSource.AD_UNIT c2 = iVar.c();
boolean s2 = iVar.s();
Map<String, Object> g2 = iVar.g();
List<String> k2 = iVar.k();
h e2 = iVar.e();
int n2 = iVar.n();
ISBannerSize f2 = iVar.f();
IronSourceSegment m2 = iVar.m();
boolean o2 = iVar.o();
boolean p2 = iVar.p();
ArrayList<y4> j2 = iVar.j();
JSONObject jSONObject = new JSONObject();
JSONObject jSONObject2 = new JSONObject();
Iterator<String> it = g2.keySet().iterator();
while (true) {
z2 = o2;
z3 = s2;
String str = "";
iSBannerSize = f2;
if (!it.hasNext()) {
break;
}
String next = it.next();
Iterator<String> it2 = it;
JSONObject jSONObject3 = new JSONObject();
IronSourceSegment ironSourceSegment = m2;
jSONObject3.put(ad.n0, 2);
jSONObject3.put(ad.e0, new JSONObject((Map) g2.get(next)));
if (e2 != null) {
str = e2.a(next);
}
jSONObject3.put(ad.q0, str);
jSONObject3.put("ts", p2 ? 1 : 0);
jSONObject2.put(next, jSONObject3);
o2 = z2;
s2 = z3 ? 1 : 0;
f2 = iSBannerSize;
it = it2;
m2 = ironSourceSegment;
}
IronSourceSegment ironSourceSegment2 = m2;
int i2 = 2;
for (String str2 : k2) {
JSONObject jSONObject4 = new JSONObject();
jSONObject4.put(ad.n0, 1);
jSONObject4.put(ad.q0, e2 != null ? e2.a(str2) : "");
jSONObject2.put(str2, jSONObject4);
}
Iterator<y4> it3 = j2.iterator();
while (it3.hasNext()) {
y4 next2 = it3.next();
JSONObject jSONObject5 = new JSONObject();
jSONObject5.put(ad.n0, next2.e() ? i2 : 1);
Map<String, Object> f3 = next2.f();
if (!f3.isEmpty()) {
jSONObject5.put(ad.e0, new JSONObject(f3));
}
jSONObject5.put(ad.q0, e2 != null ? e2.a(next2.g()) : "");
jSONObject5.put("ts", p2 ? 1 : 0);
if (!next2.h().isEmpty()) {
jSONObject5.put(u, next2.h());
}
jSONObject2.put(next2.g(), jSONObject5);
i2 = 2;
}
jSONObject.put(ad.m0, jSONObject2);
if (iVar.u()) {
jSONObject.put(ad.f1, 1);
}
if (iVar.r()) {
jSONObject.put("do", 1);
}
JSONObject a2 = new u4(q2.a(c2)).a();
a(a2, false);
a2.put(ad.o0, n2);
a2.put(ad.p0, a().ordinal());
if (ironSourceSegment2 != null) {
a2.put(ad.R0, ironSourceSegment2.toJson());
}
jSONObject.put(ad.j0, a2);
if (iSBannerSize != null) {
JSONObject jSONObject6 = new JSONObject();
jSONObject6.put(ad.g0, iSBannerSize.getDescription());
jSONObject6.put(ad.i0, iSBannerSize.getWidth());
jSONObject6.put(ad.h0, iSBannerSize.getHeight());
jSONObject.put(ad.f0, jSONObject6);
}
jSONObject.put(ad.a0, c2.toString());
if (iVar.b() != null) {
jSONObject.put("adf", iVar.b());
}
if (iVar.d() != null) {
jSONObject.put("mediationAdUnitId", iVar.d());
}
if (iVar.t() != null) {
jSONObject.put(ad.d0, iVar.t());
}
jSONObject.put(ad.k0, !z3 ? 1 : 0);
Object remove = a2.remove(ad.b1);
if (remove != null) {
jSONObject.put(ad.b1, remove);
}
if (z2) {
jSONObject.put(ad.Z0, 1);
}
return jSONObject;
}
public void a(String str, String str2, String str3) {
IronSourceThreadManager.INSTANCE.postMediationBackgroundTask(new b(str, str2, str3));
}
public void a(JSONObject jSONObject, boolean z2) {
if (jSONObject == null || jSONObject.length() <= 0 || TextUtils.isEmpty(jSONObject.optString(ad.T0)) || !this.a.compareAndSet(false, true)) {
return;
}
rp.i().a(new kb(IronSourceConstants.TROUBLESHOOTING_MEDIATION_TCS_CALCULATED, IronSourceUtils.getMediationAdditionalData(z2, true, -1)));
}
public Map<String, String> b(String str) {
HashMap hashMap = new HashMap();
try {
JSONObject jSONObject = new JSONObject(str);
if (jSONObject.has("params")) {
JSONObject jSONObject2 = jSONObject.getJSONObject("params");
Iterator<String> keys = jSONObject2.keys();
while (keys.hasNext()) {
String next = keys.next();
Object obj = jSONObject2.get(next);
if (obj instanceof String) {
hashMap.put(next, (String) obj);
}
}
}
} catch (JSONException e2) {
i9.d().a(e2);
IronLog.INTERNAL.error("exception " + e2.getMessage());
}
return hashMap;
}
public String c(String str) {
String str2 = "";
try {
if (TextUtils.isEmpty(str) || !hj.a(str)) {
return "";
}
JSONObject jSONObject = new JSONObject(str);
if (!jSONObject.has("params")) {
return "";
}
JSONObject jSONObject2 = jSONObject.getJSONObject("params");
IronLog ironLog = IronLog.INTERNAL;
ironLog.verbose("parameters = " + jSONObject2);
if (!jSONObject2.has("dynamicDemandSource")) {
return "";
}
str2 = jSONObject2.getString("dynamicDemandSource");
ironLog.verbose("demand source = " + str2);
return str2;
} catch (JSONException e2) {
i9.d().a(e2);
IronLog.INTERNAL.error("exception " + e2.getMessage());
return str2;
}
}
}