Add decompiled APK source code (JADX)

- 28,932 files
- Full Java source code
- Smali files
- Resources

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-02-18 14:52:23 -08:00
parent cc210a65ea
commit f9d20bb3fc
26991 changed files with 2541449 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
package com.vungle.ads.internal.load;
import com.vungle.ads.VungleError;
import com.vungle.ads.internal.model.AdPayload;
/* loaded from: classes4.dex */
public interface AdLoaderCallback {
void onFailure(VungleError vungleError);
void onSuccess(AdPayload adPayload);
}

View File

@@ -0,0 +1,61 @@
package com.vungle.ads.internal.load;
import com.vungle.ads.VungleAdSize;
import com.vungle.ads.internal.model.BidPayload;
import com.vungle.ads.internal.model.Placement;
import java.io.Serializable;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes4.dex */
public final class AdRequest implements Serializable {
private final BidPayload adMarkup;
private final Placement placement;
private final VungleAdSize requestAdSize;
public final BidPayload getAdMarkup() {
return this.adMarkup;
}
public final Placement getPlacement() {
return this.placement;
}
public final VungleAdSize getRequestAdSize() {
return this.requestAdSize;
}
public AdRequest(Placement placement, BidPayload bidPayload, VungleAdSize vungleAdSize) {
Intrinsics.checkNotNullParameter(placement, "placement");
this.placement = placement;
this.adMarkup = bidPayload;
this.requestAdSize = vungleAdSize;
}
public String toString() {
return "AdRequest{placementId='" + this.placement.getReferenceId() + "', adMarkup=" + this.adMarkup + ", requestAdSize=" + this.requestAdSize + '}';
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null || !Intrinsics.areEqual(AdRequest.class, obj.getClass())) {
return false;
}
AdRequest adRequest = (AdRequest) obj;
if (!Intrinsics.areEqual(this.placement.getReferenceId(), adRequest.placement.getReferenceId()) || !Intrinsics.areEqual(this.requestAdSize, adRequest.requestAdSize)) {
return false;
}
BidPayload bidPayload = this.adMarkup;
BidPayload bidPayload2 = adRequest.adMarkup;
return bidPayload != null ? Intrinsics.areEqual(bidPayload, bidPayload2) : bidPayload2 == null;
}
public int hashCode() {
int hashCode = this.placement.getReferenceId().hashCode() * 31;
VungleAdSize vungleAdSize = this.requestAdSize;
int hashCode2 = (hashCode + (vungleAdSize != null ? vungleAdSize.hashCode() : 0)) * 31;
BidPayload bidPayload = this.adMarkup;
return hashCode2 + (bidPayload != null ? bidPayload.hashCode() : 0);
}
}

View File

