- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
598 lines
21 KiB
Java
598 lines
21 KiB
Java
package com.applovin.impl;
|
|
|
|
import android.net.Uri;
|
|
import android.os.Bundle;
|
|
import android.text.TextUtils;
|
|
import com.applovin.impl.e1;
|
|
import com.applovin.impl.f1;
|
|
import com.applovin.impl.sdk.utils.CollectionUtils;
|
|
import com.applovin.impl.sdk.utils.StringUtils;
|
|
import com.applovin.impl.ze;
|
|
import com.applovin.sdk.AppLovinAdLoadListener;
|
|
import com.applovin.sdk.AppLovinErrorCodes;
|
|
import com.applovin.sdk.AppLovinSdkUtils;
|
|
import com.mbridge.msdk.foundation.entity.CampaignEx;
|
|
import com.vungle.ads.internal.model.AdPayload;
|
|
import java.io.File;
|
|
import java.io.InputStream;
|
|
import java.util.ArrayList;
|
|
import java.util.Arrays;
|
|
import java.util.Collection;
|
|
import java.util.HashSet;
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.UUID;
|
|
import java.util.concurrent.ExecutorService;
|
|
|
|
/* loaded from: classes.dex */
|
|
public abstract class bm extends yl implements ze.a {
|
|
protected final com.applovin.impl.sdk.ad.b h;
|
|
protected final u2 i;
|
|
private AppLovinAdLoadListener j;
|
|
private final com.applovin.impl.sdk.l k;
|
|
private final Collection l;
|
|
private boolean m;
|
|
protected ExecutorService n;
|
|
protected ExecutorService o;
|
|
protected List p;
|
|
protected String q;
|
|
|
|
public interface e {
|
|
void a(String str);
|
|
}
|
|
|
|
public List e() {
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
this.c.a(this.b, "Caching mute images...");
|
|
}
|
|
ArrayList arrayList = new ArrayList();
|
|
if (this.h.L() != null) {
|
|
arrayList.add(a(this.h.L().toString(), new a()));
|
|
}
|
|
if (this.h.f0() != null) {
|
|
arrayList.add(a(this.h.f0().toString(), new b()));
|
|
}
|
|
return arrayList;
|
|
}
|
|
|
|
public void f() {
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
this.c.a(this.b, "Rendered new ad:" + this.h);
|
|
}
|
|
AppLovinSdkUtils.runOnUiThread(new Runnable() { // from class: com.applovin.impl.bm$$ExternalSyntheticLambda0
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
bm.this.i();
|
|
}
|
|
});
|
|
}
|
|
|
|
public void j() {
|
|
if (z3.f()) {
|
|
return;
|
|
}
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
this.c.a(this.b, "Caching mute images...");
|
|
}
|
|
Uri a2 = a(this.h.L(), CampaignEx.JSON_NATIVE_VIDEO_MUTE);
|
|
if (a2 != null) {
|
|
this.h.b(a2);
|
|
}
|
|
Uri a3 = a(this.h.f0(), CampaignEx.JSON_NATIVE_VIDEO_UNMUTE);
|
|
if (a3 != null) {
|
|
this.h.c(a3);
|
|
}
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
this.c.a(this.b, "Ad updated with muteImageFilename = " + this.h.L() + ", unmuteImageFilename = " + this.h.f0());
|
|
}
|
|
}
|
|
|
|
public boolean l() {
|
|
return this.m;
|
|
}
|
|
|
|
public bm(String str, com.applovin.impl.sdk.ad.b bVar, com.applovin.impl.sdk.j jVar, AppLovinAdLoadListener appLovinAdLoadListener) {
|
|
super(str, jVar);
|
|
if (bVar != null) {
|
|
this.h = bVar;
|
|
this.j = appLovinAdLoadListener;
|
|
this.k = jVar.B();
|
|
this.l = h();
|
|
this.i = new u2();
|
|
if (((Boolean) jVar.a(sj.c1)).booleanValue()) {
|
|
this.q = StringUtils.isValidString(bVar.H()) ? bVar.H() : UUID.randomUUID().toString();
|
|
this.n = jVar.j0().a("com.applovin.sdk.caching." + this.q, ((Integer) jVar.a(sj.d1)).intValue());
|
|
this.o = jVar.j0().a("com.applovin.sdk.caching.html." + this.q, ((Integer) jVar.a(sj.e1)).intValue());
|
|
return;
|
|
}
|
|
return;
|
|
}
|
|
throw new IllegalArgumentException("No ad specified.");
|
|
}
|
|
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
if (this.h.e1()) {
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
this.c.a(this.b, "Subscribing to timeout events...");
|
|
}
|
|
this.a.S().a(this);
|
|
}
|
|
}
|
|
|
|
public void k() {
|
|
this.a.S().b(this);
|
|
ExecutorService executorService = this.n;
|
|
if (executorService != null) {
|
|
executorService.shutdown();
|
|
this.n = null;
|
|
}
|
|
ExecutorService executorService2 = this.o;
|
|
if (executorService2 != null) {
|
|
executorService2.shutdown();
|
|
this.o = null;
|
|
}
|
|
}
|
|
|
|
public void g() {
|
|
this.m = true;
|
|
List list = this.p;
|
|
if (list != null && !list.isEmpty()) {
|
|
Iterator it = this.p.iterator();
|
|
while (it.hasNext()) {
|
|
((d1) it.next()).a(true);
|
|
}
|
|
}
|
|
ExecutorService executorService = this.n;
|
|
if (executorService != null) {
|
|
executorService.shutdown();
|
|
this.n = null;
|
|
}
|
|
ExecutorService executorService2 = this.o;
|
|
if (executorService2 != null) {
|
|
executorService2.shutdown();
|
|
this.o = null;
|
|
}
|
|
}
|
|
|
|
public List a(List list) {
|
|
this.p = list;
|
|
return this.a.j0().a(list, this.n);
|
|
}
|
|
|
|
public class a implements f1.a {
|
|
public a() {
|
|
}
|
|
|
|
@Override // com.applovin.impl.f1.a
|
|
public void a(Uri uri) {
|
|
bm.this.h.b(uri);
|
|
com.applovin.impl.sdk.n nVar = bm.this.c;
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
bm bmVar = bm.this;
|
|
bmVar.c.a(bmVar.b, "Ad updated with muteImageUri = " + uri);
|
|
}
|
|
}
|
|
}
|
|
|
|
public class b implements f1.a {
|
|
public b() {
|
|
}
|
|
|
|
@Override // com.applovin.impl.f1.a
|
|
public void a(Uri uri) {
|
|
bm.this.h.c(uri);
|
|
com.applovin.impl.sdk.n nVar = bm.this.c;
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
bm bmVar = bm.this;
|
|
bmVar.c.a(bmVar.b, "Ad updated with unmuteImageUri = " + uri);
|
|
}
|
|
}
|
|
}
|
|
|
|
public class c implements f1.a {
|
|
final /* synthetic */ f1.a a;
|
|
|
|
public c(f1.a aVar) {
|
|
this.a = aVar;
|
|
}
|
|
|
|
@Override // com.applovin.impl.f1.a
|
|
public void a(Uri uri) {
|
|
if (uri != null) {
|
|
com.applovin.impl.sdk.n nVar = bm.this.c;
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
bm bmVar = bm.this;
|
|
bmVar.c.a(bmVar.b, "Finish caching video for ad #" + bm.this.h.getAdIdNumber() + ". Updating ad with cachedVideoURL = " + uri);
|
|
}
|
|
this.a.a(uri);
|
|
return;
|
|
}
|
|
com.applovin.impl.sdk.n nVar2 = bm.this.c;
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
bm bmVar2 = bm.this;
|
|
bmVar2.c.b(bmVar2.b, "Failed to cache video");
|
|
}
|
|
bm.this.a(AppLovinErrorCodes.UNABLE_TO_PRECACHE_VIDEO_RESOURCES);
|
|
Bundle bundle = new Bundle();
|
|
bundle.putLong("ad_id", bm.this.h.getAdIdNumber());
|
|
bundle.putInt("load_response_code", bm.this.i.b());
|
|
Throwable a = bm.this.i.a();
|
|
if (a != null) {
|
|
bundle.putString("load_exception_message", a.getMessage());
|
|
}
|
|
bm.this.a.p().a(bundle, "video_caching_failed");
|
|
}
|
|
}
|
|
|
|
public class d implements e1.c {
|
|
final /* synthetic */ e a;
|
|
|
|
public d(e eVar) {
|
|
this.a = eVar;
|
|
}
|
|
|
|
@Override // com.applovin.impl.e1.c
|
|
public void a(String str, boolean z) {
|
|
if (z) {
|
|
bm.this.a(AppLovinErrorCodes.UNABLE_TO_PRECACHE_HTML_RESOURCES);
|
|
return;
|
|
}
|
|
e eVar = this.a;
|
|
if (eVar != null) {
|
|
eVar.a(str);
|
|
}
|
|
}
|
|
}
|
|
|
|
public Uri c(String str) {
|
|
return c(str, this.h.X(), true);
|
|
}
|
|
|
|
public Uri b(String str) {
|
|
return a(str, this.h.X(), true);
|
|
}
|
|
|
|
public String d(String str, List list, boolean z) {
|
|
if (((Boolean) this.a.a(sj.D)).booleanValue()) {
|
|
try {
|
|
InputStream a2 = this.k.a(str, list, z, this.i);
|
|
if (a2 == null) {
|
|
if (a2 != null) {
|
|
a2.close();
|
|
}
|
|
return null;
|
|
}
|
|
try {
|
|
String a3 = this.k.a(a2);
|
|
a2.close();
|
|
return a3;
|
|
} finally {
|
|
}
|
|
} catch (Throwable th) {
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
this.c.a(this.b, "Unknown failure to read input stream.", th);
|
|
}
|
|
this.c.a(this.b, th);
|
|
this.a.E().a(this.b, "readInputStreamAsString", th);
|
|
return null;
|
|
}
|
|
}
|
|
InputStream a4 = this.k.a(str, list, z, this.i);
|
|
if (a4 == null) {
|
|
return null;
|
|
}
|
|
try {
|
|
String a5 = this.k.a(a4);
|
|
yp.a(a4, this.a);
|
|
return a5;
|
|
} catch (Throwable th2) {
|
|
try {
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
this.c.a(this.b, "Unknown failure to read input stream.", th2);
|
|
}
|
|
this.a.E().a(this.b, "readInputStreamAsString", th2);
|
|
yp.a(a4, this.a);
|
|
return null;
|
|
} catch (Throwable th3) {
|
|
yp.a(a4, this.a);
|
|
throw th3;
|
|
}
|
|
}
|
|
}
|
|
|
|
public Uri c(String str, List list, boolean z) {
|
|
if (!StringUtils.isValidString(str)) {
|
|
return null;
|
|
}
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
this.c.a(this.b, "Caching video " + str + "...");
|
|
}
|
|
String a2 = this.k.a(a(), str, this.h.getCachePrefix(), list, z, this.i, this.a.B().a(str, this.h));
|
|
if (StringUtils.isValidString(a2)) {
|
|
File a3 = this.k.a(a2, a());
|
|
if (a3 != null) {
|
|
Uri fromFile = Uri.fromFile(a3);
|
|
if (fromFile != null) {
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
this.c.a(this.b, "Finish caching video for ad #" + this.h.getAdIdNumber() + ". Updating ad with cachedVideoFilename = " + a2);
|
|
}
|
|
return fromFile;
|
|
}
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
this.c.b(this.b, "Unable to create URI from cached video file = " + a3);
|
|
}
|
|
this.a.E().a(la.G, "extractUriFromVideoFile", (Map) CollectionUtils.hashMap("url", a2));
|
|
return null;
|
|
}
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
this.c.b(this.b, "Unable to retrieve File from cached video filename = " + a2);
|
|
}
|
|
this.a.E().a(la.G, "retrieveVideoFile", (Map) CollectionUtils.hashMap("url", a2));
|
|
return null;
|
|
}
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
this.c.b(this.b, "Failed to cache video: " + str);
|
|
}
|
|
this.a.E().a(la.G, "cacheVideo", (Map) CollectionUtils.hashMap("url", str));
|
|
a(AppLovinErrorCodes.UNABLE_TO_PRECACHE_VIDEO_RESOURCES);
|
|
return null;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public /* synthetic */ void i() {
|
|
AppLovinAdLoadListener appLovinAdLoadListener = this.j;
|
|
if (appLovinAdLoadListener != null) {
|
|
appLovinAdLoadListener.adReceived(this.h);
|
|
this.j = null;
|
|
}
|
|
}
|
|
|
|
private Collection h() {
|
|
HashSet hashSet = new HashSet();
|
|
for (char c2 : ((String) this.a.a(sj.X0)).toCharArray()) {
|
|
hashSet.add(Character.valueOf(c2));
|
|
}
|
|
hashSet.add('\"');
|
|
return hashSet;
|
|
}
|
|
|
|
public String b(String str, List list, boolean z) {
|
|
InputStream inputStream;
|
|
if (StringUtils.isValidString(str)) {
|
|
Uri parse = Uri.parse(str);
|
|
if (parse == null) {
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
this.c.a(this.b, "Nothing to cache, skipping...");
|
|
}
|
|
return null;
|
|
}
|
|
try {
|
|
File a2 = this.k.a(yp.a(parse, this.h.getCachePrefix(), this.a), a());
|
|
if (!this.k.a(a2)) {
|
|
if (((Boolean) this.a.a(sj.D)).booleanValue()) {
|
|
try {
|
|
InputStream a3 = this.k.a(str, list, z, this.i);
|
|
try {
|
|
if (a3 != null) {
|
|
this.k.a(a3, a2);
|
|
} else {
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
this.c.b(this.b, "Failed to load resource: " + str);
|
|
}
|
|
this.a.E().a(la.G, "cacheStringResource", (Map) CollectionUtils.hashMap("url", str));
|
|
}
|
|
if (a3 != null) {
|
|
a3.close();
|
|
}
|
|
} finally {
|
|
}
|
|
} catch (Throwable th) {
|
|
this.c.a(this.b, th);
|
|
this.a.E().a(this.b, "cacheStringResource", th);
|
|
}
|
|
} else {
|
|
try {
|
|
inputStream = this.k.a(str, list, z, this.i);
|
|
try {
|
|
if (inputStream != null) {
|
|
this.k.a(inputStream, a2);
|
|
} else {
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
this.c.b(this.b, "Failed to load resource: " + str);
|
|
}
|
|
this.a.E().a(la.G, "cacheStringResource", (Map) CollectionUtils.hashMap("url", str));
|
|
}
|
|
yp.a(inputStream, this.a);
|
|
} catch (Throwable th2) {
|
|
th = th2;
|
|
yp.a(inputStream, this.a);
|
|
throw th;
|
|
}
|
|
} catch (Throwable th3) {
|
|
th = th3;
|
|
inputStream = null;
|
|
}
|
|
}
|
|
}
|
|
return this.k.e(a2);
|
|
} catch (Throwable th4) {
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
this.c.a(this.b, "Resource at " + str + " failed to load.", th4);
|
|
}
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
private Uri a(String str, String str2) {
|
|
File a2 = this.k.a(yp.a(Uri.parse(str2), this.h.getCachePrefix(), this.a), com.applovin.impl.sdk.j.l());
|
|
if (a2 == null) {
|
|
return null;
|
|
}
|
|
if (this.k.a(a2)) {
|
|
this.i.a(a2.length());
|
|
return Uri.parse(AdPayload.FILE_SCHEME + a2.getAbsolutePath());
|
|
}
|
|
String str3 = str + str2;
|
|
if (!this.k.a(a2, str3, Arrays.asList(str), this.i, this.a.B().a(str3, this.h))) {
|
|
return null;
|
|
}
|
|
return Uri.parse(AdPayload.FILE_SCHEME + a2.getAbsolutePath());
|
|
}
|
|
|
|
public f1 b(String str, f1.a aVar) {
|
|
return a(str, this.h.X(), true, aVar);
|
|
}
|
|
|
|
/* JADX WARN: Code restructure failed: missing block: B:64:0x0038, code lost:
|
|
|
|
continue;
|
|
*/
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct add '--show-bad-code' argument
|
|
*/
|
|
public java.lang.String a(java.lang.String r12, java.util.List r13, com.applovin.impl.sdk.ad.b r14) {
|
|
/*
|
|
Method dump skipped, instructions count: 360
|
|
To view this dump add '--comments-level debug' option
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: com.applovin.impl.bm.a(java.lang.String, java.util.List, com.applovin.impl.sdk.ad.b):java.lang.String");
|
|
}
|
|
|
|
public Uri a(String str, List list, boolean z) {
|
|
try {
|
|
String a2 = this.k.a(a(), str, this.h.getCachePrefix(), list, z, this.i, this.a.B().a(str, this.h));
|
|
if (StringUtils.isValidString(a2)) {
|
|
File a3 = this.k.a(a2, a());
|
|
if (a3 != null) {
|
|
Uri fromFile = Uri.fromFile(a3);
|
|
if (fromFile != null) {
|
|
return fromFile;
|
|
}
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
this.c.b(this.b, "Unable to extract Uri from image file");
|
|
}
|
|
this.a.E().a(la.G, "extractUriFromImageFile", (Map) CollectionUtils.hashMap("url", a2));
|
|
return null;
|
|
}
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
this.c.b(this.b, "Unable to retrieve File from cached image filename = " + a2);
|
|
}
|
|
this.a.E().a(la.G, "retrieveImageFile", (Map) CollectionUtils.hashMap("url", a2));
|
|
return null;
|
|
}
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
this.c.b(this.b, "Failed to cache image: " + str);
|
|
}
|
|
this.a.E().a(la.G, "cacheImageResource", (Map) CollectionUtils.hashMap("url", str));
|
|
return null;
|
|
} catch (Throwable th) {
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
this.c.a(this.b, "Failed to cache image at url = " + str, th);
|
|
}
|
|
this.a.E().a(this.b, "cacheImageResource", th, CollectionUtils.hashMap("url", str));
|
|
return null;
|
|
}
|
|
}
|
|
|
|
public Uri a(Uri uri, String str) {
|
|
if (uri == null) {
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
this.c.a(this.b, "No " + str + " image to cache");
|
|
}
|
|
return null;
|
|
}
|
|
String uri2 = uri.toString();
|
|
if (TextUtils.isEmpty(uri2)) {
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
this.c.a(this.b, "Failed to cache " + str + " image");
|
|
}
|
|
return null;
|
|
}
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
this.c.a(this.b, "Caching " + str + " image...");
|
|
}
|
|
return b(uri2);
|
|
}
|
|
|
|
public void a(com.applovin.impl.sdk.ad.b bVar) {
|
|
String a2 = a(bVar.h0(), bVar.i0(), bVar.P0(), bVar.X(), bVar.b1());
|
|
if (bVar.O0() && StringUtils.isValidString(a2)) {
|
|
String a3 = a(a2, bVar.X(), bVar);
|
|
bVar.a(a3);
|
|
this.c.f(this.b, "Ad updated with video button HTML assets cached = " + a3);
|
|
}
|
|
}
|
|
|
|
public f1 a(String str, List list, boolean z, f1.a aVar) {
|
|
if (TextUtils.isEmpty(str)) {
|
|
if (!com.applovin.impl.sdk.n.a()) {
|
|
return null;
|
|
}
|
|
this.c.a(this.b, "No video to cache, skipping...");
|
|
return null;
|
|
}
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
this.c.a(this.b, "Caching video " + str + "...");
|
|
}
|
|
return new f1(str, this.h, list, z, this.i, this.a, new c(aVar));
|
|
}
|
|
|
|
public void a(int i) {
|
|
if (this.j != null) {
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
this.c.a(this.b, "Calling back ad load failed with error code: " + i);
|
|
}
|
|
this.j.failedToReceiveAd(i);
|
|
this.j = null;
|
|
}
|
|
g();
|
|
}
|
|
|
|
@Override // com.applovin.impl.ze.a
|
|
public void a(ge geVar) {
|
|
if (geVar.S().equalsIgnoreCase(this.h.H())) {
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
this.c.b(this.b, "Updating flag for timeout...");
|
|
}
|
|
g();
|
|
}
|
|
this.a.S().b(this);
|
|
}
|
|
|
|
public String a(String str, String str2, boolean z, List list, boolean z2) {
|
|
if (StringUtils.isValidString(str2)) {
|
|
String a2 = a(str2, z, list, z2);
|
|
if (StringUtils.isValidString(a2)) {
|
|
return a2;
|
|
}
|
|
if (TextUtils.isEmpty(str)) {
|
|
a(AppLovinErrorCodes.UNABLE_TO_PRECACHE_HTML_RESOURCES);
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
this.c.b(this.b, "Could not retrieve HTML from: " + str2 + " and HTML source is invalid.");
|
|
}
|
|
this.a.E().a(la.G, "retrieveHtmlString", (Map) CollectionUtils.hashMap("url", str2));
|
|
}
|
|
}
|
|
return str;
|
|
}
|
|
|
|
private String a(String str, boolean z, List list, boolean z2) {
|
|
if (z) {
|
|
return b(str, list, z2);
|
|
}
|
|
return d(str, list, z2);
|
|
}
|
|
|
|
public f1 a(String str, f1.a aVar) {
|
|
return new f1(str, this.h, this.i, this.a, aVar);
|
|
}
|
|
|
|
public e1 a(String str, List list, e eVar) {
|
|
return new e1(str, this.h, list, this.i, this.o, this.a, new d(eVar));
|
|
}
|
|
}
|