- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
194 lines
6.7 KiB
Java
194 lines
6.7 KiB
Java
package com.applovin.impl;
|
|
|
|
import android.os.Bundle;
|
|
import android.text.TextUtils;
|
|
import com.applovin.communicator.AppLovinCommunicator;
|
|
import com.applovin.communicator.AppLovinCommunicatorMessage;
|
|
import com.applovin.communicator.AppLovinCommunicatorSubscriber;
|
|
import com.applovin.impl.sdk.utils.StringUtils;
|
|
import com.applovin.impl.tm;
|
|
import com.applovin.mediation.MaxAdFormat;
|
|
import com.unity3d.services.ads.gmascar.bridges.mobileads.MobileAdsBridge;
|
|
import java.util.Collections;
|
|
import java.util.HashSet;
|
|
import java.util.Iterator;
|
|
import java.util.LinkedHashMap;
|
|
import java.util.Map;
|
|
import java.util.Set;
|
|
|
|
/* loaded from: classes.dex */
|
|
public class v implements AppLovinCommunicatorSubscriber {
|
|
private final com.applovin.impl.sdk.j a;
|
|
private final Object b = new Object();
|
|
private final LinkedHashMap c = new a();
|
|
private final Set d = Collections.synchronizedSet(new HashSet());
|
|
|
|
public interface b {
|
|
void onCreativeIdGenerated(String str, String str2);
|
|
}
|
|
|
|
@Override // com.applovin.communicator.AppLovinCommunicatorEntity
|
|
public String getCommunicatorId() {
|
|
return v.class.getSimpleName();
|
|
}
|
|
|
|
public class a extends LinkedHashMap {
|
|
public a() {
|
|
}
|
|
|
|
@Override // java.util.LinkedHashMap
|
|
public boolean removeEldestEntry(Map.Entry entry) {
|
|
return size() > 16;
|
|
}
|
|
}
|
|
|
|
public v(com.applovin.impl.sdk.j jVar) {
|
|
this.a = jVar;
|
|
if (StringUtils.isValidString(b())) {
|
|
AppLovinCommunicator.getInstance(com.applovin.impl.sdk.j.l()).subscribe(this, "safedk_ad_info");
|
|
}
|
|
}
|
|
|
|
public Bundle a(String str) {
|
|
Bundle bundle;
|
|
if (TextUtils.isEmpty(str)) {
|
|
return null;
|
|
}
|
|
synchronized (this.b) {
|
|
bundle = (Bundle) this.c.get(str);
|
|
}
|
|
this.a.J();
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
this.a.J().a("AdReviewManager", "Retrieved ad info (" + bundle + ") for serve id: " + str);
|
|
}
|
|
return bundle;
|
|
}
|
|
|
|
public void c(String str) {
|
|
this.a.J();
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
this.a.J().a("AdReviewManager", "Removing ad info for serve id: " + str);
|
|
}
|
|
if (TextUtils.isEmpty(str)) {
|
|
return;
|
|
}
|
|
synchronized (this.b) {
|
|
this.c.remove(str);
|
|
}
|
|
}
|
|
|
|
public void b(b bVar) {
|
|
this.d.remove(bVar);
|
|
}
|
|
|
|
public static String b() {
|
|
return b(MobileAdsBridge.versionMethodName);
|
|
}
|
|
|
|
private static String b(String str) {
|
|
Class<?> cls;
|
|
try {
|
|
try {
|
|
cls = Class.forName("com.applovin.quality.AppLovinQualityService");
|
|
} catch (Throwable unused) {
|
|
cls = Class.forName("com.safedk.android.SafeDK");
|
|
}
|
|
return (String) cls.getMethod(str, new Class[0]).invoke(null, new Object[0]);
|
|
} catch (Throwable unused2) {
|
|
return "";
|
|
}
|
|
}
|
|
|
|
@Override // com.applovin.communicator.AppLovinCommunicatorSubscriber
|
|
public void onMessageReceived(AppLovinCommunicatorMessage appLovinCommunicatorMessage) {
|
|
if ("safedk_ad_info".equals(appLovinCommunicatorMessage.getTopic())) {
|
|
Bundle bundle = appLovinCommunicatorMessage.getMessageData().getBundle("public");
|
|
if (bundle == null) {
|
|
this.a.J();
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
this.a.J().k("AdReviewManager", "Received SafeDK ad info without public data");
|
|
return;
|
|
}
|
|
return;
|
|
}
|
|
Bundle bundle2 = appLovinCommunicatorMessage.getMessageData().getBundle("private");
|
|
if (bundle2 == null) {
|
|
this.a.J();
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
this.a.J().k("AdReviewManager", "Received SafeDK ad info without private data");
|
|
return;
|
|
}
|
|
return;
|
|
}
|
|
if (MaxAdFormat.formatFromString(bundle2.getString("ad_format")) == null) {
|
|
this.a.J();
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
this.a.J().k("AdReviewManager", "Received SafeDK ad info without ad format");
|
|
return;
|
|
}
|
|
return;
|
|
}
|
|
final String string = bundle2.getString("id");
|
|
if (TextUtils.isEmpty(string)) {
|
|
this.a.J();
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
this.a.J().k("AdReviewManager", "Received SafeDK ad info without serve id");
|
|
return;
|
|
}
|
|
return;
|
|
}
|
|
synchronized (this.b) {
|
|
try {
|
|
this.a.J();
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
this.a.J().a("AdReviewManager", "Storing current SafeDK ad info for serve id: " + string + ", public data: " + bundle);
|
|
}
|
|
this.c.put(string, bundle);
|
|
} catch (Throwable th) {
|
|
throw th;
|
|
}
|
|
}
|
|
final String string2 = bundle.getString("ad_review_creative_id");
|
|
this.a.J();
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
this.a.J().a("AdReviewManager", "Received SafeDK ad info with Ad Review creative id: " + string2);
|
|
}
|
|
if (!StringUtils.isValidString(string2) || this.d.isEmpty()) {
|
|
return;
|
|
}
|
|
HashSet hashSet = new HashSet(this.d);
|
|
this.a.J();
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
this.a.J().a("AdReviewManager", "Notifying listeners: " + this.d);
|
|
}
|
|
Iterator it = hashSet.iterator();
|
|
while (it.hasNext()) {
|
|
final b bVar = (b) it.next();
|
|
this.a.j0().a((yl) new jn(this.a, "creativeIdGenerated", new Runnable() { // from class: com.applovin.impl.v$$ExternalSyntheticLambda0
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
v.this.a(bVar, string, string2);
|
|
}
|
|
}), tm.b.OTHER);
|
|
}
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public /* synthetic */ void a(b bVar, String str, String str2) {
|
|
this.a.J();
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
this.a.J().a("AdReviewManager", "Notifying Ad Review creative id generated for listener: " + bVar);
|
|
}
|
|
bVar.onCreativeIdGenerated(str, str2);
|
|
}
|
|
|
|
public void a(b bVar) {
|
|
this.d.add(bVar);
|
|
}
|
|
|
|
public static String a() {
|
|
return b("getSdkKey");
|
|
}
|
|
}
|