@@ -0,0 +1,173 @@
package com.vungle.ads.internal.load;
import com.vungle.ads.AnalyticsClient;
import com.vungle.ads.AssetDownloadError;
import com.vungle.ads.SingleValueMetric;
import com.vungle.ads.internal.downloader.AssetDownloadListener;
import com.vungle.ads.internal.downloader.DownloadRequest;
import com.vungle.ads.internal.executor.VungleThreadPoolExecutor;
import com.vungle.ads.internal.model.AdAsset;
import com.vungle.ads.internal.model.AdPayload;
import com.vungle.ads.internal.util.Logger;
import java.io.File;
import java.io.IOException;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicLong;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes4.dex */
public final class BaseAdLoader$assetDownloadListener$1 implements AssetDownloadListener {
final /* synthetic */ BaseAdLoader this$0;
public BaseAdLoader$assetDownloadListener$1(BaseAdLoader baseAdLoader) {
this.this$0 = baseAdLoader;
}
@Override // com.vungle.ads.internal.downloader.AssetDownloadListener
public void onError(AssetDownloadListener.DownloadError downloadError, final DownloadRequest downloadRequest) {
Intrinsics.checkNotNullParameter(downloadRequest, "downloadRequest");
Logger.Companion companion = Logger.Companion;
StringBuilder sb = new StringBuilder();
sb.append("onError called: reason ");
sb.append(downloadError != null ? Integer.valueOf(downloadError.getReason()) : null);
sb.append("; cause ");
sb.append(downloadError != null ? downloadError.getCause() : null);
companion.e("BaseAdLoader", sb.toString());
VungleThreadPoolExecutor backgroundExecutor = this.this$0.getSdkExecutors().getBackgroundExecutor();
final BaseAdLoader baseAdLoader = this.this$0;
backgroundExecutor.execute(new Runnable() { // from class: com.vungle.ads.internal.load.BaseAdLoader$assetDownloadListener$1$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
BaseAdLoader$assetDownloadListener$1.m3894onError$lambda0(BaseAdLoader.this, downloadRequest);
}
});
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: onError$lambda-0, reason: not valid java name */
public static final void m3894onError$lambda0(BaseAdLoader this$0, DownloadRequest downloadRequest) {
AtomicBoolean atomicBoolean;
AtomicLong atomicLong;
AtomicLong atomicLong2;
AtomicBoolean atomicBoolean2;
Intrinsics.checkNotNullParameter(this$0, "this$0");
Intrinsics.checkNotNullParameter(downloadRequest, "$downloadRequest");
atomicBoolean = this$0.fullyDownloaded;
atomicBoolean.set(false);
if (downloadRequest.getAsset().isRequired()) {
atomicBoolean2 = this$0.requiredAssetDownloaded;
atomicBoolean2.set(false);
}
if (downloadRequest.getAsset().isRequired()) {
atomicLong2 = this$0.downloadRequiredCount;
if (atomicLong2.decrementAndGet() <= 0) {
this$0.onAdLoadFailed(new AssetDownloadError());
this$0.cancel();
return;
}
}
atomicLong = this$0.downloadCount;
if (atomicLong.decrementAndGet() <= 0) {
this$0.onAdLoadFailed(new AssetDownloadError());
}
}
@Override // com.vungle.ads.internal.downloader.AssetDownloadListener
public void onSuccess(final File file, final DownloadRequest downloadRequest) {
Intrinsics.checkNotNullParameter(file, "file");
Intrinsics.checkNotNullParameter(downloadRequest, "downloadRequest");
VungleThreadPoolExecutor backgroundExecutor = this.this$0.getSdkExecutors().getBackgroundExecutor();
final BaseAdLoader baseAdLoader = this.this$0;
backgroundExecutor.execute(new Runnable() { // from class: com.vungle.ads.internal.load.BaseAdLoader$assetDownloadListener$1$$ExternalSyntheticLambda1
@Override // java.lang.Runnable
public final void run() {
BaseAdLoader$assetDownloadListener$1.m3895onSuccess$lambda1(file, this, downloadRequest, baseAdLoader);
}
});
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: onSuccess$lambda-1, reason: not valid java name */
public static final void m3895onSuccess$lambda1(File file, BaseAdLoader$assetDownloadListener$1 this$0, DownloadRequest downloadRequest, BaseAdLoader this$1) {
SingleValueMetric singleValueMetric;
SingleValueMetric singleValueMetric2;
AtomicLong atomicLong;
AtomicBoolean atomicBoolean;
AtomicLong atomicLong2;
AtomicBoolean atomicBoolean2;
boolean processVmTemplate;
AtomicBoolean atomicBoolean3;
AtomicBoolean atomicBoolean4;
Intrinsics.checkNotNullParameter(file, "$file");
Intrinsics.checkNotNullParameter(this$0, "this$0");
Intrinsics.checkNotNullParameter(downloadRequest, "$downloadRequest");
Intrinsics.checkNotNullParameter(this$1, "this$1");
if (!file.exists()) {
this$0.onError(new AssetDownloadListener.DownloadError(-1, new IOException("Downloaded file not found!"), AssetDownloadListener.DownloadError.ErrorReason.Companion.getFILE_NOT_FOUND_ERROR()), downloadRequest);
return;
}
AdAsset asset = downloadRequest.getAsset();
asset.setFileSize(file.length());
asset.setStatus(AdAsset.Status.DOWNLOAD_SUCCESS);
if (downloadRequest.isTemplate()) {
downloadRequest.stopRecord();
SingleValueMetric singleValueMetric3 = downloadRequest.isHtmlTemplate() ? this$1.templateHtmlSizeMetric : this$1.templateSizeMetric;
singleValueMetric3.setValue(Long.valueOf(file.length()));
AnalyticsClient analyticsClient = AnalyticsClient.INSTANCE;
String referenceId = this$1.getAdRequest().getPlacement().getReferenceId();
AdPayload advertisement$vungle_ads_release = this$1.getAdvertisement$vungle_ads_release();
String creativeId = advertisement$vungle_ads_release != null ? advertisement$vungle_ads_release.getCreativeId() : null;
AdPayload advertisement$vungle_ads_release2 = this$1.getAdvertisement$vungle_ads_release();
analyticsClient.logMetric$vungle_ads_release(singleValueMetric3, referenceId, creativeId, advertisement$vungle_ads_release2 != null ? advertisement$vungle_ads_release2.eventId() : null, asset.getServerPath());
} else if (downloadRequest.isMainVideo()) {
singleValueMetric = this$1.mainVideoSizeMetric;
singleValueMetric.setValue(Long.valueOf(file.length()));
AnalyticsClient analyticsClient2 = AnalyticsClient.INSTANCE;
singleValueMetric2 = this$1.mainVideoSizeMetric;
String referenceId2 = this$1.getAdRequest().getPlacement().getReferenceId();
AdPayload advertisement$vungle_ads_release3 = this$1.getAdvertisement$vungle_ads_release();
String creativeId2 = advertisement$vungle_ads_release3 != null ? advertisement$vungle_ads_release3.getCreativeId() : null;
AdPayload advertisement$vungle_ads_release4 = this$1.getAdvertisement$vungle_ads_release();
analyticsClient2.logMetric$vungle_ads_release(singleValueMetric2, referenceId2, creativeId2, advertisement$vungle_ads_release4 != null ? advertisement$vungle_ads_release4.eventId() : null, asset.getServerPath());
}
AdPayload advertisement$vungle_ads_release5 = this$1.getAdvertisement$vungle_ads_release();
if (advertisement$vungle_ads_release5 != null) {
advertisement$vungle_ads_release5.updateAdAssetPath(asset);
}
if (downloadRequest.isTemplate()) {
processVmTemplate = this$1.processVmTemplate(asset, this$1.getAdvertisement$vungle_ads_release());
if (!processVmTemplate) {
atomicBoolean3 = this$1.fullyDownloaded;
atomicBoolean3.set(false);
if (asset.isRequired()) {
atomicBoolean4 = this$1.requiredAssetDownloaded;
atomicBoolean4.set(false);
}
}
}
if (asset.isRequired()) {
atomicLong2 = this$1.downloadRequiredCount;
if (atomicLong2.decrementAndGet() <= 0) {
atomicBoolean2 = this$1.requiredAssetDownloaded;
if (atomicBoolean2.get()) {
this$1.onAdReady();
} else {
this$1.onAdLoadFailed(new AssetDownloadError());
this$1.cancel();
return;
}
}
}
atomicLong = this$1.downloadCount;
if (atomicLong.decrementAndGet() <= 0) {
atomicBoolean = this$1.fullyDownloaded;
if (atomicBoolean.get()) {
AdRequest adRequest = this$1.getAdRequest();
AdPayload advertisement$vungle_ads_release6 = this$1.getAdvertisement$vungle_ads_release();
this$1.onDownloadCompleted(adRequest, advertisement$vungle_ads_release6 != null ? advertisement$vungle_ads_release6.eventId() : null);
return;
}
this$1.onAdLoadFailed(new AssetDownloadError());
}
}
}

View File

@@ -0,0 +1,538 @@
package com.vungle.ads.internal.load;
import android.content.Context;
import android.webkit.URLUtil;
import androidx.annotation.WorkerThread;
import com.vungle.ads.AnalyticsClient;
import com.vungle.ads.AssetDownloadError;
import com.vungle.ads.InternalError;
import com.vungle.ads.MraidJsError;
import com.vungle.ads.NativeAdInternal;
import com.vungle.ads.ServiceLocator;
import com.vungle.ads.SingleValueMetric;
import com.vungle.ads.TimeIntervalMetric;
import com.vungle.ads.VungleError;
import com.vungle.ads.internal.ConfigManager;
import com.vungle.ads.internal.Constants;
import com.vungle.ads.internal.downloader.AssetDownloadListener;
import com.vungle.ads.internal.downloader.DownloadRequest;
import com.vungle.ads.internal.downloader.Downloader;
import com.vungle.ads.internal.executor.Executors;
import com.vungle.ads.internal.load.MraidJsLoader;
import com.vungle.ads.internal.model.AdAsset;
import com.vungle.ads.internal.model.AdPayload;
import com.vungle.ads.internal.model.ConfigPayload;
import com.vungle.ads.internal.network.TpatSender;
import com.vungle.ads.internal.network.VungleApiClient;
import com.vungle.ads.internal.omsdk.OMInjector;
import com.vungle.ads.internal.protos.Sdk;
import com.vungle.ads.internal.signals.SignalManager;
import com.vungle.ads.internal.util.FileUtility;
import com.vungle.ads.internal.util.Logger;
import com.vungle.ads.internal.util.PathProvider;
import com.vungle.ads.internal.util.UnzipUtility;
import java.io.File;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicLong;
import kotlin.Lazy;
import kotlin.LazyKt__LazyJVMKt;
import kotlin.LazyThreadSafetyMode;
import kotlin.io.FilesKt__UtilsKt;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.StringsKt__StringsJVMKt;
/* loaded from: classes4.dex */
public abstract class BaseAdLoader {
public static final Companion Companion = new Companion(null);
private static final String DOWNLOADED_FILE_NOT_FOUND = "Downloaded file not found!";
private static final String TAG = "BaseAdLoader";
private final List<AdAsset> adAssets;
private AdLoaderCallback adLoaderCallback;
private final AdRequest adRequest;
private AdPayload advertisement;
private TimeIntervalMetric assetDownloadDurationMetric;
private final Context context;
private final AtomicLong downloadCount;
private final AtomicLong downloadRequiredCount;
private final Downloader downloader;
private AtomicBoolean fullyDownloaded;
private SingleValueMetric mainVideoSizeMetric;
private AtomicBoolean notifyFailed;
private AtomicBoolean notifySuccess;
private final OMInjector omInjector;
private final PathProvider pathProvider;
private AtomicBoolean requiredAssetDownloaded;
private final Executors sdkExecutors;
private SingleValueMetric templateHtmlSizeMetric;
private SingleValueMetric templateSizeMetric;
private final VungleApiClient vungleApiClient;
public final AdRequest getAdRequest() {
return this.adRequest;
}
public final AdPayload getAdvertisement$vungle_ads_release() {
return this.advertisement;
}
public final Context getContext() {
return this.context;
}
public final PathProvider getPathProvider() {
return this.pathProvider;
}
public final Executors getSdkExecutors() {
return this.sdkExecutors;
}
public final VungleApiClient getVungleApiClient() {
return this.vungleApiClient;
}
public abstract void onAdLoadReady();
public abstract void requestAd();
public final void setAdvertisement$vungle_ads_release(AdPayload adPayload) {
this.advertisement = adPayload;
}
public BaseAdLoader(Context context, VungleApiClient vungleApiClient, Executors sdkExecutors, OMInjector omInjector, Downloader downloader, PathProvider pathProvider, AdRequest adRequest) {
Intrinsics.checkNotNullParameter(context, "context");
Intrinsics.checkNotNullParameter(vungleApiClient, "vungleApiClient");
Intrinsics.checkNotNullParameter(sdkExecutors, "sdkExecutors");
Intrinsics.checkNotNullParameter(omInjector, "omInjector");
Intrinsics.checkNotNullParameter(downloader, "downloader");
Intrinsics.checkNotNullParameter(pathProvider, "pathProvider");
Intrinsics.checkNotNullParameter(adRequest, "adRequest");
this.context = context;
this.vungleApiClient = vungleApiClient;
this.sdkExecutors = sdkExecutors;
this.omInjector = omInjector;
this.downloader = downloader;
this.pathProvider = pathProvider;
this.adRequest = adRequest;
this.downloadCount = new AtomicLong(0L);
this.downloadRequiredCount = new AtomicLong(0L);
this.notifySuccess = new AtomicBoolean(false);
this.notifyFailed = new AtomicBoolean(false);
this.adAssets = new ArrayList();
this.fullyDownloaded = new AtomicBoolean(true);
this.requiredAssetDownloaded = new AtomicBoolean(true);
this.mainVideoSizeMetric = new SingleValueMetric(Sdk.SDKMetric.SDKMetricType.ASSET_FILE_SIZE);
this.templateSizeMetric = new SingleValueMetric(Sdk.SDKMetric.SDKMetricType.TEMPLATE_ZIP_SIZE);
this.templateHtmlSizeMetric = new SingleValueMetric(Sdk.SDKMetric.SDKMetricType.TEMPLATE_HTML_SIZE);
this.assetDownloadDurationMetric = new TimeIntervalMetric(Sdk.SDKMetric.SDKMetricType.ASSET_DOWNLOAD_DURATION_MS);
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
}
private final AssetDownloadListener getAssetDownloadListener() {
return new BaseAdLoader$assetDownloadListener$1(this);
}
public final void loadAd(AdLoaderCallback adLoaderCallback) {
Intrinsics.checkNotNullParameter(adLoaderCallback, "adLoaderCallback");
this.adLoaderCallback = adLoaderCallback;
this.sdkExecutors.getBackgroundExecutor().execute(new Runnable() { // from class: com.vungle.ads.internal.load.BaseAdLoader$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
BaseAdLoader.m3892loadAd$lambda0(BaseAdLoader.this);
}
});
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: loadAd$lambda-0, reason: not valid java name */
public static final void m3892loadAd$lambda0(BaseAdLoader this$0) {
Intrinsics.checkNotNullParameter(this$0, "this$0");
AnalyticsClient.INSTANCE.logMetric$vungle_ads_release(Sdk.SDKMetric.SDKMetricType.LOAD_AD_API, (r15 & 2) != 0 ? 0L : 0L, (r15 & 4) != 0 ? null : this$0.adRequest.getPlacement().getReferenceId(), (r15 & 8) != 0 ? null : null, (r15 & 16) != 0 ? null : null, (r15 & 32) == 0 ? null : null);
this$0.requestAd();
}
public final void cancel() {
this.downloader.cancelAll();
}
/* JADX INFO: Access modifiers changed from: private */
public final void downloadAssets(AdPayload adPayload) {
this.assetDownloadDurationMetric.markStart();
this.downloadCount.set(this.adAssets.size());
AtomicLong atomicLong = this.downloadRequiredCount;
List<AdAsset> list = this.adAssets;
ArrayList arrayList = new ArrayList();
for (Object obj : list) {
if (((AdAsset) obj).isRequired()) {
arrayList.add(obj);
}
}
atomicLong.set(arrayList.size());
for (AdAsset adAsset : this.adAssets) {
DownloadRequest downloadRequest = new DownloadRequest(getAssetPriority(adAsset), adAsset, this.adRequest.getPlacement().getReferenceId(), adPayload.getCreativeId(), adPayload.eventId());
if (downloadRequest.isTemplate()) {
downloadRequest.startRecord();
}
this.downloader.download(downloadRequest, getAssetDownloadListener());
}
}
public final void onAdLoadFailed(VungleError error) {
AdLoaderCallback adLoaderCallback;
Intrinsics.checkNotNullParameter(error, "error");
if (this.notifySuccess.get() || !this.notifyFailed.compareAndSet(false, true) || (adLoaderCallback = this.adLoaderCallback) == null) {
return;
}
adLoaderCallback.onFailure(error);
}
/* JADX INFO: Access modifiers changed from: private */
public final void onAdReady() {
AdPayload adPayload = this.advertisement;
if (adPayload == null || this.notifyFailed.get() || !this.notifySuccess.compareAndSet(false, true)) {
return;
}
onAdLoadReady();
AdLoaderCallback adLoaderCallback = this.adLoaderCallback;
if (adLoaderCallback != null) {
adLoaderCallback.onSuccess(adPayload);
}
}
private final boolean isUrlValid(String str) {
return (str == null || str.length() == 0 || (!URLUtil.isHttpsUrl(str) && !URLUtil.isHttpUrl(str))) ? false : true;
}
private final boolean fileIsValid(File file, AdAsset adAsset) {
return file.exists() && file.length() == adAsset.getFileSize();
}
private final boolean unzipFile(AdPayload adPayload, File file, File file2) {
final ArrayList arrayList = new ArrayList();
for (AdAsset adAsset : this.adAssets) {
if (adAsset.getFileType() == AdAsset.FileType.ASSET) {
arrayList.add(adAsset.getLocalPath());
}
}
try {
UnzipUtility unzipUtility = UnzipUtility.INSTANCE;
String path = file.getPath();
String path2 = file2.getPath();
Intrinsics.checkNotNullExpressionValue(path2, "destinationDir.path");
unzipUtility.unzip(path, path2, new UnzipUtility.Filter() { // from class: com.vungle.ads.internal.load.BaseAdLoader$unzipFile$1
@Override // com.vungle.ads.internal.util.UnzipUtility.Filter
public boolean matches(String str) {
if (str != null && str.length() != 0) {
File file3 = new File(str);
Iterator<String> it = arrayList.iterator();
while (it.hasNext()) {
File file4 = new File(it.next());
if (Intrinsics.areEqual(file4, file3)) {
return false;
}
String path3 = file3.getPath();
Intrinsics.checkNotNullExpressionValue(path3, "toExtract.path");
if (StringsKt__StringsJVMKt.startsWith$default(path3, file4.getPath() + File.separator, false, 2, null)) {
return false;
}
}
}
return true;
}
});
if (!new File(file2.getPath(), Constants.AD_INDEX_FILE_NAME).exists()) {
AnalyticsClient.INSTANCE.logError$vungle_ads_release(115, "Failed to retrieve indexFileUrl from the Ad.", this.adRequest.getPlacement().getReferenceId(), adPayload.getCreativeId(), adPayload.eventId());
return false;
}
FileUtility.delete(file);
return true;
} catch (Exception e) {
AnalyticsClient.INSTANCE.logError$vungle_ads_release(109, "Unzip failed: " + e.getMessage(), this.adRequest.getPlacement().getReferenceId(), adPayload.getCreativeId(), adPayload.eventId());
return false;
}
}
private final File getDestinationDir(AdPayload adPayload) {
return this.pathProvider.getDownloadsDirForAd(adPayload.eventId());
}
private final boolean injectMraidJS(File file) {
try {
File file2 = new File(file.getPath(), Constants.AD_MRAID_JS_FILE_NAME);
File file3 = new File(this.pathProvider.getJsAssetDir(ConfigManager.INSTANCE.getMraidJsVersion()), Constants.MRAID_JS_FILE_NAME);
if (!file3.exists()) {
return true;
}
FilesKt__UtilsKt.copyTo$default(file3, file2, true, 0, 4, null);
return true;
} catch (Exception e) {
Logger.Companion.e(TAG, "Failed to inject mraid.js: " + e.getMessage());
return false;
}
}
/* JADX INFO: Access modifiers changed from: private */
public final boolean processVmTemplate(AdAsset adAsset, AdPayload adPayload) {
if (adPayload == null || adAsset.getStatus() != AdAsset.Status.DOWNLOAD_SUCCESS || adAsset.getLocalPath().length() == 0) {
return false;
}
File file = new File(adAsset.getLocalPath());
if (!fileIsValid(file, adAsset)) {
return false;
}
File destinationDir = getDestinationDir(adPayload);
if (destinationDir == null || !destinationDir.isDirectory()) {
Logger.Companion.e(TAG, "Unable to access Destination Directory");
return false;
}
if (adAsset.getFileType() == AdAsset.FileType.ZIP && !unzipFile(adPayload, file, destinationDir)) {
return false;
}
if (adPayload.omEnabled()) {
try {
this.omInjector.injectJsFiles(destinationDir);
} catch (Exception e) {
Logger.Companion.e(TAG, "Failed to inject OMSDK: " + e.getMessage());
return false;
}
}
boolean injectMraidJS = injectMraidJS(destinationDir);
FileUtility.printDirectoryTree(destinationDir);
return injectMraidJS;
}
@WorkerThread
public void onDownloadCompleted(AdRequest request, String str) {
Intrinsics.checkNotNullParameter(request, "request");
Logger.Companion.d(TAG, "download completed " + request);
AdPayload adPayload = this.advertisement;
if (adPayload != null) {
adPayload.setAssetFullyDownloaded();
}
onAdReady();
this.assetDownloadDurationMetric.markEnd();
AdPayload adPayload2 = this.advertisement;
String placementId = adPayload2 != null ? adPayload2.placementId() : null;
AdPayload adPayload3 = this.advertisement;
String creativeId = adPayload3 != null ? adPayload3.getCreativeId() : null;
AdPayload adPayload4 = this.advertisement;
AnalyticsClient.logMetric$vungle_ads_release$default(AnalyticsClient.INSTANCE, this.assetDownloadDurationMetric, placementId, creativeId, adPayload4 != null ? adPayload4.eventId() : null, (String) null, 16, (Object) null);
}
public static /* synthetic */ void handleAdMetaData$vungle_ads_release$default(BaseAdLoader baseAdLoader, AdPayload adPayload, SingleValueMetric singleValueMetric, int i, Object obj) {
if (obj != null) {
throw new UnsupportedOperationException("Super calls with default arguments not supported in this target, function: handleAdMetaData");
}
if ((i & 2) != 0) {
singleValueMetric = null;
}
baseAdLoader.handleAdMetaData$vungle_ads_release(adPayload, singleValueMetric);
}
public final void handleAdMetaData$vungle_ads_release(final AdPayload advertisement, SingleValueMetric singleValueMetric) {
Lazy lazy;
List<String> loadAdUrls;
Intrinsics.checkNotNullParameter(advertisement, "advertisement");
this.advertisement = advertisement;
ConfigPayload config = advertisement.config();
if (config != null) {
ConfigManager.INSTANCE.initWithConfig$vungle_ads_release(this.context, config, false, singleValueMetric);
}
ErrorInfo validateAdMetadata = validateAdMetadata(advertisement);
if (validateAdMetadata != null) {
AnalyticsClient.INSTANCE.logError$vungle_ads_release(validateAdMetadata.getReason(), validateAdMetadata.getDescription(), this.adRequest.getPlacement().getReferenceId(), advertisement.getCreativeId(), advertisement.eventId());
onAdLoadFailed(new InternalError(validateAdMetadata.getReason(), validateAdMetadata.getDescriptionExternal()));
return;
}
File destinationDir = getDestinationDir(advertisement);
if (destinationDir == null || !destinationDir.isDirectory() || !destinationDir.exists()) {
onAdLoadFailed(new AssetDownloadError());
return;
}
ServiceLocator.Companion companion = ServiceLocator.Companion;
final Context context = this.context;
lazy = LazyKt__LazyJVMKt.lazy(LazyThreadSafetyMode.SYNCHRONIZED, new Function0() { // from class: com.vungle.ads.internal.load.BaseAdLoader$handleAdMetaData$$inlined$inject$1
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
{
super(0);
}
/* JADX WARN: Type inference failed for: r0v2, types: [com.vungle.ads.internal.signals.SignalManager, java.lang.Object] */
@Override // kotlin.jvm.functions.Function0
public final SignalManager invoke() {
return ServiceLocator.Companion.getInstance(context).getService(SignalManager.class);
}
});
AdPayload.AdUnit adUnit = advertisement.adUnit();
if (adUnit != null && (loadAdUrls = adUnit.getLoadAdUrls()) != null) {
TpatSender tpatSender = new TpatSender(this.vungleApiClient, advertisement.placementId(), advertisement.getCreativeId(), advertisement.eventId(), this.sdkExecutors.getIoExecutor(), this.pathProvider, m3891handleAdMetaData$lambda5(lazy));
Iterator<T> it = loadAdUrls.iterator();
while (it.hasNext()) {
tpatSender.sendTpat((String) it.next(), this.sdkExecutors.getJobExecutor());
}
}
if (!this.adAssets.isEmpty()) {
this.adAssets.clear();
}
this.adAssets.addAll(advertisement.getDownloadableAssets(destinationDir));
if (this.adAssets.isEmpty()) {
onAdLoadFailed(new AssetDownloadError());
} else {
MraidJsLoader.INSTANCE.downloadJs(this.pathProvider, this.downloader, this.sdkExecutors.getBackgroundExecutor(), new MraidJsLoader.DownloadResultListener() { // from class: com.vungle.ads.internal.load.BaseAdLoader$handleAdMetaData$3
@Override // com.vungle.ads.internal.load.MraidJsLoader.DownloadResultListener
public void onDownloadResult(int i) {
AdLoaderCallback adLoaderCallback;
if (i == 10 || i == 13) {
if (i == 10) {
AnalyticsClient.INSTANCE.logMetric$vungle_ads_release(Sdk.SDKMetric.SDKMetricType.MRAID_DOWNLOAD_JS_RETRY_SUCCESS, (r15 & 2) != 0 ? 0L : 0L, (r15 & 4) != 0 ? null : BaseAdLoader.this.getAdRequest().getPlacement().getReferenceId(), (r15 & 8) != 0 ? null : null, (r15 & 16) != 0 ? null : null, (r15 & 32) == 0 ? null : null);
}
BaseAdLoader.this.downloadAssets(advertisement);
} else {
adLoaderCallback = BaseAdLoader.this.adLoaderCallback;
if (adLoaderCallback != null) {
adLoaderCallback.onFailure(new MraidJsError(null, 1, null));
}
}
}
});
}
}
/* renamed from: handleAdMetaData$lambda-5, reason: not valid java name */
private static final SignalManager m3891handleAdMetaData$lambda5(Lazy lazy) {
return (SignalManager) lazy.getValue();
}
private final DownloadRequest.Priority getAssetPriority(AdAsset adAsset) {
if (adAsset.isRequired()) {
return DownloadRequest.Priority.CRITICAL;
}
return DownloadRequest.Priority.HIGHEST;
}
private final ErrorInfo validateAdMetadata(AdPayload adPayload) {
AdPayload.AdUnit adUnit = adPayload.adUnit();
if ((adUnit != null ? adUnit.getSleep() : null) != null) {
return getErrorInfo(adPayload);
}
String referenceId = this.adRequest.getPlacement().getReferenceId();
AdPayload adPayload2 = this.advertisement;
if (!Intrinsics.areEqual(referenceId, adPayload2 != null ? adPayload2.placementId() : null)) {
return new ErrorInfo(215, "Requests and responses don't match the placement Id.", null, false, 12, null);
}
AdPayload.AdUnit adUnit2 = adPayload.adUnit();
AdPayload.TemplateSettings templateSettings = adUnit2 != null ? adUnit2.getTemplateSettings() : null;
if (templateSettings == null) {
return new ErrorInfo(113, "Missing template settings", null, false, 12, null);
}
Map<String, AdPayload.CacheableReplacement> cacheableReplacements = templateSettings.getCacheableReplacements();
if (!adPayload.isNativeTemplateType()) {
AdPayload.AdUnit adUnit3 = adPayload.adUnit();
String templateURL = adUnit3 != null ? adUnit3.getTemplateURL() : null;
AdPayload.AdUnit adUnit4 = adPayload.adUnit();
String vmURL = adUnit4 != null ? adUnit4.getVmURL() : null;
if ((templateURL == null || templateURL.length() == 0) && (vmURL == null || vmURL.length() == 0)) {
return new ErrorInfo(105, "Failed to prepare vmURL or templateURL for downloading.", null, false, 12, null);
}
if (templateURL != null && templateURL.length() != 0 && !isUrlValid(templateURL)) {
return new ErrorInfo(112, "Failed to load template asset.", null, false, 12, null);
}
if (vmURL != null && vmURL.length() != 0 && !isUrlValid(vmURL)) {
return new ErrorInfo(112, "Failed to load vm url asset.", null, false, 12, null);
}
} else if (cacheableReplacements != null) {
AdPayload.CacheableReplacement cacheableReplacement = cacheableReplacements.get(NativeAdInternal.TOKEN_MAIN_IMAGE);
if ((cacheableReplacement != null ? cacheableReplacement.getUrl() : null) == null) {
return new ErrorInfo(600, "Unable to load main image.", null, false, 12, null);
}
AdPayload.CacheableReplacement cacheableReplacement2 = cacheableReplacements.get(NativeAdInternal.TOKEN_VUNGLE_PRIVACY_ICON_URL);
if ((cacheableReplacement2 != null ? cacheableReplacement2.getUrl() : null) == null) {
return new ErrorInfo(600, "Unable to load privacy image.", null, false, 12, null);
}
}
if (adPayload.hasExpired()) {
return new ErrorInfo(304, "The ad markup has expired for playback.", null, false, 12, null);
}
String eventId = adPayload.eventId();
if (eventId == null || eventId.length() == 0) {
return new ErrorInfo(200, "Event id is invalid.", null, false, 12, null);
}
if (cacheableReplacements != null) {
Iterator<Map.Entry<String, AdPayload.CacheableReplacement>> it = cacheableReplacements.entrySet().iterator();
while (it.hasNext()) {
String url = it.next().getValue().getUrl();
if (url == null || url.length() == 0) {
return new ErrorInfo(111, "Invalid asset URL " + url, null, false, 12, null);
}
if (!isUrlValid(url)) {
return new ErrorInfo(112, "Invalid asset URL " + url, null, false, 12, null);
}
}
}
return null;
}
private final ErrorInfo getErrorInfo(AdPayload adPayload) {
Integer errorCode;
AdPayload.AdUnit adUnit = adPayload.adUnit();
int intValue = (adUnit == null || (errorCode = adUnit.getErrorCode()) == null) ? 212 : errorCode.intValue();
AdPayload.AdUnit adUnit2 = adPayload.adUnit();
Integer sleep = adUnit2 != null ? adUnit2.getSleep() : null;
AdPayload.AdUnit adUnit3 = adPayload.adUnit();
String info = adUnit3 != null ? adUnit3.getInfo() : null;
if (intValue == 10001 || intValue == 10002 || intValue == 20001 || intValue == 30001 || intValue == 30002) {
return new ErrorInfo(intValue, "Response error: " + sleep, "Request failed with error: " + intValue + ", " + info, false, 8, null);
}
return new ErrorInfo(212, "Response error: " + sleep, "Request failed with error: 212, " + info, false, 8, null);
}
public static final class ErrorInfo {
private final String description;
private final String descriptionExternal;
private final boolean errorIsTerminal;
private final int reason;
public final String getDescription() {
return this.description;
}
public final String getDescriptionExternal() {
return this.descriptionExternal;
}
public final boolean getErrorIsTerminal() {
return this.errorIsTerminal;
}
public final int getReason() {
return this.reason;
}
public ErrorInfo(int i, String description, String descriptionExternal, boolean z) {
Intrinsics.checkNotNullParameter(description, "description");
Intrinsics.checkNotNullParameter(descriptionExternal, "descriptionExternal");
this.reason = i;
this.description = description;
this.descriptionExternal = descriptionExternal;
this.errorIsTerminal = z;
}
public /* synthetic */ ErrorInfo(int i, String str, String str2, boolean z, int i2, DefaultConstructorMarker defaultConstructorMarker) {
this(i, str, (i2 & 4) != 0 ? str : str2, (i2 & 8) != 0 ? false : z);
}
}
}

View File

@@ -0,0 +1,111 @@
package com.vungle.ads.internal.load;
import com.vungle.ads.AdRetryError;
import com.vungle.ads.AnalyticsClient;
import com.vungle.ads.NoServeError;
import com.vungle.ads.SingleValueMetric;
import com.vungle.ads.VungleError;
import com.vungle.ads.internal.executor.VungleThreadPoolExecutor;
import com.vungle.ads.internal.model.AdPayload;
import com.vungle.ads.internal.model.Placement;
import com.vungle.ads.internal.network.Call;
import com.vungle.ads.internal.network.Callback;
import com.vungle.ads.internal.network.Response;
import com.vungle.ads.internal.protos.Sdk;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes4.dex */
public final class DefaultAdLoader$fetchAdMetadata$1 implements Callback<AdPayload> {
final /* synthetic */ Placement $placement;
final /* synthetic */ DefaultAdLoader this$0;
public DefaultAdLoader$fetchAdMetadata$1(DefaultAdLoader defaultAdLoader, Placement placement) {
this.this$0 = defaultAdLoader;
this.$placement = placement;
}
@Override // com.vungle.ads.internal.network.Callback
public void onResponse(Call<AdPayload> call, final Response<AdPayload> response) {
VungleThreadPoolExecutor backgroundExecutor = this.this$0.getSdkExecutors().getBackgroundExecutor();
final DefaultAdLoader defaultAdLoader = this.this$0;
final Placement placement = this.$placement;
backgroundExecutor.execute(new Runnable() { // from class: com.vungle.ads.internal.load.DefaultAdLoader$fetchAdMetadata$1$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
DefaultAdLoader$fetchAdMetadata$1.m3898onResponse$lambda0(DefaultAdLoader.this, placement, response);
}
});
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: onResponse$lambda-0, reason: not valid java name */
public static final void m3898onResponse$lambda0(DefaultAdLoader this$0, Placement placement, Response response) {
Intrinsics.checkNotNullParameter(this$0, "this$0");
Intrinsics.checkNotNullParameter(placement, "$placement");
if (this$0.getVungleApiClient().getRetryAfterHeaderValue(placement.getReferenceId()) > 0) {
this$0.onAdLoadFailed(new AdRetryError().logError$vungle_ads_release());
return;
}
if (response == null || response.isSuccessful()) {
AdPayload adPayload = response != null ? (AdPayload) response.body() : null;
if ((adPayload != null ? adPayload.adUnit() : null) != null) {
this$0.handleAdMetaData$vungle_ads_release(adPayload, new SingleValueMetric(Sdk.SDKMetric.SDKMetricType.CONFIG_LOADED_FROM_AD_LOAD));
return;
} else {
AnalyticsClient.INSTANCE.logError$vungle_ads_release(215, "Ad response is empty.", (r13 & 4) != 0 ? null : placement.getReferenceId(), (r13 & 8) != 0 ? null : null, (r13 & 16) != 0 ? null : null);
this$0.onAdLoadFailed(new NoServeError());
return;
}
}
AnalyticsClient.INSTANCE.logError$vungle_ads_release(104, "Failed to get a successful response from the API call", (r13 & 4) != 0 ? null : placement.getReferenceId(), (r13 & 8) != 0 ? null : null, (r13 & 16) != 0 ? null : null);
this$0.onAdLoadFailed(new NoServeError());
}
@Override // com.vungle.ads.internal.network.Callback
public void onFailure(Call<AdPayload> call, final Throwable th) {
VungleThreadPoolExecutor backgroundExecutor = this.this$0.getSdkExecutors().getBackgroundExecutor();
final DefaultAdLoader defaultAdLoader = this.this$0;
final Placement placement = this.$placement;
backgroundExecutor.execute(new Runnable() { // from class: com.vungle.ads.internal.load.DefaultAdLoader$fetchAdMetadata$1$$ExternalSyntheticLambda1
@Override // java.lang.Runnable
public final void run() {
DefaultAdLoader$fetchAdMetadata$1.m3897onFailure$lambda1(DefaultAdLoader.this, th, placement);
}
});
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: onFailure$lambda-1, reason: not valid java name */
public static final void m3897onFailure$lambda1(DefaultAdLoader this$0, Throwable th, Placement placement) {
VungleError retrofitToVungleError;
Intrinsics.checkNotNullParameter(this$0, "this$0");
Intrinsics.checkNotNullParameter(placement, "$placement");
retrofitToVungleError = this$0.retrofitToVungleError(th);
this$0.onAdLoadFailed(retrofitToVungleError);
int code = retrofitToVungleError.getCode();
if (code == 10020) {
AnalyticsClient analyticsClient = AnalyticsClient.INSTANCE;
String referenceId = placement.getReferenceId();
AdPayload advertisement$vungle_ads_release = this$0.getAdvertisement$vungle_ads_release();
String creativeId = advertisement$vungle_ads_release != null ? advertisement$vungle_ads_release.getCreativeId() : null;
AdPayload advertisement$vungle_ads_release2 = this$0.getAdvertisement$vungle_ads_release();
analyticsClient.logError$vungle_ads_release(101, "Ads request error.", referenceId, creativeId, advertisement$vungle_ads_release2 != null ? advertisement$vungle_ads_release2.eventId() : null);
return;
}
if (code == 10047) {
AnalyticsClient analyticsClient2 = AnalyticsClient.INSTANCE;
String referenceId2 = placement.getReferenceId();
AdPayload advertisement$vungle_ads_release3 = this$0.getAdvertisement$vungle_ads_release();
String creativeId2 = advertisement$vungle_ads_release3 != null ? advertisement$vungle_ads_release3.getCreativeId() : null;
AdPayload advertisement$vungle_ads_release4 = this$0.getAdvertisement$vungle_ads_release();
analyticsClient2.logError$vungle_ads_release(217, "Timeout for ads call.", referenceId2, creativeId2, advertisement$vungle_ads_release4 != null ? advertisement$vungle_ads_release4.eventId() : null);
return;
}
AnalyticsClient analyticsClient3 = AnalyticsClient.INSTANCE;
String referenceId3 = placement.getReferenceId();
AdPayload advertisement$vungle_ads_release5 = this$0.getAdvertisement$vungle_ads_release();
String creativeId3 = advertisement$vungle_ads_release5 != null ? advertisement$vungle_ads_release5.getCreativeId() : null;
AdPayload advertisement$vungle_ads_release6 = this$0.getAdvertisement$vungle_ads_release();
analyticsClient3.logError$vungle_ads_release(103, "Unable to decode ads response.", referenceId3, creativeId3, advertisement$vungle_ads_release6 != null ? advertisement$vungle_ads_release6.eventId() : null);
}
}

View File

@@ -0,0 +1,71 @@
package com.vungle.ads.internal.load;
import android.content.Context;
import com.vungle.ads.AdFailedToDownloadError;
import com.vungle.ads.AdRetryActiveError;
import com.vungle.ads.InternalError;
import com.vungle.ads.VungleAdSize;
import com.vungle.ads.VungleError;
import com.vungle.ads.internal.downloader.Downloader;
import com.vungle.ads.internal.executor.Executors;
import com.vungle.ads.internal.model.AdPayload;
import com.vungle.ads.internal.model.Placement;
import com.vungle.ads.internal.network.Call;
import com.vungle.ads.internal.network.VungleApiClient;
import com.vungle.ads.internal.omsdk.OMInjector;
import com.vungle.ads.internal.util.PathProvider;
import java.io.IOException;
import java.net.SocketTimeoutException;
import java.net.UnknownHostException;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes4.dex */
public final class DefaultAdLoader extends BaseAdLoader {
@Override // com.vungle.ads.internal.load.BaseAdLoader
public void onAdLoadReady() {
}
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public DefaultAdLoader(Context context, VungleApiClient vungleApiClient, Executors sdkExecutors, OMInjector omInjector, Downloader downloader, PathProvider pathProvider, AdRequest adRequest) {
super(context, vungleApiClient, sdkExecutors, omInjector, downloader, pathProvider, adRequest);
Intrinsics.checkNotNullParameter(context, "context");
Intrinsics.checkNotNullParameter(vungleApiClient, "vungleApiClient");
Intrinsics.checkNotNullParameter(sdkExecutors, "sdkExecutors");
Intrinsics.checkNotNullParameter(omInjector, "omInjector");
Intrinsics.checkNotNullParameter(downloader, "downloader");
Intrinsics.checkNotNullParameter(pathProvider, "pathProvider");
Intrinsics.checkNotNullParameter(adRequest, "adRequest");
}
@Override // com.vungle.ads.internal.load.BaseAdLoader
public void requestAd() {
fetchAdMetadata(getAdRequest().getRequestAdSize(), getAdRequest().getPlacement());
}
private final void fetchAdMetadata(VungleAdSize vungleAdSize, Placement placement) {
if (getVungleApiClient().checkIsRetryAfterActive(placement.getReferenceId())) {
onAdLoadFailed(new AdRetryActiveError().logError$vungle_ads_release());
return;
}
Call<AdPayload> requestAd = getVungleApiClient().requestAd(placement.getReferenceId(), vungleAdSize);
if (requestAd == null) {
onAdLoadFailed(new AdFailedToDownloadError());
} else {
requestAd.enqueue(new DefaultAdLoader$fetchAdMetadata$1(this, placement));
}
}
/* JADX INFO: Access modifiers changed from: private */
public final VungleError retrofitToVungleError(Throwable th) {
if (th instanceof UnknownHostException) {
return new AdFailedToDownloadError();
}
if (th instanceof SocketTimeoutException) {
return new InternalError(VungleError.NETWORK_TIMEOUT, null, 2, null);
}
if (th instanceof IOException) {
return new InternalError(VungleError.NETWORK_ERROR, null, 2, null);
}
return new AdFailedToDownloadError();
}
}

View File

@@ -0,0 +1,98 @@
package com.vungle.ads.internal.load;
import com.vungle.ads.AnalyticsClient;
import com.vungle.ads.MraidJsError;
import com.vungle.ads.internal.downloader.AssetDownloadListener;
import com.vungle.ads.internal.downloader.DownloadRequest;
import com.vungle.ads.internal.executor.VungleThreadPoolExecutor;
import com.vungle.ads.internal.util.FileUtility;
import com.vungle.ads.internal.util.Logger;
import java.io.File;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes4.dex */
public final class MraidJsLoader$downloadJs$1$2 implements AssetDownloadListener {
final /* synthetic */ VungleThreadPoolExecutor $executor;
final /* synthetic */ File $jsPath;
final /* synthetic */ File $mraidJsFile;
public MraidJsLoader$downloadJs$1$2(VungleThreadPoolExecutor vungleThreadPoolExecutor, File file, File file2) {
this.$executor = vungleThreadPoolExecutor;
this.$jsPath = file;
this.$mraidJsFile = file2;
}
@Override // com.vungle.ads.internal.downloader.AssetDownloadListener
public void onError(final AssetDownloadListener.DownloadError downloadError, final DownloadRequest downloadRequest) {
Intrinsics.checkNotNullParameter(downloadRequest, "downloadRequest");
VungleThreadPoolExecutor vungleThreadPoolExecutor = this.$executor;
final File file = this.$jsPath;
vungleThreadPoolExecutor.execute(new Runnable() { // from class: com.vungle.ads.internal.load.MraidJsLoader$downloadJs$1$2$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
MraidJsLoader$downloadJs$1$2.m3901onError$lambda0(AssetDownloadListener.DownloadError.this, downloadRequest, file);
}
});
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: onError$lambda-0, reason: not valid java name */
public static final void m3901onError$lambda0(AssetDownloadListener.DownloadError downloadError, DownloadRequest downloadRequest, File jsPath) {
Intrinsics.checkNotNullParameter(downloadRequest, "$downloadRequest");
Intrinsics.checkNotNullParameter(jsPath, "$jsPath");
try {
try {
StringBuilder sb = new StringBuilder();
sb.append("download mraid js error: ");
sb.append(downloadError != null ? Integer.valueOf(downloadError.getServerCode()) : null);
sb.append(". Failed to load asset ");
sb.append(downloadRequest.getAsset().getServerPath());
String sb2 = sb.toString();
Logger.Companion.d("MraidJsLoader", sb2);
new MraidJsError(sb2).logErrorNoReturnValue$vungle_ads_release();
FileUtility.deleteContents(jsPath);
} catch (Exception e) {
Logger.Companion.e("MraidJsLoader", "Failed to delete js assets", e);
}
MraidJsLoader.INSTANCE.notifyListeners(12);
} catch (Throwable th) {
MraidJsLoader.INSTANCE.notifyListeners(12);
throw th;
}
}
@Override // com.vungle.ads.internal.downloader.AssetDownloadListener
public void onSuccess(final File file, DownloadRequest downloadRequest) {
Intrinsics.checkNotNullParameter(file, "file");
Intrinsics.checkNotNullParameter(downloadRequest, "downloadRequest");
VungleThreadPoolExecutor vungleThreadPoolExecutor = this.$executor;
final File file2 = this.$mraidJsFile;
final File file3 = this.$jsPath;
vungleThreadPoolExecutor.execute(new Runnable() { // from class: com.vungle.ads.internal.load.MraidJsLoader$downloadJs$1$2$$ExternalSyntheticLambda1
@Override // java.lang.Runnable
public final void run() {
MraidJsLoader$downloadJs$1$2.m3902onSuccess$lambda1(file, file2, file3);
}
});
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: onSuccess$lambda-1, reason: not valid java name */
public static final void m3902onSuccess$lambda1(File file, File mraidJsFile, File jsPath) {
Intrinsics.checkNotNullParameter(file, "$file");
Intrinsics.checkNotNullParameter(mraidJsFile, "$mraidJsFile");
Intrinsics.checkNotNullParameter(jsPath, "$jsPath");
try {
if (file.exists() && file.length() > 0) {
MraidJsLoader.INSTANCE.notifyListeners(10);
} else {
AnalyticsClient.INSTANCE.logError$vungle_ads_release(131, "Mraid js downloaded but write failure: " + mraidJsFile.getAbsolutePath(), (r13 & 4) != 0 ? null : null, (r13 & 8) != 0 ? null : null, (r13 & 16) != 0 ? null : null);
FileUtility.deleteContents(jsPath);
MraidJsLoader.INSTANCE.notifyListeners(12);
}
} catch (Exception e) {
Logger.Companion.e("MraidJsLoader", "Failed to delete js assets", e);
MraidJsLoader.INSTANCE.notifyListeners(12);
}
}
}

View File

@@ -0,0 +1,102 @@
package com.vungle.ads.internal.load;
import com.vungle.ads.internal.ConfigManager;
import com.vungle.ads.internal.Constants;
import com.vungle.ads.internal.downloader.DownloadRequest;
import com.vungle.ads.internal.downloader.Downloader;
import com.vungle.ads.internal.executor.VungleThreadPoolExecutor;
import com.vungle.ads.internal.load.MraidJsLoader;
import com.vungle.ads.internal.model.AdAsset;
import com.vungle.ads.internal.util.FileUtility;
import com.vungle.ads.internal.util.Logger;
import com.vungle.ads.internal.util.PathProvider;
import java.io.File;
import java.util.Iterator;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.atomic.AtomicBoolean;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes4.dex */
public final class MraidJsLoader {
public static final int MRAID_AVAILABLE = 13;
public static final int MRAID_DOWNLOADED = 10;
public static final int MRAID_DOWNLOAD_FAILED = 12;
public static final int MRAID_INVALID_ENDPOINT = 11;
private static final String TAG = "MraidJsLoader";
public static final MraidJsLoader INSTANCE = new MraidJsLoader();
private static final AtomicBoolean isDownloading = new AtomicBoolean(false);
private static final CopyOnWriteArrayList<DownloadResultListener> listeners = new CopyOnWriteArrayList<>();
public interface DownloadResultListener {
void onDownloadResult(int i);
}
private MraidJsLoader() {
}
public static /* synthetic */ void downloadJs$default(MraidJsLoader mraidJsLoader, PathProvider pathProvider, Downloader downloader, VungleThreadPoolExecutor vungleThreadPoolExecutor, DownloadResultListener downloadResultListener, int i, Object obj) {
if ((i & 8) != 0) {
downloadResultListener = null;
}
mraidJsLoader.downloadJs(pathProvider, downloader, vungleThreadPoolExecutor, downloadResultListener);
}
public final void downloadJs(final PathProvider pathProvider, final Downloader downloader, final VungleThreadPoolExecutor executor, final DownloadResultListener downloadResultListener) {
Intrinsics.checkNotNullParameter(pathProvider, "pathProvider");
Intrinsics.checkNotNullParameter(downloader, "downloader");
Intrinsics.checkNotNullParameter(executor, "executor");
executor.execute(new Runnable() { // from class: com.vungle.ads.internal.load.MraidJsLoader$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
MraidJsLoader.m3899downloadJs$lambda1(MraidJsLoader.DownloadResultListener.this, pathProvider, downloader, executor);
}
});
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: downloadJs$lambda-1, reason: not valid java name */
public static final void m3899downloadJs$lambda1(DownloadResultListener downloadResultListener, PathProvider pathProvider, Downloader downloader, VungleThreadPoolExecutor executor) {
Intrinsics.checkNotNullParameter(pathProvider, "$pathProvider");
Intrinsics.checkNotNullParameter(downloader, "$downloader");
Intrinsics.checkNotNullParameter(executor, "$executor");
if (downloadResultListener != null) {
try {
listeners.add(downloadResultListener);
} catch (Exception e) {
Logger.Companion.e(TAG, "Failed to download mraid js", e);
return;
}
}
if (isDownloading.getAndSet(true)) {
Logger.Companion.w(TAG, "mraid js is downloading, waiting for the previous request.");
return;
}
ConfigManager configManager = ConfigManager.INSTANCE;
String mraidEndpoint = configManager.getMraidEndpoint();
if (mraidEndpoint != null && mraidEndpoint.length() != 0) {
File file = new File(pathProvider.getJsAssetDir(configManager.getMraidJsVersion()), Constants.MRAID_JS_FILE_NAME);
if (file.exists()) {
Logger.Companion.w(TAG, "mraid js already downloaded");
INSTANCE.notifyListeners(13);
return;
}
File jsDir = pathProvider.getJsDir();
FileUtility.deleteContents(jsDir);
String absolutePath = file.getAbsolutePath();
Intrinsics.checkNotNullExpressionValue(absolutePath, "mraidJsFile.absolutePath");
downloader.download(new DownloadRequest(DownloadRequest.Priority.HIGH, new AdAsset(Constants.MRAID_JS_FILE_NAME, mraidEndpoint + "/mraid.min.js", absolutePath, AdAsset.FileType.ASSET, true), null, null, null, 28, null), new MraidJsLoader$downloadJs$1$2(executor, jsDir, file));
return;
}
INSTANCE.notifyListeners(11);
}
/* JADX INFO: Access modifiers changed from: private */
public final void notifyListeners(int i) {
Iterator<T> it = listeners.iterator();
while (it.hasNext()) {
((DownloadResultListener) it.next()).onDownloadResult(i);
}
listeners.clear();
isDownloading.set(false);
}
}

View File

@@ -0,0 +1,31 @@
package com.vungle.ads.internal.load;
import com.vungle.ads.internal.network.VungleApiClient;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes4.dex */
public final class RTADebugger {
public static final Companion Companion = new Companion(null);
public static final String RTA_DEBUG_ENDPOINT = "https://events.ads.vungle.com/rtadebugging";
private final VungleApiClient apiClient;
public RTADebugger(VungleApiClient apiClient) {
Intrinsics.checkNotNullParameter(apiClient, "apiClient");
this.apiClient = apiClient;
}
public static final class Companion {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private Companion() {
}
}
public final void reportAdMarkup(String adm) {
Intrinsics.checkNotNullParameter(adm, "adm");
this.apiClient.sendAdMarkup(adm, RTA_DEBUG_ENDPOINT);
}
}

View File

@@ -0,0 +1,133 @@
package com.vungle.ads.internal.load;
import android.content.Context;
import com.vungle.ads.AdMarkupInvalidError;
import com.vungle.ads.AnalyticsClient;
import com.vungle.ads.ServiceLocator;
import com.vungle.ads.SingleValueMetric;
import com.vungle.ads.internal.ConfigManager;
import com.vungle.ads.internal.downloader.Downloader;
import com.vungle.ads.internal.executor.Executors;
import com.vungle.ads.internal.model.AdPayload;
import com.vungle.ads.internal.model.BidPayload;
import com.vungle.ads.internal.network.TpatSender;
import com.vungle.ads.internal.network.VungleApiClient;
import com.vungle.ads.internal.omsdk.OMInjector;
import com.vungle.ads.internal.protos.Sdk;
import com.vungle.ads.internal.signals.SignalManager;
import com.vungle.ads.internal.util.Logger;
import com.vungle.ads.internal.util.PathProvider;
import java.util.Iterator;
import java.util.List;
import kotlin.Lazy;
import kotlin.LazyKt__LazyJVMKt;
import kotlin.LazyThreadSafetyMode;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes4.dex */
public final class RealtimeAdLoader extends BaseAdLoader {
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public RealtimeAdLoader(Context context, VungleApiClient vungleApiClient, Executors sdkExecutors, OMInjector omInjector, Downloader downloader, PathProvider pathProvider, AdRequest adRequest) {
super(context, vungleApiClient, sdkExecutors, omInjector, downloader, pathProvider, adRequest);
Intrinsics.checkNotNullParameter(context, "context");
Intrinsics.checkNotNullParameter(vungleApiClient, "vungleApiClient");
Intrinsics.checkNotNullParameter(sdkExecutors, "sdkExecutors");
Intrinsics.checkNotNullParameter(omInjector, "omInjector");
Intrinsics.checkNotNullParameter(downloader, "downloader");
Intrinsics.checkNotNullParameter(pathProvider, "pathProvider");
Intrinsics.checkNotNullParameter(adRequest, "adRequest");
}
@Override // com.vungle.ads.internal.load.BaseAdLoader
public void requestAd() {
Lazy lazy;
BidPayload adMarkup = getAdRequest().getAdMarkup();
if (adMarkup != null) {
if (ConfigManager.INSTANCE.rtaDebuggingEnabled()) {
try {
String decodedAdsResponse = adMarkup.getDecodedAdsResponse();
Logger.Companion.d("RTA_DEBUGGER", String.valueOf(decodedAdsResponse));
ServiceLocator.Companion companion = ServiceLocator.Companion;
final Context context = getContext();
lazy = LazyKt__LazyJVMKt.lazy(LazyThreadSafetyMode.SYNCHRONIZED, new Function0() { // from class: com.vungle.ads.internal.load.RealtimeAdLoader$requestAd$$inlined$inject$1
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
{
super(0);
}
/* JADX WARN: Type inference failed for: r0v2, types: [com.vungle.ads.internal.network.VungleApiClient, java.lang.Object] */
@Override // kotlin.jvm.functions.Function0
public final VungleApiClient invoke() {
return ServiceLocator.Companion.getInstance(context).getService(VungleApiClient.class);
}
});
if (decodedAdsResponse != null) {
new RTADebugger(m3903requestAd$lambda0(lazy)).reportAdMarkup(decodedAdsResponse);
}
} catch (Throwable unused) {
}
}
AdPayload adPayload = adMarkup.getAdPayload();
Integer version = adMarkup.getVersion();
if (version != null && version.intValue() == 2 && adPayload != null) {
handleAdMetaData$vungle_ads_release(adPayload, new SingleValueMetric(Sdk.SDKMetric.SDKMetricType.CONFIG_LOADED_FROM_ADM_LOAD));
return;
} else {
AnalyticsClient.INSTANCE.logError$vungle_ads_release(213, "The ad response did not contain valid ad markup.", (r13 & 4) != 0 ? null : getAdRequest().getPlacement().getReferenceId(), (r13 & 8) != 0 ? null : null, (r13 & 16) != 0 ? null : adMarkup.getEventId());
onAdLoadFailed(new AdMarkupInvalidError());
return;
}
}
AnalyticsClient.INSTANCE.logError$vungle_ads_release(208, "Unable to create data object from payload string.", (r13 & 4) != 0 ? null : getAdRequest().getPlacement().getReferenceId(), (r13 & 8) != 0 ? null : null, (r13 & 16) != 0 ? null : null);
onAdLoadFailed(new AdMarkupInvalidError());
}
/* renamed from: requestAd$lambda-0, reason: not valid java name */
private static final VungleApiClient m3903requestAd$lambda0(Lazy lazy) {
return (VungleApiClient) lazy.getValue();
}
@Override // com.vungle.ads.internal.load.BaseAdLoader
public void onAdLoadReady() {
AdPayload advertisement$vungle_ads_release = getAdvertisement$vungle_ads_release();
sendWinNotification(advertisement$vungle_ads_release != null ? advertisement$vungle_ads_release.getWinNotifications() : null);
}
private final void sendWinNotification(List<String> list) {
Lazy lazy;
if (list == null || !list.isEmpty()) {
ServiceLocator.Companion companion = ServiceLocator.Companion;
final Context context = getContext();
lazy = LazyKt__LazyJVMKt.lazy(LazyThreadSafetyMode.SYNCHRONIZED, new Function0() { // from class: com.vungle.ads.internal.load.RealtimeAdLoader$sendWinNotification$$inlined$inject$1
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
{
super(0);
}
/* JADX WARN: Type inference failed for: r0v2, types: [com.vungle.ads.internal.signals.SignalManager, java.lang.Object] */
@Override // kotlin.jvm.functions.Function0
public final SignalManager invoke() {
return ServiceLocator.Companion.getInstance(context).getService(SignalManager.class);
}
});
VungleApiClient vungleApiClient = getVungleApiClient();
String referenceId = getAdRequest().getPlacement().getReferenceId();
AdPayload advertisement$vungle_ads_release = getAdvertisement$vungle_ads_release();
String creativeId = advertisement$vungle_ads_release != null ? advertisement$vungle_ads_release.getCreativeId() : null;
AdPayload advertisement$vungle_ads_release2 = getAdvertisement$vungle_ads_release();
TpatSender tpatSender = new TpatSender(vungleApiClient, referenceId, creativeId, advertisement$vungle_ads_release2 != null ? advertisement$vungle_ads_release2.eventId() : null, getSdkExecutors().getIoExecutor(), getPathProvider(), m3904sendWinNotification$lambda2(lazy));
if (list != null) {
Iterator<T> it = list.iterator();
while (it.hasNext()) {
tpatSender.sendWinNotification((String) it.next(), getSdkExecutors().getJobExecutor());
}
}
}
}
/* renamed from: sendWinNotification$lambda-2, reason: not valid java name */
private static final SignalManager m3904sendWinNotification$lambda2(Lazy lazy) {
return (SignalManager) lazy.getValue();
}
}