- 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
230 lines
11 KiB
Java
230 lines
11 KiB
Java
package com.vungle.ads.internal.network;
|
|
|
|
import androidx.annotation.VisibleForTesting;
|
|
import com.vungle.ads.AnalyticsClient;
|
|
import com.vungle.ads.TpatRetryFailure;
|
|
import com.vungle.ads.internal.Constants;
|
|
import com.vungle.ads.internal.load.BaseAdLoader;
|
|
import com.vungle.ads.internal.persistence.FilePreferences;
|
|
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.HashMap;
|
|
import java.util.Iterator;
|
|
import java.util.Map;
|
|
import java.util.concurrent.Executor;
|
|
import java.util.regex.Pattern;
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
import kotlin.jvm.internal.Intrinsics;
|
|
import kotlin.jvm.internal.Reflection;
|
|
import kotlin.reflect.KTypeProjection;
|
|
import kotlin.text.Regex;
|
|
import kotlinx.serialization.DeserializationStrategy;
|
|
import kotlinx.serialization.SerializationStrategy;
|
|
import kotlinx.serialization.SerializersKt;
|
|
import kotlinx.serialization.StringFormat;
|
|
import kotlinx.serialization.json.Json;
|
|
import kotlinx.serialization.modules.SerializersModule;
|
|
|
|
/* loaded from: classes4.dex */
|
|
public final class TpatSender {
|
|
public static final Companion Companion = new Companion(null);
|
|
private static final String FAILED_TPATS = "FAILED_TPATS";
|
|
private static final int MAX_RETRIES = 5;
|
|
private static final String TAG = "TpatSender";
|
|
private final String creativeId;
|
|
private final String eventId;
|
|
private final String placementId;
|
|
private final SignalManager signalManager;
|
|
private final FilePreferences tpatFilePreferences;
|
|
private final VungleApiClient vungleApiClient;
|
|
|
|
public final String getCreativeId() {
|
|
return this.creativeId;
|
|
}
|
|
|
|
public final String getEventId() {
|
|
return this.eventId;
|
|
}
|
|
|
|
public final String getPlacementId() {
|
|
return this.placementId;
|
|
}
|
|
|
|
public final SignalManager getSignalManager() {
|
|
return this.signalManager;
|
|
}
|
|
|
|
public final VungleApiClient getVungleApiClient() {
|
|
return this.vungleApiClient;
|
|
}
|
|
|
|
public TpatSender(VungleApiClient vungleApiClient, String str, String str2, String str3, Executor ioExecutor, PathProvider pathProvider, SignalManager signalManager) {
|
|
Intrinsics.checkNotNullParameter(vungleApiClient, "vungleApiClient");
|
|
Intrinsics.checkNotNullParameter(ioExecutor, "ioExecutor");
|
|
Intrinsics.checkNotNullParameter(pathProvider, "pathProvider");
|
|
this.vungleApiClient = vungleApiClient;
|
|
this.placementId = str;
|
|
this.creativeId = str2;
|
|
this.eventId = str3;
|
|
this.signalManager = signalManager;
|
|
this.tpatFilePreferences = FilePreferences.Companion.get(ioExecutor, pathProvider, FilePreferences.TPAT_FAILED_FILENAME);
|
|
}
|
|
|
|
public /* synthetic */ TpatSender(VungleApiClient vungleApiClient, String str, String str2, String str3, Executor executor, PathProvider pathProvider, SignalManager signalManager, int i, DefaultConstructorMarker defaultConstructorMarker) {
|
|
this(vungleApiClient, str, str2, str3, executor, pathProvider, (i & 64) != 0 ? null : signalManager);
|
|
}
|
|
|
|
public static final class Companion {
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
|
|
private Companion() {
|
|
}
|
|
}
|
|
|
|
public final void sendWinNotification(String urlString, Executor executor) {
|
|
Intrinsics.checkNotNullParameter(urlString, "urlString");
|
|
Intrinsics.checkNotNullParameter(executor, "executor");
|
|
final String injectSessionIdToUrl = injectSessionIdToUrl(urlString);
|
|
executor.execute(new Runnable() { // from class: com.vungle.ads.internal.network.TpatSender$$ExternalSyntheticLambda1
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
TpatSender.m3942sendWinNotification$lambda0(TpatSender.this, injectSessionIdToUrl);
|
|
}
|
|
});
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
/* renamed from: sendWinNotification$lambda-0, reason: not valid java name */
|
|
public static final void m3942sendWinNotification$lambda0(TpatSender this$0, String url) {
|
|
Intrinsics.checkNotNullParameter(this$0, "this$0");
|
|
Intrinsics.checkNotNullParameter(url, "$url");
|
|
BaseAdLoader.ErrorInfo pingTPAT = this$0.vungleApiClient.pingTPAT(url);
|
|
if (pingTPAT != null) {
|
|
AnalyticsClient.INSTANCE.logError$vungle_ads_release(Sdk.SDKError.Reason.AD_WIN_NOTIFICATION_ERROR, "Fail to send " + url + ", error: " + pingTPAT.getDescription(), this$0.placementId, this$0.creativeId, this$0.eventId);
|
|
}
|
|
}
|
|
|
|
public final void sendTpat(final String url, Executor executor) {
|
|
Intrinsics.checkNotNullParameter(url, "url");
|
|
Intrinsics.checkNotNullParameter(executor, "executor");
|
|
final String injectSessionIdToUrl = injectSessionIdToUrl(url);
|
|
executor.execute(new Runnable() { // from class: com.vungle.ads.internal.network.TpatSender$$ExternalSyntheticLambda0
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
TpatSender.m3941sendTpat$lambda2(TpatSender.this, url, injectSessionIdToUrl);
|
|
}
|
|
});
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
/* renamed from: sendTpat$lambda-2, reason: not valid java name */
|
|
public static final void m3941sendTpat$lambda2(TpatSender this$0, String url, String urlWithSessionId) {
|
|
Intrinsics.checkNotNullParameter(this$0, "this$0");
|
|
Intrinsics.checkNotNullParameter(url, "$url");
|
|
Intrinsics.checkNotNullParameter(urlWithSessionId, "$urlWithSessionId");
|
|
HashMap<String, Integer> storedTpats = this$0.getStoredTpats();
|
|
Integer num = storedTpats.get(url);
|
|
if (num == null) {
|
|
num = 0;
|
|
}
|
|
int intValue = num.intValue();
|
|
BaseAdLoader.ErrorInfo pingTPAT = this$0.vungleApiClient.pingTPAT(urlWithSessionId);
|
|
if (pingTPAT == null) {
|
|
if (intValue != 0) {
|
|
storedTpats.remove(url);
|
|
this$0.saveStoredTpats(storedTpats);
|
|
return;
|
|
}
|
|
return;
|
|
}
|
|
if (!pingTPAT.getErrorIsTerminal()) {
|
|
if (intValue >= 5) {
|
|
storedTpats.remove(url);
|
|
this$0.saveStoredTpats(storedTpats);
|
|
new TpatRetryFailure(urlWithSessionId).logErrorNoReturnValue$vungle_ads_release();
|
|
} else {
|
|
storedTpats.put(url, Integer.valueOf(intValue + 1));
|
|
this$0.saveStoredTpats(storedTpats);
|
|
}
|
|
}
|
|
Logger.Companion.e(TAG, "TPAT failed with " + pingTPAT.getDescription() + ", url:" + urlWithSessionId);
|
|
if (pingTPAT.getReason() != 29) {
|
|
AnalyticsClient.INSTANCE.logError$vungle_ads_release(Sdk.SDKError.Reason.TPAT_ERROR, "Fail to send " + urlWithSessionId + ", error: " + pingTPAT.getDescription(), this$0.placementId, this$0.creativeId, this$0.eventId);
|
|
return;
|
|
}
|
|
AnalyticsClient.INSTANCE.logMetric$vungle_ads_release(Sdk.SDKMetric.SDKMetricType.NOTIFICATION_REDIRECT, (r15 & 2) != 0 ? 0L : 0L, (r15 & 4) != 0 ? null : this$0.placementId, (r15 & 8) != 0 ? null : null, (r15 & 16) != 0 ? null : null, (r15 & 32) == 0 ? urlWithSessionId : null);
|
|
}
|
|
|
|
private final HashMap<String, Integer> getStoredTpats() {
|
|
HashMap<String, Integer> hashMap;
|
|
String string = this.tpatFilePreferences.getString(FAILED_TPATS);
|
|
try {
|
|
if (string != null) {
|
|
StringFormat stringFormat = Json.Default;
|
|
SerializersModule serializersModule = stringFormat.getSerializersModule();
|
|
KTypeProjection.Companion companion = KTypeProjection.Companion;
|
|
DeserializationStrategy serializer = SerializersKt.serializer(serializersModule, Reflection.typeOf(HashMap.class, companion.invariant(Reflection.typeOf(String.class)), companion.invariant(Reflection.typeOf(Integer.TYPE))));
|
|
Intrinsics.checkNotNull(serializer, "null cannot be cast to non-null type kotlinx.serialization.KSerializer<T of kotlinx.serialization.internal.Platform_commonKt.cast>");
|
|
hashMap = (HashMap) stringFormat.decodeFromString(serializer, string);
|
|
} else {
|
|
hashMap = new HashMap<>();
|
|
}
|
|
return hashMap;
|
|
} catch (Exception unused) {
|
|
Logger.Companion.e(TAG, "Failed to decode stored tpats: " + string);
|
|
return new HashMap<>();
|
|
}
|
|
}
|
|
|
|
private final void saveStoredTpats(HashMap<String, Integer> hashMap) {
|
|
try {
|
|
FilePreferences filePreferences = this.tpatFilePreferences;
|
|
StringFormat stringFormat = Json.Default;
|
|
SerializersModule serializersModule = stringFormat.getSerializersModule();
|
|
KTypeProjection.Companion companion = KTypeProjection.Companion;
|
|
SerializationStrategy serializer = SerializersKt.serializer(serializersModule, Reflection.typeOf(HashMap.class, companion.invariant(Reflection.typeOf(String.class)), companion.invariant(Reflection.typeOf(Integer.TYPE))));
|
|
Intrinsics.checkNotNull(serializer, "null cannot be cast to non-null type kotlinx.serialization.KSerializer<T of kotlinx.serialization.internal.Platform_commonKt.cast>");
|
|
filePreferences.put(FAILED_TPATS, stringFormat.encodeToString(serializer, hashMap)).apply();
|
|
} catch (Exception unused) {
|
|
Logger.Companion.e(TAG, "Failed to encode the about to storing tpats: " + hashMap);
|
|
}
|
|
}
|
|
|
|
public final void resendStoredTpats$vungle_ads_release(Executor executor) {
|
|
Intrinsics.checkNotNullParameter(executor, "executor");
|
|
Iterator<Map.Entry<String, Integer>> it = getStoredTpats().entrySet().iterator();
|
|
while (it.hasNext()) {
|
|
sendTpat(it.next().getKey(), executor);
|
|
}
|
|
}
|
|
|
|
@VisibleForTesting
|
|
public final String injectSessionIdToUrl(String url) {
|
|
String str;
|
|
Intrinsics.checkNotNullParameter(url, "url");
|
|
SignalManager signalManager = this.signalManager;
|
|
if (signalManager == null || (str = signalManager.getUuid()) == null) {
|
|
str = "";
|
|
}
|
|
if (str.length() <= 0) {
|
|
return url;
|
|
}
|
|
String quote = Pattern.quote(Constants.SESSION_ID);
|
|
Intrinsics.checkNotNullExpressionValue(quote, "quote(Constants.SESSION_ID)");
|
|
return new Regex(quote).replace(url, str);
|
|
}
|
|
|
|
public final void sendTpats(Iterable<String> urls, Executor executor) {
|
|
Intrinsics.checkNotNullParameter(urls, "urls");
|
|
Intrinsics.checkNotNullParameter(executor, "executor");
|
|
Iterator<String> it = urls.iterator();
|
|
while (it.hasNext()) {
|
|
sendTpat(it.next(), executor);
|
|
}
|
|
}
|
|
}
|