- 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
529 lines
20 KiB
Java
529 lines
20 KiB
Java
package com.mbridge.msdk.interstitial.a;
|
|
|
|
import android.content.Context;
|
|
import android.os.Handler;
|
|
import android.os.Looper;
|
|
import android.os.Message;
|
|
import android.text.TextUtils;
|
|
import androidx.work.WorkRequest;
|
|
import com.mbridge.msdk.MBridgeConstans;
|
|
import com.mbridge.msdk.c.g;
|
|
import com.mbridge.msdk.c.h;
|
|
import com.mbridge.msdk.c.i;
|
|
import com.mbridge.msdk.c.k;
|
|
import com.mbridge.msdk.foundation.controller.c;
|
|
import com.mbridge.msdk.foundation.db.j;
|
|
import com.mbridge.msdk.foundation.entity.CampaignEx;
|
|
import com.mbridge.msdk.foundation.entity.CampaignUnit;
|
|
import com.mbridge.msdk.foundation.same.a.b;
|
|
import com.mbridge.msdk.foundation.same.c;
|
|
import com.mbridge.msdk.foundation.same.net.f.e;
|
|
import com.mbridge.msdk.foundation.same.report.d.d;
|
|
import com.mbridge.msdk.foundation.tools.SameMD5;
|
|
import com.mbridge.msdk.foundation.tools.af;
|
|
import com.mbridge.msdk.foundation.tools.ak;
|
|
import com.mbridge.msdk.foundation.tools.aq;
|
|
import com.mbridge.msdk.interstitial.c.a;
|
|
import java.io.File;
|
|
import java.io.FileOutputStream;
|
|
import java.util.ArrayList;
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import org.json.JSONArray;
|
|
|
|
/* loaded from: classes4.dex */
|
|
public final class a {
|
|
private Context a;
|
|
private String b;
|
|
private String c;
|
|
private int d;
|
|
private boolean e;
|
|
private int f;
|
|
private String g;
|
|
private a.C0205a h;
|
|
private k i;
|
|
private Handler j;
|
|
|
|
public final void a(a.C0205a c0205a) {
|
|
this.h = c0205a;
|
|
}
|
|
|
|
public final boolean c() {
|
|
return this.e;
|
|
}
|
|
|
|
public a(Context context, String str, String str2, String str3, boolean z) {
|
|
this.a = context;
|
|
this.b = str;
|
|
this.c = str2;
|
|
this.g = str3;
|
|
this.e = z;
|
|
k d = h.a().d(c.m().k(), str);
|
|
this.i = d;
|
|
if (d == null) {
|
|
this.i = k.c(this.b);
|
|
}
|
|
this.j = new Handler(Looper.getMainLooper()) { // from class: com.mbridge.msdk.interstitial.a.a.1
|
|
@Override // android.os.Handler
|
|
public final void handleMessage(Message message) {
|
|
Object obj;
|
|
Object obj2;
|
|
try {
|
|
int i = message.what;
|
|
if (i != 3) {
|
|
if (i == 4 && a.this.h != null && (obj2 = message.obj) != null && (obj2 instanceof String)) {
|
|
a.this.h.b(a.this.e, (String) obj2);
|
|
}
|
|
} else if (a.this.h != null && (obj = message.obj) != null && (obj instanceof String)) {
|
|
a.this.h.a(a.this.e, (String) obj);
|
|
}
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
};
|
|
}
|
|
|
|
public final CampaignEx a() {
|
|
try {
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
if (TextUtils.isEmpty(this.b)) {
|
|
return null;
|
|
}
|
|
e();
|
|
List<CampaignEx> f = f();
|
|
if (f != null && f.size() > 0) {
|
|
for (int i = 0; i < f.size(); i++) {
|
|
CampaignEx campaignEx = f.get(i);
|
|
if (campaignEx != null && (!TextUtils.isEmpty(campaignEx.getHtmlUrl()) || !TextUtils.isEmpty(campaignEx.getMraid()))) {
|
|
return campaignEx;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public final void b() {
|
|
if (this.a == null) {
|
|
b("context is null");
|
|
return;
|
|
}
|
|
if (TextUtils.isEmpty(this.b)) {
|
|
b("unitid is null");
|
|
return;
|
|
}
|
|
k kVar = this.i;
|
|
if (kVar == null) {
|
|
b("unitSetting is null please call load");
|
|
return;
|
|
}
|
|
if (kVar.e() <= 0) {
|
|
b("controller don't request ad");
|
|
return;
|
|
}
|
|
e();
|
|
List<CampaignEx> f = f();
|
|
if (f != null && f.size() > 0) {
|
|
CampaignEx campaignEx = f.get(0);
|
|
a(campaignEx != null ? campaignEx.getRequestId() : "");
|
|
return;
|
|
}
|
|
try {
|
|
if (this.a == null) {
|
|
b("context is null");
|
|
return;
|
|
}
|
|
if (TextUtils.isEmpty(this.b)) {
|
|
b("unitid is null");
|
|
return;
|
|
}
|
|
if (this.i == null) {
|
|
b("unitSetting is null please call load");
|
|
return;
|
|
}
|
|
String k = c.m().k();
|
|
String md5 = SameMD5.getMD5(c.m().k() + c.m().b());
|
|
int i = this.e ? 3 : 2;
|
|
this.f = 1;
|
|
if (this.i.d() > 0) {
|
|
this.f = this.i.d();
|
|
}
|
|
int e = this.i.e() > 0 ? this.i.e() : 1;
|
|
String a = b.a(this.b, "interstitial");
|
|
this.d = h();
|
|
String j = j();
|
|
if (TextUtils.isEmpty(this.g)) {
|
|
this.g = "0";
|
|
}
|
|
e eVar = new e();
|
|
com.mbridge.msdk.foundation.same.net.e.b.a(eVar, "app_id", k);
|
|
com.mbridge.msdk.foundation.same.net.e.b.a(eVar, MBridgeConstans.PROPERTIES_UNIT_ID, this.b);
|
|
if (!TextUtils.isEmpty(this.c)) {
|
|
com.mbridge.msdk.foundation.same.net.e.b.a(eVar, MBridgeConstans.PLACEMENT_ID, this.c);
|
|
}
|
|
com.mbridge.msdk.foundation.same.net.e.b.a(eVar, "sign", md5);
|
|
com.mbridge.msdk.foundation.same.net.e.b.a(eVar, "category", this.g);
|
|
com.mbridge.msdk.foundation.same.net.e.b.a(eVar, "req_type", i + "");
|
|
com.mbridge.msdk.foundation.same.net.e.b.a(eVar, "ad_num", e + "");
|
|
com.mbridge.msdk.foundation.same.net.e.b.a(eVar, "tnum", this.f + "");
|
|
com.mbridge.msdk.foundation.same.net.e.b.a(eVar, "only_impression", "1");
|
|
com.mbridge.msdk.foundation.same.net.e.b.a(eVar, "ping_mode", "1");
|
|
com.mbridge.msdk.foundation.same.net.e.b.a(eVar, e.d, a);
|
|
com.mbridge.msdk.foundation.same.net.e.b.a(eVar, e.e, d());
|
|
com.mbridge.msdk.foundation.same.net.e.b.a(eVar, CampaignEx.JSON_KEY_AD_SOURCE_ID, "1");
|
|
com.mbridge.msdk.foundation.same.net.e.b.a(eVar, e.f, j);
|
|
com.mbridge.msdk.foundation.same.net.e.b.a(eVar, "ad_type", "279");
|
|
com.mbridge.msdk.foundation.same.net.e.b.a(eVar, "offset", this.d + "");
|
|
String d = ak.d(this.b);
|
|
if (!TextUtils.isEmpty(d)) {
|
|
eVar.a("j", d);
|
|
}
|
|
com.mbridge.msdk.interstitial.d.a aVar = new com.mbridge.msdk.interstitial.d.a(this.a);
|
|
com.mbridge.msdk.interstitial.d.b bVar = new com.mbridge.msdk.interstitial.d.b() { // from class: com.mbridge.msdk.interstitial.a.a.2
|
|
@Override // com.mbridge.msdk.interstitial.d.b
|
|
public final void a(CampaignUnit campaignUnit) {
|
|
try {
|
|
a.a(a.this, campaignUnit);
|
|
} catch (Exception e2) {
|
|
e2.printStackTrace();
|
|
a.this.b("can't show because unknow error");
|
|
a.this.i();
|
|
}
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.interstitial.d.b
|
|
public final void a(int i2, String str) {
|
|
af.b("IntersAdapter", str);
|
|
a.this.b(str);
|
|
a.this.i();
|
|
}
|
|
};
|
|
bVar.setUnitId(this.b);
|
|
bVar.setPlacementId(this.c);
|
|
bVar.setAdType(279);
|
|
aVar.choiceV3OrV5BySetting(1, eVar, bVar, "", WorkRequest.DEFAULT_BACKOFF_DELAY_MILLIS);
|
|
} catch (Exception e2) {
|
|
e2.printStackTrace();
|
|
b("can't show because unknow error");
|
|
i();
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public void a(String str) {
|
|
if (this.j != null) {
|
|
Message obtain = Message.obtain();
|
|
obtain.obj = str;
|
|
obtain.what = 3;
|
|
this.j.sendMessage(obtain);
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public void b(String str) {
|
|
try {
|
|
if (this.j != null) {
|
|
Message obtain = Message.obtain();
|
|
obtain.obj = str;
|
|
obtain.what = 4;
|
|
this.j.sendMessage(obtain);
|
|
}
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
|
|
private String d() {
|
|
String str;
|
|
str = "";
|
|
try {
|
|
JSONArray b = ak.b(this.a, this.b);
|
|
str = b.length() > 0 ? ak.a(b) : "";
|
|
af.c("IntersAdapter", "get excludes:" + str);
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
return str;
|
|
}
|
|
|
|
private void e() {
|
|
try {
|
|
if (com.mbridge.msdk.interstitial.b.a.a() != null) {
|
|
g b = h.a().b(c.m().k());
|
|
if (b == null) {
|
|
h.a();
|
|
b = i.a();
|
|
}
|
|
com.mbridge.msdk.interstitial.b.a.a().a(b.ac() * 1000, this.b);
|
|
}
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
|
|
private List<CampaignEx> f() {
|
|
try {
|
|
if (com.mbridge.msdk.interstitial.b.a.a() != null) {
|
|
return com.mbridge.msdk.interstitial.b.a.a().a(this.b, 1);
|
|
}
|
|
return null;
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
return null;
|
|
}
|
|
}
|
|
|
|
private List<CampaignEx> a(List<CampaignEx> list) {
|
|
ArrayList arrayList = new ArrayList();
|
|
if (list != null) {
|
|
try {
|
|
if (list.size() > 0) {
|
|
int d = this.i.d();
|
|
for (int i = 0; i < list.size() && i < this.f && arrayList.size() < d; i++) {
|
|
final CampaignEx campaignEx = list.get(i);
|
|
int i2 = 1;
|
|
if ((campaignEx == null || campaignEx.getOfferType() != 1 || !TextUtils.isEmpty(campaignEx.getVideoUrlEncode())) && campaignEx != null && ((!TextUtils.isEmpty(campaignEx.getHtmlUrl()) || campaignEx.isMraid()) && campaignEx.getOfferType() != 99)) {
|
|
if (ak.c(campaignEx)) {
|
|
if (!ak.c(this.a, campaignEx.getPackageName())) {
|
|
i2 = 2;
|
|
}
|
|
campaignEx.setRtinsType(i2);
|
|
}
|
|
if (com.mbridge.msdk.foundation.same.c.a(this.a, campaignEx)) {
|
|
arrayList.add(campaignEx);
|
|
} else {
|
|
ak.a(this.b, campaignEx, com.mbridge.msdk.foundation.same.a.x);
|
|
}
|
|
final Context context = this.a;
|
|
try {
|
|
final com.mbridge.msdk.foundation.same.report.d.a.a aVar = null;
|
|
com.mbridge.msdk.foundation.same.c.a(campaignEx, context, null, new c.a() { // from class: com.mbridge.msdk.interstitial.a.a.3
|
|
@Override // com.mbridge.msdk.foundation.same.c.a
|
|
public final void a(String str, com.mbridge.msdk.foundation.same.report.d.c cVar) {
|
|
d.a().a(str, cVar, campaignEx, context, aVar);
|
|
}
|
|
});
|
|
} catch (Exception e) {
|
|
if (MBridgeConstans.DEBUG) {
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} catch (Exception e2) {
|
|
e2.printStackTrace();
|
|
}
|
|
}
|
|
return arrayList;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public List<CampaignEx> b(List<CampaignEx> list) {
|
|
File file;
|
|
File file2;
|
|
FileOutputStream fileOutputStream;
|
|
ArrayList arrayList = new ArrayList(list.size());
|
|
for (CampaignEx campaignEx : list) {
|
|
if (campaignEx.isMraid() && !TextUtils.isEmpty(campaignEx.getMraid())) {
|
|
FileOutputStream fileOutputStream2 = null;
|
|
try {
|
|
try {
|
|
String a = com.mbridge.msdk.foundation.same.b.e.a(com.mbridge.msdk.foundation.same.b.c.MBRIDGE_700_HTML);
|
|
String md5 = SameMD5.getMD5(aq.b(campaignEx.getMraid()));
|
|
if (TextUtils.isEmpty(md5)) {
|
|
md5 = String.valueOf(System.currentTimeMillis());
|
|
}
|
|
file2 = new File(a, md5.concat(".html"));
|
|
fileOutputStream = new FileOutputStream(file2);
|
|
} catch (Exception e) {
|
|
e = e;
|
|
}
|
|
} catch (Throwable th) {
|
|
th = th;
|
|
}
|
|
try {
|
|
StringBuilder sb = new StringBuilder();
|
|
String b = com.mbridge.msdk.c.b.a.a().b();
|
|
if (!TextUtils.isEmpty(b)) {
|
|
sb.append("<script>");
|
|
sb.append(b);
|
|
sb.append("</script>");
|
|
}
|
|
sb.append(campaignEx.getMraid());
|
|
fileOutputStream.write(sb.toString().getBytes());
|
|
fileOutputStream.flush();
|
|
campaignEx.setMraid(file2.getAbsolutePath());
|
|
com.mbridge.msdk.foundation.same.report.g.a(campaignEx, "", this.b, CampaignEx.CLICKMODE_ON);
|
|
try {
|
|
fileOutputStream.close();
|
|
} catch (Exception e2) {
|
|
e2.printStackTrace();
|
|
}
|
|
} catch (Exception e3) {
|
|
e = e3;
|
|
fileOutputStream2 = fileOutputStream;
|
|
e.printStackTrace();
|
|
campaignEx.setMraid("");
|
|
com.mbridge.msdk.foundation.same.report.g.a(campaignEx, e.getMessage(), this.b, CampaignEx.CLICKMODE_ON);
|
|
if (fileOutputStream2 != null) {
|
|
fileOutputStream2.close();
|
|
}
|
|
file = new File(campaignEx.getMraid());
|
|
if (file.exists()) {
|
|
}
|
|
b("mraid resource write fail");
|
|
} catch (Throwable th2) {
|
|
th = th2;
|
|
fileOutputStream2 = fileOutputStream;
|
|
if (fileOutputStream2 != null) {
|
|
try {
|
|
fileOutputStream2.close();
|
|
} catch (Exception e4) {
|
|
e4.printStackTrace();
|
|
}
|
|
}
|
|
throw th;
|
|
}
|
|
file = new File(campaignEx.getMraid());
|
|
if (file.exists() || !file.isFile() || !file.canRead()) {
|
|
b("mraid resource write fail");
|
|
}
|
|
}
|
|
arrayList.add(campaignEx);
|
|
}
|
|
return arrayList;
|
|
}
|
|
|
|
private int g() {
|
|
try {
|
|
Map<String, Integer> map = com.mbridge.msdk.interstitial.c.a.d;
|
|
int intValue = (TextUtils.isEmpty(this.b) || map == null || !map.containsKey(this.b)) ? 1 : map.get(this.b).intValue();
|
|
if (intValue <= 0) {
|
|
return 1;
|
|
}
|
|
return intValue;
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
return 1;
|
|
}
|
|
}
|
|
|
|
private int h() {
|
|
int i = 0;
|
|
try {
|
|
int a = !TextUtils.isEmpty(this.b) ? com.mbridge.msdk.interstitial.c.a.a(this.b) : 0;
|
|
if (a <= g()) {
|
|
i = a;
|
|
}
|
|
af.c("IntersAdapter", "getCurrentOffset:" + i);
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
return i;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public void i() {
|
|
try {
|
|
if (TextUtils.isEmpty(this.b)) {
|
|
return;
|
|
}
|
|
com.mbridge.msdk.interstitial.c.a.a(this.b, 0);
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
|
|
private String j() {
|
|
try {
|
|
return !TextUtils.isEmpty(com.mbridge.msdk.interstitial.c.a.a) ? com.mbridge.msdk.interstitial.c.a.a : "";
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
return "";
|
|
}
|
|
}
|
|
|
|
public static /* synthetic */ void a(a aVar, CampaignUnit campaignUnit) {
|
|
if (campaignUnit == null || campaignUnit.getAds() == null || campaignUnit.getAds().size() <= 0) {
|
|
aVar.b("no server ads available");
|
|
return;
|
|
}
|
|
final ArrayList<CampaignEx> ads = campaignUnit.getAds();
|
|
final List<CampaignEx> a = aVar.a(ads);
|
|
String sessionId = campaignUnit.getSessionId();
|
|
if (!TextUtils.isEmpty(sessionId)) {
|
|
af.c("IntersAdapter", "onload sessionId:" + sessionId);
|
|
com.mbridge.msdk.interstitial.c.a.a = sessionId;
|
|
}
|
|
try {
|
|
aVar.d += aVar.f;
|
|
if (aVar.d > aVar.g()) {
|
|
aVar.d = 0;
|
|
}
|
|
if (!TextUtils.isEmpty(aVar.b)) {
|
|
com.mbridge.msdk.interstitial.c.a.a(aVar.b, aVar.d);
|
|
}
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
new Thread(new Runnable() { // from class: com.mbridge.msdk.interstitial.a.a.4
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
List list = a;
|
|
if (list == null || list.size() <= 0) {
|
|
a.this.b("no ads available");
|
|
} else {
|
|
String str = a.this.b;
|
|
List b = a.this.b((List<CampaignEx>) a);
|
|
if (com.mbridge.msdk.interstitial.b.a.a() != null) {
|
|
com.mbridge.msdk.interstitial.b.a a2 = com.mbridge.msdk.interstitial.b.a.a();
|
|
try {
|
|
if (!TextUtils.isEmpty(str) && b != null && b.size() > 0) {
|
|
Iterator it = b.iterator();
|
|
while (it.hasNext()) {
|
|
a2.b((CampaignEx) it.next(), str);
|
|
}
|
|
}
|
|
} catch (Exception e2) {
|
|
e2.printStackTrace();
|
|
}
|
|
}
|
|
CampaignEx campaignEx = (CampaignEx) a.get(0);
|
|
a.this.a(campaignEx != null ? campaignEx.getRequestId() : "");
|
|
}
|
|
j.a(com.mbridge.msdk.foundation.db.g.a(a.this.a)).a();
|
|
List list2 = ads;
|
|
if (list2 == null || list2.size() <= 0) {
|
|
return;
|
|
}
|
|
a.b(a.this, ads);
|
|
}
|
|
}).start();
|
|
}
|
|
|
|
public static /* synthetic */ void b(a aVar, List list) {
|
|
if (aVar.a == null || list == null || list.size() == 0) {
|
|
return;
|
|
}
|
|
j a = j.a(com.mbridge.msdk.foundation.db.g.a(aVar.a));
|
|
for (int i = 0; i < list.size(); i++) {
|
|
CampaignEx campaignEx = (CampaignEx) list.get(i);
|
|
if (campaignEx != null && a != null && !a.b(campaignEx.getId())) {
|
|
com.mbridge.msdk.foundation.entity.g gVar = new com.mbridge.msdk.foundation.entity.g();
|
|
gVar.a(campaignEx.getId());
|
|
gVar.b(campaignEx.getFca());
|
|
gVar.c(campaignEx.getFcb());
|
|
gVar.a(0);
|
|
gVar.d(0);
|
|
gVar.a(System.currentTimeMillis());
|
|
a.a(gVar);
|
|
}
|
|
}
|
|
}
|
|
}
|