- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
394 lines
15 KiB
Java
394 lines
15 KiB
Java
package com.mbridge.msdk.foundation.b;
|
|
|
|
import android.text.TextUtils;
|
|
import com.mbridge.msdk.foundation.entity.CampaignEx;
|
|
import com.mbridge.msdk.foundation.entity.j;
|
|
import com.mbridge.msdk.foundation.tools.af;
|
|
import com.mbridge.msdk.foundation.tools.aq;
|
|
import com.mbridge.msdk.foundation.tools.z;
|
|
import java.util.ArrayList;
|
|
import java.util.Collections;
|
|
import java.util.Comparator;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import org.json.JSONArray;
|
|
import org.json.JSONObject;
|
|
|
|
/* loaded from: classes4.dex */
|
|
public class a {
|
|
public static int b = 4;
|
|
private static String c = "BaseCandidateCache";
|
|
protected com.mbridge.msdk.foundation.db.c a;
|
|
private JSONArray d;
|
|
private JSONObject e;
|
|
private String f;
|
|
|
|
public final void a(JSONArray jSONArray) {
|
|
this.d = jSONArray;
|
|
}
|
|
|
|
public final void e(String str) {
|
|
this.f = str;
|
|
}
|
|
|
|
public final JSONObject a(String str) {
|
|
JSONArray jSONArray = this.d;
|
|
if (jSONArray == null) {
|
|
return null;
|
|
}
|
|
if (jSONArray.length() > 1) {
|
|
if (TextUtils.isEmpty(str)) {
|
|
return null;
|
|
}
|
|
for (int i = 0; i < this.d.length(); i++) {
|
|
try {
|
|
JSONObject optJSONObject = this.d.optJSONObject(i);
|
|
if (optJSONObject != null && str.equals(optJSONObject.getString("g"))) {
|
|
this.e = optJSONObject;
|
|
return optJSONObject;
|
|
}
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
return this.d.optJSONObject(0);
|
|
}
|
|
|
|
public final String b(String str) {
|
|
c c2 = c(str);
|
|
if (c2 != null && c2.g() != c.c && c2.g() != c.a) {
|
|
String[] split = z.a(str.split("_")[3]).split("\\|");
|
|
if (split.length > 1) {
|
|
return split[1];
|
|
}
|
|
}
|
|
return "";
|
|
}
|
|
|
|
public final c c(String str) {
|
|
c cVar = new c();
|
|
if (TextUtils.isEmpty(str) || str.split("_").length <= 3 || TextUtils.isEmpty(str.split("_")[3])) {
|
|
cVar.d("bid token exception");
|
|
cVar.a(c.a);
|
|
return cVar;
|
|
}
|
|
JSONArray jSONArray = this.d;
|
|
if (jSONArray == null || jSONArray.length() == 0) {
|
|
cVar.d("config is empty");
|
|
cVar.a(c.a);
|
|
return cVar;
|
|
}
|
|
String a = z.a(str.split("_")[3]);
|
|
if (TextUtils.isEmpty(a)) {
|
|
cVar.d("bid token exception:decode error");
|
|
cVar.a(c.a);
|
|
return cVar;
|
|
}
|
|
String[] split = a.split("\\|");
|
|
if (split.length == 0) {
|
|
cVar.d("bid token can not get bid price");
|
|
cVar.a(c.a);
|
|
return cVar;
|
|
}
|
|
if (split.length > 0) {
|
|
try {
|
|
String str2 = split[0];
|
|
} catch (Exception unused) {
|
|
cVar.d("bid token can not cast bid price");
|
|
cVar.a(c.a);
|
|
return cVar;
|
|
}
|
|
}
|
|
if (TextUtils.isEmpty(this.f)) {
|
|
cVar.d("unitId is empty");
|
|
cVar.a(c.c);
|
|
}
|
|
return cVar;
|
|
}
|
|
|
|
public final double d(String str) {
|
|
c c2 = c(str);
|
|
if (c2 != null && c2.g() != c.c && c2.g() != c.a) {
|
|
try {
|
|
String[] split = z.a(str.split("_")[3]).split("\\|");
|
|
if (split.length > 0) {
|
|
return Double.parseDouble(split[0]);
|
|
}
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
return -1.0d;
|
|
}
|
|
|
|
public final void a(List<CampaignEx> list, com.mbridge.msdk.foundation.same.report.d.c cVar, String str, int i, String str2, int i2, double d) {
|
|
if (list != null) {
|
|
try {
|
|
if (list.size() > 0) {
|
|
for (int i3 = 0; i3 < list.size(); i3++) {
|
|
CampaignEx campaignEx = list.get(i3);
|
|
campaignEx.setReadyState(0);
|
|
if (cVar != null) {
|
|
campaignEx.setNLRid(cVar.f());
|
|
}
|
|
campaignEx.setNRid(str);
|
|
campaignEx.setReasond(str2);
|
|
campaignEx.setTyped(i);
|
|
String b2 = z.b(d + "");
|
|
campaignEx.setNoticeUrl(a(campaignEx.getNoticeUrl(), i2, str, b2));
|
|
campaignEx.setClickURL(a(campaignEx.getClickURL(), i2, str, b2));
|
|
campaignEx.setImpressionURL(a(campaignEx.getImpressionURL(), i2, str, b2));
|
|
campaignEx.setOnlyImpressionURL(a(campaignEx.getOnlyImpressionURL(), i2, str, b2));
|
|
campaignEx.setAdvImp(a(campaignEx.getAdvImpList(), i2, str, b2));
|
|
j nativeVideoTracking = campaignEx.getNativeVideoTracking();
|
|
if (nativeVideoTracking != null) {
|
|
nativeVideoTracking.k(a(nativeVideoTracking.l(), i2, str, b2));
|
|
nativeVideoTracking.c(a(nativeVideoTracking.c(), i2, str, b2));
|
|
nativeVideoTracking.o(a(nativeVideoTracking.p(), i2, str, b2));
|
|
nativeVideoTracking.s(a(nativeVideoTracking.t(), i2, str, b2));
|
|
nativeVideoTracking.a(a(nativeVideoTracking.a(), i2, str, b2));
|
|
nativeVideoTracking.b(a(nativeVideoTracking.b(), i2, str, b2));
|
|
nativeVideoTracking.r(a(nativeVideoTracking.s(), i2, str, b2));
|
|
nativeVideoTracking.u(a(nativeVideoTracking.v(), i2, str, b2));
|
|
nativeVideoTracking.t(a(nativeVideoTracking.v(), i2, str, b2));
|
|
nativeVideoTracking.v(a(nativeVideoTracking.w(), i2, str, b2));
|
|
nativeVideoTracking.h(a(nativeVideoTracking.h(), i2, str, b2));
|
|
nativeVideoTracking.p(a(nativeVideoTracking.q(), i2, str, b2));
|
|
nativeVideoTracking.q(a(nativeVideoTracking.r(), i2, str, b2));
|
|
nativeVideoTracking.n(a(nativeVideoTracking.o(), i2, str, b2));
|
|
nativeVideoTracking.e(a(nativeVideoTracking.e(), i2, str, b2));
|
|
nativeVideoTracking.f(a(nativeVideoTracking.f(), i2, str, b2));
|
|
nativeVideoTracking.g(a(nativeVideoTracking.g(), i2, str, b2));
|
|
nativeVideoTracking.i(a(nativeVideoTracking.j(), i2, str, b2));
|
|
nativeVideoTracking.j(a(nativeVideoTracking.k(), i2, str, b2));
|
|
nativeVideoTracking.l(a(nativeVideoTracking.m(), i2, str, b2));
|
|
nativeVideoTracking.a(a(nativeVideoTracking.i(), i2, str, b2));
|
|
nativeVideoTracking.d(a(nativeVideoTracking.d(), i2, str, b2));
|
|
nativeVideoTracking.m(a(nativeVideoTracking.n(), i2, str, b2));
|
|
campaignEx.setNativeVideoTracking(nativeVideoTracking);
|
|
campaignEx.setNativeVideoTrackingString(CampaignEx.object2TrackingStr(nativeVideoTracking));
|
|
}
|
|
campaignEx.setPv_urls(b(campaignEx.getPv_urls(), i2, str, b2));
|
|
}
|
|
}
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
}
|
|
|
|
public final c a() {
|
|
JSONArray jSONArray;
|
|
c cVar = new c();
|
|
try {
|
|
jSONArray = this.d;
|
|
} catch (Exception unused) {
|
|
cVar.d("checkConfigAndDB exception");
|
|
cVar.a(c.c);
|
|
}
|
|
if (jSONArray != null && jSONArray.length() != 0) {
|
|
if (this.a == null) {
|
|
cVar.d("db error");
|
|
cVar.a(c.c);
|
|
return cVar;
|
|
}
|
|
return cVar;
|
|
}
|
|
cVar.d("setting config is null");
|
|
cVar.a(c.a);
|
|
return cVar;
|
|
}
|
|
|
|
public final void a(List<C0195a> list, int i) {
|
|
if (list != null) {
|
|
try {
|
|
if (list.size() > 0) {
|
|
Collections.sort(list, new Comparator<C0195a>() { // from class: com.mbridge.msdk.foundation.b.a.1
|
|
@Override // java.util.Comparator
|
|
public final /* synthetic */ int compare(C0195a c0195a, C0195a c0195a2) {
|
|
return Double.compare(c0195a.b, c0195a2.b);
|
|
}
|
|
});
|
|
int size = list.size() - i;
|
|
if (size > 0) {
|
|
List<C0195a> subList = list.subList(0, size);
|
|
if (this.a == null || subList.size() <= 0) {
|
|
return;
|
|
}
|
|
for (int i2 = 0; i2 < subList.size(); i2++) {
|
|
b bVar = subList.get(i2).a;
|
|
this.a.a(this.f, bVar.e(), bVar.d());
|
|
a(b, 1, null, true, bVar.e(), bVar.d(), -1, this.f);
|
|
}
|
|
}
|
|
}
|
|
} catch (Exception e) {
|
|
af.a(c, e);
|
|
}
|
|
}
|
|
}
|
|
|
|
private String a(String str, int i, String str2, String str3) {
|
|
if (TextUtils.isEmpty(str) || str.contains("ca_sce") || str.contains("real_rid") || str.contains("real_bp")) {
|
|
return str;
|
|
}
|
|
if (aq.c(str) > 0) {
|
|
return str + "&ca_sce=" + i + "&real_rid=" + str2 + "&real_bp=" + str3;
|
|
}
|
|
return str + "?ca_sce=" + i + "&real_rid=" + str2 + "&real_bp=" + str3;
|
|
}
|
|
|
|
private String a(Map<Integer, String> map, int i, String str, String str2) {
|
|
if (map == null || map.size() == 0) {
|
|
return null;
|
|
}
|
|
JSONArray jSONArray = new JSONArray();
|
|
try {
|
|
for (Map.Entry<Integer, String> entry : map.entrySet()) {
|
|
String value = entry.getValue();
|
|
JSONObject jSONObject = new JSONObject();
|
|
jSONObject.put(CampaignEx.JSON_AD_IMP_KEY, entry.getKey());
|
|
jSONObject.put("url", a(value, i, str, str2));
|
|
jSONArray.put(jSONObject);
|
|
}
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
if (jSONArray.length() == 0) {
|
|
return null;
|
|
}
|
|
return jSONArray.toString();
|
|
}
|
|
|
|
private String[] a(String[] strArr, int i, String str, String str2) {
|
|
if (strArr == null || strArr.length == 0) {
|
|
return strArr;
|
|
}
|
|
String[] strArr2 = new String[strArr.length];
|
|
for (int i2 = 0; i2 < strArr.length; i2++) {
|
|
strArr2[i2] = a(strArr[i2], i, str, str2);
|
|
}
|
|
return strArr2;
|
|
}
|
|
|
|
private List<Map<Integer, String>> a(List<Map<Integer, String>> list, int i, String str, String str2) {
|
|
if (list == null || list.size() == 0) {
|
|
return list;
|
|
}
|
|
ArrayList arrayList = new ArrayList();
|
|
for (int i2 = 0; i2 < list.size(); i2++) {
|
|
Map<Integer, String> map = list.get(i2);
|
|
if (map != null && map.size() > 0) {
|
|
for (Map.Entry<Integer, String> entry : map.entrySet()) {
|
|
map.put(entry.getKey(), a(entry.getValue(), i, str, str2));
|
|
}
|
|
arrayList.add(map);
|
|
}
|
|
}
|
|
return arrayList;
|
|
}
|
|
|
|
private List<String> b(List<String> list, int i, String str, String str2) {
|
|
if (list == null || list.size() == 0) {
|
|
return list;
|
|
}
|
|
ArrayList arrayList = new ArrayList();
|
|
for (int i2 = 0; i2 < list.size(); i2++) {
|
|
arrayList.add(a(list.get(i2), i, str, str2));
|
|
}
|
|
return arrayList;
|
|
}
|
|
|
|
public final long a(List<CampaignEx> list, String str) {
|
|
if (list == null || list.size() == 0) {
|
|
return 0L;
|
|
}
|
|
String ecppv = list.get(0).getEcppv();
|
|
if (TextUtils.isEmpty(ecppv)) {
|
|
return 0L;
|
|
}
|
|
String a = z.a(ecppv);
|
|
if (TextUtils.isEmpty(a)) {
|
|
return 0L;
|
|
}
|
|
try {
|
|
if (Double.parseDouble(a) <= 0.0d) {
|
|
return 0L;
|
|
}
|
|
JSONObject a2 = a(b(str));
|
|
int optInt = a2 != null ? a2.optInt("max_cache_num", 20) : 20;
|
|
com.mbridge.msdk.foundation.db.c cVar = this.a;
|
|
if (cVar == null || optInt <= 0) {
|
|
return -1L;
|
|
}
|
|
return cVar.a(list, this.f);
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
return -1L;
|
|
}
|
|
}
|
|
|
|
public final void a(String str, String str2, int i, String str3) {
|
|
try {
|
|
if (this.a == null || TextUtils.isEmpty(str3)) {
|
|
return;
|
|
}
|
|
if (i == 1) {
|
|
this.a.a(str2, str, this.f, i);
|
|
a(b, 3, null, true, str2, str, -1, this.f);
|
|
} else if (i == 2) {
|
|
this.a.a(this.f, str2, str);
|
|
a(b, 1, null, true, str2, str, -1, this.f);
|
|
} else if (i == 3) {
|
|
this.a.b(str2, str, this.f);
|
|
a(b, 4, null, true, str2, str, -1, this.f);
|
|
}
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
|
|
/* JADX WARN: Removed duplicated region for block: B:61:0x0187 A[Catch: Exception -> 0x002c, TryCatch #1 {Exception -> 0x002c, blocks: (B:3:0x0011, B:6:0x0031, B:8:0x0069, B:11:0x0079, B:13:0x007f, B:17:0x0086, B:19:0x0091, B:22:0x0098, B:24:0x009e, B:26:0x00a6, B:28:0x0104, B:32:0x0108, B:36:0x0113, B:39:0x0119, B:42:0x011f, B:44:0x012d, B:46:0x0131, B:48:0x0142, B:50:0x0148, B:52:0x0150, B:54:0x0168, B:57:0x016b, B:59:0x017f, B:61:0x0187, B:62:0x018c, B:69:0x0177), top: B:2:0x0011, inners: #0 }] */
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct add '--show-bad-code' argument
|
|
*/
|
|
public final void a(int r17, int r18, java.util.List<com.mbridge.msdk.foundation.entity.CampaignEx> r19, boolean r20, java.lang.String r21, java.lang.String r22, int r23, java.lang.String r24) {
|
|
/*
|
|
Method dump skipped, instructions count: 414
|
|
To view this dump add '--comments-level debug' option
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: com.mbridge.msdk.foundation.b.a.a(int, int, java.util.List, boolean, java.lang.String, java.lang.String, int, java.lang.String):void");
|
|
}
|
|
|
|
/* renamed from: com.mbridge.msdk.foundation.b.a$a, reason: collision with other inner class name */
|
|
public static class C0195a {
|
|
private b a;
|
|
private double b;
|
|
|
|
public final b a() {
|
|
return this.a;
|
|
}
|
|
|
|
public C0195a(double d, b bVar) {
|
|
this.b = d;
|
|
this.a = bVar;
|
|
}
|
|
}
|
|
|
|
public final List<b> a(int i, long j) {
|
|
com.mbridge.msdk.foundation.db.c cVar;
|
|
if (i >= 0 && (cVar = this.a) != null) {
|
|
cVar.a(this.f, i);
|
|
a(b, 1, null, true, "", "", i, this.f);
|
|
}
|
|
com.mbridge.msdk.foundation.db.c cVar2 = this.a;
|
|
if (cVar2 != null) {
|
|
return cVar2.a(this.f, 0, j);
|
|
}
|
|
return null;
|
|
}
|
|
}
|