- 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
433 lines
14 KiB
Java
433 lines
14 KiB
Java
package com.mbridge.msdk.videocommon.a;
|
|
|
|
import android.content.Context;
|
|
import android.text.TextUtils;
|
|
import com.mbridge.msdk.c.h;
|
|
import com.mbridge.msdk.c.i;
|
|
import com.mbridge.msdk.foundation.controller.c;
|
|
import com.mbridge.msdk.foundation.db.e;
|
|
import com.mbridge.msdk.foundation.db.g;
|
|
import com.mbridge.msdk.foundation.entity.CampaignEx;
|
|
import com.mbridge.msdk.foundation.tools.af;
|
|
import com.mbridge.msdk.videocommon.d.b;
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
import java.util.concurrent.ConcurrentHashMap;
|
|
import java.util.concurrent.CopyOnWriteArrayList;
|
|
|
|
/* loaded from: classes4.dex */
|
|
public class a {
|
|
private static final String a = "com.mbridge.msdk.videocommon.a.a";
|
|
private static a b;
|
|
private e c;
|
|
|
|
private a() {
|
|
try {
|
|
Context c = c.m().c();
|
|
if (c != null) {
|
|
this.c = e.a(g.a(c));
|
|
} else {
|
|
af.b(a, "RewardCampaignCache get Context is null");
|
|
}
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
|
|
public static a a() {
|
|
if (b == null) {
|
|
synchronized (a.class) {
|
|
try {
|
|
if (b == null) {
|
|
b = new a();
|
|
}
|
|
} finally {
|
|
}
|
|
}
|
|
}
|
|
return b;
|
|
}
|
|
|
|
public final CopyOnWriteArrayList<CampaignEx> a(String str, int i) {
|
|
List<CampaignEx> a2;
|
|
CopyOnWriteArrayList<CampaignEx> copyOnWriteArrayList = null;
|
|
try {
|
|
if (TextUtils.isEmpty(str) || (a2 = this.c.a(str, 0, 0, i)) == null) {
|
|
return null;
|
|
}
|
|
CopyOnWriteArrayList<CampaignEx> copyOnWriteArrayList2 = new CopyOnWriteArrayList<>();
|
|
try {
|
|
for (CampaignEx campaignEx : a2) {
|
|
if (campaignEx != null) {
|
|
copyOnWriteArrayList2.add(campaignEx);
|
|
}
|
|
}
|
|
return copyOnWriteArrayList2;
|
|
} catch (Exception e) {
|
|
e = e;
|
|
copyOnWriteArrayList = copyOnWriteArrayList2;
|
|
e.printStackTrace();
|
|
return copyOnWriteArrayList;
|
|
}
|
|
} catch (Exception e2) {
|
|
e = e2;
|
|
}
|
|
}
|
|
|
|
public final void a(String str, List<CampaignEx> list, String str2, int i) {
|
|
e eVar;
|
|
if (TextUtils.isEmpty(str) || list == null || list.size() <= 0 || TextUtils.isEmpty(str2) || (eVar = this.c) == null) {
|
|
return;
|
|
}
|
|
eVar.a(str, list, str2, i);
|
|
}
|
|
|
|
public final void a(String str, List<CampaignEx> list) {
|
|
e eVar;
|
|
if (TextUtils.isEmpty(str) || list == null || list.size() <= 0 || (eVar = this.c) == null) {
|
|
return;
|
|
}
|
|
eVar.b(str, list);
|
|
}
|
|
|
|
public final void a(String str, List<CampaignEx> list, String str2) {
|
|
e eVar;
|
|
try {
|
|
if (TextUtils.isEmpty(str) || list == null || list.size() <= 0 || (eVar = this.c) == null) {
|
|
return;
|
|
}
|
|
eVar.a(str, list, str2);
|
|
} catch (Exception e) {
|
|
af.b(a, e.getMessage());
|
|
}
|
|
}
|
|
|
|
public final void a(String str, String str2) {
|
|
if (this.c == null || TextUtils.isEmpty(str)) {
|
|
return;
|
|
}
|
|
this.c.f(str, str2);
|
|
}
|
|
|
|
public final List<CampaignEx> a(String str, int i, boolean z) {
|
|
return a(str, i, z, "");
|
|
}
|
|
|
|
public final CopyOnWriteArrayList<CampaignEx> a(String str, int i, boolean z, String str2) {
|
|
List<CampaignEx> a2;
|
|
CopyOnWriteArrayList<CampaignEx> copyOnWriteArrayList = null;
|
|
try {
|
|
com.mbridge.msdk.videocommon.d.a b2 = b.a().b();
|
|
long f = b2 != null ? b2.f() : 0L;
|
|
if (TextUtils.isEmpty(str)) {
|
|
return null;
|
|
}
|
|
if (z) {
|
|
a2 = this.c.a(str, 0, 0, i, str2);
|
|
} else {
|
|
a2 = this.c.a(str, 0, 0, i, false);
|
|
}
|
|
long currentTimeMillis = System.currentTimeMillis();
|
|
if (a2 == null) {
|
|
return null;
|
|
}
|
|
CopyOnWriteArrayList<CampaignEx> copyOnWriteArrayList2 = new CopyOnWriteArrayList<>();
|
|
try {
|
|
for (CampaignEx campaignEx : a2) {
|
|
if (campaignEx != null) {
|
|
if (campaignEx.getReadyState() != 0 && campaignEx.getLoadTimeoutState() != 1) {
|
|
}
|
|
long plct = campaignEx.getPlct() * 1000;
|
|
long timestamp = currentTimeMillis - campaignEx.getTimestamp();
|
|
if ((plct > 0 && plct >= timestamp) || (plct <= 0 && f >= timestamp)) {
|
|
copyOnWriteArrayList2.add(campaignEx);
|
|
}
|
|
}
|
|
}
|
|
return copyOnWriteArrayList2;
|
|
} catch (Exception e) {
|
|
e = e;
|
|
copyOnWriteArrayList = copyOnWriteArrayList2;
|
|
e.printStackTrace();
|
|
return copyOnWriteArrayList;
|
|
}
|
|
} catch (Exception e2) {
|
|
e = e2;
|
|
}
|
|
}
|
|
|
|
public final List<CampaignEx> a(List<CampaignEx> list) {
|
|
ArrayList arrayList = null;
|
|
if (list == null) {
|
|
return null;
|
|
}
|
|
try {
|
|
com.mbridge.msdk.videocommon.d.a b2 = b.a().b();
|
|
long f = b2 != null ? b2.f() : 0L;
|
|
long currentTimeMillis = System.currentTimeMillis();
|
|
if (list.size() <= 0) {
|
|
return null;
|
|
}
|
|
ArrayList arrayList2 = new ArrayList();
|
|
try {
|
|
for (CampaignEx campaignEx : list) {
|
|
if (campaignEx != null) {
|
|
long plct = campaignEx.getPlct() * 1000;
|
|
long timestamp = currentTimeMillis - campaignEx.getTimestamp();
|
|
if ((plct > 0 && plct >= timestamp) || (plct <= 0 && f >= timestamp)) {
|
|
arrayList2.add(campaignEx);
|
|
}
|
|
}
|
|
}
|
|
return arrayList2;
|
|
} catch (Exception e) {
|
|
e = e;
|
|
arrayList = arrayList2;
|
|
e.printStackTrace();
|
|
return arrayList;
|
|
}
|
|
} catch (Exception e2) {
|
|
e = e2;
|
|
}
|
|
}
|
|
|
|
public final List<com.mbridge.msdk.foundation.entity.c> a(String str) {
|
|
try {
|
|
if (TextUtils.isEmpty(str)) {
|
|
return null;
|
|
}
|
|
return this.c.d(str);
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
return null;
|
|
}
|
|
}
|
|
|
|
public final int b(String str, int i, boolean z, String str2) {
|
|
List<CampaignEx> a2;
|
|
try {
|
|
if (TextUtils.isEmpty(str)) {
|
|
return 0;
|
|
}
|
|
ArrayList arrayList = new ArrayList();
|
|
if (z) {
|
|
a2 = this.c.a(str, 0, 0, i, str2);
|
|
} else {
|
|
a2 = this.c.a(str, 0, 0, i, false);
|
|
}
|
|
if (a2 == null) {
|
|
return 0;
|
|
}
|
|
for (CampaignEx campaignEx : a2) {
|
|
if (campaignEx != null && campaignEx.getReadyState() == 0) {
|
|
arrayList.add(campaignEx);
|
|
}
|
|
}
|
|
return arrayList.size();
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
public final List<CampaignEx> b(String str, int i, boolean z) {
|
|
try {
|
|
if (TextUtils.isEmpty(str)) {
|
|
return null;
|
|
}
|
|
return this.c.a(str, 0, 0, i, z);
|
|
} catch (Exception e) {
|
|
af.b(a, e.getLocalizedMessage());
|
|
return null;
|
|
}
|
|
}
|
|
|
|
public final List<CampaignEx> c(String str, int i, boolean z, String str2) {
|
|
long ad;
|
|
List<CampaignEx> a2;
|
|
ArrayList arrayList = null;
|
|
try {
|
|
com.mbridge.msdk.c.g b2 = h.a().b(c.m().k());
|
|
if (b2 != null) {
|
|
ad = b2.ad();
|
|
} else {
|
|
h.a();
|
|
ad = i.a().ad();
|
|
}
|
|
long j = ad * 1000;
|
|
if (TextUtils.isEmpty(str)) {
|
|
return null;
|
|
}
|
|
if (z) {
|
|
a2 = this.c.a(str, 0, 0, i, str2);
|
|
} else {
|
|
a2 = this.c.a(str, 0, 0, i, false);
|
|
}
|
|
long currentTimeMillis = System.currentTimeMillis();
|
|
if (a2 == null) {
|
|
return null;
|
|
}
|
|
ArrayList arrayList2 = new ArrayList();
|
|
try {
|
|
for (CampaignEx campaignEx : a2) {
|
|
if (campaignEx != null && campaignEx.getReadyState() == 0) {
|
|
long plctb = campaignEx.getPlctb() * 1000;
|
|
long timestamp = currentTimeMillis - campaignEx.getTimestamp();
|
|
if ((plctb <= 0 && j >= timestamp) || (plctb > 0 && plctb >= timestamp)) {
|
|
arrayList2.add(campaignEx);
|
|
}
|
|
}
|
|
}
|
|
return arrayList2;
|
|
} catch (Exception e) {
|
|
e = e;
|
|
arrayList = arrayList2;
|
|
e.printStackTrace();
|
|
return arrayList;
|
|
}
|
|
} catch (Exception e2) {
|
|
e = e2;
|
|
}
|
|
}
|
|
|
|
public final void a(CampaignEx campaignEx, String str) {
|
|
if (campaignEx != null) {
|
|
try {
|
|
if (TextUtils.isEmpty(str)) {
|
|
return;
|
|
}
|
|
if (campaignEx.isBidCampaign()) {
|
|
com.mbridge.msdk.foundation.same.a.b.c(str, campaignEx.getRequestId());
|
|
}
|
|
this.c.a(campaignEx.getId(), str, campaignEx.isBidCampaign(), campaignEx.getRequestId());
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
}
|
|
|
|
public final void a(CampaignEx campaignEx) {
|
|
if (campaignEx != null) {
|
|
try {
|
|
if (TextUtils.isEmpty(campaignEx.getId())) {
|
|
return;
|
|
}
|
|
this.c.b(campaignEx.getId(), campaignEx.getRequestId());
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
}
|
|
|
|
public final void b(String str) {
|
|
ConcurrentHashMap<String, com.mbridge.msdk.foundation.entity.c> f;
|
|
try {
|
|
if (TextUtils.isEmpty(str) || (f = this.c.f(str)) == null || f.size() <= 0) {
|
|
return;
|
|
}
|
|
com.mbridge.msdk.c.g b2 = h.a().b(c.m().k());
|
|
if (b2 == null) {
|
|
h.a();
|
|
b2 = i.a();
|
|
}
|
|
long ad = b2 != null ? b2.ad() : 0L;
|
|
long currentTimeMillis = System.currentTimeMillis();
|
|
for (com.mbridge.msdk.foundation.entity.c cVar : f.values()) {
|
|
if (cVar != null) {
|
|
long e = cVar.e();
|
|
if (e <= 0) {
|
|
e = ad;
|
|
}
|
|
if (cVar.f() + (e * 1000) < currentTimeMillis && !TextUtils.isEmpty(cVar.a())) {
|
|
af.b("HBOPTIMIZE", "不在有效期范围内 删除" + cVar.a());
|
|
c(str, cVar.a());
|
|
}
|
|
}
|
|
}
|
|
} catch (Exception e2) {
|
|
e2.printStackTrace();
|
|
}
|
|
}
|
|
|
|
public final void b(String str, String str2) {
|
|
e eVar = this.c;
|
|
if (eVar != null) {
|
|
eVar.e(str, str2);
|
|
}
|
|
}
|
|
|
|
public final void b(String str, int i) {
|
|
int size;
|
|
try {
|
|
List<com.mbridge.msdk.foundation.entity.c> d = this.c.d(str);
|
|
if (d == null || d.size() <= 0 || (size = d.size() - i) <= 0) {
|
|
return;
|
|
}
|
|
for (int i2 = 0; i2 < size; i2++) {
|
|
c(str, d.get(i2).a());
|
|
com.mbridge.msdk.foundation.same.a.b.c(str, d.get(i2).a());
|
|
}
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
|
|
public final synchronized void c(String str, String str2) {
|
|
try {
|
|
this.c.c(str2, str);
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
|
|
public final void a(String str, String str2, List<CampaignEx> list) {
|
|
try {
|
|
if (TextUtils.isEmpty(str2) || list == null || list.size() <= 0) {
|
|
return;
|
|
}
|
|
this.c.a(list, str, str2, 0);
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
|
|
public final synchronized void a(long j, String str) {
|
|
try {
|
|
this.c.a(j, str);
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
af.b(a, e.getMessage());
|
|
}
|
|
}
|
|
|
|
public final synchronized void c(String str, int i) {
|
|
int m;
|
|
try {
|
|
try {
|
|
com.mbridge.msdk.c.g b2 = h.a().b(c.m().k());
|
|
if (b2 == null) {
|
|
h.a();
|
|
b2 = i.a();
|
|
}
|
|
m = b2.m();
|
|
} catch (Exception e) {
|
|
af.b(a, e.getMessage());
|
|
}
|
|
if (m == 0) {
|
|
return;
|
|
}
|
|
List<CampaignEx> b3 = this.c.b(str, i, m == 2);
|
|
if (b3 != null && b3.size() > 0) {
|
|
for (CampaignEx campaignEx : b3) {
|
|
String requestIdNotice = campaignEx.getRequestIdNotice();
|
|
String id = campaignEx.getId();
|
|
com.mbridge.msdk.videocommon.a.b(campaignEx.getCampaignUnitId() + "_" + id + "_" + requestIdNotice + "_" + campaignEx.getCMPTEntryUrl());
|
|
}
|
|
}
|
|
this.c.a(str, i, m == 2);
|
|
} catch (Throwable th) {
|
|
throw th;
|
|
}
|
|
}
|
|
}
|