- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
465 lines
18 KiB
Java
465 lines
18 KiB
Java
package com.mbridge.msdk.videocommon.download;
|
|
|
|
import android.content.Context;
|
|
import android.text.TextUtils;
|
|
import com.mbridge.msdk.MBridgeConstans;
|
|
import com.mbridge.msdk.foundation.entity.CampaignEx;
|
|
import com.mbridge.msdk.foundation.tools.af;
|
|
import com.mbridge.msdk.foundation.tools.ak;
|
|
import com.mbridge.msdk.foundation.tools.ap;
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.concurrent.ConcurrentHashMap;
|
|
import java.util.concurrent.CopyOnWriteArrayList;
|
|
|
|
/* loaded from: classes4.dex */
|
|
public final class i {
|
|
private com.mbridge.msdk.videocommon.listener.a a;
|
|
private ConcurrentHashMap<String, com.mbridge.msdk.videocommon.listener.a> b;
|
|
private final Context c;
|
|
private final String d;
|
|
private com.mbridge.msdk.videocommon.d.c e;
|
|
private final int f;
|
|
private final CopyOnWriteArrayList<CampaignEx> g;
|
|
private final ConcurrentHashMap<String, com.mbridge.msdk.videocommon.download.a> h;
|
|
|
|
public final void a(com.mbridge.msdk.videocommon.listener.a aVar) {
|
|
this.a = aVar;
|
|
}
|
|
|
|
public i(List<CampaignEx> list, String str, int i) {
|
|
CopyOnWriteArrayList<CampaignEx> copyOnWriteArrayList = new CopyOnWriteArrayList<>();
|
|
this.g = copyOnWriteArrayList;
|
|
this.h = new ConcurrentHashMap<>();
|
|
this.c = com.mbridge.msdk.foundation.controller.c.m().c();
|
|
this.d = str;
|
|
this.f = i;
|
|
if (list != null) {
|
|
copyOnWriteArrayList.addAll(list);
|
|
}
|
|
}
|
|
|
|
public i(CampaignEx campaignEx, String str, int i) {
|
|
CopyOnWriteArrayList<CampaignEx> copyOnWriteArrayList = new CopyOnWriteArrayList<>();
|
|
this.g = copyOnWriteArrayList;
|
|
this.h = new ConcurrentHashMap<>();
|
|
this.c = com.mbridge.msdk.foundation.controller.c.m().c();
|
|
this.d = str;
|
|
this.f = i;
|
|
if (campaignEx != null) {
|
|
copyOnWriteArrayList.add(campaignEx);
|
|
}
|
|
}
|
|
|
|
public final void a(String str, com.mbridge.msdk.videocommon.listener.a aVar) {
|
|
if (this.b == null) {
|
|
this.b = new ConcurrentHashMap<>();
|
|
}
|
|
if (aVar == null || TextUtils.isEmpty(str)) {
|
|
return;
|
|
}
|
|
this.b.put(str, aVar);
|
|
}
|
|
|
|
public final void a(List<CampaignEx> list) {
|
|
if (list != null) {
|
|
try {
|
|
this.g.addAll(list);
|
|
} catch (Exception e) {
|
|
if (MBridgeConstans.DEBUG) {
|
|
af.b("RewardVideoRefactorManager", this.d + " update error", e);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public final void a(CampaignEx campaignEx) {
|
|
if (campaignEx != null) {
|
|
try {
|
|
this.g.add(campaignEx);
|
|
} catch (Exception e) {
|
|
if (MBridgeConstans.DEBUG) {
|
|
af.b("RewardVideoRefactorManager", this.d + " update error", e);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
/* JADX WARN: Can't wrap try/catch for region: R(21:15|16|(2:17|18)|(2:20|(4:32|(3:155|156|(1:158))|34|(5:38|(1:(6:44|(2:46|(1:48))|49|(1:51)|52|(16:(3:56|(1:60)|61)(2:151|152)|62|63|(1:147)(1:67)|(3:70|71|72)|115|(2:117|(9:137|(3:140|141|142)|79|(5:85|86|(1:88)|89|(1:113)(7:91|92|(1:94)|95|(2:97|(1:(2:100|(2:102|(1:104)(1:108))(1:109))(1:110))(1:111))(1:112)|105|106))|114|86|(0)|89|(0)(0)))|145|(3:140|141|142)|79|(5:85|86|(0)|89|(0)(0))|114|86|(0)|89|(0)(0))(1:54))(1:43))|154|52|(0)(0))))|163|62|63|(1:65)|147|(3:70|71|72)|115|(0)|145|(0)|79|(0)|114|86|(0)|89|(0)(0)) */
|
|
/* JADX WARN: Code restructure failed: missing block: B:149:0x0144, code lost:
|
|
|
|
r0 = e;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:150:0x00f4, code lost:
|
|
|
|
r10 = false;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:153:0x0128, code lost:
|
|
|
|
if (com.mbridge.msdk.foundation.download.utils.Utils.getDownloadRate(r8.j(), r8.m()) >= r17) goto L78;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:159:0x00ab, code lost:
|
|
|
|
if (r7.getRsIgnoreCheckRule().contains(0) != false) goto L78;
|
|
*/
|
|
/* JADX WARN: Removed duplicated region for block: B:113:0x001d A[SYNTHETIC] */
|
|
/* JADX WARN: Removed duplicated region for block: B:117:0x0158 A[Catch: Exception -> 0x0150, TryCatch #0 {Exception -> 0x0150, blocks: (B:72:0x014c, B:115:0x0152, B:117:0x0158, B:120:0x0163, B:123:0x016a, B:126:0x0171, B:128:0x0177, B:130:0x0181, B:133:0x0191, B:135:0x0197), top: B:71:0x014c }] */
|
|
/* JADX WARN: Removed duplicated region for block: B:139:0x01a3 A[ADDED_TO_REGION] */
|
|
/* JADX WARN: Removed duplicated region for block: B:54:0x0102 */
|
|
/* JADX WARN: Removed duplicated region for block: B:55:0x0103 */
|
|
/* JADX WARN: Removed duplicated region for block: B:78:0x01af A[Catch: Exception -> 0x01c6, TryCatch #3 {Exception -> 0x01c6, blocks: (B:11:0x002d, B:76:0x01ab, B:78:0x01af, B:79:0x01c9, B:86:0x01d9, B:88:0x01de, B:89:0x01e1, B:92:0x01e5, B:94:0x01eb, B:95:0x01f0, B:105:0x0301), top: B:10:0x002d }] */
|
|
/* JADX WARN: Removed duplicated region for block: B:81:0x01cf A[ADDED_TO_REGION] */
|
|
/* JADX WARN: Removed duplicated region for block: B:88:0x01de A[Catch: Exception -> 0x01c6, TryCatch #3 {Exception -> 0x01c6, blocks: (B:11:0x002d, B:76:0x01ab, B:78:0x01af, B:79:0x01c9, B:86:0x01d9, B:88:0x01de, B:89:0x01e1, B:92:0x01e5, B:94:0x01eb, B:95:0x01f0, B:105:0x0301), top: B:10:0x002d }] */
|
|
/* JADX WARN: Removed duplicated region for block: B:91:0x01e5 A[SYNTHETIC] */
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct add '--show-bad-code' argument
|
|
*/
|
|
public final java.util.List<com.mbridge.msdk.videocommon.download.a> a(java.util.List<com.mbridge.msdk.foundation.entity.CampaignEx> r19, boolean r20) {
|
|
/*
|
|
Method dump skipped, instructions count: 906
|
|
To view this dump add '--comments-level debug' option
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: com.mbridge.msdk.videocommon.download.i.a(java.util.List, boolean):java.util.List");
|
|
}
|
|
|
|
private com.mbridge.msdk.videocommon.download.a a(CampaignEx campaignEx, String str, com.mbridge.msdk.videocommon.download.a aVar) {
|
|
if (aVar != null) {
|
|
return aVar;
|
|
}
|
|
com.mbridge.msdk.videocommon.download.a c = c(campaignEx);
|
|
c.n();
|
|
this.h.put(str, c);
|
|
return c;
|
|
}
|
|
|
|
private String b(CampaignEx campaignEx) {
|
|
if (campaignEx == null) {
|
|
return "";
|
|
}
|
|
try {
|
|
CampaignEx.c rewardTemplateMode = campaignEx.getRewardTemplateMode();
|
|
if (rewardTemplateMode != null) {
|
|
return rewardTemplateMode.e();
|
|
}
|
|
} catch (Exception e) {
|
|
if (MBridgeConstans.DEBUG) {
|
|
af.b("RewardVideoRefactorManager", this.d + " getVideoTemplateUrl error", e);
|
|
}
|
|
}
|
|
return "";
|
|
}
|
|
|
|
public final com.mbridge.msdk.videocommon.download.a b() {
|
|
List<com.mbridge.msdk.videocommon.download.a> list;
|
|
if (this.g.size() == 0) {
|
|
af.a("RewardVideoRefactorManager", this.d + " isReady campaignExes is null");
|
|
return null;
|
|
}
|
|
try {
|
|
list = a((List<CampaignEx>) this.g, false);
|
|
} catch (Exception e) {
|
|
if (MBridgeConstans.DEBUG) {
|
|
af.b("RewardVideoRefactorManager", this.d + " isReady error", e);
|
|
}
|
|
list = null;
|
|
}
|
|
if (list == null || list.size() <= 0) {
|
|
return null;
|
|
}
|
|
return list.get(0);
|
|
}
|
|
|
|
private com.mbridge.msdk.videocommon.download.a c(CampaignEx campaignEx) {
|
|
com.mbridge.msdk.videocommon.download.a aVar;
|
|
com.mbridge.msdk.videocommon.download.a aVar2 = null;
|
|
try {
|
|
aVar = new com.mbridge.msdk.videocommon.download.a(this.c, campaignEx, this.d, f());
|
|
} catch (Exception e) {
|
|
e = e;
|
|
}
|
|
try {
|
|
aVar.a(campaignEx);
|
|
aVar.d(this.f);
|
|
aVar.c(f(campaignEx));
|
|
aVar.b(e());
|
|
aVar.e(d(campaignEx));
|
|
aVar.a((c) null);
|
|
aVar.a(new a(this.d, this.b, this.a));
|
|
return aVar;
|
|
} catch (Exception e2) {
|
|
e = e2;
|
|
aVar2 = aVar;
|
|
if (MBridgeConstans.DEBUG) {
|
|
af.a("RewardVideoRefactorManager", this.d + " createAndStartCampaignDownloadTask error " + e.getMessage());
|
|
}
|
|
return aVar2;
|
|
}
|
|
}
|
|
|
|
private int e() {
|
|
com.mbridge.msdk.videocommon.d.c c = c(this.d);
|
|
if (c == null) {
|
|
return 0;
|
|
}
|
|
try {
|
|
return c.s();
|
|
} catch (Exception e) {
|
|
if (!MBridgeConstans.DEBUG) {
|
|
return 0;
|
|
}
|
|
af.a("RewardVideoRefactorManager", this.d + " getCDRate error " + e.getMessage());
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
private com.mbridge.msdk.videocommon.d.c c(String str) {
|
|
try {
|
|
if (this.e == null) {
|
|
this.e = com.mbridge.msdk.videocommon.d.b.a().a(com.mbridge.msdk.foundation.controller.c.m().k(), str, this.f == 287);
|
|
}
|
|
} catch (Exception e) {
|
|
if (MBridgeConstans.DEBUG) {
|
|
af.a("RewardVideoRefactorManager", this.d + " getRewardUnitSetting error " + e.getMessage());
|
|
}
|
|
}
|
|
return this.e;
|
|
}
|
|
|
|
private int d(CampaignEx campaignEx) {
|
|
if (campaignEx == null) {
|
|
return 1;
|
|
}
|
|
try {
|
|
return campaignEx.getVideoCtnType();
|
|
} catch (Exception e) {
|
|
if (!MBridgeConstans.DEBUG) {
|
|
return 1;
|
|
}
|
|
af.a("RewardVideoRefactorManager", this.d + " getVideoCtnType error " + e.getMessage());
|
|
return 1;
|
|
}
|
|
}
|
|
|
|
private int f() {
|
|
if (TextUtils.isEmpty(this.d)) {
|
|
return 1;
|
|
}
|
|
try {
|
|
com.mbridge.msdk.videocommon.d.c c = c(this.d);
|
|
if (c != null) {
|
|
return c.w();
|
|
}
|
|
} catch (Exception e) {
|
|
if (MBridgeConstans.DEBUG) {
|
|
af.a("RewardVideoRefactorManager", this.d + " getDlnet error " + e.getMessage());
|
|
}
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
private boolean a(String str, CampaignEx campaignEx, com.mbridge.msdk.videocommon.download.a aVar) {
|
|
if (campaignEx != null && aVar != null) {
|
|
try {
|
|
if (aVar.b()) {
|
|
af.a("RewardVideoRefactorManager", this.d + " checkEndCardZipOrSourceDownLoad endCard download success");
|
|
return true;
|
|
}
|
|
if (campaignEx.getRsIgnoreCheckRule() != null && campaignEx.getRsIgnoreCheckRule().size() > 0 && campaignEx.getRsIgnoreCheckRule().contains(2)) {
|
|
return true;
|
|
}
|
|
if ((campaignEx.isDynamicView() && !ak.l(str)) || ap.a(str) || campaignEx.isMraid() || TextUtils.isEmpty(str) || ((campaignEx.getLoadTimeoutState() == 1 && !e(campaignEx)) || ((campaignEx.getRsIgnoreCheckRule() != null && campaignEx.getRsIgnoreCheckRule().size() > 0 && campaignEx.getRsIgnoreCheckRule().contains(2)) || ap.b(f.a(str)) || ap.b(f.b(str))))) {
|
|
return true;
|
|
}
|
|
} catch (Throwable th) {
|
|
if (MBridgeConstans.DEBUG) {
|
|
af.a("RewardVideoRefactorManager", this.d + " checkEndCardDownload error " + th.getMessage());
|
|
}
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public final com.mbridge.msdk.videocommon.download.a c() {
|
|
try {
|
|
return b();
|
|
} catch (Throwable th) {
|
|
if (!MBridgeConstans.DEBUG) {
|
|
return null;
|
|
}
|
|
af.b("RewardVideoRefactorManager", this.d + " getCampaignDownLoadTask error:" + th.getMessage());
|
|
return null;
|
|
}
|
|
}
|
|
|
|
public final com.mbridge.msdk.videocommon.download.a a(String str) {
|
|
if (!TextUtils.isEmpty(str) && this.h.containsKey(str)) {
|
|
return this.h.get(str);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public final CopyOnWriteArrayList<Map<String, com.mbridge.msdk.videocommon.download.a>> d() {
|
|
try {
|
|
CopyOnWriteArrayList<Map<String, com.mbridge.msdk.videocommon.download.a>> copyOnWriteArrayList = new CopyOnWriteArrayList<>();
|
|
copyOnWriteArrayList.add(this.h);
|
|
return copyOnWriteArrayList;
|
|
} catch (Exception e) {
|
|
if (!MBridgeConstans.DEBUG) {
|
|
return null;
|
|
}
|
|
af.b("RewardVideoRefactorManager", this.d + " getCampaignDownLoadTaskList error:" + e.getMessage());
|
|
return null;
|
|
}
|
|
}
|
|
|
|
private boolean e(CampaignEx campaignEx) {
|
|
if (campaignEx == null) {
|
|
return false;
|
|
}
|
|
try {
|
|
return campaignEx.getPlayable_ads_without_video() == 2;
|
|
} catch (Throwable th) {
|
|
if (!MBridgeConstans.DEBUG) {
|
|
return false;
|
|
}
|
|
af.a("RewardVideoRefactorManager", this.d + " isPlayerAbleAds error:" + th.getMessage());
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public final void b(String str) {
|
|
com.mbridge.msdk.videocommon.download.a remove;
|
|
CampaignEx l;
|
|
if (TextUtils.isEmpty(str)) {
|
|
return;
|
|
}
|
|
try {
|
|
if (!this.h.containsKey(str) || (remove = this.h.remove(str)) == null || (l = remove.l()) == null) {
|
|
return;
|
|
}
|
|
this.g.remove(l);
|
|
if (MBridgeConstans.DEBUG) {
|
|
af.a("RewardVideoRefactorManager", this.d + " removeCampaignDownloadTask campaign name: " + l.getAppName());
|
|
}
|
|
} catch (Exception e) {
|
|
if (MBridgeConstans.DEBUG) {
|
|
af.b("RewardVideoRefactorManager", this.d + " removeCampaignDownloadTask error:" + e.getMessage());
|
|
}
|
|
}
|
|
}
|
|
|
|
private int f(CampaignEx campaignEx) {
|
|
if (campaignEx == null) {
|
|
return -1;
|
|
}
|
|
if (campaignEx.getReady_rate() != -1) {
|
|
return campaignEx.getReady_rate();
|
|
}
|
|
return g();
|
|
}
|
|
|
|
private int g() {
|
|
try {
|
|
return c(this.d).r();
|
|
} catch (Throwable th) {
|
|
if (!MBridgeConstans.DEBUG) {
|
|
return 100;
|
|
}
|
|
af.a("RewardVideoRefactorManager", this.d + " getRewardReadyRate error:" + th.getMessage());
|
|
return 100;
|
|
}
|
|
}
|
|
|
|
public static final class a implements com.mbridge.msdk.videocommon.listener.a {
|
|
private final String a;
|
|
private final ConcurrentHashMap<String, com.mbridge.msdk.videocommon.listener.a> b;
|
|
private final com.mbridge.msdk.videocommon.listener.a c;
|
|
|
|
public a(String str, ConcurrentHashMap<String, com.mbridge.msdk.videocommon.listener.a> concurrentHashMap, com.mbridge.msdk.videocommon.listener.a aVar) {
|
|
this.a = str;
|
|
this.b = concurrentHashMap;
|
|
this.c = aVar;
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.videocommon.listener.a
|
|
public final void a(String str) {
|
|
com.mbridge.msdk.videocommon.listener.a aVar = this.c;
|
|
if (aVar != null) {
|
|
try {
|
|
aVar.a(str);
|
|
} catch (Exception e) {
|
|
if (MBridgeConstans.DEBUG) {
|
|
af.b("RewardVideoRefactorManager", this.a + " videoDownloadListener onDownLoadDone error: " + e.getMessage());
|
|
}
|
|
}
|
|
}
|
|
ConcurrentHashMap<String, com.mbridge.msdk.videocommon.listener.a> concurrentHashMap = this.b;
|
|
if (concurrentHashMap != null) {
|
|
Iterator<com.mbridge.msdk.videocommon.listener.a> it = concurrentHashMap.values().iterator();
|
|
while (it.hasNext()) {
|
|
try {
|
|
it.next().a(str);
|
|
} catch (Exception e2) {
|
|
if (MBridgeConstans.DEBUG) {
|
|
af.b("RewardVideoRefactorManager", this.a + " videoDownloadListener onDownLoadDone error: " + e2.getMessage());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.videocommon.listener.a
|
|
public final void a(String str, String str2) {
|
|
com.mbridge.msdk.videocommon.listener.a aVar = this.c;
|
|
if (aVar != null) {
|
|
try {
|
|
aVar.a(str, str2);
|
|
} catch (Exception e) {
|
|
if (MBridgeConstans.DEBUG) {
|
|
af.b("RewardVideoRefactorManager", this.a + " videoDownloadListener onDownLoadFailed error: " + e.getMessage());
|
|
}
|
|
}
|
|
}
|
|
ConcurrentHashMap<String, com.mbridge.msdk.videocommon.listener.a> concurrentHashMap = this.b;
|
|
if (concurrentHashMap != null) {
|
|
Iterator<com.mbridge.msdk.videocommon.listener.a> it = concurrentHashMap.values().iterator();
|
|
while (it.hasNext()) {
|
|
try {
|
|
it.next().a(str, str2);
|
|
} catch (Exception e2) {
|
|
if (MBridgeConstans.DEBUG) {
|
|
af.b("RewardVideoRefactorManager", this.a + " videoDownloadListener onDownLoadFailed error: " + e2.getMessage());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public final void a() {
|
|
CopyOnWriteArrayList<CampaignEx> copyOnWriteArrayList = this.g;
|
|
if (copyOnWriteArrayList == null || copyOnWriteArrayList.size() == 0) {
|
|
af.a("RewardVideoRefactorManager", this.d + " load campaignExes is null");
|
|
return;
|
|
}
|
|
Iterator<CampaignEx> it = copyOnWriteArrayList.iterator();
|
|
while (it.hasNext()) {
|
|
CampaignEx next = it.next();
|
|
if (next != null) {
|
|
try {
|
|
String str = next.getRequestId() + next.getId() + next.getVideoUrlEncode();
|
|
if (!this.h.containsKey(str)) {
|
|
a(next, str, (com.mbridge.msdk.videocommon.download.a) null);
|
|
}
|
|
} catch (Exception e) {
|
|
if (MBridgeConstans.DEBUG) {
|
|
af.b("RewardVideoRefactorManager", this.d + " handlerCampaignLoadEvent error", e);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|