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,271 @@
package com.applovin.impl.sdk;
import android.graphics.Color;
import androidx.annotation.Nullable;
import com.applovin.impl.lg;
import com.applovin.impl.mg;
import com.applovin.impl.sdk.array.ArrayDirectDownloadAd;
import com.applovin.impl.sdk.utils.JsonUtils;
import com.applovin.impl.sdk.utils.StringUtils;
import com.applovin.impl.sj;
import com.applovin.impl.tl;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public abstract class AppLovinAdBase implements lg, ArrayDirectDownloadAd {
@Nullable
protected final JSONObject adObject;
private final long createdAtMillis;
@Nullable
protected final JSONObject fullResponse;
protected final j sdk;
@Nullable
protected final tl synchronizedAdObject;
@Nullable
protected final tl synchronizedFullResponse;
protected final Object adObjectLock = new Object();
protected final Object fullResponseLock = new Object();
public AppLovinAdBase(JSONObject jSONObject, JSONObject jSONObject2, j jVar) {
if (jSONObject == null) {
throw new IllegalArgumentException("No ad object specified");
}
if (jSONObject2 == null) {
throw new IllegalArgumentException("No response specified");
}
if (jVar == null) {
throw new IllegalArgumentException("No sdk specified");
}
this.sdk = jVar;
if (((Boolean) jVar.a(sj.u6)).booleanValue()) {
this.synchronizedAdObject = new tl(jSONObject);
this.synchronizedFullResponse = new tl(jSONObject2);
this.adObject = null;
this.fullResponse = null;
} else {
this.adObject = jSONObject;
this.fullResponse = jSONObject2;
this.synchronizedAdObject = null;
this.synchronizedFullResponse = null;
}
this.createdAtMillis = System.currentTimeMillis();
}
public String getAdDomain() {
return getStringFromFullResponse("adomain", "");
}
@Override // com.applovin.impl.lg
public abstract /* synthetic */ mg getAdEventTracker();
public abstract long getAdIdNumber();
public String getClCode() {
String stringFromAdObject = getStringFromAdObject("clcode", "");
return StringUtils.isValidString(stringFromAdObject) ? stringFromAdObject : getStringFromFullResponse("clcode", "");
}
public int getColorFromAdObject(String str, int i) {
String stringFromAdObject = getStringFromAdObject(str, null);
return StringUtils.isValidString(stringFromAdObject) ? Color.parseColor(stringFromAdObject) : i;
}
public long getCreatedAtMillis() {
return this.createdAtMillis;
}
public String getDspId() {
return getStringFromFullResponse("dsp_id", "");
}
public String getDspName() {
return getStringFromFullResponse("dsp_name", "");
}
public long getFetchLatencyMillis() {
return getLongFromFullResponse("ad_fetch_latency_millis", -1L);
}
public long getFetchResponseSize() {
return getLongFromFullResponse("ad_fetch_response_size", -1L);
}
@Override // com.applovin.impl.lg
@Nullable
public abstract /* synthetic */ String getOpenMeasurementContentUrl();
@Override // com.applovin.impl.lg
public abstract /* synthetic */ String getOpenMeasurementCustomReferenceData();
@Override // com.applovin.impl.lg
public abstract /* synthetic */ List getOpenMeasurementVerificationScriptResources();
public j getSdk() {
return this.sdk;
}
@Override // com.applovin.impl.lg
public abstract /* synthetic */ boolean isOpenMeasurementEnabled();
public boolean containsKeyForAdObject(String str) {
boolean has;
tl tlVar = this.synchronizedAdObject;
if (tlVar != null) {
return tlVar.a(str);
}
synchronized (this.adObjectLock) {
has = this.adObject.has(str);
}
return has;
}
public boolean getBooleanFromAdObject(String str, Boolean bool) {
boolean booleanValue;
tl tlVar = this.synchronizedAdObject;
if (tlVar != null) {
return tlVar.a(str, bool).booleanValue();
}
synchronized (this.adObjectLock) {
booleanValue = JsonUtils.getBoolean(this.adObject, str, bool).booleanValue();
}
return booleanValue;
}
public boolean getBooleanFromFullResponse(String str, boolean z) {
boolean booleanValue;
tl tlVar = this.synchronizedFullResponse;
if (tlVar != null) {
return tlVar.a(str, Boolean.valueOf(z)).booleanValue();
}
synchronized (this.fullResponseLock) {
booleanValue = JsonUtils.getBoolean(this.fullResponse, str, Boolean.valueOf(z)).booleanValue();
}
return booleanValue;
}
public float getFloatFromAdObject(String str, float f) {
float f2;
tl tlVar = this.synchronizedAdObject;
if (tlVar != null) {
return tlVar.a(str, f);
}
synchronized (this.adObjectLock) {
f2 = JsonUtils.getFloat(this.adObject, str, f);
}
return f2;
}
public int getIntFromAdObject(String str, int i) {
int i2;
tl tlVar = this.synchronizedAdObject;
if (tlVar != null) {
return tlVar.a(str, i);
}
synchronized (this.adObjectLock) {
i2 = JsonUtils.getInt(this.adObject, str, i);
}
return i2;
}
public List<Integer> getIntegerListFromAdObject(String str, List<Integer> list) {
List<Integer> integerList;
tl tlVar = this.synchronizedAdObject;
if (tlVar != null) {
return tlVar.a(str, (List) list);
}
synchronized (this.adObjectLock) {
integerList = JsonUtils.getIntegerList(this.adObject, str, list);
}
return integerList;
}
public JSONArray getJsonArrayFromAdObject(String str, JSONArray jSONArray) {
JSONArray jSONArray2;
tl tlVar = this.synchronizedAdObject;
if (tlVar != null) {
return tlVar.a(str, jSONArray);
}
synchronized (this.adObjectLock) {
jSONArray2 = JsonUtils.getJSONArray(this.adObject, str, jSONArray);
}
return jSONArray2;
}
public JSONObject getJsonObjectFromAdObject(String str, JSONObject jSONObject) {
JSONObject jSONObject2;
tl tlVar = this.synchronizedAdObject;
if (tlVar != null) {
return tlVar.a(str, jSONObject);
}
synchronized (this.adObjectLock) {
jSONObject2 = JsonUtils.getJSONObject(this.adObject, str, jSONObject);
}
return jSONObject2;
}
public long getLongFromAdObject(String str, long j) {
long j2;
tl tlVar = this.synchronizedAdObject;
if (tlVar != null) {
return tlVar.a(str, j);
}
synchronized (this.adObjectLock) {
j2 = JsonUtils.getLong(this.adObject, str, j);
}
return j2;
}
public long getLongFromFullResponse(String str, long j) {
long j2;
tl tlVar = this.synchronizedFullResponse;
if (tlVar != null) {
return tlVar.a(str, j);
}
synchronized (this.fullResponseLock) {
j2 = JsonUtils.getLong(this.fullResponse, str, j);
}
return j2;
}
public String getStringFromAdObject(String str, String str2) {
String string;
tl tlVar = this.synchronizedAdObject;
if (tlVar != null) {
return tlVar.a(str, str2);
}
synchronized (this.adObjectLock) {
string = JsonUtils.getString(this.adObject, str, str2);
}
return string;
}
public String getStringFromFullResponse(String str, String str2) {
String string;
tl tlVar = this.synchronizedFullResponse;
if (tlVar != null) {
return tlVar.a(str, str2);
}
synchronized (this.fullResponseLock) {
string = JsonUtils.getString(this.fullResponse, str, str2);
}
return string;
}
public List<String> getStringListFromAdObject(String str, List<String> list) {
List<String> stringList;
tl tlVar = this.synchronizedAdObject;
if (tlVar != null) {
return tlVar.b(str, list);
}
synchronized (this.adObjectLock) {
stringList = JsonUtils.getStringList(this.adObject, str, list);
}
return stringList;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,238 @@
package com.applovin.impl.sdk;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.Uri;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import androidx.annotation.Nullable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
/* loaded from: classes2.dex */
public class AppLovinBroadcastManager {
private static final Map a = new HashMap();
private static final Map b = new HashMap();
private static final ArrayList c = new ArrayList();
private static final Handler d = new a(Looper.getMainLooper());
public interface Receiver {
void onReceive(Intent intent, @Nullable Map<String, Object> map);
}
public class a extends Handler {
public a(Looper looper) {
super(looper);
}
@Override // android.os.Handler
public void handleMessage(Message message) {
if (message.what == 1) {
AppLovinBroadcastManager.b();
} else {
super.handleMessage(message);
}
}
}
public static class b {
final Intent a;
final Map b;
final List c;
public b(Intent intent, Map map, List list) {
this.a = intent;
this.b = map;
this.c = list;
}
}
public static class c {
final IntentFilter a;
final Receiver b;
boolean c;
boolean d;
public c(IntentFilter intentFilter, Receiver receiver) {
this.a = intentFilter;
this.b = receiver;
}
}
/* JADX INFO: Access modifiers changed from: private */
public static void b() {
int size;
b[] bVarArr;
while (true) {
synchronized (a) {
try {
ArrayList arrayList = c;
size = arrayList.size();
if (size <= 0) {
return;
}
bVarArr = new b[size];
arrayList.toArray(bVarArr);
arrayList.clear();
} catch (Throwable th) {
throw th;
}
}
for (int i = 0; i < size; i++) {
b bVar = bVarArr[i];
if (bVar != null) {
for (c cVar : bVar.c) {
if (cVar != null && !cVar.d) {
cVar.b.onReceive(bVar.a, bVar.b);
}
}
}
}
}
}
public static void registerReceiver(Receiver receiver, IntentFilter intentFilter) {
Map map = a;
synchronized (map) {
try {
c cVar = new c(intentFilter, receiver);
ArrayList arrayList = (ArrayList) map.get(receiver);
if (arrayList == null) {
arrayList = new ArrayList(1);
map.put(receiver, arrayList);
}
arrayList.add(cVar);
Iterator<String> actionsIterator = intentFilter.actionsIterator();
while (actionsIterator.hasNext()) {
String next = actionsIterator.next();
Map map2 = b;
ArrayList arrayList2 = (ArrayList) map2.get(next);
if (arrayList2 == null) {
arrayList2 = new ArrayList(1);
map2.put(next, arrayList2);
}
arrayList2.add(cVar);
}
} catch (Throwable th) {
throw th;
}
}
}
public static boolean sendBroadcast(Intent intent, @Nullable Map<String, Object> map) {
synchronized (a) {
try {
List a2 = a(intent);
if (a2 == null) {
return false;
}
c.add(new b(intent, map, a2));
Handler handler = d;
if (!handler.hasMessages(1)) {
handler.sendEmptyMessage(1);
}
return true;
} catch (Throwable th) {
throw th;
}
}
}
public static void sendBroadcastSync(Intent intent, @Nullable Map<String, Object> map) {
List<c> a2 = a(intent);
if (a2 == null) {
return;
}
for (c cVar : a2) {
if (!cVar.d) {
cVar.b.onReceive(intent, map);
}
}
}
public static void sendBroadcastSyncWithPendingBroadcasts(Intent intent, @Nullable Map<String, Object> map) {
if (sendBroadcast(intent, map)) {
b();
}
}
public static boolean sendBroadcastWithAdObject(String str, Object obj) {
HashMap hashMap = new HashMap(1);
hashMap.put("ad", obj);
return sendBroadcast(new Intent(str), hashMap);
}
public static void unregisterReceiver(Receiver receiver) {
Map map = a;
synchronized (map) {
try {
List<c> list = (List) map.remove(receiver);
if (list == null) {
return;
}
for (c cVar : list) {
cVar.d = true;
Iterator<String> actionsIterator = cVar.a.actionsIterator();
while (actionsIterator.hasNext()) {
String next = actionsIterator.next();
List list2 = (List) b.get(next);
if (list2 != null) {
Iterator it = list2.iterator();
while (it.hasNext()) {
if (((c) it.next()).b == receiver) {
cVar.d = true;
it.remove();
}
}
if (list2.size() <= 0) {
b.remove(next);
}
}
}
}
} catch (Throwable th) {
throw th;
}
}
}
private static List a(Intent intent) {
synchronized (a) {
try {
String action = intent.getAction();
Uri data = intent.getData();
String scheme = intent.getScheme();
Set<String> categories = intent.getCategories();
List<c> list = (List) b.get(action);
if (list == null) {
return null;
}
ArrayList arrayList = null;
for (c cVar : list) {
if (!cVar.c && cVar.a.match(action, null, scheme, data, categories, "AppLovinBroadcastManager") >= 0) {
if (arrayList == null) {
arrayList = new ArrayList();
}
arrayList.add(cVar);
cVar.c = true;
}
}
if (arrayList == null) {
return null;
}
Iterator it = arrayList.iterator();
while (it.hasNext()) {
((c) it.next()).c = false;
}
return arrayList;
} catch (Throwable th) {
throw th;
}
}
}
}

View File

@@ -0,0 +1,54 @@
package com.applovin.impl.sdk;
import androidx.annotation.Nullable;
/* loaded from: classes2.dex */
public class AppLovinError {
public static final AppLovinError NO_FILL = new AppLovinError(204, "No Fill");
private final int a;
private final String b;
public AppLovinError(int i, @Nullable String str) {
this.a = i;
this.b = str;
}
public boolean canEqual(Object obj) {
return obj instanceof AppLovinError;
}
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof AppLovinError)) {
return false;
}
AppLovinError appLovinError = (AppLovinError) obj;
if (!appLovinError.canEqual(this) || getCode() != appLovinError.getCode()) {
return false;
}
String message = getMessage();
String message2 = appLovinError.getMessage();
return message != null ? message.equals(message2) : message2 == null;
}
public int getCode() {
return this.a;
}
@Nullable
public String getMessage() {
return this.b;
}
public int hashCode() {
int code = getCode() + 59;
String message = getMessage();
return (code * 59) + (message == null ? 43 : message.hashCode());
}
public String toString() {
return "AppLovinError(code=" + getCode() + ", message=" + getMessage() + ")";
}
}

View File

@@ -0,0 +1,62 @@
package com.applovin.impl.sdk;
import android.os.Process;
import com.applovin.impl.la;
import com.applovin.impl.sdk.utils.CollectionUtils;
import com.applovin.impl.sj;
import com.ironsource.v8;
import java.lang.Thread;
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;
/* loaded from: classes2.dex */
public class AppLovinExceptionHandler implements Thread.UncaughtExceptionHandler {
private static final AppLovinExceptionHandler d = new AppLovinExceptionHandler();
private final Set a = new HashSet(2);
private final AtomicBoolean b = new AtomicBoolean();
private Thread.UncaughtExceptionHandler c;
public static AppLovinExceptionHandler shared() {
return d;
}
public void addSdk(j jVar) {
if (this.a.contains(jVar)) {
return;
}
this.a.add(jVar);
}
public void enable() {
if (this.b.compareAndSet(false, true)) {
this.c = Thread.getDefaultUncaughtExceptionHandler();
Thread.setDefaultUncaughtExceptionHandler(this);
}
}
@Override // java.lang.Thread.UncaughtExceptionHandler
public void uncaughtException(Thread thread, Throwable th) {
long j = 500;
for (j jVar : this.a) {
jVar.J();
if (n.a()) {
jVar.J().a("AppLovinExceptionHandler", "Detected unhandled exception");
}
jVar.E().a(la.J, CollectionUtils.map("top_main_method", th.toString()));
jVar.A().trackEventSynchronously(v8.h.e0);
j = ((Long) jVar.a(sj.F3)).longValue();
}
try {
Thread.sleep(j);
} catch (InterruptedException unused) {
}
Thread.UncaughtExceptionHandler uncaughtExceptionHandler = this.c;
if (uncaughtExceptionHandler != null) {
uncaughtExceptionHandler.uncaughtException(thread, th);
} else {
Process.killProcess(Process.myPid());
System.exit(1);
}
}
}

View File

@@ -0,0 +1,211 @@
package com.applovin.impl.sdk;
import android.content.Context;
import androidx.annotation.Nullable;
import com.applovin.impl.sdk.utils.StringUtils;
import com.applovin.mediation.MaxSegmentCollection;
import com.applovin.sdk.AppLovinSdkInitializationConfiguration;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/* loaded from: classes2.dex */
public class AppLovinSdkInitializationConfigurationImpl implements AppLovinSdkInitializationConfiguration {
private final String a;
private final String b;
private final String c;
private final MaxSegmentCollection d;
private final List e;
private final List f;
private final boolean g;
public static class BuilderImpl implements AppLovinSdkInitializationConfiguration.Builder {
private String a;
private String b;
private String c;
private MaxSegmentCollection d;
private List e = Collections.emptyList();
private List f = Collections.emptyList();
private boolean g = true;
public BuilderImpl(String str, Context context) {
this.a = str;
n.e("AppLovinSdkInitializationConfiguration", "Initializing with key: " + str);
}
@Override // com.applovin.sdk.AppLovinSdkInitializationConfiguration.Builder
public AppLovinSdkInitializationConfiguration build() {
return new AppLovinSdkInitializationConfigurationImpl(this);
}
@Override // com.applovin.sdk.AppLovinSdkInitializationConfiguration.Builder
public List<String> getAdUnitIds() {
return this.f;
}
@Override // com.applovin.sdk.AppLovinSdkInitializationConfiguration.Builder
@Nullable
public String getMediationProvider() {
return this.b;
}
@Override // com.applovin.sdk.AppLovinSdkInitializationConfiguration.Builder
@Nullable
public String getPluginVersion() {
return this.c;
}
@Override // com.applovin.sdk.AppLovinSdkInitializationConfiguration.Builder
public String getSdkKey() {
return this.a;
}
@Override // com.applovin.sdk.AppLovinSdkInitializationConfiguration.Builder
@Nullable
public MaxSegmentCollection getSegmentCollection() {
return this.d;
}
@Override // com.applovin.sdk.AppLovinSdkInitializationConfiguration.Builder
public List<String> getTestDeviceAdvertisingIds() {
return this.e;
}
@Override // com.applovin.sdk.AppLovinSdkInitializationConfiguration.Builder
public boolean isExceptionHandlerEnabled() {
return this.g;
}
@Override // com.applovin.sdk.AppLovinSdkInitializationConfiguration.Builder
public AppLovinSdkInitializationConfiguration.Builder setAdUnitIds(List<String> list) {
n.e("AppLovinSdkInitializationConfiguration", "setAdUnitIds(adUnitIds=" + list + ")");
if (list == null) {
return this;
}
ArrayList arrayList = new ArrayList(list.size());
for (String str : list) {
if (StringUtils.isValidString(str) && str.length() > 0) {
if (str.length() == 16) {
arrayList.add(str);
} else {
n.h("AppLovinSdkInitializationConfiguration", "Unable to set initialization ad unit id (" + str + ") - please make sure it is in the format of XXXXXXXXXXXXXXXX");
}
}
}
this.f = arrayList;
return this;
}
@Override // com.applovin.sdk.AppLovinSdkInitializationConfiguration.Builder
public AppLovinSdkInitializationConfiguration.Builder setExceptionHandlerEnabled(boolean z) {
n.e("AppLovinSdkInitializationConfiguration", "setExceptionHandlerEnabled(exceptionHandlerEnabled=" + z + ")");
this.g = z;
return this;
}
@Override // com.applovin.sdk.AppLovinSdkInitializationConfiguration.Builder
public AppLovinSdkInitializationConfiguration.Builder setMediationProvider(@Nullable String str) {
n.e("AppLovinSdkInitializationConfiguration", "setMediationProvider(mediationProvider=" + str + ")");
if (str == null || (!str.isEmpty() && str.length() <= 64 && StringUtils.isAlphaNumeric(str))) {
this.b = str;
return this;
}
n.h("AppLovinSdkInitializationConfiguration", "Mediation provider set to invalid value: " + str + ". Please use a valid mediation provider (e.g., AppLovinMediationProvider.MAX)");
return this;
}
@Override // com.applovin.sdk.AppLovinSdkInitializationConfiguration.Builder
public AppLovinSdkInitializationConfiguration.Builder setPluginVersion(@Nullable String str) {
n.e("AppLovinSdkInitializationConfiguration", "setPluginVersion(pluginVersion=" + str + ")");
this.c = str;
return this;
}
public AppLovinSdkInitializationConfiguration.Builder setSdkKey(String str) {
this.a = str;
return this;
}
@Override // com.applovin.sdk.AppLovinSdkInitializationConfiguration.Builder
public AppLovinSdkInitializationConfiguration.Builder setSegmentCollection(MaxSegmentCollection maxSegmentCollection) {
n.e("AppLovinSdkInitializationConfiguration", "setSegmentCollection(segmentCollection=" + maxSegmentCollection + ")");
this.d = maxSegmentCollection;
return this;
}
@Override // com.applovin.sdk.AppLovinSdkInitializationConfiguration.Builder
public AppLovinSdkInitializationConfiguration.Builder setTestDeviceAdvertisingIds(List<String> list) {
n.e("AppLovinSdkInitializationConfiguration", "setTestDeviceAdvertisingIds(testDeviceAdvertisingIds=" + list + ")");
if (list == null) {
return this;
}
ArrayList arrayList = new ArrayList(list.size());
for (String str : list) {
if (str == null || str.length() != 36) {
n.h("AppLovinSdkInitializationConfiguration", "Unable to set test device advertising id (" + str + ") - please make sure it is in the format of xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx");
} else {
arrayList.add(str);
}
}
this.e = arrayList;
return this;
}
public String toString() {
return "AppLovinSdkInitializationConfiguration.Builder{ sdkKey=" + this.a + "mediationProvider=" + this.b + "pluginVersion=" + this.c + "testDeviceAdvertisingIdentifiers=" + this.e + "adUnitIdentifiers=" + this.f + "isExceptionHandlerEnabled=" + this.g + "segmentCollection=" + this.d + "}";
}
}
@Override // com.applovin.sdk.AppLovinSdkInitializationConfiguration
public List<String> getAdUnitIds() {
return this.f;
}
@Override // com.applovin.sdk.AppLovinSdkInitializationConfiguration
@Nullable
public String getMediationProvider() {
return this.b;
}
@Override // com.applovin.sdk.AppLovinSdkInitializationConfiguration
@Nullable
public String getPluginVersion() {
return this.c;
}
@Override // com.applovin.sdk.AppLovinSdkInitializationConfiguration
@Nullable
public String getSdkKey() {
return this.a;
}
@Override // com.applovin.sdk.AppLovinSdkInitializationConfiguration
@Nullable
public MaxSegmentCollection getSegmentCollection() {
return this.d;
}
@Override // com.applovin.sdk.AppLovinSdkInitializationConfiguration
public List<String> getTestDeviceAdvertisingIds() {
return this.e;
}
@Override // com.applovin.sdk.AppLovinSdkInitializationConfiguration
public boolean isExceptionHandlerEnabled() {
return this.g;
}
public String toString() {
return "AppLovinSdkInitializationConfiguration{ sdkKey=" + this.a + ", mediationProvider=" + this.b + ", pluginVersion=" + this.c + ", testDeviceAdvertisingIds=" + this.e + ", adUnitIdentifiers=" + this.f + ", isExceptionHandlerEnabled=" + this.g + ", segmentCollection=" + this.d + "}";
}
private AppLovinSdkInitializationConfigurationImpl(BuilderImpl builderImpl) {
this.a = builderImpl.a;
this.b = builderImpl.b;
this.c = builderImpl.c;
this.d = builderImpl.d;
this.e = builderImpl.e;
this.f = builderImpl.f;
this.g = builderImpl.g;
}
}

View File

@@ -0,0 +1,12 @@
package com.applovin.impl.sdk;
import com.applovin.sdk.AppLovinTermsAndPrivacyPolicyFlowSettings;
/* loaded from: classes2.dex */
public class AppLovinSdkSettingsBase {
protected AppLovinTermsAndPrivacyPolicyFlowSettings backingConsentFlowSettings;
public AppLovinTermsAndPrivacyPolicyFlowSettings getBackingConsentFlowSettings() {
return this.backingConsentFlowSettings;
}
}

View File

@@ -0,0 +1,152 @@
package com.applovin.impl.sdk;
import android.content.Intent;
import androidx.core.app.NotificationCompat;
import com.applovin.impl.jn;
import com.applovin.impl.sdk.utils.CollectionUtils;
import com.applovin.impl.sj;
import com.applovin.impl.tm;
import com.applovin.impl.v7;
import com.applovin.impl.vi;
import com.applovin.impl.yl;
import com.applovin.impl.yp;
import com.applovin.sdk.AppLovinEventParameters;
import com.applovin.sdk.AppLovinEventService;
import com.applovin.sdk.AppLovinEventTypes;
import com.firemonkeys.cloudcellapi.Consts;
import com.ironsource.v8;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
/* loaded from: classes2.dex */
public class EventServiceImpl implements AppLovinEventService {
public static final List<String> ALLOW_PRE_INIT_EVENT_TYPES = Arrays.asList("landing", v8.h.e0, "resumed", "cf_start", "tos_ok", "gdpr_ok");
private final j a;
private final AtomicBoolean b = new AtomicBoolean();
public EventServiceImpl(j jVar) {
this.a = jVar;
}
private String b() {
return ((String) this.a.a(sj.P0)) + "4.0/pix";
}
public void maybeTrackAppOpenEvent() {
if (this.b.compareAndSet(false, true)) {
this.a.A().trackEvent("landing");
}
}
public String toString() {
return "EventService{}";
}
@Override // com.applovin.sdk.AppLovinEventService
public void trackCheckout(String str, Map<String, String> map) {
Map<String, String> map2 = CollectionUtils.map(map);
map2.put(AppLovinEventParameters.CHECKOUT_TRANSACTION_IDENTIFIER, str);
trackEvent(AppLovinEventTypes.USER_COMPLETED_CHECKOUT, map2);
}
@Override // com.applovin.sdk.AppLovinEventService
public void trackEvent(String str) {
trackEvent(str, new HashMap());
}
public void trackEventSynchronously(String str) {
this.a.J();
if (n.a()) {
this.a.J().a("AppLovinEventService", "Tracking event: \"" + str + "\" synchronously");
}
v7 v7Var = new v7(str, new HashMap());
Map a = a(v7Var, true);
HashMap hashMap = new HashMap(v7Var.d());
if (((Boolean) this.a.a(sj.G5)).booleanValue() || ((Boolean) this.a.a(sj.B5)).booleanValue()) {
hashMap.putAll(a);
a = null;
}
this.a.X().e(com.applovin.impl.sdk.network.d.b().d(b()).a(a()).b(a).c(hashMap).a(a(v7Var, (Map) null)).c(((Boolean) this.a.a(sj.Q5)).booleanValue()).a(((Boolean) this.a.a(sj.o5)).booleanValue()).a());
}
@Override // com.applovin.sdk.AppLovinEventService
public void trackInAppPurchase(Intent intent, Map<String, String> map) {
Map<String, String> map2 = CollectionUtils.map(map);
try {
map2.put(AppLovinEventParameters.IN_APP_PURCHASE_DATA, intent.getStringExtra(Consts.RESPONSE_INAPP_PURCHASE_DATA));
map2.put(AppLovinEventParameters.IN_APP_DATA_SIGNATURE, intent.getStringExtra(Consts.RESPONSE_INAPP_SIGNATURE));
} catch (Throwable th) {
n.c("AppLovinEventService", "Unable to track in app purchase - invalid purchase intent", th);
this.a.E().a("AppLovinEventService", "trackIAP", th);
}
trackEvent("iap", map2);
}
@Override // com.applovin.sdk.AppLovinEventService
public void trackEvent(String str, Map<String, String> map) {
trackEvent(str, map, null);
}
public void trackEvent(String str, Map<String, String> map, final Map<String, String> map2) {
this.a.J();
if (n.a()) {
this.a.J().a("AppLovinEventService", "Tracking event: \"" + str + "\" with parameters: " + map);
}
final v7 v7Var = new v7(str, map);
final boolean contains = ALLOW_PRE_INIT_EVENT_TYPES.contains(str);
try {
this.a.j0().a((yl) new jn(this.a, contains, "submitTrackEventPostback", new Runnable() { // from class: com.applovin.impl.sdk.EventServiceImpl$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
EventServiceImpl.this.a(v7Var, map2, contains);
}
}), tm.b.OTHER);
} catch (Throwable th) {
this.a.J();
if (n.a()) {
this.a.J().a("AppLovinEventService", "Unable to track event: " + v7Var, th);
}
this.a.E().a("AppLovinEventService", "trackEvent", th);
}
}
private Map a(v7 v7Var, Map map) {
Map map2 = CollectionUtils.map(map);
boolean contains = this.a.c(sj.U0).contains(v7Var.c());
map2.put("AppLovin-Event", contains ? v7Var.c() : "postinstall");
if (!contains) {
map2.put("AppLovin-Sub-Event", v7Var.c());
}
return map2;
}
private Map a(v7 v7Var, boolean z) {
boolean contains = this.a.c(sj.U0).contains(v7Var.c());
Map a = this.a.y().a(null, z, false);
a.put(NotificationCompat.CATEGORY_EVENT, contains ? v7Var.c() : "postinstall");
a.put("event_id", v7Var.b());
a.put("ts", Long.toString(v7Var.a()));
if (!contains) {
a.put("sub_event", v7Var.c());
}
return yp.a(a);
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void a(v7 v7Var, Map map, boolean z) {
Map a = a(v7Var, false);
HashMap hashMap = new HashMap(v7Var.d());
if (((Boolean) this.a.a(sj.G5)).booleanValue() || ((Boolean) this.a.a(sj.B5)).booleanValue()) {
hashMap.putAll(a);
a = null;
}
this.a.X().e(com.applovin.impl.sdk.network.d.b().d(b()).a(a()).b(a).c(hashMap).a(a(v7Var, map)).c(((Boolean) this.a.a(sj.Q5)).booleanValue()).a(((Boolean) this.a.a(sj.o5)).booleanValue()).d(z).a(vi.a.a(((Integer) this.a.a(sj.y5)).intValue())).a());
}
private String a() {
return ((String) this.a.a(sj.Q0)) + "4.0/pix";
}
}

View File

@@ -0,0 +1,163 @@
package com.applovin.impl.sdk;
import com.applovin.impl.sdk.e;
import com.applovin.impl.sdk.utils.JsonUtils;
import com.applovin.impl.sj;
import com.applovin.impl.yp;
import com.mbridge.msdk.foundation.entity.CampaignEx;
import java.io.File;
import java.util.HashSet;
import java.util.List;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public class NativeCrashReporter implements e.d {
private static boolean a;
private static boolean b;
private static final NativeCrashReporter c = new NativeCrashReporter();
private NativeCrashReporter() {
}
public static void a(j jVar) {
if (jVar == null) {
return;
}
if (!((Boolean) jVar.a(sj.G4)).booleanValue() && !yp.i(j.l())) {
if (b) {
try {
e j = jVar.j();
NativeCrashReporter nativeCrashReporter = c;
j.a(nativeCrashReporter);
nativeCrashReporter.disable();
return;
} catch (Throwable th) {
jVar.J();
if (n.a()) {
jVar.J().a("NativeCrashReporter", "Failed to disable native crash reporter", th);
}
jVar.E().a("NativeCrashReporter", "disableInstance", th);
return;
}
}
return;
}
if (a()) {
List c2 = jVar.c(sj.H4);
int[] iArr = new int[c2.size()];
for (int i = 0; i < c2.size(); i++) {
try {
iArr[i] = Integer.parseInt((String) c2.get(i));
} catch (NumberFormatException unused) {
}
}
File file = new File(j.l().getCacheDir(), "al-reports");
if (file.exists()) {
a(file, jVar);
} else if (!file.mkdir()) {
jVar.J();
if (n.a()) {
jVar.J().b("NativeCrashReporter", "Failed to create reports directory");
return;
}
return;
}
try {
NativeCrashReporter nativeCrashReporter2 = c;
nativeCrashReporter2.enable(file.getAbsolutePath(), iArr, ((Boolean) jVar.a(sj.I4)).booleanValue());
HashSet hashSet = new HashSet();
hashSet.add(e.c.SHOW);
hashSet.add(e.c.CLICK);
hashSet.add(e.c.SHOW_ERROR);
hashSet.add(e.c.DESTROY);
jVar.j().a(nativeCrashReporter2, hashSet);
} catch (Throwable th2) {
jVar.J();
if (n.a()) {
jVar.J().a("NativeCrashReporter", "Failed to enable native crash reporter", th2);
}
jVar.E().a("NativeCrashReporter", "enableInstance", th2);
}
}
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void b(e.b bVar) {
JSONObject jSONObject = new JSONObject();
JsonUtils.putString(jSONObject, "ad_unit_id", bVar.a());
JsonUtils.putString(jSONObject, "ad_format", bVar.g());
JsonUtils.putString(jSONObject, "network_name", bVar.c());
JsonUtils.putString(jSONObject, "adapter_class", bVar.b());
JsonUtils.putString(jSONObject, "adapter_version", bVar.d());
JsonUtils.putString(jSONObject, "bcode", bVar.e());
JsonUtils.putString(jSONObject, CampaignEx.JSON_KEY_CREATIVE_ID, bVar.f());
JsonUtils.putString(jSONObject, "operation", bVar.i().toString());
updateAdInfo(bVar.h(), jSONObject.toString());
}
private native void disable();
private native void enable(String str, int[] iArr, boolean z);
private native void removeAdInfo(int i);
private native void updateAdInfo(int i, String str);
private static boolean a() {
if (!a) {
a = true;
try {
System.loadLibrary("applovin-native-crash-reporter");
b = true;
} catch (Throwable th) {
n.b("NativeCrashReporter", "Failed to load native crash reporter library", th);
}
}
return b;
}
/* JADX WARN: Can't wrap try/catch for region: R(8:7|(2:9|(8:11|12|13|(1:15)(4:33|(4:36|(2:38|39)(2:41|42)|40|34)|43|44)|16|17|(2:19|(2:21|22)(1:24))(1:25)|23))|51|(1:53)|16|17|(0)(0)|23) */
/* JADX WARN: Code restructure failed: missing block: B:27:0x00e7, code lost:
r0 = move-exception;
*/
/* JADX WARN: Code restructure failed: missing block: B:28:0x00e8, code lost:
r17.J();
*/
/* JADX WARN: Code restructure failed: missing block: B:29:0x00ef, code lost:
if (com.applovin.impl.sdk.n.a() != false) goto L42;
*/
/* JADX WARN: Code restructure failed: missing block: B:30:0x00f1, code lost:
r17.J().a("NativeCrashReporter", "Failed to delete native crash report: " + r6.getAbsolutePath(), r0);
*/
/* JADX WARN: Removed duplicated region for block: B:19:0x00c3 A[Catch: all -> 0x00e7, TryCatch #0 {all -> 0x00e7, blocks: (B:17:0x00bd, B:19:0x00c3, B:21:0x00cc), top: B:16:0x00bd }] */
/* JADX WARN: Removed duplicated region for block: B:25:0x010b A[SYNTHETIC] */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
private static void a(java.io.File r16, com.applovin.impl.sdk.j r17) {
/*
Method dump skipped, instructions count: 272
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: com.applovin.impl.sdk.NativeCrashReporter.a(java.io.File, com.applovin.impl.sdk.j):void");
}
@Override // com.applovin.impl.sdk.e.d
public void a(final e.b bVar) {
if (bVar.i() == e.c.DESTROY) {
removeAdInfo(bVar.h());
} else {
yp.a(new Runnable() { // from class: com.applovin.impl.sdk.NativeCrashReporter$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
NativeCrashReporter.this.b(bVar);
}
});
}
}
}

View File

@@ -0,0 +1,55 @@
package com.applovin.impl.sdk;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.applovin.impl.sdk.utils.StringUtils;
import com.applovin.impl.sj;
import com.applovin.sdk.AppLovinSdkConfiguration;
import java.util.List;
/* loaded from: classes2.dex */
public class SdkConfigurationImpl implements AppLovinSdkConfiguration {
private final List a;
private final j b;
public SdkConfigurationImpl(@Nullable List<String> list, j jVar) {
this.a = list;
this.b = jVar;
}
@Override // com.applovin.sdk.AppLovinSdkConfiguration
public AppLovinSdkConfiguration.ConsentDialogState getConsentDialogState() {
String str = this.b.g0().getExtraParameters().get("consent_dialog_state");
if (!StringUtils.isValidString(str)) {
str = (String) this.b.a(sj.y6);
}
return "applies".equalsIgnoreCase(str) ? AppLovinSdkConfiguration.ConsentDialogState.APPLIES : "does_not_apply".equalsIgnoreCase(str) ? AppLovinSdkConfiguration.ConsentDialogState.DOES_NOT_APPLY : AppLovinSdkConfiguration.ConsentDialogState.UNKNOWN;
}
@Override // com.applovin.sdk.AppLovinSdkConfiguration
public AppLovinSdkConfiguration.ConsentFlowUserGeography getConsentFlowUserGeography() {
String str = (String) this.b.a(sj.y6);
return "applies".equalsIgnoreCase(str) ? AppLovinSdkConfiguration.ConsentFlowUserGeography.GDPR : "does_not_apply".equalsIgnoreCase(str) ? AppLovinSdkConfiguration.ConsentFlowUserGeography.OTHER : AppLovinSdkConfiguration.ConsentFlowUserGeography.UNKNOWN;
}
@Override // com.applovin.sdk.AppLovinSdkConfiguration
public String getCountryCode() {
return (String) this.b.a(sj.z6);
}
@Override // com.applovin.sdk.AppLovinSdkConfiguration
@Nullable
public List<String> getEnabledAmazonAdUnitIds() {
return this.a;
}
@Override // com.applovin.sdk.AppLovinSdkConfiguration
public boolean isTestModeEnabled() {
return this.b.l0().c();
}
@NonNull
public String toString() {
return "AppLovinSdkConfiguration{, countryCode=" + getCountryCode() + ", enabledAmazonAdUnitIds=" + getEnabledAmazonAdUnitIds() + ", testModeEnabled=" + isTestModeEnabled() + '}';
}
}

View File

@@ -0,0 +1,179 @@
package com.applovin.impl.sdk;
import android.app.Activity;
import android.app.Application;
import android.content.BroadcastReceiver;
import android.content.ComponentCallbacks2;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.res.Configuration;
import com.applovin.impl.ca;
import com.applovin.impl.sj;
import com.applovin.impl.yp;
import com.ironsource.v8;
import java.util.Date;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
/* loaded from: classes2.dex */
public class SessionTracker {
public static final String ACTION_APPLICATION_PAUSED = "com.applovin.application_paused";
public static final String ACTION_APPLICATION_RESUMED = "com.applovin.application_resumed";
final j a;
private final AtomicBoolean b = new AtomicBoolean();
private final AtomicBoolean c = new AtomicBoolean();
private final AtomicInteger d = new AtomicInteger();
private final AtomicLong e = new AtomicLong();
private final AtomicLong f = new AtomicLong();
private Date g;
private Date h;
public class a extends com.applovin.impl.p {
public a() {
}
@Override // com.applovin.impl.p, android.app.Application.ActivityLifecycleCallbacks
public void onActivityResumed(Activity activity) {
super.onActivityResumed(activity);
SessionTracker.this.b();
}
}
public class b implements ComponentCallbacks2 {
public b() {
}
@Override // android.content.ComponentCallbacks
public void onConfigurationChanged(Configuration configuration) {
}
@Override // android.content.ComponentCallbacks
public void onLowMemory() {
}
@Override // android.content.ComponentCallbacks2
public void onTrimMemory(int i) {
SessionTracker.this.d.set(i);
if (i == 20) {
SessionTracker.this.a();
}
}
}
public class c extends BroadcastReceiver {
public c() {
}
@Override // android.content.BroadcastReceiver
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if ("android.intent.action.USER_PRESENT".equals(action)) {
if (yp.g()) {
SessionTracker.this.b();
}
} else if ("android.intent.action.SCREEN_OFF".equals(action)) {
SessionTracker.this.a();
}
}
}
public SessionTracker(j jVar) {
this.a = jVar;
Application application = (Application) j.l();
application.registerActivityLifecycleCallbacks(new a());
application.registerComponentCallbacks(new b());
IntentFilter intentFilter = new IntentFilter("android.intent.action.SCREEN_OFF");
intentFilter.addAction("android.intent.action.USER_PRESENT");
application.registerReceiver(new c(), intentFilter);
}
private void d() {
this.a.J();
if (n.a()) {
this.a.J().a("SessionTracker", "Application Resumed");
}
this.f.set(System.currentTimeMillis());
boolean booleanValue = ((Boolean) this.a.a(sj.L3)).booleanValue();
long longValue = ((Long) this.a.a(sj.M3)).longValue();
AppLovinBroadcastManager.sendBroadcastSync(new Intent(ACTION_APPLICATION_RESUMED), null);
if (this.b.getAndSet(false)) {
return;
}
long millis = TimeUnit.MINUTES.toMillis(longValue);
if (this.h == null || System.currentTimeMillis() - this.h.getTime() >= millis) {
this.a.A().trackEvent("resumed");
if (booleanValue) {
this.h = new Date();
}
}
if (!booleanValue) {
this.h = new Date();
}
this.a.D().c(ca.p);
}
public long getAppEnteredBackgroundTimeMillis() {
return this.e.get();
}
public long getAppEnteredForegroundTimeMillis() {
return this.f.get();
}
public int getLastTrimMemoryLevel() {
return this.d.get();
}
public boolean isApplicationPaused() {
return this.c.get();
}
public void pauseForClick() {
this.b.set(true);
}
public void resumeForClick() {
this.b.set(false);
}
/* JADX INFO: Access modifiers changed from: private */
public void a() {
if (this.c.compareAndSet(false, true)) {
c();
}
}
/* JADX INFO: Access modifiers changed from: private */
public void b() {
if (this.c.compareAndSet(true, false)) {
d();
}
}
private void c() {
this.a.J();
if (n.a()) {
this.a.J().a("SessionTracker", "Application Paused");
}
this.e.set(System.currentTimeMillis());
AppLovinBroadcastManager.sendBroadcastSync(new Intent(ACTION_APPLICATION_PAUSED), null);
if (this.b.get()) {
return;
}
boolean booleanValue = ((Boolean) this.a.a(sj.L3)).booleanValue();
long millis = TimeUnit.MINUTES.toMillis(((Long) this.a.a(sj.N3)).longValue());
if (this.g == null || System.currentTimeMillis() - this.g.getTime() >= millis) {
this.a.A().trackEvent(v8.h.e0);
if (booleanValue) {
this.g = new Date();
}
}
if (booleanValue) {
return;
}
this.g = new Date();
}
}

View File

@@ -0,0 +1,27 @@
package com.applovin.impl.sdk;
import android.app.Activity;
import com.applovin.sdk.AppLovinUserService;
/* loaded from: classes2.dex */
public class UserServiceImpl implements AppLovinUserService {
private final j a;
public UserServiceImpl(j jVar) {
this.a = jVar;
}
@Override // com.applovin.sdk.AppLovinUserService
public void preloadConsentDialog() {
this.a.t().g();
}
@Override // com.applovin.sdk.AppLovinUserService
public void showConsentDialog(Activity activity, AppLovinUserService.OnConsentDialogDismissListener onConsentDialogDismissListener) {
this.a.t().a(activity, onConsentDialogDismissListener);
}
public String toString() {
return "UserService{}";
}
}

View File

@@ -0,0 +1,170 @@
package com.applovin.impl.sdk;
import android.content.Intent;
import android.content.IntentFilter;
import com.applovin.impl.j8;
import com.applovin.impl.sdk.AppLovinBroadcastManager;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.concurrent.TimeUnit;
/* loaded from: classes2.dex */
public class a implements AppLovinBroadcastManager.Receiver {
private static final long f = TimeUnit.SECONDS.toMillis(2);
private final j a;
private final n b;
private final HashSet c = new HashSet();
private final Object d = new Object();
/* renamed from: com.applovin.impl.sdk.a$a, reason: collision with other inner class name */
public interface InterfaceC0037a {
void onAdExpired(j8 j8Var);
}
public a(j jVar) {
this.a = jVar;
this.b = jVar.J();
}
@Override // com.applovin.impl.sdk.AppLovinBroadcastManager.Receiver
public void onReceive(Intent intent, Map map) {
String action = intent.getAction();
if (SessionTracker.ACTION_APPLICATION_PAUSED.equals(action)) {
a();
} else if (SessionTracker.ACTION_APPLICATION_RESUMED.equals(action)) {
b();
}
}
public void a(j8 j8Var) {
synchronized (this.d) {
try {
b b = b(j8Var);
if (b != null) {
if (n.a()) {
this.b.a("AdExpirationManager", "Cancelling expiration timer for ad: " + j8Var);
}
b.a();
a(b);
}
} catch (Throwable th) {
throw th;
}
}
}
private b b(j8 j8Var) {
synchronized (this.d) {
try {
if (j8Var == null) {
return null;
}
Iterator it = this.c.iterator();
while (it.hasNext()) {
b bVar = (b) it.next();
if (j8Var == bVar.b()) {
return bVar;
}
}
return null;
} catch (Throwable th) {
throw th;
}
}
}
private void b() {
HashSet hashSet = new HashSet();
synchronized (this.d) {
try {
Iterator it = this.c.iterator();
while (it.hasNext()) {
b bVar = (b) it.next();
j8 b = bVar.b();
if (b == null) {
hashSet.add(bVar);
} else {
long timeToLiveMillis = b.getTimeToLiveMillis();
if (timeToLiveMillis <= 0) {
if (n.a()) {
this.b.a("AdExpirationManager", "Ad expired while app was paused. Preparing to notify listener for ad: " + b);
}
hashSet.add(bVar);
} else {
if (n.a()) {
this.b.a("AdExpirationManager", "Rescheduling expiration with remaining " + TimeUnit.MILLISECONDS.toSeconds(timeToLiveMillis) + " seconds for ad: " + b);
}
bVar.a(timeToLiveMillis);
}
}
}
} catch (Throwable th) {
throw th;
}
}
Iterator it2 = hashSet.iterator();
while (it2.hasNext()) {
b bVar2 = (b) it2.next();
a(bVar2);
bVar2.d();
}
}
public boolean a(j8 j8Var, InterfaceC0037a interfaceC0037a) {
synchronized (this.d) {
try {
if (b(j8Var) != null) {
if (n.a()) {
this.b.a("AdExpirationManager", "Ad expiration already scheduled for ad: " + j8Var);
}
return true;
}
if (j8Var.getTimeToLiveMillis() <= f) {
if (n.a()) {
this.b.a("AdExpirationManager", "Ad has already expired: " + j8Var);
}
j8Var.setExpired();
return false;
}
if (n.a()) {
this.b.a("AdExpirationManager", "Scheduling ad expiration " + TimeUnit.MILLISECONDS.toSeconds(j8Var.getTimeToLiveMillis()) + " seconds from now for " + j8Var + "...");
}
if (this.c.isEmpty()) {
AppLovinBroadcastManager.registerReceiver(this, new IntentFilter(SessionTracker.ACTION_APPLICATION_PAUSED));
AppLovinBroadcastManager.registerReceiver(this, new IntentFilter(SessionTracker.ACTION_APPLICATION_RESUMED));
}
this.c.add(b.a(j8Var, interfaceC0037a, this.a));
return true;
} catch (Throwable th) {
throw th;
}
}
}
public void a(b bVar) {
synchronized (this.d) {
try {
this.c.remove(bVar);
if (this.c.isEmpty()) {
AppLovinBroadcastManager.unregisterReceiver(this);
}
} catch (Throwable th) {
throw th;
}
}
}
private void a() {
synchronized (this.d) {
try {
Iterator it = this.c.iterator();
while (it.hasNext()) {
((b) it.next()).a();
}
} catch (Throwable th) {
throw th;
}
}
}
}

View File

@@ -0,0 +1,173 @@
package com.applovin.impl.sdk.ad;
import android.os.Bundle;
import androidx.annotation.NonNull;
import com.applovin.impl.h0;
import com.applovin.impl.j8;
import com.applovin.impl.sdk.AppLovinAdBase;
import com.applovin.impl.sdk.j;
import com.applovin.impl.sdk.n;
import com.applovin.impl.sdk.utils.BundleUtils;
import com.applovin.impl.sj;
import com.applovin.impl.tl;
import com.applovin.sdk.AppLovinAd;
import com.applovin.sdk.AppLovinAdSize;
import com.applovin.sdk.AppLovinAdType;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public abstract class AppLovinAdImpl extends AppLovinAdBase implements AppLovinAd, j8 {
private final Bundle a;
private h0 b;
private boolean c;
private c d;
public AppLovinAdImpl(JSONObject jSONObject, JSONObject jSONObject2, j jVar) {
super(jSONObject, jSONObject2, jVar);
this.a = new Bundle();
}
private long a() {
return getLongFromAdObject("ad_expiration_ms", ((Long) this.sdk.a(sj.r1)).longValue());
}
public boolean canExpire() {
return getSize() == AppLovinAdSize.INTERSTITIAL && a() > 0;
}
public boolean equals(Object obj) {
AppLovinAd b;
if ((obj instanceof c) && (b = ((c) obj).b()) != null) {
obj = b;
}
if (this == obj) {
return true;
}
return obj != null && getClass() == obj.getClass() && getAdIdNumber() == ((AppLovinAdImpl) obj).getAdIdNumber();
}
@Override // com.applovin.impl.sdk.AppLovinAdBase
public long getAdIdNumber() {
return getLongFromAdObject("ad_id", -1L);
}
public c getDummyAd() {
return this.d;
}
public Bundle getMAXAdValues() {
return this.a;
}
public abstract JSONObject getOriginalFullResponse();
@Override // com.applovin.sdk.AppLovinAd
public AppLovinAdSize getSize() {
return AppLovinAdSize.fromString(getStringFromFullResponse("ad_size", null));
}
@Override // com.applovin.impl.j8
public long getTimeToLiveMillis() {
if (!canExpire()) {
return Long.MAX_VALUE;
}
return a() - (System.currentTimeMillis() - getCreatedAtMillis());
}
@Override // com.applovin.sdk.AppLovinAd
public AppLovinAdType getType() {
return AppLovinAdType.fromString(getStringFromFullResponse("ad_type", null));
}
@Override // com.applovin.sdk.AppLovinAd
public String getZoneId() {
if (getAdZone().i()) {
return null;
}
return getStringFromFullResponse("zone_id", null);
}
public boolean hasShown() {
return getBooleanFromAdObject("shown", Boolean.FALSE);
}
public boolean hasVideoUrl() {
this.sdk.J();
if (!n.a()) {
return false;
}
this.sdk.J().b("AppLovinAd", "Attempting to invoke hasVideoUrl() from base ad class");
return false;
}
public int hashCode() {
return (int) getAdIdNumber();
}
public boolean isExpired() {
return this.c;
}
public boolean isVideoAd() {
return this.adObject.has("is_video_ad") ? getBooleanFromAdObject("is_video_ad", Boolean.FALSE) : hasVideoUrl();
}
public void setDummyAd(c cVar) {
this.d = cVar;
}
@Override // com.applovin.impl.j8
public void setExpired() {
this.c = true;
}
public void setMaxAdValue(String str, Object obj) {
BundleUtils.put(str, obj, this.a);
}
@NonNull
public String toString() {
return "AppLovinAd{adIdNumber=" + getAdIdNumber() + ", zoneId=\"" + getZoneId() + "\"}";
}
public String getRawFullResponse() {
String jSONObject;
tl tlVar = this.synchronizedFullResponse;
if (tlVar != null) {
return tlVar.toString();
}
synchronized (this.fullResponseLock) {
jSONObject = this.fullResponse.toString();
}
return jSONObject;
}
public void setHasShown(boolean z) {
try {
tl tlVar = this.synchronizedAdObject;
if (tlVar != null) {
tlVar.a("shown", (Object) Boolean.valueOf(z));
return;
}
synchronized (this.adObjectLock) {
this.adObject.put("shown", z);
}
} catch (Throwable unused) {
}
}
public h0 getAdZone() {
h0 h0Var = this.b;
if (h0Var != null) {
if (h0Var.f() != null && this.b.g() != null) {
return this.b;
}
if (getSize() == null && getType() == null) {
return this.b;
}
}
h0 a = h0.a(getSize(), getType(), getStringFromFullResponse("zone_id", null), getBooleanFromFullResponse("is_bidding", false), getBooleanFromFullResponse("is_direct_sold", false));
this.b = a;
return a;
}
}

View File

@@ -0,0 +1,209 @@
package com.applovin.impl.sdk.ad;
import android.net.Uri;
import androidx.core.util.Consumer;
import com.applovin.impl.adview.e;
import com.applovin.impl.ng;
import com.applovin.impl.sdk.j;
import com.applovin.impl.sdk.utils.JsonUtils;
import com.applovin.impl.sdk.utils.StringUtils;
import com.applovin.impl.tl;
import com.mbridge.msdk.foundation.entity.CampaignEx;
import com.tapjoy.TJAdUnitConstants;
import org.json.JSONArray;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public final class a extends b {
private final String l;
private final String m;
private final String n;
private final ng o;
public a(JSONObject jSONObject, JSONObject jSONObject2, j jVar) {
super(jSONObject, jSONObject2, jVar);
this.l = j1();
this.m = o1();
this.n = n1();
this.o = new ng(this);
}
private String n1() {
return getStringFromAdObject("stream_url", "");
}
@Override // com.applovin.impl.sdk.ad.b
public boolean I0() {
return containsKeyForAdObject("stream_url");
}
@Override // com.applovin.impl.sdk.ad.b
public String P() {
return this.m;
}
@Override // com.applovin.impl.sdk.ad.b, com.applovin.impl.sdk.AppLovinAdBase, com.applovin.impl.lg
public ng getAdEventTracker() {
return this.o;
}
@Override // com.applovin.impl.sdk.ad.AppLovinAdImpl
public boolean hasVideoUrl() {
return t0() != null;
}
@Override // com.applovin.impl.sdk.ad.b
public Uri i() {
String stringFromAdObject = getStringFromAdObject(CampaignEx.JSON_KEY_CLICK_URL, "");
if (StringUtils.isValidString(stringFromAdObject)) {
return Uri.parse(stringFromAdObject);
}
return null;
}
public e.a i1() {
return a(getIntFromAdObject("expandable_style", e.a.INVISIBLE.b()));
}
@Override // com.applovin.impl.sdk.ad.b, com.applovin.impl.sdk.AppLovinAdBase, com.applovin.impl.lg
public boolean isOpenMeasurementEnabled() {
if (this.sdk.W().e()) {
return true;
}
return getBooleanFromAdObject("omsdk_enabled", Boolean.FALSE);
}
public String j1() {
return getStringFromAdObject(TJAdUnitConstants.String.HTML, "");
}
@Override // com.applovin.impl.sdk.ad.b
public Uri k0() {
String stringFromAdObject = getStringFromAdObject("video_click_url", "");
return StringUtils.isValidString(stringFromAdObject) ? Uri.parse(stringFromAdObject) : i();
}
public String k1() {
return getStringFromAdObject(com.mbridge.msdk.foundation.entity.b.JSON_KEY_HTML_URL, "");
}
public float l1() {
return getFloatFromAdObject("mraid_close_delay_graphic", 0.0f);
}
public String m1() {
return this.n;
}
public String o1() {
return getStringFromAdObject("video", "");
}
public boolean p1() {
if (this.adObject.has("close_button_expandable_hidden")) {
return getBooleanFromAdObject("close_button_expandable_hidden", Boolean.FALSE);
}
return true;
}
public boolean r1() {
return getBooleanFromAdObject("should_cache_html_url_contents", Boolean.FALSE);
}
public boolean s1() {
return getBooleanFromAdObject("should_respect_whitelist_when_retrieving_html_from_url", Boolean.FALSE);
}
@Override // com.applovin.impl.sdk.ad.b
public Uri t0() {
String n1 = n1();
if (StringUtils.isValidString(n1)) {
return Uri.parse(n1);
}
String o1 = o1();
if (StringUtils.isValidString(o1)) {
return Uri.parse(o1);
}
return null;
}
@Override // com.applovin.impl.sdk.ad.b
public void L0() {
tl tlVar = this.synchronizedAdObject;
if (tlVar != null) {
tlVar.a(new Consumer() { // from class: com.applovin.impl.sdk.ad.a$$ExternalSyntheticLambda0
@Override // androidx.core.util.Consumer
public final void accept(Object obj) {
a.this.w((tl) obj);
}
});
return;
}
synchronized (this.adObjectLock) {
JsonUtils.putString(this.adObject, TJAdUnitConstants.String.HTML, this.l);
JsonUtils.putString(this.adObject, "stream_url", this.n);
}
}
public void b(String str) {
tl tlVar = this.synchronizedAdObject;
if (tlVar != null) {
tlVar.b(TJAdUnitConstants.String.HTML, str);
return;
}
synchronized (this.adObjectLock) {
JsonUtils.putString(this.adObject, TJAdUnitConstants.String.HTML, str);
}
}
public void d(Uri uri) {
tl tlVar = this.synchronizedAdObject;
if (tlVar != null) {
tlVar.b("video", uri.toString());
return;
}
synchronized (this.adObjectLock) {
JsonUtils.putString(this.adObject, "video", uri.toString());
}
}
@Override // com.applovin.impl.sdk.ad.AppLovinAdImpl
public JSONObject getOriginalFullResponse() {
JSONObject deepCopy;
JSONObject jSONObject;
tl tlVar = this.synchronizedFullResponse;
if (tlVar != null) {
jSONObject = tlVar.a();
} else {
synchronized (this.fullResponseLock) {
deepCopy = JsonUtils.deepCopy(this.fullResponse);
}
jSONObject = deepCopy;
}
JSONArray jSONArray = JsonUtils.getJSONArray(jSONObject, com.mbridge.msdk.foundation.entity.b.JSON_KEY_ADS, new JSONArray());
if (jSONArray.length() > 0) {
JSONObject jSONObject2 = JsonUtils.getJSONObject(jSONArray, 0, new JSONObject());
JsonUtils.putString(jSONObject2, TJAdUnitConstants.String.HTML, this.l);
JsonUtils.putString(jSONObject2, "video", this.m);
JsonUtils.putString(jSONObject2, "stream_url", this.n);
}
return jSONObject;
}
public void q1() {
tl tlVar = this.synchronizedAdObject;
if (tlVar != null) {
tlVar.c("stream_url");
return;
}
synchronized (this.adObjectLock) {
this.adObject.remove("stream_url");
}
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void w(tl tlVar) {
tlVar.b(TJAdUnitConstants.String.HTML, this.l);
tlVar.b("stream_url", this.n);
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,173 @@
package com.applovin.impl.sdk.ad;
import android.os.Bundle;
import com.applovin.impl.h0;
import com.applovin.impl.mg;
import com.applovin.impl.sdk.j;
import com.applovin.sdk.AppLovinAd;
import com.applovin.sdk.AppLovinAdSize;
import com.applovin.sdk.AppLovinAdType;
import java.util.List;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public final class c extends AppLovinAdImpl {
private AppLovinAd f;
private final h0 g;
private AppLovinAd c() {
return (AppLovinAd) this.sdk.g().f(this.g);
}
private String d() {
h0 adZone = getAdZone();
if (adZone == null || adZone.i()) {
return null;
}
return adZone.e();
}
public void a(AppLovinAd appLovinAd) {
this.f = appLovinAd;
}
public AppLovinAd b() {
AppLovinAd appLovinAd = this.f;
return appLovinAd != null ? appLovinAd : c();
}
public AppLovinAd e() {
return this.f;
}
@Override // com.applovin.impl.sdk.ad.AppLovinAdImpl
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null || c.class != obj.getClass()) {
return false;
}
AppLovinAd b = b();
return b != null ? b.equals(obj) : super.equals(obj);
}
@Override // com.applovin.impl.sdk.AppLovinAdBase, com.applovin.impl.lg
public mg getAdEventTracker() {
return null;
}
@Override // com.applovin.impl.sdk.ad.AppLovinAdImpl, com.applovin.impl.sdk.AppLovinAdBase
public long getAdIdNumber() {
AppLovinAd b = b();
if (b instanceof AppLovinAdImpl) {
return ((AppLovinAdImpl) b).getAdIdNumber();
}
return 0L;
}
@Override // com.applovin.impl.sdk.AppLovinAdBase
public long getCreatedAtMillis() {
AppLovinAd b = b();
if (b instanceof AppLovinAdImpl) {
return ((AppLovinAdImpl) b).getCreatedAtMillis();
}
return 0L;
}
@Override // com.applovin.impl.sdk.array.ArrayDirectDownloadAd
public Bundle getDirectDownloadParameters() {
return new Bundle();
}
@Override // com.applovin.impl.sdk.array.ArrayDirectDownloadAd
public String getDirectDownloadToken() {
return null;
}
@Override // com.applovin.impl.sdk.AppLovinAdBase, com.applovin.impl.lg
public String getOpenMeasurementContentUrl() {
return null;
}
@Override // com.applovin.impl.sdk.AppLovinAdBase, com.applovin.impl.lg
public String getOpenMeasurementCustomReferenceData() {
return null;
}
@Override // com.applovin.impl.sdk.AppLovinAdBase, com.applovin.impl.lg
public List getOpenMeasurementVerificationScriptResources() {
return null;
}
@Override // com.applovin.impl.sdk.ad.AppLovinAdImpl
public JSONObject getOriginalFullResponse() {
AppLovinAd b = b();
if (b instanceof AppLovinAdImpl) {
return ((AppLovinAdImpl) b).getOriginalFullResponse();
}
return null;
}
@Override // com.applovin.impl.sdk.ad.AppLovinAdImpl, com.applovin.sdk.AppLovinAd
public AppLovinAdSize getSize() {
return getAdZone().f();
}
@Override // com.applovin.impl.sdk.ad.AppLovinAdImpl, com.applovin.sdk.AppLovinAd
public AppLovinAdType getType() {
return getAdZone().g();
}
@Override // com.applovin.impl.sdk.ad.AppLovinAdImpl, com.applovin.sdk.AppLovinAd
public String getZoneId() {
if (this.g.i()) {
return null;
}
return this.g.e();
}
@Override // com.applovin.impl.sdk.ad.AppLovinAdImpl
public int hashCode() {
AppLovinAd b = b();
return b != null ? b.hashCode() : super.hashCode();
}
@Override // com.applovin.impl.sdk.array.ArrayDirectDownloadAd
public boolean isDirectDownloadEnabled() {
return false;
}
@Override // com.applovin.impl.sdk.ad.AppLovinAdImpl
public boolean isExpired() {
AppLovinAdImpl appLovinAdImpl = (AppLovinAdImpl) b();
return appLovinAdImpl != null && appLovinAdImpl.isExpired();
}
@Override // com.applovin.impl.sdk.AppLovinAdBase, com.applovin.impl.lg
public boolean isOpenMeasurementEnabled() {
return false;
}
@Override // com.applovin.impl.sdk.ad.AppLovinAdImpl
public boolean isVideoAd() {
AppLovinAd b = b();
return (b instanceof AppLovinAdImpl) && ((AppLovinAdImpl) b).isVideoAd();
}
@Override // com.applovin.impl.sdk.ad.AppLovinAdImpl
public String toString() {
return "AppLovinAd{ #" + getAdIdNumber() + ", adType=" + getType() + ", adSize=" + getSize() + ", zoneId='" + d() + "'}";
}
public c(h0 h0Var, j jVar) {
super(new JSONObject(), new JSONObject(), jVar);
this.g = h0Var;
}
@Override // com.applovin.impl.sdk.ad.AppLovinAdImpl
public h0 getAdZone() {
AppLovinAdImpl appLovinAdImpl = (AppLovinAdImpl) b();
return appLovinAdImpl != null ? appLovinAdImpl.getAdZone() : this.g;
}
}

View File

@@ -0,0 +1,56 @@
package com.applovin.impl.sdk.array;
import androidx.annotation.Nullable;
import com.applovin.array.apphub.aidl.IAppHubService;
import com.applovin.impl.sdk.j;
import com.applovin.impl.sdk.n;
/* loaded from: classes2.dex */
public class ArrayDataCollector {
private static final String TAG = "ArrayService";
private final n logger;
private final j sdk;
public ArrayDataCollector(j jVar) {
this.sdk = jVar;
this.logger = jVar.J();
}
public long collectAppHubVersionCode(IAppHubService iAppHubService) {
try {
return iAppHubService.getAppHubVersionCode();
} catch (Throwable th) {
if (!n.a()) {
return -1L;
}
this.logger.a(TAG, "Failed to collect version code", th);
return -1L;
}
}
@Nullable
public Boolean collectDirectDownloadEnabled(IAppHubService iAppHubService) {
try {
return Boolean.valueOf(iAppHubService.getEnabledFeatures().getBoolean("DIRECT_DOWNLOAD"));
} catch (Throwable th) {
if (!n.a()) {
return null;
}
this.logger.a(TAG, "Failed to collect enabled features", th);
return null;
}
}
@Nullable
public String collectRandomUserToken(IAppHubService iAppHubService) {
try {
return iAppHubService.getRandomUserToken();
} catch (Throwable th) {
if (!n.a()) {
return null;
}
this.logger.a(TAG, "Failed to collect random user token", th);
return null;
}
}
}

View File

@@ -0,0 +1,14 @@
package com.applovin.impl.sdk.array;
import android.os.Bundle;
import androidx.annotation.Nullable;
/* loaded from: classes2.dex */
public interface ArrayDirectDownloadAd {
Bundle getDirectDownloadParameters();
@Nullable
String getDirectDownloadToken();
boolean isDirectDownloadEnabled();
}

View File

@@ -0,0 +1,368 @@
package com.applovin.impl.sdk.array;
import android.app.Activity;
import android.content.ComponentName;
import android.content.Intent;
import android.content.ServiceConnection;
import android.content.pm.ResolveInfo;
import android.os.Bundle;
import android.os.IBinder;
import android.os.RemoteException;
import android.text.TextUtils;
import androidx.annotation.Nullable;
import androidx.core.view.InputDeviceCompat;
import com.applovin.array.apphub.aidl.IAppHubDirectDownloadServiceCallback;
import com.applovin.array.apphub.aidl.IAppHubService;
import com.applovin.impl.p;
import com.applovin.impl.sdk.j;
import com.applovin.impl.sdk.n;
import com.applovin.impl.sj;
import com.applovin.impl.z3;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
/* loaded from: classes2.dex */
public class ArrayService extends IAppHubDirectDownloadServiceCallback.Stub {
private static final int MAX_RECONNECT_RETRY_COUNT = 3;
private static final String SERVICE_INTENT_CLASS_NAME = "com.applovin.oem.am.android.external.AppHubService";
private static final String SERVICE_INTENT_FILTER_ACTION = "com.applovin.am.intent.action.APPHUB_SERVICE";
private static final String TAG = "ArrayService";
@Nullable
private String appHubPackageName;
@Nullable
private IAppHubService appHubService;
@Nullable
private final Intent appHubServiceIntent;
private long appHubVersionCode = -1;
@Nullable
private DirectDownloadState currentDownloadState;
private int currentRetryCount;
private final ArrayDataCollector dataCollector;
@Nullable
private Boolean isDirectDownloadEnabled;
private final n logger;
@Nullable
private String randomUserToken;
private final j sdk;
public interface DirectDownloadListener {
void onAppDetailsDismissed();
void onAppDetailsDisplayed();
void onFailure();
}
public static class DirectDownloadState {
private final String adToken;
private final AtomicBoolean errorCallbackInvoked = new AtomicBoolean();
private final DirectDownloadListener listener;
@Nullable
private final Bundle parameters;
public DirectDownloadState(String str, @Nullable Bundle bundle, DirectDownloadListener directDownloadListener) {
this.adToken = str;
this.parameters = bundle;
this.listener = directDownloadListener;
}
public boolean canEqual(Object obj) {
return obj instanceof DirectDownloadState;
}
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof DirectDownloadState)) {
return false;
}
DirectDownloadState directDownloadState = (DirectDownloadState) obj;
if (!directDownloadState.canEqual(this)) {
return false;
}
AtomicBoolean errorCallbackInvoked = getErrorCallbackInvoked();
AtomicBoolean errorCallbackInvoked2 = directDownloadState.getErrorCallbackInvoked();
if (errorCallbackInvoked != null ? !errorCallbackInvoked.equals(errorCallbackInvoked2) : errorCallbackInvoked2 != null) {
return false;
}
String adToken = getAdToken();
String adToken2 = directDownloadState.getAdToken();
if (adToken != null ? !adToken.equals(adToken2) : adToken2 != null) {
return false;
}
Bundle parameters = getParameters();
Bundle parameters2 = directDownloadState.getParameters();
if (parameters != null ? !parameters.equals(parameters2) : parameters2 != null) {
return false;
}
DirectDownloadListener listener = getListener();
DirectDownloadListener listener2 = directDownloadState.getListener();
return listener != null ? listener.equals(listener2) : listener2 == null;
}
public String getAdToken() {
return this.adToken;
}
public AtomicBoolean getErrorCallbackInvoked() {
return this.errorCallbackInvoked;
}
public DirectDownloadListener getListener() {
return this.listener;
}
@Nullable
public Bundle getParameters() {
return this.parameters;
}
public int hashCode() {
AtomicBoolean errorCallbackInvoked = getErrorCallbackInvoked();
int hashCode = errorCallbackInvoked == null ? 43 : errorCallbackInvoked.hashCode();
String adToken = getAdToken();
int hashCode2 = ((hashCode + 59) * 59) + (adToken == null ? 43 : adToken.hashCode());
Bundle parameters = getParameters();
int hashCode3 = (hashCode2 * 59) + (parameters == null ? 43 : parameters.hashCode());
DirectDownloadListener listener = getListener();
return (hashCode3 * 59) + (listener != null ? listener.hashCode() : 43);
}
public String toString() {
return "ArrayService.DirectDownloadState(errorCallbackInvoked=" + getErrorCallbackInvoked() + ", adToken=" + getAdToken() + ", parameters=" + getParameters() + ", listener=" + getListener() + ")";
}
}
public ArrayService(j jVar) {
this.sdk = jVar;
this.logger = jVar.J();
this.dataCollector = new ArrayDataCollector(jVar);
Intent createAppHubServiceIntent = createAppHubServiceIntent();
this.appHubServiceIntent = createAppHubServiceIntent;
if (createAppHubServiceIntent != null) {
bindAppHubService();
}
jVar.e().a(new p() { // from class: com.applovin.impl.sdk.array.ArrayService.1
@Override // com.applovin.impl.p, android.app.Application.ActivityLifecycleCallbacks
public void onActivityStopped(Activity activity) {
DirectDownloadState directDownloadState = ArrayService.this.currentDownloadState;
if (ArrayService.this.appHubService == null || directDownloadState == null) {
return;
}
try {
n unused = ArrayService.this.logger;
if (n.a()) {
ArrayService.this.logger.a(ArrayService.TAG, "Dismissing Direct Download Activity");
}
ArrayService.this.appHubService.dismissDirectDownloadAppDetails(directDownloadState.adToken);
directDownloadState.listener.onAppDetailsDismissed();
ArrayService.this.currentDownloadState = null;
} catch (RemoteException e) {
n unused2 = ArrayService.this.logger;
if (n.a()) {
ArrayService.this.logger.a(ArrayService.TAG, "Failed dismiss Direct Download Activity", e);
}
}
}
});
}
@Nullable
private Intent createAppHubServiceIntent() {
Intent intent = new Intent(SERVICE_INTENT_FILTER_ACTION);
List<ResolveInfo> queryIntentServices = j.l().getPackageManager().queryIntentServices(intent, 0);
if (queryIntentServices == null || queryIntentServices.isEmpty()) {
if (!n.a()) {
return null;
}
this.logger.k(TAG, "App Hub not available");
return null;
}
String str = queryIntentServices.get(0).serviceInfo.packageName;
this.appHubPackageName = str;
intent.setClassName(str, SERVICE_INTENT_CLASS_NAME);
return intent;
}
public void collectAppHubData() {
if (isAppHubInstalled()) {
if (n.a()) {
this.logger.a(TAG, "Collecting data...");
}
if (this.isDirectDownloadEnabled == null && ((Boolean) this.sdk.a(sj.f0)).booleanValue()) {
this.isDirectDownloadEnabled = this.dataCollector.collectDirectDownloadEnabled(this.appHubService);
}
if (this.appHubVersionCode == -1 && ((Boolean) this.sdk.a(sj.e0)).booleanValue()) {
this.appHubVersionCode = this.dataCollector.collectAppHubVersionCode(this.appHubService);
}
if (TextUtils.isEmpty(this.randomUserToken) && ((Boolean) this.sdk.a(sj.g0)).booleanValue()) {
this.randomUserToken = this.dataCollector.collectRandomUserToken(this.appHubService);
}
}
}
@Nullable
public String getAppHubPackageName() {
return this.appHubPackageName;
}
public long getAppHubVersionCode() {
return this.appHubVersionCode;
}
@Nullable
public Boolean getIsDirectDownloadEnabled() {
return this.isDirectDownloadEnabled;
}
@Nullable
public String getRandomUserToken() {
return this.randomUserToken;
}
public boolean isAppHubInstalled() {
return this.appHubService != null;
}
@Override // com.applovin.array.apphub.aidl.IAppHubDirectDownloadServiceCallback
public void onAppDetailsDismissed(String str) {
if (n.a()) {
this.logger.a(TAG, "App details dismissed");
}
DirectDownloadState directDownloadState = this.currentDownloadState;
if (directDownloadState == null) {
return;
}
directDownloadState.listener.onAppDetailsDismissed();
this.currentDownloadState = null;
}
@Override // com.applovin.array.apphub.aidl.IAppHubDirectDownloadServiceCallback
public void onAppDetailsShown(String str) {
if (n.a()) {
this.logger.a(TAG, "App details shown");
}
DirectDownloadState directDownloadState = this.currentDownloadState;
if (directDownloadState == null) {
return;
}
directDownloadState.listener.onAppDetailsDisplayed();
}
@Override // com.applovin.array.apphub.aidl.IAppHubDirectDownloadServiceCallback
public void onDownloadStarted(String str) {
if (n.a()) {
this.logger.a(TAG, "Download started");
}
}
@Override // com.applovin.array.apphub.aidl.IAppHubDirectDownloadServiceCallback
public void onError(String str, String str2) {
if (n.a()) {
this.logger.b(TAG, "Encountered error: " + str2);
}
DirectDownloadState directDownloadState = this.currentDownloadState;
if (directDownloadState != null && directDownloadState.errorCallbackInvoked.compareAndSet(false, true)) {
directDownloadState.listener.onFailure();
this.currentDownloadState = null;
}
}
/* JADX INFO: Access modifiers changed from: private */
public void bindAppHubService() {
if (this.currentRetryCount > 3) {
if (n.a()) {
this.logger.k(TAG, "Exceeded maximum retry count");
return;
}
return;
}
if (n.a()) {
this.logger.a(TAG, "Attempting connection to App Hub service...");
}
this.currentRetryCount++;
try {
if (j.l().bindService(this.appHubServiceIntent, new ServiceConnection() { // from class: com.applovin.impl.sdk.array.ArrayService.2
@Override // android.content.ServiceConnection
public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
n unused = ArrayService.this.logger;
if (n.a()) {
ArrayService.this.logger.a(ArrayService.TAG, "Connection successful: " + componentName);
}
ArrayService.this.appHubService = IAppHubService.Stub.asInterface(iBinder);
}
@Override // android.content.ServiceConnection
public void onServiceDisconnected(ComponentName componentName) {
n unused = ArrayService.this.logger;
if (n.a()) {
ArrayService.this.logger.b(ArrayService.TAG, "Service disconnected: " + componentName);
}
ArrayService.this.appHubService = null;
n unused2 = ArrayService.this.logger;
if (n.a()) {
ArrayService.this.logger.b(ArrayService.TAG, "Retrying...");
}
ArrayService.this.bindAppHubService();
}
}, z3.c() ? InputDeviceCompat.SOURCE_DPAD : 1) || !n.a()) {
return;
}
this.logger.k(TAG, "App Hub not available");
} catch (Throwable th) {
if (n.a()) {
this.logger.a(TAG, "Failed to bind to service", th);
}
}
}
public void startDirectInstallOrDownloadProcess(ArrayDirectDownloadAd arrayDirectDownloadAd, @Nullable Bundle bundle, DirectDownloadListener directDownloadListener) {
if (this.appHubService == null) {
if (n.a()) {
this.logger.b(TAG, "Cannot begin Direct Install / Download process - service disconnected");
}
directDownloadListener.onFailure();
return;
}
if (!arrayDirectDownloadAd.isDirectDownloadEnabled()) {
if (n.a()) {
this.logger.b(TAG, "Cannot begin Direct Install / Download process - missing token");
}
directDownloadListener.onFailure();
return;
}
try {
Bundle directDownloadParameters = arrayDirectDownloadAd.getDirectDownloadParameters();
if (bundle != null) {
directDownloadParameters.putAll(bundle);
}
this.currentDownloadState = new DirectDownloadState(arrayDirectDownloadAd.getDirectDownloadToken(), directDownloadParameters, directDownloadListener);
if (n.a()) {
this.logger.a(TAG, "Starting Direct Download Activity");
}
if (this.appHubVersionCode >= 21) {
this.appHubService.showDirectDownloadAppDetailsWithExtra(this.currentDownloadState.adToken, this.currentDownloadState.parameters, this);
} else {
this.appHubService.showDirectDownloadAppDetails(this.currentDownloadState.adToken, this);
}
if (n.a()) {
this.logger.a(TAG, "Activity started");
}
} catch (Throwable th) {
if (n.a()) {
this.logger.a(TAG, "Failed to execute Direct Install / Download process", th);
}
this.sdk.E().a(TAG, "directInstallDownload", th);
this.currentDownloadState = null;
directDownloadListener.onFailure();
}
}
}

View File

@@ -0,0 +1,71 @@
package com.applovin.impl.sdk;
import com.applovin.impl.go;
import com.applovin.impl.j8;
import com.applovin.impl.sdk.a;
import com.applovin.impl.sj;
import java.lang.ref.WeakReference;
/* loaded from: classes2.dex */
public class b {
private final j a;
private final WeakReference b;
private final WeakReference c;
private go d;
public static b a(j8 j8Var, a.InterfaceC0037a interfaceC0037a, j jVar) {
b bVar = new b(j8Var, interfaceC0037a, jVar);
bVar.a(j8Var.getTimeToLiveMillis());
return bVar;
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void c() {
d();
this.a.f().a(this);
}
public void d() {
a();
j8 b = b();
if (b == null) {
return;
}
b.setExpired();
a.InterfaceC0037a interfaceC0037a = (a.InterfaceC0037a) this.c.get();
if (interfaceC0037a == null) {
return;
}
interfaceC0037a.onAdExpired(b);
}
public void a(long j) {
a();
if (((Boolean) this.a.a(sj.q1)).booleanValue() || !this.a.f0().isApplicationPaused()) {
this.d = go.a(j, this.a, new Runnable() { // from class: com.applovin.impl.sdk.b$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
b.this.c();
}
});
}
}
public void a() {
go goVar = this.d;
if (goVar != null) {
goVar.a();
this.d = null;
}
}
private b(j8 j8Var, a.InterfaceC0037a interfaceC0037a, j jVar) {
this.b = new WeakReference(j8Var);
this.c = new WeakReference(interfaceC0037a);
this.a = jVar;
}
public j8 b() {
return (j8) this.b.get();
}
}

View File

@@ -0,0 +1,130 @@
package com.applovin.impl.sdk;
import com.applovin.impl.h0;
import com.applovin.impl.sdk.ad.AppLovinAdImpl;
import java.util.HashMap;
import java.util.Map;
/* loaded from: classes2.dex */
public class c {
private final j a;
private final n b;
private final Map d = new HashMap();
private final Map e = new HashMap();
private final Object c = new Object();
public c(j jVar) {
this.a = jVar;
this.b = jVar.J();
for (h0 h0Var : h0.a()) {
this.d.put(h0Var, new p());
this.e.put(h0Var, new p());
}
}
public AppLovinAdImpl e(h0 h0Var) {
com.applovin.impl.sdk.ad.c cVar;
synchronized (this.c) {
try {
p d = d(h0Var);
if (d.b() > 0) {
b(h0Var).a(d.a());
cVar = new com.applovin.impl.sdk.ad.c(h0Var, this.a);
} else {
cVar = null;
}
} catch (Throwable th) {
throw th;
}
}
if (cVar != null) {
if (n.a()) {
this.b.a("AdPreloadManager", "Retrieved ad of zone " + h0Var + "...");
}
} else if (n.a()) {
this.b.a("AdPreloadManager", "Unable to retrieve ad of zone " + h0Var + "...");
}
return cVar;
}
public AppLovinAdImpl a(h0 h0Var) {
AppLovinAdImpl a;
synchronized (this.c) {
a = c(h0Var).a();
}
return a;
}
public void a(AppLovinAdImpl appLovinAdImpl) {
synchronized (this.c) {
try {
d(appLovinAdImpl.getAdZone()).a(appLovinAdImpl);
if (n.a()) {
this.b.a("AdPreloadManager", "Ad enqueued: " + appLovinAdImpl);
}
} catch (Throwable th) {
throw th;
}
}
}
public AppLovinAdBase f(h0 h0Var) {
AppLovinAdImpl d;
synchronized (this.c) {
d = c(h0Var).d();
}
return d;
}
private p d(h0 h0Var) {
p pVar;
synchronized (this.c) {
try {
pVar = (p) this.d.get(h0Var);
if (pVar == null) {
pVar = new p();
this.d.put(h0Var, pVar);
}
} catch (Throwable th) {
throw th;
}
}
return pVar;
}
private p b(h0 h0Var) {
p pVar;
synchronized (this.c) {
try {
pVar = (p) this.e.get(h0Var);
if (pVar == null) {
pVar = new p();
this.e.put(h0Var, pVar);
}
} catch (Throwable th) {
throw th;
}
}
return pVar;
}
public void b(AppLovinAdImpl appLovinAdImpl) {
synchronized (this.c) {
c(appLovinAdImpl.getAdZone()).b(appLovinAdImpl);
}
}
private p c(h0 h0Var) {
synchronized (this.c) {
try {
p b = b(h0Var);
if (b.b() > 0) {
return b;
}
return d(h0Var);
} catch (Throwable th) {
throw th;
}
}
}
}

View File

@@ -0,0 +1,269 @@
package com.applovin.impl.sdk;
import android.content.Intent;
import android.content.IntentFilter;
import com.applovin.impl.go;
import com.applovin.impl.sdk.AppLovinBroadcastManager;
import com.applovin.impl.ve;
import java.lang.ref.WeakReference;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
/* loaded from: classes2.dex */
public class d implements AppLovinBroadcastManager.Receiver {
private go a;
private final Object b = new Object();
private final AtomicBoolean c = new AtomicBoolean();
private boolean d;
private final j f;
private final WeakReference g;
private long h;
public interface a {
void onAdRefresh();
}
public d(j jVar, a aVar) {
this.g = new WeakReference(aVar);
this.f = jVar;
}
private void e() {
if (((Boolean) this.f.a(ve.f7)).booleanValue()) {
k();
}
}
private void f() {
if (((Boolean) this.f.a(ve.f7)).booleanValue()) {
synchronized (this.b) {
try {
if (this.d) {
this.f.J();
if (n.a()) {
this.f.J().a("AdRefreshManager", "Fullscreen ad dismissed but banner ad refresh paused by publisher. Waiting for publisher to resume banner ad refresh.");
}
} else if (this.f.f0().isApplicationPaused()) {
this.f.J();
if (n.a()) {
this.f.J().a("AdRefreshManager", "Waiting for the application to enter foreground to resume the timer.");
}
} else {
go goVar = this.a;
if (goVar != null) {
goVar.e();
}
}
} finally {
}
}
}
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void i() {
l();
a aVar = (a) this.g.get();
if (aVar != null) {
aVar.onAdRefresh();
}
}
private void k() {
synchronized (this.b) {
try {
go goVar = this.a;
if (goVar != null) {
goVar.d();
} else {
this.f.J();
if (n.a()) {
this.f.J().a("AdRefreshManager", "An ad load is in progress. Will pause refresh once the ad finishes loading.");
}
this.c.set(true);
}
} catch (Throwable th) {
throw th;
}
}
}
private void l() {
synchronized (this.b) {
try {
this.a = null;
if (!((Boolean) this.f.a(ve.g7)).booleanValue()) {
AppLovinBroadcastManager.unregisterReceiver(this);
}
} catch (Throwable th) {
throw th;
}
}
}
private void n() {
synchronized (this.b) {
try {
go goVar = this.a;
if (goVar != null) {
goVar.e();
} else {
this.c.set(false);
}
} catch (Throwable th) {
throw th;
}
}
}
public void a(long j) {
synchronized (this.b) {
try {
a();
this.h = j;
this.a = go.a(j, this.f, new Runnable() { // from class: com.applovin.impl.sdk.d$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
d.this.i();
}
});
if (!((Boolean) this.f.a(ve.g7)).booleanValue()) {
AppLovinBroadcastManager.registerReceiver(this, new IntentFilter(SessionTracker.ACTION_APPLICATION_PAUSED));
AppLovinBroadcastManager.registerReceiver(this, new IntentFilter(SessionTracker.ACTION_APPLICATION_RESUMED));
AppLovinBroadcastManager.registerReceiver(this, new IntentFilter("com.applovin.fullscreen_ad_displayed"));
AppLovinBroadcastManager.registerReceiver(this, new IntentFilter("com.applovin.fullscreen_ad_hidden"));
}
if (((Boolean) this.f.a(ve.f7)).booleanValue() && (this.f.C().c() || this.f.f0().isApplicationPaused())) {
this.a.d();
}
if (this.c.compareAndSet(true, false) && ((Boolean) this.f.a(ve.h7)).booleanValue()) {
this.f.J();
if (n.a()) {
this.f.J().a("AdRefreshManager", "Pausing refresh for a previous request.");
}
this.a.d();
}
} catch (Throwable th) {
throw th;
}
}
}
public long b() {
long c;
synchronized (this.b) {
try {
go goVar = this.a;
c = goVar != null ? goVar.c() : -1L;
} catch (Throwable th) {
throw th;
}
}
return c;
}
public void c() {
if (((Boolean) this.f.a(ve.e7)).booleanValue()) {
k();
}
}
public void d() {
boolean z;
a aVar;
if (((Boolean) this.f.a(ve.e7)).booleanValue()) {
synchronized (this.b) {
try {
if (this.d) {
this.f.J();
if (n.a()) {
this.f.J().a("AdRefreshManager", "Application resumed but banner ad refresh paused by publisher. Waiting for publisher to resume banner ad refresh.");
}
return;
}
if (this.f.C().c()) {
this.f.J();
if (n.a()) {
this.f.J().a("AdRefreshManager", "Waiting for the full screen ad to be dismissed to resume the timer.");
}
return;
}
if (this.a != null) {
long b = this.h - b();
long longValue = ((Long) this.f.a(ve.d7)).longValue();
if (longValue >= 0 && b > longValue) {
a();
z = true;
if (z || (aVar = (a) this.g.get()) == null) {
}
aVar.onAdRefresh();
return;
}
this.a.e();
}
z = false;
if (z) {
}
} catch (Throwable th) {
throw th;
}
}
}
}
public boolean g() {
return this.d;
}
public boolean h() {
boolean z;
synchronized (this.b) {
z = this.a != null;
}
return z;
}
public void j() {
synchronized (this.b) {
k();
this.d = true;
}
}
public void m() {
synchronized (this.b) {
n();
this.d = false;
}
}
@Override // com.applovin.impl.sdk.AppLovinBroadcastManager.Receiver
public void onReceive(Intent intent, Map map) {
String action = intent.getAction();
if (SessionTracker.ACTION_APPLICATION_PAUSED.equals(action)) {
c();
return;
}
if (SessionTracker.ACTION_APPLICATION_RESUMED.equals(action)) {
d();
} else if ("com.applovin.fullscreen_ad_displayed".equals(action)) {
e();
} else if ("com.applovin.fullscreen_ad_hidden".equals(action)) {
f();
}
}
public void a() {
synchronized (this.b) {
try {
go goVar = this.a;
if (goVar != null) {
goVar.a();
l();
}
} catch (Throwable th) {
throw th;
}
}
}
}

View File

@@ -0,0 +1,213 @@
package com.applovin.impl.sdk;
import com.applovin.impl.ge;
import com.applovin.impl.q6;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
/* loaded from: classes2.dex */
public class e {
private final j a;
private final Map b = new HashMap();
private final Object c = new Object();
private final Map d = new HashMap();
private final Object e = new Object();
public enum c {
LOAD("load"),
SHOW("show"),
HIDE("hide"),
CLICK("click"),
DESTROY("destroy"),
SHOW_ERROR("show_error");
public static final Set i = new HashSet(Arrays.asList(values()));
private final String a;
c(String str) {
this.a = str;
}
@Override // java.lang.Enum
public String toString() {
return this.a;
}
}
public interface d {
void a(b bVar);
}
public e(j jVar) {
this.a = jVar;
a();
}
public static class b {
private final String a;
private final String b;
private final String c;
private final String d;
private final String e;
private final String f;
private final String g;
private final int h;
private long i;
private final ArrayDeque j;
public String a() {
return this.a;
}
public String b() {
return this.d;
}
public String c() {
return this.c;
}
public String d() {
return this.e;
}
public String e() {
return this.f;
}
public String f() {
return this.g;
}
public String g() {
return this.b;
}
public int h() {
return this.h;
}
public c i() {
return (c) this.j.getLast();
}
public String toString() {
return "AdInfo{state='" + i() + "', adUnitId='" + this.a + "', format='" + this.b + "', adapterName='" + this.c + "', adapterClass='" + this.d + "', adapterVersion='" + this.e + "', bCode='" + this.f + "', creativeId='" + this.g + "', updated=" + this.i + '}';
}
/* JADX INFO: Access modifiers changed from: private */
public void a(c cVar) {
this.i = System.currentTimeMillis();
this.j.add(cVar);
}
private b(ge geVar, c cVar) {
this.j = new ArrayDeque();
this.a = geVar.getAdUnitId();
this.b = geVar.getFormat().getLabel();
this.c = geVar.c();
this.d = geVar.b();
this.e = geVar.z();
this.f = geVar.B();
this.g = geVar.getCreativeId();
this.h = geVar.hashCode();
a(cVar);
}
}
public void a(ge geVar, c cVar) {
synchronized (this.e) {
try {
int hashCode = geVar.hashCode();
b bVar = (b) this.d.get(Integer.valueOf(hashCode));
if (bVar == null) {
if (cVar == c.DESTROY) {
return;
}
bVar = new b(geVar, cVar);
this.d.put(Integer.valueOf(hashCode), bVar);
} else if (bVar.i() == cVar) {
return;
} else {
bVar.a(cVar);
}
if (cVar == c.DESTROY) {
this.d.remove(Integer.valueOf(hashCode));
}
a(bVar, cVar);
} catch (Throwable th) {
throw th;
}
}
}
public void a() {
synchronized (this.c) {
try {
for (c cVar : c.values()) {
this.b.put(cVar, new HashSet());
}
} catch (Throwable th) {
throw th;
}
}
}
public void a(d dVar, Set set) {
synchronized (this.c) {
try {
Iterator it = set.iterator();
while (it.hasNext()) {
a((c) it.next()).add(dVar);
}
} catch (Throwable th) {
throw th;
}
}
}
public void a(d dVar) {
synchronized (this.c) {
try {
Iterator it = this.b.keySet().iterator();
while (it.hasNext()) {
a((c) it.next()).remove(dVar);
}
} catch (Throwable th) {
throw th;
}
}
}
private Set a(c cVar) {
synchronized (this.c) {
try {
Set set = (Set) this.b.get(cVar);
if (q6.a(set)) {
return set;
}
return new HashSet();
} catch (Throwable th) {
throw th;
}
}
}
private void a(b bVar, c cVar) {
synchronized (this.c) {
try {
Iterator it = a(cVar).iterator();
while (it.hasNext()) {
((d) it.next()).a(bVar);
}
} catch (Throwable th) {
throw th;
}
}
}
}

View File

@@ -0,0 +1,141 @@
package com.applovin.impl.sdk;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.media.AudioManager;
import com.applovin.impl.sdk.AppLovinBroadcastManager;
import com.applovin.impl.sdk.f;
import com.applovin.sdk.AppLovinSdkUtils;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
/* loaded from: classes2.dex */
public class f extends BroadcastReceiver implements AppLovinBroadcastManager.Receiver {
public static int i = -1;
private final AudioManager a;
private final Context b;
private final j c;
private final Set d = new HashSet();
private final Object f = new Object();
private boolean g;
private int h;
public interface a {
void a(int i);
}
public f(j jVar) {
this.c = jVar;
Context l = j.l();
this.b = l;
this.a = (AudioManager) l.getSystemService("audio");
}
public static boolean a(int i2) {
return i2 == 0 || i2 == 1;
}
private void c() {
this.c.J();
if (n.a()) {
this.c.J().a("AudioSessionManager", "Stopping observation of mute switch state...");
}
this.b.unregisterReceiver(this);
AppLovinBroadcastManager.unregisterReceiver(this);
}
public void b(a aVar) {
synchronized (this.f) {
try {
if (this.d.contains(aVar)) {
this.d.remove(aVar);
if (this.d.isEmpty()) {
c();
}
}
} catch (Throwable th) {
throw th;
}
}
}
@Override // android.content.BroadcastReceiver
public void onReceive(Context context, Intent intent) {
if ("android.media.RINGER_MODE_CHANGED".equals(intent.getAction())) {
b(this.a.getRingerMode());
}
}
public int a() {
return this.a.getRingerMode();
}
public void a(a aVar) {
synchronized (this.f) {
try {
if (this.d.contains(aVar)) {
return;
}
this.d.add(aVar);
if (this.d.size() == 1) {
b();
}
} catch (Throwable th) {
throw th;
}
}
}
@Override // com.applovin.impl.sdk.AppLovinBroadcastManager.Receiver
public void onReceive(Intent intent, Map map) {
String action = intent.getAction();
if (SessionTracker.ACTION_APPLICATION_PAUSED.equals(action)) {
this.g = true;
this.h = this.a.getRingerMode();
} else if (SessionTracker.ACTION_APPLICATION_RESUMED.equals(action)) {
this.g = false;
if (this.h != this.a.getRingerMode()) {
this.h = i;
b(this.a.getRingerMode());
}
}
}
private void b() {
this.c.J();
if (n.a()) {
this.c.J().a("AudioSessionManager", "Observing ringer mode...");
}
this.h = i;
this.b.registerReceiver(this, new IntentFilter("android.media.RINGER_MODE_CHANGED"));
AppLovinBroadcastManager.registerReceiver(this, new IntentFilter(SessionTracker.ACTION_APPLICATION_PAUSED));
AppLovinBroadcastManager.registerReceiver(this, new IntentFilter(SessionTracker.ACTION_APPLICATION_RESUMED));
}
private void b(final int i2) {
if (this.g) {
return;
}
this.c.J();
if (n.a()) {
this.c.J().a("AudioSessionManager", "Ringer mode is " + i2);
}
synchronized (this.f) {
try {
for (final a aVar : this.d) {
AppLovinSdkUtils.runOnUiThread(new Runnable() { // from class: com.applovin.impl.sdk.f$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
f.a.this.a(i2);
}
});
}
} catch (Throwable th) {
throw th;
}
}
}
}

View File

@@ -0,0 +1,327 @@
package com.applovin.impl.sdk;
import android.os.Bundle;
import android.view.View;
import com.applovin.communicator.AppLovinCommunicator;
import com.applovin.communicator.AppLovinCommunicatorMessage;
import com.applovin.communicator.AppLovinCommunicatorPublisher;
import com.applovin.communicator.AppLovinCommunicatorSubscriber;
import com.applovin.impl.af;
import com.applovin.impl.communicator.CommunicatorMessageImpl;
import com.applovin.impl.ge;
import com.applovin.impl.he;
import com.applovin.impl.ie;
import com.applovin.impl.io;
import com.applovin.impl.je;
import com.applovin.impl.ne;
import com.applovin.impl.sdk.network.d;
import com.applovin.impl.sdk.utils.BundleUtils;
import com.applovin.impl.sdk.utils.CollectionUtils;
import com.applovin.impl.sdk.utils.JsonUtils;
import com.applovin.impl.sdk.utils.StringUtils;
import com.applovin.impl.sj;
import com.applovin.impl.tm;
import com.applovin.impl.v3;
import com.applovin.impl.yl;
import com.applovin.impl.yp;
import com.applovin.impl.zq;
import com.applovin.mediation.adapter.MaxAdapter;
import com.applovin.sdk.AppLovinSdkUtils;
import com.applovin.sdk.AppLovinWebViewActivity;
import com.ironsource.cr;
import com.mbridge.msdk.MBridgeConstans;
import com.mbridge.msdk.foundation.entity.CampaignEx;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public class g implements AppLovinCommunicatorSubscriber, AppLovinCommunicatorPublisher {
private final j a;
private final AppLovinCommunicator b;
public g(j jVar) {
this.a = jVar;
AppLovinCommunicator appLovinCommunicator = AppLovinCommunicator.getInstance(j.l());
this.b = appLovinCommunicator;
if (((Boolean) jVar.a(sj.N6)).booleanValue()) {
appLovinCommunicator.a(jVar);
appLovinCommunicator.subscribe(this, io.a);
}
}
@Override // com.applovin.communicator.AppLovinCommunicatorEntity
public String getCommunicatorId() {
return "applovin_sdk";
}
@Override // com.applovin.communicator.AppLovinCommunicatorSubscriber
public void onMessageReceived(AppLovinCommunicatorMessage appLovinCommunicatorMessage) {
Map<String, Object> map;
long j;
int i;
if (((Boolean) this.a.a(sj.N6)).booleanValue()) {
if ("send_http_request".equalsIgnoreCase(appLovinCommunicatorMessage.getTopic())) {
Bundle messageData = appLovinCommunicatorMessage.getMessageData();
Map<String, String> stringMap = BundleUtils.toStringMap(messageData.getBundle("query_params"));
Map<String, Object> map2 = BundleUtils.toMap(messageData.getBundle("post_body"));
Map<String, String> stringMap2 = BundleUtils.toStringMap(messageData.getBundle("headers"));
String string = messageData.getString("id", "");
if (!map2.containsKey(AppLovinWebViewActivity.INTENT_EXTRA_KEY_SDK_KEY)) {
map2.put(AppLovinWebViewActivity.INTENT_EXTRA_KEY_SDK_KEY, this.a.b0());
}
this.a.X().e(new d.b().d(messageData.getString("url")).a(messageData.getString("backup_url")).b(stringMap).c(map2).a(stringMap2).a(((Boolean) this.a.a(sj.o5)).booleanValue()).b(string).a());
return;
}
if (!"send_http_request_v2".equalsIgnoreCase(appLovinCommunicatorMessage.getTopic())) {
if ("set_ad_request_query_params".equalsIgnoreCase(appLovinCommunicatorMessage.getTopic())) {
this.a.i().addCustomQueryParams(yp.a((Map) BundleUtils.toMap(appLovinCommunicatorMessage.getMessageData())));
return;
} else if ("set_ad_request_post_body".equalsIgnoreCase(appLovinCommunicatorMessage.getTopic())) {
this.a.i().setCustomPostBody(BundleUtils.toJSONObject(appLovinCommunicatorMessage.getMessageData()));
return;
} else {
if ("set_mediate_request_post_body_data".equalsIgnoreCase(appLovinCommunicatorMessage.getTopic())) {
this.a.Q().setCustomPostBodyData(BundleUtils.toJSONObject(appLovinCommunicatorMessage.getMessageData()));
return;
}
return;
}
}
Bundle messageData2 = appLovinCommunicatorMessage.getMessageData();
String string2 = messageData2.getString("http_method", "POST");
long millis = messageData2.containsKey("timeout_sec") ? TimeUnit.SECONDS.toMillis(messageData2.getLong("timeout_sec")) : ((Long) this.a.a(sj.B3)).longValue();
int i2 = messageData2.getInt("retry_count", ((Integer) this.a.a(sj.C3)).intValue());
long millis2 = messageData2.containsKey("retry_delay_sec") ? TimeUnit.SECONDS.toMillis(messageData2.getLong("retry_delay_sec")) : ((Long) this.a.a(sj.D3)).longValue();
Map<String, String> stringMap3 = BundleUtils.toStringMap(messageData2.getBundle("query_params"));
long j2 = millis2;
if ("GET".equalsIgnoreCase(string2)) {
if (messageData2.getBoolean("include_data_collector_info", true)) {
stringMap3.putAll(BundleUtils.toStringMap(CollectionUtils.toBundle(this.a.y().a(null, false, false))));
}
j = millis;
i = i2;
map = null;
} else {
map = BundleUtils.toMap(messageData2.getBundle("post_body"));
if (messageData2.getBoolean("include_data_collector_info", true)) {
Map A = this.a.y().A();
Map l = this.a.y().l();
if (l.containsKey("idfv") && l.containsKey("idfv_scope")) {
i = i2;
String str = (String) l.get("idfv");
j = millis;
Integer num = (Integer) l.get("idfv_scope");
num.intValue();
l.remove("idfv");
l.remove("idfv_scope");
A.put("idfv", str);
A.put("idfv_scope", num);
} else {
j = millis;
i = i2;
}
A.put("server_installed_at", this.a.a(sj.p));
A.put(AppLovinWebViewActivity.INTENT_EXTRA_KEY_SDK_KEY, this.a.b0());
map.put(MBridgeConstans.DYNAMIC_VIEW_WX_APP, A);
map.put("device", l);
} else {
j = millis;
i = i2;
}
}
this.a.j0().a((yl) new v3(appLovinCommunicatorMessage.getPublisherId(), com.applovin.impl.sdk.network.a.a(this.a).b(messageData2.getString("url")).a(messageData2.getString("backup_url")).b(stringMap3).c(string2).a((Map) BundleUtils.toStringMap(messageData2.getBundle("headers"))).a(map != null ? new JSONObject(map) : null).c((int) j).a(i).b((int) j2).a((Object) new JSONObject()).a(messageData2.getBoolean("is_encoding_enabled", false)).a(), this.a), tm.b.OTHER);
}
}
public void b(ge geVar, String str) {
if (((Boolean) this.a.a(sj.N6)).booleanValue() && this.b.hasSubscriber("max_ad_events")) {
Bundle a = a(geVar);
a.putString("type", str);
this.a.J();
if (n.a()) {
this.a.J().a("CommunicatorService", "Sending \"max_ad_events\" message: " + a);
}
a(a, "max_ad_events");
}
}
public void a(ge geVar, String str) {
if (((Boolean) this.a.a(sj.N6)).booleanValue() && this.b.hasSubscriber("ad_callback_blocked_after_hidden")) {
Bundle a = a(geVar);
a.putString("callback_name", str);
a(a, "ad_callback_blocked_after_hidden");
}
}
public void a(JSONObject jSONObject, boolean z) {
if (((Boolean) this.a.a(sj.N6)).booleanValue() && this.b.hasSubscriber("safedk_init")) {
Bundle bundle = new Bundle();
bundle.putString(AppLovinWebViewActivity.INTENT_EXTRA_KEY_SDK_KEY, this.a.b0());
bundle.putString("applovin_random_token", this.a.a0());
bundle.putString("compass_random_token", this.a.q());
bundle.putString("device_type", AppLovinSdkUtils.isTablet(j.l()) ? "tablet" : "phone");
bundle.putString("init_success", String.valueOf(z));
bundle.putParcelableArrayList("installed_mediation_adapters", JsonUtils.toBundle(af.a(this.a)));
JSONObject jSONObject2 = JsonUtils.getJSONObject(jSONObject, "communicator_settings", (JSONObject) null);
Bundle bundle2 = (Bundle) bundle.clone();
bundle2.putString("user_id", this.a.q0().c());
JSONObject jSONObject3 = JsonUtils.getJSONObject(jSONObject2, "safedk_settings", new JSONObject());
if (!((Boolean) this.a.a(sj.O6)).booleanValue()) {
JSONObject jSONObject4 = new JSONObject();
JsonUtils.putBoolean(jSONObject4, "deactivated", true);
JsonUtils.putJSONObject(jSONObject3, "safeDKDeactivation", jSONObject4);
}
bundle2.putBundle("settings", JsonUtils.toBundle(jSONObject3));
this.a.J();
if (n.a()) {
this.a.J().a("CommunicatorService", "Sending \"safedk_init\" message: " + bundle);
}
a(bundle2, "safedk_init");
}
}
public void a(MaxAdapter.InitializationStatus initializationStatus, String str) {
if (((Boolean) this.a.a(sj.N6)).booleanValue() && this.b.hasSubscriber("adapter_initialization_status")) {
Bundle bundle = new Bundle();
bundle.putString("adapter_class", str);
bundle.putInt("init_status", initializationStatus.getCode());
a(bundle, "adapter_initialization_status");
}
}
public void a() {
if (((Boolean) this.a.a(sj.N6)).booleanValue() && this.b.hasSubscriber("privacy_setting_updated")) {
a(new Bundle(), "privacy_setting_updated");
}
}
public void a(String str, String str2) {
if (((Boolean) this.a.a(sj.N6)).booleanValue() && this.b.hasSubscriber("network_sdk_version_updated")) {
Bundle bundle = new Bundle();
bundle.putString("adapter_class", str2);
bundle.putString("sdk_version", str);
a(bundle, "network_sdk_version_updated");
}
}
public void a(List list) {
if (((Boolean) this.a.a(sj.N6)).booleanValue() && this.b.hasSubscriber("live_networks_updated")) {
if (list != null && !list.isEmpty()) {
Bundle bundle = new Bundle();
bundle.putStringArrayList("live_networks", new ArrayList<>(list));
a(bundle, "live_networks_updated");
return;
}
a(Bundle.EMPTY, "live_networks_updated");
}
}
public void a(String str, String str2, String str3) {
if (((Boolean) this.a.a(sj.N6)).booleanValue() && this.b.hasSubscriber("responses")) {
String maybeConvertToIndentedString = JsonUtils.maybeConvertToIndentedString(str3, 2);
String maybeConvertToIndentedString2 = JsonUtils.maybeConvertToIndentedString(str, 2);
Bundle bundle = new Bundle();
bundle.putString("request_url", str2);
bundle.putString("request_body", maybeConvertToIndentedString);
bundle.putString(cr.n, maybeConvertToIndentedString2);
a(bundle, "responses");
}
}
public void a(String str, String str2, int i, Object obj, String str3, boolean z) {
if (((Boolean) this.a.a(sj.N6)).booleanValue() && this.b.hasSubscriber("receive_http_response")) {
Bundle bundle = new Bundle();
bundle.putString("id", str);
bundle.putString("url", str2);
bundle.putInt("code", i);
bundle.putBundle("body", JsonUtils.toBundle(obj));
bundle.putBoolean("success", z);
BundleUtils.putString("error_message", str3, bundle);
a(bundle, "receive_http_response");
}
}
public void a(Bundle bundle, String str) {
if (((Boolean) this.a.a(sj.N6)).booleanValue() && this.b.hasSubscriber(str)) {
this.b.getMessagingService().publish(CommunicatorMessageImpl.create(bundle, str, this));
}
}
public boolean a(String str) {
return io.a.contains(str);
}
private Bundle a(ge geVar) {
View view;
Bundle bundle = new Bundle();
bundle.putString("id", geVar.S());
bundle.putString("network_name", geVar.c());
bundle.putString("max_ad_unit_id", geVar.getAdUnitId());
bundle.putString("third_party_ad_placement_id", geVar.U());
bundle.putString("ad_format", geVar.getFormat().getLabel());
BundleUtils.putStringIfValid(CampaignEx.JSON_KEY_CREATIVE_ID, geVar.getCreativeId(), bundle);
BundleUtils.putStringIfValid("adomain", geVar.v(), bundle);
BundleUtils.putStringIfValid("dsp_name", geVar.getDspName(), bundle);
if (geVar.a0()) {
BundleUtils.putStringIfValid("hybrid_ad_format", geVar.I().getLabel(), bundle);
}
if (geVar.b0()) {
bundle.putString("custom_js_network_name", geVar.getNetworkName());
} else if ("CUSTOM_NETWORK_SDK".equalsIgnoreCase(geVar.c())) {
bundle.putString("custom_sdk_network_name", geVar.getNetworkName());
}
bundle.putAll(JsonUtils.toBundle(geVar.x()));
if (geVar instanceof ne) {
if (geVar instanceof he) {
view = ((he) geVar).y();
} else {
if (geVar instanceof je) {
je jeVar = (je) geVar;
if (!jeVar.w0()) {
view = jeVar.q0() != null ? jeVar.q0() : jeVar.r0();
}
}
view = null;
}
bundle.putString("ad_view", view != null ? zq.a(view) : "N/A");
} else if (geVar instanceof ie) {
Bundle bundle2 = ((ie) geVar).o0().getBundle("applovin_ad_view_info");
bundle.putString("ad_view", BundleUtils.getString("ad_view_address", "N/A", bundle2));
bundle.putString("video_view", BundleUtils.getString("video_view_address", "N/A", bundle2));
}
return bundle;
}
public void b(ge geVar) {
if (((Boolean) this.a.a(sj.N6)).booleanValue() && this.b.hasSubscriber("max_revenue_events")) {
Bundle a = a(geVar);
a.putAll(JsonUtils.toBundle(geVar.R()));
a.putString("country_code", this.a.r().getCountryCode());
a(a, "max_revenue_events");
}
}
public void b(String str, String str2) {
if (((Boolean) this.a.a(sj.N6)).booleanValue() && this.b.hasSubscriber("user_info")) {
Bundle bundle = new Bundle(2);
bundle.putString("user_id", StringUtils.emptyIfNull(str));
bundle.putString("applovin_random_token", str2);
a(bundle, "user_info");
}
}
public void b(List list) {
if (((Boolean) this.a.a(sj.N6)).booleanValue() && this.b.hasSubscriber("test_mode_networks_updated")) {
if (list != null && !list.isEmpty()) {
Bundle bundle = new Bundle();
bundle.putStringArrayList("test_mode_networks", new ArrayList<>(list));
a(bundle, "test_mode_networks_updated");
return;
}
a(Bundle.EMPTY, "test_mode_networks_updated");
}
}
}

View File

@@ -0,0 +1,149 @@
package com.applovin.impl.sdk;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import com.applovin.impl.e4;
import com.applovin.impl.go;
import com.applovin.impl.sdk.AppLovinBroadcastManager;
import com.applovin.impl.sdk.h;
import com.applovin.impl.sj;
import com.applovin.sdk.AppLovinSdkUtils;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
/* loaded from: classes2.dex */
class h implements AppLovinBroadcastManager.Receiver {
private static AlertDialog c;
private static final AtomicBoolean d = new AtomicBoolean();
private final i a;
private go b;
public interface a {
void a();
void b();
}
public h(i iVar, j jVar) {
this.a = iVar;
AppLovinBroadcastManager.registerReceiver(this, new IntentFilter(SessionTracker.ACTION_APPLICATION_PAUSED));
AppLovinBroadcastManager.registerReceiver(this, new IntentFilter(SessionTracker.ACTION_APPLICATION_RESUMED));
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void b(final j jVar, final a aVar) {
if (this.a.f()) {
jVar.J();
if (n.a()) {
jVar.J().b("ConsentAlertManager", "Consent dialog already showing, skip showing of consent alert");
return;
}
return;
}
Activity b = jVar.e().b();
if (b != null && e4.a(j.l())) {
AppLovinSdkUtils.runOnUiThread(new Runnable() { // from class: com.applovin.impl.sdk.h$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
h.this.a(jVar, aVar);
}
});
return;
}
if (b == null) {
jVar.J();
if (n.a()) {
jVar.J().b("ConsentAlertManager", "No parent Activity found - rescheduling consent alert...");
}
} else {
jVar.J();
if (n.a()) {
jVar.J().b("ConsentAlertManager", "No internet available - rescheduling consent alert...");
}
}
d.set(false);
a(((Long) jVar.a(sj.w0)).longValue(), jVar, aVar);
}
public void a(long j, final j jVar, final a aVar) {
if (j <= 0) {
return;
}
AlertDialog alertDialog = c;
if (alertDialog == null || !alertDialog.isShowing()) {
if (d.getAndSet(true)) {
if (j >= this.b.c()) {
jVar.J();
if (n.a()) {
jVar.J().k("ConsentAlertManager", "Skip scheduling consent alert - one scheduled already with remaining time of " + this.b.c() + " milliseconds");
return;
}
return;
}
jVar.J();
if (n.a()) {
jVar.J().a("ConsentAlertManager", "Scheduling consent alert earlier (" + j + "ms) than remaining scheduled time (" + this.b.c() + "ms)");
}
this.b.a();
}
jVar.J();
if (n.a()) {
jVar.J().a("ConsentAlertManager", "Scheduling consent alert for " + j + " milliseconds");
}
this.b = go.a(j, jVar, new Runnable() { // from class: com.applovin.impl.sdk.h$$ExternalSyntheticLambda1
@Override // java.lang.Runnable
public final void run() {
h.this.b(jVar, aVar);
}
});
}
}
@Override // com.applovin.impl.sdk.AppLovinBroadcastManager.Receiver
public void onReceive(Intent intent, Map map) {
if (this.b == null) {
return;
}
String action = intent.getAction();
if (SessionTracker.ACTION_APPLICATION_PAUSED.equals(action)) {
this.b.d();
} else if (SessionTracker.ACTION_APPLICATION_RESUMED.equals(action)) {
this.b.e();
}
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void a(final j jVar, final a aVar) {
AlertDialog create = new AlertDialog.Builder(jVar.e().b()).setTitle((CharSequence) jVar.a(sj.x0)).setMessage((CharSequence) jVar.a(sj.y0)).setCancelable(false).setPositiveButton((CharSequence) jVar.a(sj.z0), new DialogInterface.OnClickListener() { // from class: com.applovin.impl.sdk.h$$ExternalSyntheticLambda2
@Override // android.content.DialogInterface.OnClickListener
public final void onClick(DialogInterface dialogInterface, int i) {
h.a(h.a.this, dialogInterface, i);
}
}).setNegativeButton((CharSequence) jVar.a(sj.A0), new DialogInterface.OnClickListener() { // from class: com.applovin.impl.sdk.h$$ExternalSyntheticLambda3
@Override // android.content.DialogInterface.OnClickListener
public final void onClick(DialogInterface dialogInterface, int i) {
h.this.a(aVar, jVar, dialogInterface, i);
}
}).create();
c = create;
create.show();
}
/* JADX INFO: Access modifiers changed from: private */
public static /* synthetic */ void a(a aVar, DialogInterface dialogInterface, int i) {
aVar.b();
dialogInterface.dismiss();
d.set(false);
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void a(a aVar, j jVar, DialogInterface dialogInterface, int i) {
aVar.a();
dialogInterface.dismiss();
d.set(false);
a(((Long) jVar.a(sj.v0)).longValue(), jVar, aVar);
}
}

View File

@@ -0,0 +1,225 @@
package com.applovin.impl.sdk;
import android.app.Activity;
import android.content.Intent;
import android.webkit.WebView;
import com.applovin.impl.e4;
import com.applovin.impl.sdk.h;
import com.applovin.impl.sdk.utils.StringUtils;
import com.applovin.impl.sj;
import com.applovin.impl.yp;
import com.applovin.sdk.AppLovinPrivacySettings;
import com.applovin.sdk.AppLovinSdkUtils;
import com.applovin.sdk.AppLovinUserService;
import com.applovin.sdk.AppLovinWebViewActivity;
import csdk.gluads.Consts;
import java.io.Serializable;
import java.lang.ref.WeakReference;
import java.util.concurrent.atomic.AtomicBoolean;
/* loaded from: classes2.dex */
public class i implements AppLovinWebViewActivity.EventListener, h.a {
private static final AtomicBoolean h = new AtomicBoolean();
private static WeakReference i;
private final j a;
private final n b;
private AppLovinUserService.OnConsentDialogDismissListener c;
private h d;
private WeakReference e;
private com.applovin.impl.p f;
private AtomicBoolean g = new AtomicBoolean();
public class a extends com.applovin.impl.p {
public a() {
}
@Override // com.applovin.impl.p, android.app.Application.ActivityLifecycleCallbacks
public void onActivityStarted(Activity activity) {
i.this.e = new WeakReference(activity);
}
}
public class b extends com.applovin.impl.p {
public b() {
}
@Override // com.applovin.impl.p, android.app.Application.ActivityLifecycleCallbacks
public void onActivityStarted(Activity activity) {
if (activity instanceof AppLovinWebViewActivity) {
if (!i.this.f() || i.i.get() != activity) {
AppLovinWebViewActivity appLovinWebViewActivity = (AppLovinWebViewActivity) activity;
WeakReference unused = i.i = new WeakReference(appLovinWebViewActivity);
appLovinWebViewActivity.loadUrl((String) i.this.a.a(sj.k0), i.this);
}
i.h.set(false);
}
}
}
public i(j jVar) {
this.e = new WeakReference(null);
this.a = jVar;
this.b = jVar.J();
if (jVar.G() != null) {
this.e = new WeakReference(jVar.G());
}
j.a(j.l()).a(new a());
this.d = new h(this, jVar);
}
private void e() {
this.a.e().b(this.f);
if (f()) {
AppLovinWebViewActivity appLovinWebViewActivity = (AppLovinWebViewActivity) i.get();
i = null;
if (appLovinWebViewActivity != null) {
appLovinWebViewActivity.finish();
AppLovinUserService.OnConsentDialogDismissListener onConsentDialogDismissListener = this.c;
if (onConsentDialogDismissListener != null) {
onConsentDialogDismissListener.onDismiss();
this.c = null;
}
}
}
}
@Override // com.applovin.impl.sdk.h.a
public void a() {
}
public void b(final long j) {
AppLovinSdkUtils.runOnUiThread(new Runnable() { // from class: com.applovin.impl.sdk.i$$ExternalSyntheticLambda3
@Override // java.lang.Runnable
public final void run() {
i.this.a(j);
}
});
}
public boolean f() {
WeakReference weakReference = i;
return (weakReference == null || weakReference.get() == null) ? false : true;
}
public void g() {
if (this.g.getAndSet(true)) {
return;
}
final String str = (String) this.a.a(sj.k0);
AppLovinSdkUtils.runOnUiThread(new Runnable() { // from class: com.applovin.impl.sdk.i$$ExternalSyntheticLambda2
@Override // java.lang.Runnable
public final void run() {
i.this.a(str);
}
});
}
@Override // com.applovin.sdk.AppLovinWebViewActivity.EventListener
public void onReceivedEvent(String str) {
if ("accepted".equalsIgnoreCase(str)) {
AppLovinPrivacySettings.setHasUserConsent(true, j.l());
e();
} else if ("rejected".equalsIgnoreCase(str)) {
AppLovinPrivacySettings.setHasUserConsent(false, j.l());
a(((Boolean) this.a.a(sj.n0)).booleanValue(), ((Long) this.a.a(sj.s0)).longValue());
} else if (Consts.PLACEMENT_STATUS_CLOSED.equalsIgnoreCase(str)) {
a(((Boolean) this.a.a(sj.o0)).booleanValue(), ((Long) this.a.a(sj.t0)).longValue());
} else if (AppLovinWebViewActivity.EVENT_DISMISSED_VIA_BACK_BUTTON.equalsIgnoreCase(str)) {
a(((Boolean) this.a.a(sj.p0)).booleanValue(), ((Long) this.a.a(sj.u0)).longValue());
}
}
@Override // com.applovin.impl.sdk.h.a
public void b() {
final Activity activity = (Activity) this.e.get();
if (activity != null) {
AppLovinSdkUtils.runOnUiThreadDelayed(new Runnable() { // from class: com.applovin.impl.sdk.i$$ExternalSyntheticLambda1
@Override // java.lang.Runnable
public final void run() {
i.this.a(activity);
}
}, ((Long) this.a.a(sj.m0)).longValue());
}
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void a(String str) {
WebView a2 = yp.a(j.l(), "preloading consent dialog", true);
if (a2 == null) {
return;
}
a2.loadUrl(str);
}
public void a(final Activity activity, final AppLovinUserService.OnConsentDialogDismissListener onConsentDialogDismissListener) {
activity.runOnUiThread(new Runnable() { // from class: com.applovin.impl.sdk.i$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
i.this.a(onConsentDialogDismissListener, activity);
}
});
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void a(AppLovinUserService.OnConsentDialogDismissListener onConsentDialogDismissListener, Activity activity) {
if (!a(this.a) || h.getAndSet(true)) {
if (onConsentDialogDismissListener != null) {
onConsentDialogDismissListener.onDismiss();
return;
}
return;
}
this.e = new WeakReference(activity);
this.c = onConsentDialogDismissListener;
this.f = new b();
this.a.e().a(this.f);
Intent intent = new Intent(activity, (Class<?>) AppLovinWebViewActivity.class);
intent.putExtra(AppLovinWebViewActivity.INTENT_EXTRA_KEY_SDK_KEY, this.a.b0());
intent.putExtra(AppLovinWebViewActivity.INTENT_EXTRA_KEY_IMMERSIVE_MODE_ON, (Serializable) this.a.a(sj.l0));
activity.startActivity(intent);
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void a(long j) {
if (n.a()) {
this.b.a("ConsentDialogManager", "Scheduling repeating consent alert");
}
this.d.a(j, this.a, this);
}
private void a(boolean z, long j) {
e();
if (z) {
b(j);
}
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void a(Activity activity) {
a(activity, (AppLovinUserService.OnConsentDialogDismissListener) null);
}
private boolean a(j jVar) {
if (f()) {
n.h("AppLovinSdk", "Consent dialog already showing");
return false;
}
if (!e4.a(j.l())) {
n.h("AppLovinSdk", "No internet available, skip showing of consent dialog");
return false;
}
if (!((Boolean) jVar.a(sj.j0)).booleanValue()) {
if (n.a()) {
this.b.b("ConsentDialogManager", "Blocked publisher from showing consent dialog");
}
return false;
}
if (StringUtils.isValidString((String) jVar.a(sj.k0))) {
return true;
}
if (n.a()) {
this.b.b("ConsentDialogManager", "AdServer returned empty consent dialog URL");
}
return false;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,967 @@
package com.applovin.impl.sdk;
import android.app.ActivityManager;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.graphics.Point;
import android.hardware.SensorManager;
import android.media.AudioDeviceInfo;
import android.media.AudioManager;
import android.net.ConnectivityManager;
import android.os.Build;
import android.os.Environment;
import android.os.LocaleList;
import android.os.PowerManager;
import android.os.SystemClock;
import android.provider.Settings;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.Base64;
import android.util.DisplayMetrics;
import com.applovin.impl.a4;
import com.applovin.impl.ca;
import com.applovin.impl.d4;
import com.applovin.impl.da;
import com.applovin.impl.e4;
import com.applovin.impl.em;
import com.applovin.impl.gc;
import com.applovin.impl.jn;
import com.applovin.impl.l0;
import com.applovin.impl.sdk.array.ArrayService;
import com.applovin.impl.sdk.utils.CollectionUtils;
import com.applovin.impl.sdk.utils.JsonUtils;
import com.applovin.impl.sdk.utils.StringUtils;
import com.applovin.impl.sj;
import com.applovin.impl.sr;
import com.applovin.impl.tm;
import com.applovin.impl.uj;
import com.applovin.impl.v;
import com.applovin.impl.vi;
import com.applovin.impl.wh;
import com.applovin.impl.wp;
import com.applovin.impl.yl;
import com.applovin.impl.yp;
import com.applovin.impl.z3;
import com.applovin.sdk.AppLovinBidTokenCollectionListener;
import com.applovin.sdk.AppLovinEventTypes;
import com.applovin.sdk.AppLovinSdk;
import com.applovin.sdk.AppLovinSdkUtils;
import com.applovin.sdk.AppLovinWebViewActivity;
import com.facebook.devicerequests.internal.DeviceRequestsHelper;
import com.facebook.internal.NativeProtocol;
import com.ironsource.ad;
import com.vungle.ads.internal.model.Cookie;
import java.io.File;
import java.nio.charset.Charset;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.TimeZone;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicReference;
import org.json.JSONArray;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public class k {
private static final AtomicReference i = new AtomicReference();
private static final AtomicReference j = new AtomicReference();
private final j a;
private final n b;
private final Context c;
private final Map d;
private final Map f;
private boolean g;
private final Object e = new Object();
private final AtomicReference h = new AtomicReference();
public class a implements em.a {
public a() {
}
@Override // com.applovin.impl.em.a
public void a(l0.a aVar) {
k.i.set(aVar);
}
}
public static class b {
public final String a;
public final int b;
public b(String str, int i) {
this.a = str;
this.b = i;
}
}
public static class c {
public int a = -1;
public int b = -1;
public Boolean c = null;
}
public k(j jVar) {
if (jVar == null) {
throw new IllegalArgumentException("No sdk specified");
}
this.a = jVar;
this.b = jVar.J();
this.c = j.l();
this.d = y();
this.f = x();
}
private Map E() {
return yp.a(a(null, true, false));
}
private JSONArray H() {
if (z3.f()) {
return CollectionUtils.toJSONArray(Build.SUPPORTED_ABIS);
}
JSONArray jSONArray = new JSONArray();
JsonUtils.putStringIfValid(jSONArray, Build.CPU_ABI);
JsonUtils.putStringIfValid(jSONArray, Build.CPU_ABI2);
return jSONArray;
}
private boolean I() {
try {
if (!b()) {
if (!c()) {
return false;
}
}
return true;
} catch (Throwable unused) {
return false;
}
}
private boolean J() {
ConnectivityManager connectivityManager;
if (z3.h() && (connectivityManager = (ConnectivityManager) this.c.getSystemService("connectivity")) != null) {
try {
return connectivityManager.getRestrictBackgroundStatus() == 3;
} catch (Throwable th) {
this.a.J();
if (n.a()) {
this.a.J().a("DataCollector", "Unable to collect constrained network info.", th);
}
}
}
return false;
}
private Boolean K() {
if (z3.i()) {
return Boolean.valueOf(this.c.getResources().getConfiguration().isScreenHdr());
}
return null;
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void M() {
this.h.set(n());
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void b(AppLovinBidTokenCollectionListener appLovinBidTokenCollectionListener) {
try {
String C = C();
if (StringUtils.isValidString(C)) {
this.a.J();
if (n.a()) {
this.a.J().a("DataCollector", "Successfully retrieved bid token");
}
gc.a(appLovinBidTokenCollectionListener, C);
return;
}
this.a.J();
if (n.a()) {
this.a.J().b("DataCollector", "Empty bid token");
}
gc.b(appLovinBidTokenCollectionListener, "Empty bid token");
} catch (Throwable th) {
if (n.a()) {
this.b.a("DataCollector", "Failed to collect bid token", th);
}
this.a.E().a("DataCollector", "collectBidToken", th);
gc.b(appLovinBidTokenCollectionListener, "Failed to collect bid token");
}
}
/* JADX WARN: Removed duplicated region for block: B:100:0x01c1 */
/* JADX WARN: Removed duplicated region for block: B:104:0x01d8 */
/* JADX WARN: Removed duplicated region for block: B:108:0x01df */
/* JADX WARN: Removed duplicated region for block: B:111:0x01c8 */
/* JADX WARN: Removed duplicated region for block: B:113:0x01b1 */
/* JADX WARN: Removed duplicated region for block: B:96:0x01aa */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
private long d() {
/*
Method dump skipped, instructions count: 488
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: com.applovin.impl.sdk.k.d():long");
}
private c h() {
c cVar = new c();
Intent registerReceiver = this.c.registerReceiver(null, new IntentFilter("android.intent.action.BATTERY_CHANGED"));
int intExtra = registerReceiver != null ? registerReceiver.getIntExtra(AppLovinEventTypes.USER_COMPLETED_LEVEL, -1) : -1;
int intExtra2 = registerReceiver != null ? registerReceiver.getIntExtra("scale", -1) : -1;
if (intExtra <= 0 || intExtra2 <= 0) {
cVar.b = -1;
} else {
cVar.b = (int) ((intExtra / intExtra2) * 100.0f);
}
cVar.a = registerReceiver != null ? registerReceiver.getIntExtra("status", -1) : -1;
if (z3.d()) {
cVar.c = Boolean.valueOf(Settings.Global.getInt(this.c.getContentResolver(), "stay_on_while_plugged_in", -1) > 0);
} else {
cVar.c = Boolean.valueOf(((registerReceiver.getIntExtra("plugged", -1) & 1) | 14) > 0);
}
return cVar;
}
private String i() {
TelephonyManager telephonyManager = (TelephonyManager) this.c.getSystemService("phone");
if (telephonyManager == null) {
return "";
}
try {
return telephonyManager.getNetworkOperatorName();
} catch (Throwable th) {
if (!n.a()) {
return "";
}
this.b.a("DataCollector", "Unable to collect carrier", th);
return "";
}
}
private String k() {
TelephonyManager telephonyManager = (TelephonyManager) this.c.getSystemService("phone");
return telephonyManager != null ? telephonyManager.getSimCountryIso().toUpperCase(Locale.ENGLISH) : "";
}
private String m() {
if (!z3.h()) {
return null;
}
try {
StringBuilder sb = new StringBuilder();
LocaleList locales = this.c.getResources().getConfiguration().getLocales();
for (int i2 = 0; i2 < locales.size(); i2++) {
sb.append(locales.get(i2));
sb.append(",");
}
if (sb.length() > 0 && sb.charAt(sb.length() - 1) == ',') {
sb.deleteCharAt(sb.length() - 1);
}
return sb.toString();
} catch (Throwable unused) {
return null;
}
}
private Integer n() {
if (((AudioManager) this.c.getSystemService("audio")) == null) {
return null;
}
try {
return Integer.valueOf((int) (r0.getStreamVolume(3) * ((Float) this.a.a(sj.o4)).floatValue()));
} catch (Throwable th) {
this.a.J();
if (n.a()) {
this.a.J().a("DataCollector", "Unable to collect device volume", th);
}
return null;
}
}
private float o() {
try {
return Settings.System.getFloat(this.c.getContentResolver(), "font_scale");
} catch (Settings.SettingNotFoundException e) {
if (!n.a()) {
return -1.0f;
}
this.b.a("DataCollector", "Error collecting font scale", e);
return -1.0f;
}
}
private boolean p() {
SensorManager sensorManager = (SensorManager) this.c.getSystemService("sensor");
return (sensorManager == null || sensorManager.getDefaultSensor(4) == null) ? false : true;
}
private Map q() {
HashMap hashMap = new HashMap();
CollectionUtils.putIntegerIfValid(Cookie.IABTCF_GDPR_APPLIES, this.a.k0().g(), hashMap);
CollectionUtils.putStringIfValid("IABTCF_TCString", this.a.k0().k(), hashMap);
CollectionUtils.putStringIfValid("IABTCF_AddtlConsent", this.a.k0().c(), hashMap);
return hashMap;
}
private Boolean r() {
AudioManager audioManager = (AudioManager) this.c.getSystemService("audio");
if (audioManager == null) {
return null;
}
return Boolean.valueOf(audioManager.isMusicActive());
}
private Boolean s() {
AudioManager audioManager = (AudioManager) this.c.getSystemService("audio");
if (audioManager == null) {
return null;
}
return Boolean.valueOf(audioManager.isSpeakerphoneOn());
}
private String t() {
TelephonyManager telephonyManager = (TelephonyManager) this.c.getSystemService("phone");
if (telephonyManager == null) {
return "";
}
try {
String networkOperator = telephonyManager.getNetworkOperator();
return networkOperator.substring(0, Math.min(3, networkOperator.length()));
} catch (Throwable th) {
if (!n.a()) {
return "";
}
this.b.a("DataCollector", "Unable to collect mobile country code", th);
return "";
}
}
private String u() {
TelephonyManager telephonyManager = (TelephonyManager) this.c.getSystemService("phone");
if (telephonyManager == null) {
return "";
}
try {
String networkOperator = telephonyManager.getNetworkOperator();
return networkOperator.substring(Math.min(3, networkOperator.length()));
} catch (Throwable th) {
if (!n.a()) {
return "";
}
this.b.a("DataCollector", "Unable to collect mobile network code", th);
return "";
}
}
private String w() {
AudioManager audioManager = (AudioManager) this.c.getSystemService("audio");
if (audioManager == null) {
return null;
}
StringBuilder sb = new StringBuilder();
if (z3.g()) {
for (AudioDeviceInfo audioDeviceInfo : audioManager.getDevices(2)) {
sb.append(audioDeviceInfo.getType());
sb.append(",");
}
} else {
if (audioManager.isWiredHeadsetOn()) {
sb.append(3);
sb.append(",");
}
if (audioManager.isBluetoothScoOn()) {
sb.append(7);
sb.append(",");
}
if (audioManager.isBluetoothA2dpOn()) {
sb.append(8);
}
}
if (sb.length() > 0 && sb.charAt(sb.length() - 1) == ',') {
sb.deleteCharAt(sb.length() - 1);
}
String sb2 = sb.toString();
if (TextUtils.isEmpty(sb2) && n.a()) {
this.b.a("DataCollector", "No sound outputs detected");
}
return sb2;
}
private Map x() {
PackageInfo packageInfo;
HashMap hashMap = new HashMap();
PackageManager packageManager = this.c.getPackageManager();
ApplicationInfo applicationInfo = this.c.getApplicationInfo();
long lastModified = new File(applicationInfo.sourceDir).lastModified();
String str = null;
try {
packageInfo = packageManager.getPackageInfo(this.c.getPackageName(), 0);
try {
str = packageManager.getInstallerPackageName(applicationInfo.packageName);
} catch (Throwable unused) {
}
} catch (Throwable unused2) {
packageInfo = null;
}
hashMap.put(NativeProtocol.BRIDGE_ARG_APP_NAME_STRING, packageManager.getApplicationLabel(applicationInfo));
hashMap.put("app_version", packageInfo != null ? packageInfo.versionName : "");
hashMap.put("app_version_code", Integer.valueOf(packageInfo != null ? packageInfo.versionCode : -1));
hashMap.put("package_name", applicationInfo.packageName);
hashMap.put("vz", StringUtils.toShortSHA1Hash(applicationInfo.packageName));
if (str == null) {
str = "";
}
hashMap.put("installer_name", str);
hashMap.put("tg", wp.a(this.a));
hashMap.put("debug", Boolean.valueOf(yp.c(this.a)));
hashMap.put("ia", Long.valueOf(lastModified));
hashMap.put("alts_ms", Long.valueOf(j.k()));
hashMap.put("j8", Boolean.valueOf(j.y0()));
hashMap.put("ps_tpg", Boolean.valueOf(wh.d(this.c)));
hashMap.put("ps_apg", Boolean.valueOf(wh.b(this.c)));
hashMap.put("ps_capg", Boolean.valueOf(wh.c(this.c)));
hashMap.put("ps_aipg", Boolean.valueOf(wh.a(this.c)));
j jVar = this.a;
uj ujVar = uj.f;
Long l = (Long) jVar.a(ujVar);
if (l != null) {
hashMap.put("ia_v2", l);
} else {
this.a.b(ujVar, Long.valueOf(lastModified));
}
hashMap.put("sdk_version", AppLovinSdk.VERSION);
hashMap.put("omid_sdk_version", this.a.W().c());
CollectionUtils.putStringIfValid("ad_review_sdk_version", v.b(), hashMap);
hashMap.put("api_did", this.a.a(sj.g));
hashMap.put("first_install_v3_ms", packageInfo != null ? Long.valueOf(packageInfo.firstInstallTime) : "");
hashMap.put("target_sdk", Integer.valueOf(applicationInfo.targetSdkVersion));
if (z3.h()) {
hashMap.put("min_sdk", Integer.valueOf(applicationInfo.minSdkVersion));
}
hashMap.put("epv", Integer.valueOf(yp.f()));
if (this.a.B0()) {
hashMap.put("unity_version", yp.a(this.a.g0()));
}
return hashMap;
}
private Map y() {
HashMap hashMap = new HashMap(34);
hashMap.put("api_level", Integer.valueOf(Build.VERSION.SDK_INT));
hashMap.put("brand", Build.MANUFACTURER);
hashMap.put("brand_name", Build.BRAND);
hashMap.put("hardware", Build.HARDWARE);
hashMap.put("sim", Boolean.valueOf(AppLovinSdkUtils.isEmulator()));
hashMap.put("aida", Boolean.valueOf(l0.a()));
hashMap.put("locale", Locale.getDefault().toString());
hashMap.put("model", Build.MODEL);
hashMap.put(ad.y, Build.VERSION.RELEASE);
hashMap.put("platform", v());
hashMap.put("revision", Build.DEVICE);
hashMap.put("tz_offset", Double.valueOf(z()));
hashMap.put("gy", Boolean.valueOf(p()));
hashMap.put("country_code", k());
hashMap.put("mcc", t());
hashMap.put("mnc", u());
hashMap.put(ad.y0, i());
hashMap.put("tv", Boolean.valueOf(AppLovinSdkUtils.isTv(this.c)));
hashMap.put("pc", Integer.valueOf(Runtime.getRuntime().availableProcessors()));
hashMap.put("hdr", K());
hashMap.put("supported_abis", H());
DisplayMetrics displayMetrics = this.c.getResources().getDisplayMetrics();
if (displayMetrics != null) {
hashMap.put("adns", Float.valueOf(displayMetrics.density));
hashMap.put("adnsd", Integer.valueOf(displayMetrics.densityDpi));
hashMap.put("xdpi", Float.valueOf(displayMetrics.xdpi));
hashMap.put("ydpi", Float.valueOf(displayMetrics.ydpi));
z3.a a2 = z3.a(this.c, this.a);
if (a2 != null) {
hashMap.put("tl_cr", Integer.valueOf(a2.c()));
hashMap.put("tr_cr", Integer.valueOf(a2.d()));
hashMap.put("bl_cr", Integer.valueOf(a2.a()));
hashMap.put("br_cr", Integer.valueOf(a2.b()));
}
}
hashMap.put("bt_ms", Long.valueOf(System.currentTimeMillis() - SystemClock.elapsedRealtime()));
hashMap.put("tbalsi_ms", Long.valueOf(this.a.I() - j.k()));
CollectionUtils.putBooleanIfValid("psase", Boolean.valueOf(wh.e(this.c)), hashMap);
CollectionUtils.putStringIfValid("process_name", yp.b(this.c), hashMap);
CollectionUtils.putBooleanIfValid("is_main_process", yp.g(this.c), hashMap);
try {
PackageInfo packageInfo = this.c.getPackageManager().getPackageInfo("com.android.vending", 0);
hashMap.put("ps_version", packageInfo.versionName);
hashMap.put("ps_version_code", Integer.valueOf(packageInfo.versionCode));
} catch (Throwable unused) {
hashMap.put("ps_version", "");
hashMap.put("ps_version_code", -1);
}
a(hashMap);
return hashMap;
}
private double z() {
return Math.round((TimeZone.getDefault().getOffset(new Date().getTime()) * 10.0d) / 3600000.0d) / 10.0d;
}
public Map A() {
Map map = CollectionUtils.map(this.f);
map.put("first_install", Boolean.valueOf(this.a.v0()));
map.put("first_install_v2", Boolean.valueOf(!this.a.t0()));
map.put("test_ads", Boolean.valueOf(this.g));
map.put("muted", Boolean.valueOf(this.a.g0().isMuted()));
if (((Boolean) this.a.a(sj.R3)).booleanValue()) {
CollectionUtils.putStringIfValid("cuid", this.a.q0().c(), map);
}
if (((Boolean) this.a.a(sj.U3)).booleanValue()) {
map.put("compass_random_token", this.a.q());
}
if (((Boolean) this.a.a(sj.W3)).booleanValue()) {
map.put("applovin_random_token", this.a.a0());
}
map.putAll(q());
if (this.a.Z() != null) {
CollectionUtils.putJsonArrayIfValid("ps_topics", this.a.Z().a(), map);
}
return map;
}
public b B() {
return (b) j.get();
}
public String C() {
String encodeToString = Base64.encodeToString(new JSONObject(E()).toString().getBytes(Charset.defaultCharset()), 2);
return ((Boolean) this.a.a(sj.q5)).booleanValue() ? vi.b(encodeToString, yp.a(this.a), vi.a.a(((Integer) this.a.a(sj.r5)).intValue()), this.a.b0(), this.a) : encodeToString;
}
public String D() {
ActivityManager activityManager = (ActivityManager) this.c.getSystemService("activity");
if (activityManager == null) {
return null;
}
return activityManager.getDeviceConfigurationInfo().getGlEsVersion();
}
public Map F() {
return CollectionUtils.map(this.f);
}
public Map G() {
return CollectionUtils.map(this.d);
}
public boolean L() {
return this.g;
}
public void N() {
tm j0 = this.a.j0();
em emVar = new em(this.a, new a());
tm.b bVar = tm.b.OTHER;
j0.a((yl) emVar, bVar);
this.a.j0().a((yl) new jn(this.a, true, "setDeviceVolume", new Runnable() { // from class: com.applovin.impl.sdk.k$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
k.this.M();
}
}), bVar);
}
public void O() {
synchronized (this.e) {
a(this.d);
}
}
public Map e() {
HashMap hashMap = new HashMap();
hashMap.put("sc", this.a.a(sj.m));
hashMap.put("sc2", this.a.a(sj.n));
hashMap.put("sc3", this.a.a(sj.o));
hashMap.put("server_installed_at", this.a.a(sj.p));
CollectionUtils.putStringIfValid("persisted_data", (String) this.a.a(uj.G), hashMap);
return hashMap;
}
public Map j() {
d4.d a2 = this.a.s().a();
if (a2 == null) {
return null;
}
HashMap hashMap = new HashMap(4);
hashMap.put("lrm_ts_ms", String.valueOf(a2.c()));
hashMap.put("lrm_url", a2.d());
hashMap.put("lrm_ct_ms", String.valueOf(a2.a()));
hashMap.put("lrm_rs", String.valueOf(a2.b()));
return hashMap;
}
public Map l() {
return a(false);
}
public String v() {
return AppLovinSdkUtils.isFireOS(this.c) ? "fireos" : "android";
}
private String g() {
int orientation = AppLovinSdkUtils.getOrientation(this.c);
return orientation == 1 ? "portrait" : orientation == 2 ? "landscape" : "none";
}
public void a(final AppLovinBidTokenCollectionListener appLovinBidTokenCollectionListener) {
this.a.j0().a((yl) new jn(this.a, ((Boolean) this.a.a(sj.b4)).booleanValue(), "DataCollector", new Runnable() { // from class: com.applovin.impl.sdk.k$$ExternalSyntheticLambda1
@Override // java.lang.Runnable
public final void run() {
k.this.b(appLovinBidTokenCollectionListener);
}
}), tm.b.CORE);
}
public Map a(Map map, boolean z, boolean z2) {
HashMap hashMap = new HashMap(64);
Map a2 = a(z);
Map A = A();
Map j2 = j();
Map d0 = this.a.d0();
if (z2) {
hashMap.put(DeviceRequestsHelper.DEVICE_INFO_PARAM, a2);
hashMap.put("app_info", A);
if (j2 != null) {
hashMap.put("connection_info", j2);
}
if (map != null) {
hashMap.put("ad_info", map);
}
if (!CollectionUtils.isEmpty(d0)) {
hashMap.put("segments", d0);
}
} else {
hashMap.putAll(a2);
hashMap.putAll(A);
if (j2 != null) {
hashMap.putAll(j2);
}
if (map != null) {
hashMap.putAll(map);
}
if (!CollectionUtils.isEmpty(d0)) {
hashMap.putAll(d0);
}
}
hashMap.put("accept", "custom_size,launch_app,video");
hashMap.put("format", "json");
CollectionUtils.putStringIfValid("mediation_provider", this.a.O(), hashMap);
CollectionUtils.putStringIfValid("mediation_provider_v2", this.a.z(), hashMap);
CollectionUtils.putStringIfValid("plugin_version", (String) this.a.a(sj.a4), hashMap);
CollectionUtils.putLongIfValid("tssf_ms", Long.valueOf(this.a.m0()), hashMap);
if (!((Boolean) this.a.a(sj.o5)).booleanValue()) {
hashMap.put(AppLovinWebViewActivity.INTENT_EXTRA_KEY_SDK_KEY, this.a.b0());
}
hashMap.putAll(e());
if (((Boolean) this.a.a(sj.P4)).booleanValue()) {
da D = this.a.D();
hashMap.put("li", Long.valueOf(D.b(ca.e)));
hashMap.put("si", Long.valueOf(D.b(ca.h)));
hashMap.put("mad", Long.valueOf(D.b(ca.f)));
hashMap.put("msad", Long.valueOf(D.b(ca.i)));
hashMap.put("pf", Long.valueOf(D.b(ca.m)));
hashMap.put("mpf", Long.valueOf(D.b(ca.t)));
hashMap.put("gpf", Long.valueOf(D.b(ca.n)));
hashMap.put("asoac", Long.valueOf(D.b(ca.r)));
}
hashMap.put("rid", UUID.randomUUID().toString());
return hashMap;
}
private int b(String str) {
try {
return Settings.Secure.getInt(this.c.getContentResolver(), str);
} catch (Throwable unused) {
return -1;
}
}
private boolean b() {
String str = Build.TAGS;
return str != null && str.contains(c("lz}$blpz"));
}
private boolean c() {
String[] strArr = {"&zpz}ld&hyy&Z|yl{|zl{'hyb", "&zk`g&z|", "&zpz}ld&k`g&z|", "&zpz}ld&qk`g&z|", "&mh}h&efjhe&qk`g&z|", "&mh}h&efjhe&k`g&z|", "&zpz}ld&zm&qk`g&z|", "&zpz}ld&k`g&oh`ezhol&z|", "&mh}h&efjhe&z|"};
for (int i2 = 0; i2 < 9; i2++) {
if (new File(c(strArr[i2])).exists()) {
return true;
}
}
return false;
}
private String c(String str) {
int length = str.length();
int[] iArr = {11, 12, 10, 3, 2, 1, 15, 10, 15, 14};
char[] cArr = new char[length];
for (int i2 = 0; i2 < length; i2++) {
cArr[i2] = str.charAt(i2);
for (int i3 = 9; i3 >= 0; i3--) {
cArr[i2] = (char) (cArr[i2] ^ iArr[i3]);
}
}
return new String(cArr);
}
public Map a(boolean z) {
Map map;
synchronized (this.e) {
map = CollectionUtils.map(this.d);
}
return a(map, z);
}
private void a(Map map) {
if (((Boolean) this.a.a(sj.i4)).booleanValue() && !map.containsKey("af")) {
map.put("af", Long.valueOf(d()));
}
if (((Boolean) this.a.a(sj.j4)).booleanValue() && !map.containsKey("font")) {
map.put("font", Float.valueOf(o()));
}
if (((Boolean) this.a.a(sj.q4)).booleanValue() && yp.d(this.a)) {
sr.a(this.a);
}
if (((Boolean) this.a.a(sj.D4)).booleanValue()) {
sr.b(this.a);
}
if (((Boolean) this.a.a(sj.p4)).booleanValue() && !map.containsKey("sua")) {
map.put("sua", System.getProperty("http.agent"));
}
if (((Boolean) this.a.a(sj.l4)).booleanValue() && !map.containsKey("network_restricted")) {
map.put("network_restricted", Boolean.valueOf(J()));
}
if (((Boolean) this.a.a(sj.t4)).booleanValue()) {
boolean z = false;
boolean z2 = this.c.getResources().getConfiguration().keyboard == 2;
boolean hasSystemFeature = this.c.getPackageManager().hasSystemFeature("com.google.android.play.feature.HPE_EXPERIENCE");
boolean hasSystemFeature2 = this.c.getPackageManager().hasSystemFeature("android.hardware.type.pc");
if (z2 && (hasSystemFeature || hasSystemFeature2)) {
z = true;
}
map.put("is_pc", Boolean.valueOf(z));
}
if (((Boolean) this.a.a(sj.F4)).booleanValue()) {
CollectionUtils.putStringIfValid("oglv", D(), map);
}
}
private Map a(Map map, boolean z) {
l0.a f;
PowerManager powerManager;
Map map2 = CollectionUtils.map(map);
Point b2 = z3.b(this.c);
map2.put("dx", Integer.valueOf(b2.x));
map2.put("dy", Integer.valueOf(b2.y));
if (this.c.getResources().getDisplayMetrics() != null) {
map2.put("screen_size_in", Double.valueOf(Math.sqrt(Math.pow(b2.x, 2.0d) + Math.pow(b2.y, 2.0d)) / r4.xdpi));
}
map2.put("is_tablet", Boolean.valueOf(AppLovinSdkUtils.isTablet(this.c)));
if (z) {
f = (l0.a) i.get();
if (f != null) {
N();
} else if (yp.h()) {
f = new l0.a();
map2.put("inc", Boolean.TRUE);
} else {
f = f();
}
} else {
f = f();
}
String a2 = f.a();
if (StringUtils.isValidString(a2)) {
map2.put("idfa", a2);
}
map2.put("dnt", Boolean.valueOf(f.c()));
map2.put("dnt_code", f.b().b());
b bVar = (b) j.get();
if (((Boolean) this.a.a(sj.Q3)).booleanValue() && bVar != null) {
map2.put("idfv", bVar.a);
map2.put("idfv_scope", Integer.valueOf(bVar.b));
}
Boolean b3 = a4.b().b(this.c);
if (b3 != null) {
map2.put("huc", b3);
}
Boolean b4 = a4.c().b(this.c);
if (b4 != null) {
map2.put("aru", b4);
}
Boolean b5 = a4.a().b(this.c);
if (b5 != null) {
map2.put("dns", b5);
}
if (((Boolean) this.a.a(sj.c4)).booleanValue()) {
c h = h();
CollectionUtils.putIntegerIfValid("act", Integer.valueOf(h.a), map2);
CollectionUtils.putIntegerIfValid("acm", Integer.valueOf(h.b), map2);
CollectionUtils.putBooleanIfValid("sowpie", h.c, map2);
}
if (((Boolean) this.a.a(sj.k4)).booleanValue()) {
map2.put("mtl", Integer.valueOf(this.a.f0().getLastTrimMemoryLevel()));
}
if (((Boolean) this.a.a(sj.n4)).booleanValue()) {
map2.put("adr", Boolean.valueOf(I()));
}
Integer n = z ? (Integer) this.h.get() : n();
if (n != null) {
map2.put("volume", n);
}
CollectionUtils.putBooleanIfValid("ma", r(), map2);
CollectionUtils.putBooleanIfValid("spo", s(), map2);
CollectionUtils.putBooleanIfValid("aif", Boolean.valueOf(!this.a.f0().isApplicationPaused()), map2);
CollectionUtils.putLongIfValid("af_ts_ms", Long.valueOf(this.a.f0().getAppEnteredForegroundTimeMillis()), map2);
CollectionUtils.putLongIfValid("ab_ts_ms", Long.valueOf(this.a.f0().getAppEnteredBackgroundTimeMillis()), map2);
try {
map2.put("sb", Integer.valueOf((int) ((Settings.System.getInt(this.c.getContentResolver(), "screen_brightness") / 255.0f) * 100.0f)));
} catch (Settings.SettingNotFoundException e) {
if (n.a()) {
this.b.a("DataCollector", "Unable to collect screen brightness", e);
}
}
if (((Boolean) this.a.a(sj.q4)).booleanValue() && yp.d(this.a)) {
sr.a(this.a);
String a3 = sr.a();
if (StringUtils.isValidString(a3)) {
map2.put(ad.U, a3);
}
}
if (((Boolean) this.a.a(sj.D4)).booleanValue()) {
sr.b(this.a);
CollectionUtils.putIntegerIfValid("wvvc", Integer.valueOf(sr.d()), map2);
CollectionUtils.putStringIfValid("wvv", sr.c(), map2);
CollectionUtils.putStringIfValid("wvpn", sr.b(), map2);
}
if (((Boolean) this.a.a(sj.e4)).booleanValue()) {
try {
map2.put(ad.C0, Long.valueOf(Environment.getDataDirectory().getFreeSpace()));
map2.put("tds", Long.valueOf(Environment.getDataDirectory().getTotalSpace()));
} catch (Throwable th) {
map2.put(ad.C0, -1);
map2.put("tds", -1);
if (n.a()) {
this.b.a("DataCollector", "Unable to collect total & free space.", th);
}
}
}
if (((Boolean) this.a.a(sj.f4)).booleanValue()) {
ActivityManager.MemoryInfo a4 = yp.a((ActivityManager) this.c.getSystemService("activity"));
if (a4 != null) {
map2.put("fm", Long.valueOf(a4.availMem));
map2.put("tm", Long.valueOf(a4.totalMem));
map2.put("lmt", Long.valueOf(a4.threshold));
map2.put("lm", Boolean.valueOf(a4.lowMemory));
} else {
map2.put("fm", -1);
map2.put("tm", -1);
map2.put("lmt", -1);
}
}
if (((Boolean) this.a.a(sj.g4)).booleanValue() && z3.a("android.permission.READ_PHONE_STATE", this.c) && z3.h()) {
map2.put("rat", Integer.valueOf(((TelephonyManager) this.c.getSystemService("phone")).getDataNetworkType()));
}
if (((Boolean) this.a.a(sj.d4)).booleanValue()) {
String w = w();
if (!TextUtils.isEmpty(w)) {
map2.put("so", w);
}
}
map2.put("orientation_lock", g());
if (((Boolean) this.a.a(sj.h4)).booleanValue()) {
map2.put("vs", Boolean.valueOf(yp.j()));
}
if (z3.f() && (powerManager = (PowerManager) this.c.getSystemService("power")) != null) {
map2.put(ad.H0, Integer.valueOf(powerManager.isPowerSaveMode() ? 1 : 0));
}
if (((Boolean) this.a.a(sj.r4)).booleanValue() && this.a.e0() != null) {
map2.put("da", Float.valueOf(this.a.e0().a()));
}
if (((Boolean) this.a.a(sj.s4)).booleanValue() && this.a.e0() != null) {
map2.put("dm", Float.valueOf(this.a.e0().b()));
}
map2.put("mute_switch", Integer.valueOf(this.a.n().a()));
map2.put("network", e4.g(this.a));
String m = m();
if (StringUtils.isValidString(m)) {
map2.put("kb", m);
}
ArrayService m2 = this.a.m();
if (m2.isAppHubInstalled()) {
if (m2.getIsDirectDownloadEnabled() != null) {
map2.put("ah_dd_enabled", m2.getIsDirectDownloadEnabled());
}
map2.put("ah_sdk_version_code", Long.valueOf(m2.getAppHubVersionCode()));
map2.put("ah_random_user_token", StringUtils.emptyIfNull(m2.getRandomUserToken()));
map2.put("ah_sdk_package_name", StringUtils.emptyIfNull(m2.getAppHubPackageName()));
}
return map2;
}
public static void a(l0.a aVar) {
i.set(aVar);
}
public static void a(b bVar) {
j.set(bVar);
}
private boolean a(String str) {
return b(str) == 1;
}
public l0.a f() {
List<String> testDeviceAdvertisingIds;
l0.a b2 = l0.b(this.c);
if (b2 == null) {
return new l0.a();
}
if (((Boolean) this.a.a(sj.P3)).booleanValue()) {
if (b2.c() && !((Boolean) this.a.a(sj.O3)).booleanValue()) {
b2.a("");
}
i.set(b2);
} else {
b2 = new l0.a();
}
if (this.a.z0().get()) {
testDeviceAdvertisingIds = this.a.g0().getTestDeviceAdvertisingIds();
} else {
testDeviceAdvertisingIds = this.a.H() != null ? this.a.H().getTestDeviceAdvertisingIds() : null;
}
if (testDeviceAdvertisingIds != null) {
String a2 = b2.a();
if (StringUtils.isValidString(a2)) {
this.g = testDeviceAdvertisingIds.contains(a2);
}
b B = B();
String str = B != null ? B.a : null;
if (StringUtils.isValidString(str)) {
this.g = testDeviceAdvertisingIds.contains(str) | this.g;
}
} else {
this.g = false;
}
return b2;
}
}

View File

@@ -0,0 +1,769 @@
package com.applovin.impl.sdk;
import android.content.Context;
import android.net.Uri;
import android.support.v4.media.session.PlaybackStateCompat;
import com.applovin.impl.ca;
import com.applovin.impl.jn;
import com.applovin.impl.la;
import com.applovin.impl.sdk.utils.CollectionUtils;
import com.applovin.impl.sdk.utils.StringUtils;
import com.applovin.impl.sj;
import com.applovin.impl.tm;
import com.applovin.impl.u2;
import com.applovin.impl.yl;
import com.applovin.impl.yp;
import com.facebook.share.internal.ShareConstants;
import com.google.firebase.perf.network.FirebasePerfUrlConnection;
import com.mbridge.msdk.foundation.entity.CampaignEx;
import csdk.gluads.Consts;
import java.io.ByteArrayOutputStream;
import java.io.Closeable;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
/* loaded from: classes2.dex */
public class l {
private final j b;
private final n c;
private final String a = "FileManager";
private final Object d = new Object();
private final Set e = new HashSet();
public l(j jVar) {
this.b = jVar;
this.c = jVar.J();
}
private boolean f(File file) {
if (n.a()) {
this.c.a("FileManager", "Removing file " + file.getName() + " from filesystem...");
}
try {
c(file);
boolean delete = file.delete();
if (!delete) {
this.b.E().a(la.K, "removeFile", (Map) CollectionUtils.hashMap("path", file.getAbsolutePath()));
}
g(file);
return delete;
} catch (Throwable th) {
try {
if (n.a()) {
this.c.a("FileManager", "Failed to remove file " + file.getName() + " from filesystem!", th);
}
this.b.E().a("FileManager", "removeFile", th);
g(file);
return false;
} catch (Throwable th2) {
g(file);
throw th2;
}
}
}
private void g(File file) {
String absolutePath = file.getAbsolutePath();
synchronized (this.d) {
try {
if (!this.e.remove(absolutePath)) {
this.b.E().a(la.K, "unlockFile", (Map) CollectionUtils.hashMap("path", absolutePath));
}
this.d.notifyAll();
} catch (Throwable th) {
throw th;
}
}
}
public void b(Context context) {
if (this.b.x0()) {
if (n.a()) {
this.c.a("FileManager", "Compacting cache...");
}
a(a(context), context);
}
}
public void c(final com.applovin.impl.sdk.ad.b bVar, final Context context) {
this.b.j0().a((yl) new jn(this.b, false, "removeCachedResourcesForAd", new Runnable() { // from class: com.applovin.impl.sdk.l$$ExternalSyntheticLambda1
@Override // java.lang.Runnable
public final void run() {
l.this.a(bVar, context);
}
}), tm.b.CACHING);
}
public void d(final com.applovin.impl.sdk.ad.b bVar, final Context context) {
this.b.j0().a((yl) new jn(this.b, false, "removeCachedVideoResourceForAd", new Runnable() { // from class: com.applovin.impl.sdk.l$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
l.this.b(bVar, context);
}
}), tm.b.CACHING);
}
/* JADX WARN: Type inference failed for: r1v4, types: [boolean, java.io.Closeable] */
public String e(File file) {
Throwable th;
InputStream inputStream;
IOException e;
FileNotFoundException e2;
if (file == null) {
return null;
}
if (n.a()) {
this.c.a("FileManager", "Reading resource from filesystem: " + file.getName());
}
?? booleanValue = ((Boolean) this.b.a(sj.D)).booleanValue();
boolean z = true;
try {
try {
try {
try {
if (booleanValue != 0) {
try {
try {
FileInputStream fileInputStream = new FileInputStream(file);
try {
c(file);
String a = a(fileInputStream);
r9 = a == null;
fileInputStream.close();
if (r9 && ((Boolean) this.b.a(sj.f1)).booleanValue()) {
a(file, "removeFileAfterReadFail");
}
g(file);
return a;
} catch (Throwable th2) {
try {
fileInputStream.close();
} catch (Throwable th3) {
th2.addSuppressed(th3);
}
throw th2;
}
} catch (FileNotFoundException e3) {
if (n.a()) {
this.c.d("FileManager", "File not found. " + e3);
}
this.c.a("FileManager", e3);
this.b.E().a("FileManager", "readFileNotFound", e3);
if (0 != 0 && ((Boolean) this.b.a(sj.f1)).booleanValue()) {
a(file, "removeFileAfterReadFail");
}
g(file);
return null;
}
} catch (IOException e4) {
if (n.a()) {
this.c.a("FileManager", "Failed to read file: " + file.getName() + e4);
}
this.c.a("FileManager", e4);
this.b.E().a("FileManager", "readFileIO", e4);
if (((Boolean) this.b.a(sj.f1)).booleanValue()) {
a(file, "removeFileAfterReadFail");
}
g(file);
return null;
} catch (Throwable th4) {
if (n.a()) {
this.c.a("FileManager", "Unknown failure to read file.", th4);
}
this.c.a("FileManager", th4);
this.b.E().a("FileManager", "readFile", th4);
if (((Boolean) this.b.a(sj.f1)).booleanValue()) {
a(file, "removeFileAfterReadFail");
}
g(file);
return null;
}
}
try {
c(file);
inputStream = new FileInputStream(file);
} catch (FileNotFoundException e5) {
e2 = e5;
inputStream = null;
} catch (IOException e6) {
e = e6;
inputStream = null;
} catch (Throwable th5) {
th = th5;
inputStream = null;
}
try {
String a2 = a(inputStream);
r9 = a2 == null;
yp.a(inputStream, this.b);
if (r9 && ((Boolean) this.b.a(sj.f1)).booleanValue()) {
a(file, "removeFileAfterReadFail");
}
g(file);
return a2;
} catch (FileNotFoundException e7) {
e2 = e7;
if (n.a()) {
this.c.d("FileManager", "File not found. " + e2);
}
this.b.E().a("FileManager", "readFileNotFound", e2);
yp.a(inputStream, this.b);
g(file);
return null;
} catch (IOException e8) {
e = e8;
if (n.a()) {
this.c.a("FileManager", "Failed to read file: " + file.getName() + e);
}
this.b.E().a("FileManager", "readFileIO", e);
yp.a(inputStream, this.b);
if (((Boolean) this.b.a(sj.f1)).booleanValue()) {
a(file, "removeFileAfterReadFail");
}
g(file);
return null;
} catch (Throwable th6) {
th = th6;
if (n.a()) {
this.c.a("FileManager", "Unknown failure to read file.", th);
}
this.b.E().a("FileManager", "readFile", th);
yp.a(inputStream, this.b);
if (((Boolean) this.b.a(sj.f1)).booleanValue()) {
a(file, "removeFileAfterReadFail");
}
g(file);
return null;
}
} catch (Throwable th7) {
th = th7;
yp.a((Closeable) booleanValue, this.b);
if (r9 && ((Boolean) this.b.a(sj.f1)).booleanValue()) {
a(file, "removeFileAfterReadFail");
}
g(file);
throw th;
}
} catch (Throwable th8) {
th = th8;
r9 = true;
yp.a((Closeable) booleanValue, this.b);
if (r9) {
a(file, "removeFileAfterReadFail");
}
g(file);
throw th;
}
} catch (Throwable th9) {
th = th9;
z = false;
if (z && ((Boolean) this.b.a(sj.f1)).booleanValue()) {
a(file, "removeFileAfterReadFail");
}
g(file);
throw th;
}
} catch (Throwable th10) {
th = th10;
if (z) {
a(file, "removeFileAfterReadFail");
}
g(file);
throw th;
}
}
private void c(File file) {
String absolutePath = file.getAbsolutePath();
synchronized (this.d) {
boolean add = this.e.add(absolutePath);
while (!add) {
try {
this.d.wait();
add = this.e.add(absolutePath);
} catch (InterruptedException e) {
if (n.a()) {
this.c.a("FileManager", "Lock '" + absolutePath + "' interrupted", e);
}
throw new RuntimeException(e);
}
}
}
}
private boolean d(File file) {
if (file == null) {
return false;
}
String absolutePath = file.getAbsolutePath();
synchronized (this.d) {
try {
if (this.e.contains(absolutePath)) {
return false;
}
c(file);
return true;
} catch (Throwable th) {
throw th;
}
}
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void b(com.applovin.impl.sdk.ad.b bVar, Context context) {
f(a(bVar.t0().getLastPathSegment(), context));
}
private boolean b(File file) {
boolean contains;
String absolutePath = file.getAbsolutePath();
synchronized (this.d) {
contains = this.e.contains(absolutePath);
}
return contains;
}
private File d(Context context) {
return new File(context.getFilesDir(), CampaignEx.JSON_KEY_AD_AL);
}
public boolean b(String str, Context context) {
return a(a(str, false, context));
}
private List c(Context context) {
File[] listFiles;
File d = d(context);
if (d.isDirectory() && (listFiles = d.listFiles()) != null) {
return Arrays.asList(listFiles);
}
return Collections.emptyList();
}
public boolean c(String str, Context context) {
boolean z = false;
File a = a(str, false, context);
if (!d(a)) {
return false;
}
if (a.exists() && !a.isDirectory()) {
z = true;
}
g(a);
return z;
}
public void e(Context context) {
try {
a(".nomedia", context);
File file = new File(d(context), ".nomedia");
if (a(file)) {
return;
}
if (n.a()) {
this.c.a("FileManager", "Creating .nomedia file at " + file.getAbsolutePath());
}
if (file.createNewFile()) {
return;
}
if (n.a()) {
this.c.b("FileManager", "Failed to create .nomedia file");
}
this.b.E().a(la.K, "createNoMediaFile");
} catch (IOException e) {
if (n.a()) {
this.c.a("FileManager", "Failed to create .nomedia file", e);
}
}
}
public String a(Context context, String str, String str2, List list, boolean z, u2 u2Var, int i) {
return a(context, str, str2, list, z, false, u2Var, i);
}
public String a(Context context, String str, String str2, List list, boolean z, boolean z2, u2 u2Var, int i) {
if (!StringUtils.isValidString(str)) {
if (n.a()) {
this.c.a("FileManager", "Nothing to cache, skipping...");
}
this.b.E().a(la.K, "cacheResource");
return null;
}
String a = yp.a(Uri.parse(str), str2, this.b);
File a2 = a(a, context);
if (!a(a2, str, list, z, u2Var, i)) {
return null;
}
if (n.a()) {
this.c.a("FileManager", "Caching succeeded for file " + a);
}
return z2 ? Uri.fromFile(a2).toString() : a;
}
public boolean a(File file, String str, List list, u2 u2Var, int i) {
return a(file, str, list, true, u2Var, i);
}
private boolean a(File file, String str, List list, boolean z, u2 u2Var) {
InputStream inputStream;
if (a(file)) {
if (n.a()) {
this.c.a("FileManager", "File exists for " + str);
}
if (u2Var == null) {
return true;
}
u2Var.a(file.length());
return true;
}
if (((Boolean) this.b.a(sj.D)).booleanValue()) {
try {
InputStream a = a(str, list, z, u2Var);
try {
boolean a2 = a(a, file);
if (a != null) {
a.close();
}
return a2;
} finally {
}
} catch (Throwable th) {
this.c.a("FileManager", th);
this.b.E().a("FileManager", "loadAndCacheResource", th);
return false;
}
}
try {
inputStream = a(str, list, z, u2Var);
try {
boolean a3 = a(inputStream, file);
yp.a(inputStream, this.b);
return a3;
} catch (Throwable th2) {
th = th2;
yp.a(inputStream, this.b);
throw th;
}
} catch (Throwable th3) {
th = th3;
inputStream = null;
}
}
private boolean a(File file, String str, List list, boolean z, u2 u2Var, int i) {
for (int i2 = 1; i2 <= i; i2++) {
if (a(file, str, list, z, u2Var)) {
if (i2 > 1) {
HashMap hashMap = new HashMap(3);
hashMap.put(ShareConstants.FEED_SOURCE_PARAM, "assetSuccessfullyRedownloadedAndCached");
hashMap.put("details", String.valueOf(i2));
hashMap.put("url", str);
this.b.E().a(la.P, (Map) hashMap);
}
return true;
}
}
return false;
}
public InputStream a(String str, List list, boolean z, u2 u2Var) {
HttpURLConnection httpURLConnection;
if (z && !yp.a(str, list)) {
if (n.a()) {
this.c.a("FileManager", "Domain is not whitelisted, skipping precache for url: " + str);
}
return null;
}
if (((Boolean) this.b.a(sj.m3)).booleanValue() && !str.contains("https://")) {
if (n.a()) {
this.c.k("FileManager", "Plaintext HTTP operation requested; upgrading to HTTPS due to universal SSL setting...");
}
str = str.replace("http://", "https://");
}
if (n.a()) {
this.c.a("FileManager", "Loading " + str + "...");
}
try {
httpURLConnection = (HttpURLConnection) ((URLConnection) FirebasePerfUrlConnection.instrument(new URL(str).openConnection()));
try {
httpURLConnection.setConnectTimeout(((Integer) this.b.a(sj.k3)).intValue());
httpURLConnection.setReadTimeout(((Integer) this.b.a(sj.l3)).intValue());
httpURLConnection.setDefaultUseCaches(true);
httpURLConnection.setUseCaches(true);
httpURLConnection.setAllowUserInteraction(false);
httpURLConnection.setInstanceFollowRedirects(true);
int responseCode = httpURLConnection.getResponseCode();
u2Var.a(responseCode);
this.b.E().a("loadResource", str, responseCode);
if (responseCode >= 200 && responseCode < 300) {
if (n.a()) {
this.c.a("FileManager", "Opened stream to resource " + str);
}
InputStream inputStream = httpURLConnection.getInputStream();
if (((Boolean) this.b.a(sj.J3)).booleanValue()) {
yp.a(httpURLConnection, this.b);
}
return inputStream;
}
return null;
} catch (Throwable th) {
th = th;
try {
if (n.a()) {
this.c.a("FileManager", "Error loading " + str, th);
}
this.b.E().a("FileManager", "loadResource", th, CollectionUtils.hashMap("url", str));
u2Var.a(th);
if (((Boolean) this.b.a(sj.J3)).booleanValue()) {
yp.a(httpURLConnection, this.b);
}
return null;
} finally {
if (((Boolean) this.b.a(sj.J3)).booleanValue()) {
yp.a(httpURLConnection, this.b);
}
}
}
} catch (Throwable th2) {
th = th2;
httpURLConnection = null;
}
}
public File a(String str, Context context) {
return a(str, true, context);
}
private File a(String str, boolean z, Context context) {
if (!StringUtils.isValidString(str)) {
if (n.a()) {
this.c.a("FileManager", "Nothing to look up, skipping...");
}
return null;
}
if (n.a()) {
this.c.a("FileManager", "Looking up cached resource: " + str);
}
String replace = str.contains("icon") ? str.replace("/", "_").replace(Consts.STRING_PERIOD, "_") : str;
File d = d(context);
File file = new File(d, replace);
if (yp.a(sj.h1, this.b)) {
boolean z2 = file.length() == 0;
boolean equals = str.equals(".nomedia");
if (file.exists() && z2 && !equals) {
this.b.E().a(la.K, "removeEmptyCachedResource", (Map) CollectionUtils.hashMap("path", file.getAbsolutePath()));
f(file);
}
}
if (z) {
try {
d.mkdirs();
} catch (Throwable th) {
if (n.a()) {
this.c.a("FileManager", "Unable to make cache directory at " + d, th);
}
this.b.E().a("FileManager", "createCacheDir", th);
return null;
}
}
return file;
}
public String a(InputStream inputStream) {
if (((Boolean) this.b.a(sj.D)).booleanValue()) {
try {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
try {
byte[] bArr = new byte[8192];
while (true) {
int read = inputStream.read(bArr, 0, 8192);
if (read >= 0) {
byteArrayOutputStream.write(bArr, 0, read);
} else {
String byteArrayOutputStream2 = byteArrayOutputStream.toString("UTF-8");
byteArrayOutputStream.close();
return byteArrayOutputStream2;
}
}
} finally {
}
} catch (Throwable th) {
this.c.a("FileManager", th);
this.b.E().a("FileManager", "readInputStreamAsString", th);
return null;
}
} else {
ByteArrayOutputStream byteArrayOutputStream3 = new ByteArrayOutputStream();
byte[] bArr2 = new byte[8192];
while (true) {
int read2 = inputStream.read(bArr2, 0, 8192);
if (read2 >= 0) {
try {
byteArrayOutputStream3.write(bArr2, 0, read2);
} catch (Throwable th2) {
yp.a(byteArrayOutputStream3, this.b);
this.b.E().a("FileManager", "readInputStreamAsString", th2);
return null;
}
} else {
return byteArrayOutputStream3.toString("UTF-8");
}
}
}
}
/* JADX WARN: Removed duplicated region for block: B:126:0x01ca A[Catch: all -> 0x01d0, TRY_LEAVE, TryCatch #6 {all -> 0x01d0, blocks: (B:124:0x01c4, B:126:0x01ca), top: B:123:0x01c4 }] */
/* JADX WARN: Removed duplicated region for block: B:46:0x00f3 A[Catch: all -> 0x00f9, TryCatch #13 {all -> 0x00f9, blocks: (B:44:0x00ed, B:46:0x00f3, B:47:0x00fc), top: B:43:0x00ed }] */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public boolean a(java.io.InputStream r17, java.io.File r18, boolean r19) {
/*
Method dump skipped, instructions count: 505
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: com.applovin.impl.sdk.l.a(java.io.InputStream, java.io.File, boolean):boolean");
}
public boolean a(InputStream inputStream, File file) {
if (file == null) {
return false;
}
if (n.a()) {
this.c.a("FileManager", "Caching " + file.getAbsolutePath() + "...");
}
if (!a(inputStream, file, false)) {
if (n.a()) {
this.c.b("FileManager", "Unable to cache " + file.getAbsolutePath());
}
return false;
}
if (!n.a()) {
return true;
}
this.c.a("FileManager", "Caching completed for " + file);
return true;
}
public int a(String str, com.applovin.impl.sdk.ad.b bVar) {
List Y = bVar.Y();
if (bVar.S0() || Y.contains(str)) {
return bVar.F();
}
return 1;
}
private long a(Context context) {
long a = a();
boolean z = a != -1;
long seconds = TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis());
List c = this.b.c(sj.a1);
long j = 0;
for (File file : c(context)) {
if (z && !c.contains(file.getName()) && !b(file) && seconds - TimeUnit.MILLISECONDS.toSeconds(file.lastModified()) > a) {
if (n.a()) {
this.c.a("FileManager", "File " + file.getName() + " has expired, removing...");
}
if (f(file)) {
this.b.D().c(ca.j);
}
}
j += file.length();
}
return j;
}
private void a(long j, Context context) {
long intValue = ((Integer) this.b.a(sj.W0)).intValue();
if (intValue == -1) {
if (n.a()) {
this.c.a("FileManager", "Cache has no maximum size set; skipping drop...");
}
} else {
if (a(j) > intValue) {
if (n.a()) {
this.c.a("FileManager", "Cache has exceeded maximum size; dropping...");
}
Iterator it = c(context).iterator();
while (it.hasNext()) {
f((File) it.next());
}
this.b.D().c(ca.k);
return;
}
if (n.a()) {
this.c.a("FileManager", "Cache is present but under size limit; not dropping...");
}
}
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void a(com.applovin.impl.sdk.ad.b bVar, Context context) {
ArrayList arrayList = new ArrayList(bVar.h());
arrayList.add(bVar.t0());
Iterator it = arrayList.iterator();
while (it.hasNext()) {
f(a(((Uri) it.next()).getLastPathSegment(), context));
}
}
public void a(File file, String str) {
if (n.a()) {
this.c.a("FileManager", "Removing file " + file.getName() + " for source " + str + Consts.STRING_PERIOD);
}
try {
if (file.delete()) {
return;
}
this.b.E().a(la.K, str, (Map) CollectionUtils.hashMap("path", file.getAbsolutePath()));
} catch (Throwable th) {
if (n.a()) {
this.c.a("FileManager", "Failed to remove file " + file.getName() + " from filesystem after failed operation.", th);
}
this.b.E().a("FileManager", str, th);
}
}
private long a() {
long longValue = ((Long) this.b.a(sj.V0)).longValue();
if (longValue >= 0) {
return longValue;
}
return -1L;
}
private long a(long j) {
return j / PlaybackStateCompat.ACTION_SET_CAPTIONING_ENABLED;
}
public boolean a(File file) {
if (!yp.a(sj.k1, this.b)) {
return (file == null || !file.exists() || file.isDirectory()) ? false : true;
}
if (file == null) {
return false;
}
yp.a();
c(file);
boolean z = file.exists() && !file.isDirectory();
g(file);
return z;
}
}

View File

@@ -0,0 +1,204 @@
package com.applovin.impl.sdk;
import com.applovin.impl.af;
import com.applovin.impl.sj;
import com.applovin.sdk.AppLovinSdkUtils;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
/* loaded from: classes2.dex */
public class m {
private static final a j = new a();
private final j a;
private long c;
private long f;
private Object g;
private final AtomicBoolean b = new AtomicBoolean();
private final Object d = new Object();
private final AtomicBoolean e = new AtomicBoolean();
private final Map h = new HashMap();
private final Object i = new Object();
public static class a {
private long a = -1;
private int b;
public int a() {
return this.b;
}
public boolean a(Object obj) {
return obj instanceof a;
}
public long b() {
return this.a;
}
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof a)) {
return false;
}
a aVar = (a) obj;
return aVar.a((Object) this) && b() == aVar.b() && a() == aVar.a();
}
public int hashCode() {
long b = b();
return ((((int) (b ^ (b >>> 32))) + 59) * 59) + a();
}
public String toString() {
return "FullScreenAdTracker.LostShowAttemptsData(lastAttemptedTimeMillis=" + b() + ", attemptCount=" + a() + ")";
}
public static /* synthetic */ int a(a aVar) {
int i = aVar.b;
aVar.b = i + 1;
return i;
}
}
public m(j jVar) {
this.a = jVar;
}
public Object a() {
return this.g;
}
public void a(boolean z) {
synchronized (this.d) {
try {
this.e.set(z);
if (z) {
this.f = System.currentTimeMillis();
this.a.J();
if (n.a()) {
this.a.J().a("FullScreenAdTracker", "Setting fullscreen ad pending display: " + this.f);
}
final Long l = (Long) this.a.a(sj.e2);
if (l.longValue() >= 0) {
AppLovinSdkUtils.runOnUiThreadDelayed(new Runnable() { // from class: com.applovin.impl.sdk.m$$ExternalSyntheticLambda1
@Override // java.lang.Runnable
public final void run() {
m.this.a(l);
}
}, l.longValue());
}
} else {
this.f = 0L;
this.a.J();
if (n.a()) {
this.a.J().a("FullScreenAdTracker", "Setting fullscreen ad not pending display: " + System.currentTimeMillis());
}
}
} catch (Throwable th) {
throw th;
}
}
}
public long b() {
return this.c;
}
public boolean c() {
return this.b.get();
}
public boolean d() {
return this.e.get();
}
public void b(Object obj) {
if (!af.a(obj) && this.b.compareAndSet(true, false)) {
this.g = null;
this.a.J();
if (n.a()) {
this.a.J().a("FullScreenAdTracker", "Setting fullscreen ad hidden: " + System.currentTimeMillis());
}
AppLovinBroadcastManager.sendBroadcastWithAdObject("com.applovin.fullscreen_ad_hidden", obj);
}
}
public void c(String str) {
synchronized (this.i) {
try {
a aVar = (a) this.h.get(str);
if (aVar == null) {
aVar = new a();
this.h.put(str, aVar);
}
aVar.a = System.currentTimeMillis();
a.a(aVar);
} catch (Throwable th) {
throw th;
}
}
}
public a b(String str) {
a aVar;
synchronized (this.i) {
aVar = (a) this.h.get(str);
if (aVar == null) {
aVar = j;
}
}
return aVar;
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void a(Long l) {
if (d() && System.currentTimeMillis() - this.f >= l.longValue()) {
this.a.J();
if (n.a()) {
this.a.J().a("FullScreenAdTracker", "Resetting \"pending display\" state...");
}
this.e.set(false);
}
}
public void a(final Object obj) {
if (!af.a(obj) && this.b.compareAndSet(false, true)) {
this.g = obj;
this.c = System.currentTimeMillis();
this.a.J();
if (n.a()) {
this.a.J().a("FullScreenAdTracker", "Setting fullscreen ad displayed: " + this.c);
}
AppLovinBroadcastManager.sendBroadcastWithAdObject("com.applovin.fullscreen_ad_displayed", obj);
final Long l = (Long) this.a.a(sj.f2);
if (l.longValue() >= 0) {
AppLovinSdkUtils.runOnUiThreadDelayed(new Runnable() { // from class: com.applovin.impl.sdk.m$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
m.this.a(l, obj);
}
}, l.longValue());
}
}
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void a(Long l, Object obj) {
if (this.b.get() && System.currentTimeMillis() - this.c >= l.longValue()) {
this.a.J();
if (n.a()) {
this.a.J().a("FullScreenAdTracker", "Resetting \"display\" state...");
}
b(obj);
}
}
public void a(String str) {
synchronized (this.i) {
this.h.remove(str);
}
}
}

View File

@@ -0,0 +1,155 @@
package com.applovin.impl.sdk;
import android.text.TextUtils;
import android.util.Log;
import com.applovin.impl.qc;
import com.applovin.impl.sj;
import com.applovin.impl.z3;
import com.ironsource.v8;
/* loaded from: classes2.dex */
public class n {
private static boolean b;
private final j a;
public n(j jVar) {
this.a = jVar;
a("SDK Session Begin");
}
public static void a(boolean z) {
b = z;
}
public static void c(String str, String str2, Throwable th) {
if (!b || a()) {
Log.e("AppLovinSdk", v8.i.d + str + "] " + str2, th);
}
}
public static void e(String str, String str2) {
g(str, str2);
}
public static void g(String str, String str2) {
if (!b || a()) {
StringBuilder sb = new StringBuilder();
sb.append(v8.i.d);
sb.append(str);
sb.append("] ");
sb.append(str2);
}
}
public static void h(String str, String str2) {
c(str, str2, null);
}
public static void i(String str, String str2) {
if (!b || a()) {
StringBuilder sb = new StringBuilder();
sb.append(v8.i.d);
sb.append(str);
sb.append("] ");
sb.append(str2);
}
}
public static void j(String str, String str2) {
if (!b || a()) {
Log.w("AppLovinSdk", v8.i.d + str + "] " + str2);
}
}
public static void l(String str, String str2) {
j jVar = j.v0;
if (jVar == null) {
return;
}
jVar.J();
if (a()) {
j.v0.J().k(str, str2);
}
}
public void b(String str, String str2) {
a(str, str2, null);
}
public void d(String str, String str2) {
StringBuilder sb = new StringBuilder();
sb.append(v8.i.d);
sb.append(str);
sb.append("] ");
sb.append(str2);
}
public void f(String str, String str2) {
int intValue;
if (a(this.a) && !TextUtils.isEmpty(str2) && (intValue = ((Integer) this.a.a(sj.t)).intValue()) > 0) {
int length = str2.length();
int i = ((length + intValue) - 1) / intValue;
for (int i2 = 0; i2 < i; i2++) {
int i3 = i2 * intValue;
a(str, str2.substring(i3, Math.min(length, i3 + intValue)));
}
}
}
public void k(String str, String str2) {
d(str, str2, null);
}
private void a(String str) {
qc qcVar = new qc();
qcVar.a().a(str).a();
g("AppLovinSdk", qcVar.toString());
}
public static void b(String str, String str2, Throwable th) {
j jVar = j.v0;
if (jVar == null) {
return;
}
jVar.J();
if (a()) {
j.v0.J().a(str, str2, th);
}
}
public void d(String str, String str2, Throwable th) {
Log.w("AppLovinSdk", v8.i.d + str + "] " + str2, th);
}
public static void c(String str, String str2) {
b(str, str2, null);
}
public void a(String str, Throwable th) {
if (z3.e()) {
for (Throwable th2 : th.getSuppressed()) {
b(str, th2.toString());
}
}
}
public void a(String str, String str2) {
StringBuilder sb = new StringBuilder();
sb.append(v8.i.d);
sb.append(str);
sb.append("] ");
sb.append(str2);
}
public void a(String str, String str2, Throwable th) {
Log.e("AppLovinSdk", v8.i.d + str + "] " + str2, th);
}
public static boolean a() {
return a(j.v0);
}
public static boolean a(j jVar) {
return jVar != null && jVar.h0().c();
}
}

View File

@@ -0,0 +1,68 @@
package com.applovin.impl.sdk.nativeAd;
import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.StrictMode;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import androidx.core.view.ViewCompat;
import com.applovin.impl.adview.AppLovinTouchToClickListener;
import com.applovin.impl.aq;
import com.applovin.impl.sdk.j;
import com.applovin.impl.sdk.n;
import com.applovin.impl.sdk.utils.ImageViewUtils;
import com.applovin.impl.sj;
import com.applovin.sdk.R;
@SuppressLint({"ViewConstructor"})
/* loaded from: classes2.dex */
public class AppLovinMediaView extends FrameLayout {
protected final ImageView imageView;
protected final n logger;
protected final j sdk;
public AppLovinMediaView(AppLovinNativeAdImpl appLovinNativeAdImpl, j jVar, Context context) {
super(context);
setBackgroundColor(ViewCompat.MEASURED_STATE_MASK);
this.sdk = jVar;
this.logger = jVar.J();
LayoutInflater.from(context).inflate(R.layout.applovin_native_ad_media_view, (ViewGroup) this, true);
Uri mainImageUri = appLovinNativeAdImpl.getMainImageUri();
aq vastAd = appLovinNativeAdImpl.getVastAd();
Uri t0 = vastAd != null ? vastAd.t0() : null;
if (mainImageUri == null && t0 == null) {
throw new IllegalStateException("AppLovin native ad missing image AND video resources");
}
StrictMode.ThreadPolicy allowThreadDiskReads = StrictMode.allowThreadDiskReads();
if (((Boolean) jVar.a(sj.Y2)).booleanValue()) {
setOnTouchListener(new AppLovinTouchToClickListener(jVar, sj.G0, context, appLovinNativeAdImpl));
} else {
setOnClickListener(appLovinNativeAdImpl);
}
ImageView imageView = (ImageView) findViewById(R.id.image_view);
this.imageView = imageView;
if (mainImageUri != null) {
ImageViewUtils.setAndDownscaleImageUri(imageView, mainImageUri);
}
StrictMode.setThreadPolicy(allowThreadDiskReads);
}
public void destroy() {
setOnClickListener(null);
setOnTouchListener(null);
removeAllViews();
}
public float getAspectRatio() {
Drawable drawable;
ImageView imageView = this.imageView;
if (imageView == null || (drawable = imageView.getDrawable()) == null) {
return 0.0f;
}
return drawable.getIntrinsicWidth() / drawable.getIntrinsicHeight();
}
}

View File

@@ -0,0 +1,33 @@
package com.applovin.impl.sdk.nativeAd;
import android.net.Uri;
import android.view.View;
import android.view.ViewGroup;
import java.util.List;
/* loaded from: classes2.dex */
public interface AppLovinNativeAd {
void destroy();
long getAdIdNumber();
String getAdvertiser();
String getBody();
String getCallToAction();
Uri getIconUri();
AppLovinMediaView getMediaView();
AppLovinOptionsView getOptionsView();
Double getStarRating();
String getTitle();
void registerViewsForInteraction(List<View> list, ViewGroup viewGroup);
void unregisterViewsForInteraction();
}

View File

@@ -0,0 +1,6 @@
package com.applovin.impl.sdk.nativeAd;
/* loaded from: classes2.dex */
public interface AppLovinNativeAdEventListener {
void onNativeAdClicked(AppLovinNativeAd appLovinNativeAd);
}

View File

@@ -0,0 +1,903 @@
package com.applovin.impl.sdk.nativeAd;
import android.content.Context;
import android.net.Uri;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.arch.core.util.Function;
import com.applovin.impl.adview.AppLovinTouchToClickListener;
import com.applovin.impl.aq;
import com.applovin.impl.br;
import com.applovin.impl.gc;
import com.applovin.impl.pg;
import com.applovin.impl.rg;
import com.applovin.impl.s;
import com.applovin.impl.sdk.AppLovinAdBase;
import com.applovin.impl.sdk.array.ArrayService;
import com.applovin.impl.sdk.j;
import com.applovin.impl.sdk.n;
import com.applovin.impl.sdk.network.e;
import com.applovin.impl.sdk.utils.JsonUtils;
import com.applovin.impl.sdk.utils.StringUtils;
import com.applovin.impl.sj;
import com.applovin.impl.tl;
import com.applovin.impl.tp;
import com.applovin.impl.yp;
import com.applovin.impl.z3;
import com.applovin.impl.zq;
import com.applovin.sdk.AppLovinSdkUtils;
import com.iab.omid.library.applovin.adsession.VerificationScriptResource;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import org.json.JSONArray;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public class AppLovinNativeAdImpl extends AppLovinAdBase implements AppLovinNativeAd, View.OnClickListener, AppLovinTouchToClickListener.OnClickListener {
private static final String AD_RESPONSE_TYPE_APPLOVIN = "applovin";
private static final String AD_RESPONSE_TYPE_ORTB = "ortb";
private static final String AD_RESPONSE_TYPE_UNDEFINED = "undefined";
private static final String DEFAULT_APPLOVIN_PRIVACY_URL = "https://www.applovin.com/privacy/";
private static final float MINIMUM_STARS_TO_RENDER = 3.0f;
private static final String TAG = "AppLovinNativeAd";
private static final int VIEWABLE_MRC100_PERCENTAGE = 100;
private static final int VIEWABLE_MRC50_PERCENTAGE = 50;
private static final int VIEWABLE_MRC_REQUIRED_SECONDS = 1;
private static final int VIEWABLE_VIDEO_MRC_REQUIRED_SECONDS = 2;
private final pg adEventTracker;
private final String advertiser;
private final String body;
private final String callToAction;
private final Uri clickDestinationBackupUri;
private final Uri clickDestinationUri;
private final List<e> clickTrackingRequests;
private final List<String> clickTrackingUrls;
private AppLovinNativeAdEventListener eventListener;
private Uri iconUri;
private final List<e> impressionRequests;
private final AtomicBoolean impressionTracked;
private final List<String> jsTrackers;
private Uri mainImageUri;
private AppLovinMediaView mediaView;
private ViewGroup nativeAdView;
private final b onAttachStateChangeHandler;
private AppLovinOptionsView optionsView;
private Uri privacyDestinationUri;
private Uri privacyIconUri;
private final List<View> registeredViews;
private final Double starRating;
private final String tag;
private final String title;
private final aq vastAd;
@Nullable
private View videoView;
private final c viewableMRC100Callback;
private br viewableMRC100Tracker;
private final c viewableMRC50Callback;
private br viewableMRC50Tracker;
@Nullable
private c viewableVideoMRC50Callback;
@Nullable
private br viewableVideoMRC50Tracker;
public class a implements ArrayService.DirectDownloadListener {
final /* synthetic */ Uri a;
final /* synthetic */ Uri b;
final /* synthetic */ Context c;
public a(Uri uri, Uri uri2, Context context) {
this.a = uri;
this.b = uri2;
this.c = context;
}
@Override // com.applovin.impl.sdk.array.ArrayService.DirectDownloadListener
public void onAppDetailsDismissed() {
}
@Override // com.applovin.impl.sdk.array.ArrayService.DirectDownloadListener
public void onAppDetailsDisplayed() {
}
@Override // com.applovin.impl.sdk.array.ArrayService.DirectDownloadListener
public void onFailure() {
AppLovinNativeAdImpl.this.launchUri(this.a, this.b, this.c);
}
}
public static class b implements View.OnAttachStateChangeListener {
private final AppLovinNativeAdImpl a;
public b(AppLovinNativeAdImpl appLovinNativeAdImpl) {
this.a = appLovinNativeAdImpl;
}
public AppLovinNativeAdImpl a() {
return this.a;
}
public boolean a(Object obj) {
return obj instanceof b;
}
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof b)) {
return false;
}
b bVar = (b) obj;
if (!bVar.a(this)) {
return false;
}
AppLovinNativeAdImpl a = a();
AppLovinNativeAdImpl a2 = bVar.a();
return a != null ? a.equals(a2) : a2 == null;
}
public int hashCode() {
AppLovinNativeAdImpl a = a();
return (a == null ? 43 : a.hashCode()) + 59;
}
@Override // android.view.View.OnAttachStateChangeListener
public void onViewAttachedToWindow(View view) {
this.a.maybeHandleOnAttachedToWindow(view);
}
@Override // android.view.View.OnAttachStateChangeListener
public void onViewDetachedFromWindow(View view) {
}
public String toString() {
return "AppLovinNativeAdImpl.OnAttachStateChangeHandler(ad=" + a() + ")";
}
}
public class c implements br.a {
private final List a;
public c(List list) {
this.a = list;
}
public List a() {
return this.a;
}
public boolean a(Object obj) {
return obj instanceof c;
}
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof c)) {
return false;
}
c cVar = (c) obj;
if (!cVar.a(this)) {
return false;
}
List a = a();
List a2 = cVar.a();
return a != null ? a.equals(a2) : a2 == null;
}
public int hashCode() {
List a = a();
return (a == null ? 43 : a.hashCode()) + 59;
}
@Override // com.applovin.impl.br.a
public void onLogVisibilityImpression() {
Iterator it = this.a.iterator();
while (it.hasNext()) {
((AppLovinAdBase) AppLovinNativeAdImpl.this).sdk.Y().dispatchPostbackRequest((e) it.next(), null);
}
}
public String toString() {
return "AppLovinNativeAdImpl.VisibilityCallback(requests=" + a() + ")";
}
}
public /* synthetic */ AppLovinNativeAdImpl(Builder builder, a aVar) {
this(builder);
}
private List<String> getPrivacySandboxClickAttributionUrls() {
return getStringListFromAdObject("privacy_sandbox_click_attribution_urls", Collections.emptyList());
}
private List<String> getPrivacySandboxImpressionAttributionUrls() {
return getStringListFromAdObject("privacy_sandbox_impression_attribution_urls", Collections.emptyList());
}
private boolean isDspAd() {
return AD_RESPONSE_TYPE_ORTB.equalsIgnoreCase(getType());
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ List lambda$getOpenMeasurementVerificationScriptResources$2(JSONArray jSONArray) {
if (jSONArray == null) {
return Collections.emptyList();
}
ArrayList arrayList = new ArrayList();
for (int i = 0; i < jSONArray.length(); i++) {
JSONObject jSONObject = JsonUtils.getJSONObject(jSONArray, i, (JSONObject) null);
try {
URL url = new URL(JsonUtils.getString(jSONObject, "url", null));
String string = JsonUtils.getString(jSONObject, "vendor_key", null);
String string2 = JsonUtils.getString(jSONObject, "parameters", null);
if (StringUtils.isValidString(string) && StringUtils.isValidString(string2)) {
arrayList.add(VerificationScriptResource.createVerificationScriptResourceWithParameters(string, url, string2));
} else {
arrayList.add(VerificationScriptResource.createVerificationScriptResourceWithoutParameters(url));
}
} catch (Throwable th) {
this.sdk.J();
if (n.a()) {
this.sdk.J().a(this.tag, "Failed to parse OMID verification script resource", th);
}
}
}
return arrayList;
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void lambda$unregisterViewsForInteraction$0() {
for (View view : this.registeredViews) {
view.setOnTouchListener(null);
view.setOnClickListener(null);
}
this.sdk.J();
if (n.a()) {
this.sdk.J().a(this.tag, "Unregistered views: " + this.registeredViews);
}
this.registeredViews.clear();
br brVar = this.viewableMRC50Tracker;
if (brVar != null) {
brVar.b();
}
br brVar2 = this.viewableMRC100Tracker;
if (brVar2 != null) {
brVar2.b();
}
br brVar3 = this.viewableVideoMRC50Tracker;
if (brVar3 != null) {
brVar3.b();
}
ViewGroup viewGroup = this.nativeAdView;
if (viewGroup != null) {
viewGroup.removeOnAttachStateChangeListener(this.onAttachStateChangeHandler);
this.nativeAdView = null;
}
AppLovinMediaView appLovinMediaView = this.mediaView;
if (appLovinMediaView != null) {
appLovinMediaView.destroy();
}
AppLovinOptionsView appLovinOptionsView = this.optionsView;
if (appLovinOptionsView != null) {
appLovinOptionsView.destroy();
}
}
/* JADX INFO: Access modifiers changed from: private */
public void launchUri(Uri uri, @Nullable Uri uri2, Context context) {
if (tp.a(uri, context, this.sdk)) {
this.sdk.J();
if (n.a()) {
this.sdk.J().a(this.tag, "Opening URL: " + uri);
return;
}
return;
}
if (tp.a(uri2, context, this.sdk)) {
this.sdk.J();
if (n.a()) {
this.sdk.J().a(this.tag, "Opening backup URL: " + uri2);
}
}
}
/* JADX INFO: Access modifiers changed from: private */
public void maybeHandleOnAttachedToWindow(View view) {
if (this.impressionTracked.compareAndSet(false, true)) {
br brVar = new br(this.nativeAdView, this.sdk, this.viewableMRC50Callback);
this.viewableMRC50Tracker = brVar;
TimeUnit timeUnit = TimeUnit.SECONDS;
brVar.a(0, 50.0f, 50.0f, timeUnit.toMillis(1L), this.nativeAdView);
br brVar2 = new br(this.nativeAdView, this.sdk, this.viewableMRC100Callback);
this.viewableMRC100Tracker = brVar2;
brVar2.a(0, 100.0f, 100.0f, timeUnit.toMillis(1L), this.nativeAdView);
aq aqVar = this.vastAd;
if (aqVar != null && aqVar.hasVideoUrl()) {
br brVar3 = new br(this.nativeAdView, this.sdk, this.viewableVideoMRC50Callback);
this.viewableVideoMRC50Tracker = brVar3;
brVar3.a(0, 50.0f, 50.0f, timeUnit.toMillis(2L), this.videoView);
}
List<String> list = this.jsTrackers;
if (list != null) {
Iterator<String> it = list.iterator();
while (it.hasNext()) {
this.sdk.r0().b(it.next());
}
}
Iterator<e> it2 = this.impressionRequests.iterator();
while (it2.hasNext()) {
this.sdk.Y().dispatchPostbackRequest(it2.next(), null);
}
this.adEventTracker.a(view);
this.adEventTracker.g();
if (this.sdk.Z() != null) {
this.sdk.Z().b(getPrivacySandboxImpressionAttributionUrls());
}
}
}
@Override // com.applovin.impl.sdk.nativeAd.AppLovinNativeAd
public void destroy() {
unregisterViewsForInteraction();
this.eventListener = null;
this.adEventTracker.f();
}
@Override // com.applovin.impl.sdk.AppLovinAdBase, com.applovin.impl.lg
public pg getAdEventTracker() {
return this.adEventTracker;
}
@Override // com.applovin.impl.sdk.AppLovinAdBase
public long getAdIdNumber() {
return getLongFromAdObject("ad_id", -1L);
}
@Override // com.applovin.impl.sdk.nativeAd.AppLovinNativeAd
public String getAdvertiser() {
return this.advertiser;
}
@Override // com.applovin.impl.sdk.nativeAd.AppLovinNativeAd
public String getBody() {
return this.body;
}
@Nullable
public String getCachePrefix() {
return getStringFromAdObject("cache_prefix", null);
}
@Override // com.applovin.impl.sdk.nativeAd.AppLovinNativeAd
public String getCallToAction() {
return this.callToAction;
}
@Override // com.applovin.impl.sdk.array.ArrayDirectDownloadAd
@Nullable
public String getDirectDownloadToken() {
return getStringFromAdObject("ah_dd_token", null);
}
@Override // com.applovin.impl.sdk.nativeAd.AppLovinNativeAd
public Uri getIconUri() {
return this.iconUri;
}
public Uri getMainImageUri() {
return this.mainImageUri;
}
@Override // com.applovin.impl.sdk.nativeAd.AppLovinNativeAd
public AppLovinMediaView getMediaView() {
return this.mediaView;
}
@Override // com.applovin.impl.sdk.AppLovinAdBase, com.applovin.impl.lg
@Nullable
public String getOpenMeasurementContentUrl() {
return getStringFromAdObject("omid_content_url", null);
}
@Override // com.applovin.impl.sdk.AppLovinAdBase, com.applovin.impl.lg
public String getOpenMeasurementCustomReferenceData() {
return getStringFromAdObject("omid_custom_ref_data", "");
}
@Override // com.applovin.impl.sdk.AppLovinAdBase, com.applovin.impl.lg
public List<VerificationScriptResource> getOpenMeasurementVerificationScriptResources() {
List<VerificationScriptResource> list;
if (this.sdk.W().e()) {
return Collections.singletonList(VerificationScriptResource.createVerificationScriptResourceWithParameters(rg.c(), rg.b(), rg.a()));
}
final Function function = new Function() { // from class: com.applovin.impl.sdk.nativeAd.AppLovinNativeAdImpl$$ExternalSyntheticLambda0
@Override // androidx.arch.core.util.Function
public final Object apply(Object obj) {
List lambda$getOpenMeasurementVerificationScriptResources$2;
lambda$getOpenMeasurementVerificationScriptResources$2 = AppLovinNativeAdImpl.this.lambda$getOpenMeasurementVerificationScriptResources$2((JSONArray) obj);
return lambda$getOpenMeasurementVerificationScriptResources$2;
}
};
tl tlVar = this.synchronizedAdObject;
if (tlVar != null) {
return (List) tlVar.a(new Function() { // from class: com.applovin.impl.sdk.nativeAd.AppLovinNativeAdImpl$$ExternalSyntheticLambda1
@Override // androidx.arch.core.util.Function
public final Object apply(Object obj) {
List lambda$getOpenMeasurementVerificationScriptResources$3;
lambda$getOpenMeasurementVerificationScriptResources$3 = AppLovinNativeAdImpl.lambda$getOpenMeasurementVerificationScriptResources$3(Function.this, (tl) obj);
return lambda$getOpenMeasurementVerificationScriptResources$3;
}
});
}
synchronized (this.adObjectLock) {
list = (List) function.apply(getJsonArrayFromAdObject("omid_verification_script_resources", null));
}
return list;
}
@Override // com.applovin.impl.sdk.nativeAd.AppLovinNativeAd
public AppLovinOptionsView getOptionsView() {
return this.optionsView;
}
public Uri getPrivacyDestinationUri() {
return this.privacyDestinationUri;
}
public Uri getPrivacyIconUri() {
return this.privacyIconUri;
}
@Override // com.applovin.impl.sdk.nativeAd.AppLovinNativeAd
public Double getStarRating() {
return this.starRating;
}
@Override // com.applovin.impl.sdk.nativeAd.AppLovinNativeAd
public String getTitle() {
return this.title;
}
public String getType() {
return getStringFromAdObject("type", "undefined");
}
public aq getVastAd() {
return this.vastAd;
}
public void handleNativeAdClick(Uri uri, @Nullable Uri uri2, MotionEvent motionEvent, Context context) {
if (this.sdk.Z() != null) {
this.sdk.Z().b(getPrivacySandboxClickAttributionUrls(), motionEvent);
}
handleNativeAdClick(uri, uri2, context);
}
@Override // com.applovin.impl.sdk.array.ArrayDirectDownloadAd
public boolean isDirectDownloadEnabled() {
return StringUtils.isValidString(getDirectDownloadToken());
}
@Override // com.applovin.impl.sdk.AppLovinAdBase, com.applovin.impl.lg
public boolean isOpenMeasurementEnabled() {
if (this.sdk.W().e()) {
return true;
}
return getBooleanFromAdObject("omsdk_enabled", Boolean.FALSE);
}
@Override // android.view.View.OnClickListener
public void onClick(View view) {
Context context;
this.sdk.J();
if (n.a()) {
this.sdk.J().a(this.tag, "Handle view clicked");
}
this.sdk.i().maybeSubmitPersistentPostbacks(getDirectClickTrackingPostbacks());
if (((Boolean) this.sdk.a(sj.F)).booleanValue()) {
context = zq.a(this.nativeAdView, this.sdk);
if (context == null) {
context = view.getContext();
}
} else {
context = view.getContext();
}
handleNativeAdClick(this.clickDestinationUri, this.clickDestinationBackupUri, context);
}
public void setEventListener(AppLovinNativeAdEventListener appLovinNativeAdEventListener) {
this.eventListener = appLovinNativeAdEventListener;
}
public void setIconUri(Uri uri) {
this.iconUri = uri;
}
public void setMainImageUri(Uri uri) {
this.mainImageUri = uri;
}
public void setPrivacyIconUri(Uri uri) {
this.privacyIconUri = uri;
}
public void setUpNativeAdViewComponents() {
aq aqVar = this.vastAd;
if (aqVar == null || !aqVar.hasVideoUrl()) {
this.mediaView = new AppLovinMediaView(this, this.sdk, j.l());
} else {
try {
this.mediaView = new AppLovinVastMediaView(this, this.sdk, j.l());
} catch (Throwable th) {
this.sdk.J();
if (n.a()) {
this.sdk.J().d(this.tag, "Failed to create ExoPlayer VAST media view. Falling back to static image for media view.", th);
}
this.sdk.E().a(TAG, "createExoPlayerVASTMediaView", th);
this.mediaView = new AppLovinMediaView(this, this.sdk, j.l());
}
}
if (this.privacyDestinationUri != null) {
this.optionsView = new AppLovinOptionsView(this, this.sdk, j.l());
return;
}
this.sdk.J();
if (n.a()) {
this.sdk.J().a(this.tag, "Privacy icon will not render because no native ad privacy URL is provided.");
}
}
public void setVideoView(@Nullable View view) {
this.videoView = view;
}
@NonNull
public String toString() {
return "AppLovinNativeAd{adIdNumber=" + getAdIdNumber() + " - " + getTitle() + "}";
}
@Override // com.applovin.impl.sdk.nativeAd.AppLovinNativeAd
public void unregisterViewsForInteraction() {
AppLovinSdkUtils.runOnUiThread(new Runnable() { // from class: com.applovin.impl.sdk.nativeAd.AppLovinNativeAdImpl$$ExternalSyntheticLambda2
@Override // java.lang.Runnable
public final void run() {
AppLovinNativeAdImpl.this.lambda$unregisterViewsForInteraction$0();
}
});
}
private AppLovinNativeAdImpl(Builder builder) {
super(builder.adObject, builder.fullResponse, builder.sdk);
this.impressionTracked = new AtomicBoolean();
this.registeredViews = new ArrayList();
this.onAttachStateChangeHandler = new b(this);
this.adEventTracker = new pg(this);
this.title = builder.title;
this.advertiser = builder.advertiser;
this.body = builder.body;
this.callToAction = builder.callToAction;
this.iconUri = builder.iconUri;
this.mainImageUri = builder.mainImageUri;
this.privacyIconUri = builder.privacyIconUri;
aq aqVar = builder.vastAd;
this.vastAd = aqVar;
this.clickDestinationUri = builder.clickDestinationUri;
this.clickDestinationBackupUri = builder.clickDestinationBackupUri;
this.clickTrackingUrls = builder.clickTrackingUrls;
this.jsTrackers = builder.jsTrackers;
this.clickTrackingRequests = builder.clickTrackingRequests;
this.impressionRequests = builder.impressionRequests;
Double d = builder.starRating;
this.starRating = (d == null || d.doubleValue() < 3.0d) ? null : d;
if (builder.privacyDestinationUri != null) {
this.privacyDestinationUri = builder.privacyDestinationUri;
} else if (!isDspAd() || getSdk().l0().c()) {
this.privacyDestinationUri = Uri.parse(DEFAULT_APPLOVIN_PRIVACY_URL);
}
this.viewableMRC50Callback = new c(builder.viewableMRC50Requests);
this.viewableMRC100Callback = new c(builder.viewableMRC100Requests);
if (aqVar != null && aqVar.hasVideoUrl()) {
this.viewableVideoMRC50Callback = new c(builder.viewableVideo50Requests);
}
this.tag = "AppLovinNativeAd:" + getAdIdNumber();
}
private List<s> getDirectClickTrackingPostbacks() {
List<s> a2;
tl tlVar = this.synchronizedAdObject;
if (tlVar != null) {
return (List) tlVar.a(new Function() { // from class: com.applovin.impl.sdk.nativeAd.AppLovinNativeAdImpl$$ExternalSyntheticLambda3
@Override // androidx.arch.core.util.Function
public final Object apply(Object obj) {
List lambda$getDirectClickTrackingPostbacks$1;
lambda$getDirectClickTrackingPostbacks$1 = AppLovinNativeAdImpl.this.lambda$getDirectClickTrackingPostbacks$1((tl) obj);
return lambda$getDirectClickTrackingPostbacks$1;
}
});
}
synchronized (this.adObjectLock) {
a2 = yp.a(getJsonObjectFromAdObject("click_tracking_urls", new JSONObject()), getClCode(), getStringFromAdObject("click_tracking_url", null), this.sdk);
}
return a2;
}
@Override // com.applovin.impl.sdk.array.ArrayDirectDownloadAd
public Bundle getDirectDownloadParameters() {
tl tlVar = this.synchronizedAdObject;
if (tlVar != null) {
return (Bundle) tlVar.a(new Function() { // from class: com.applovin.impl.sdk.nativeAd.AppLovinNativeAdImpl$$ExternalSyntheticLambda4
@Override // androidx.arch.core.util.Function
public final Object apply(Object obj) {
Bundle lambda$getDirectDownloadParameters$4;
lambda$getDirectDownloadParameters$4 = AppLovinNativeAdImpl.lambda$getDirectDownloadParameters$4((tl) obj);
return lambda$getDirectDownloadParameters$4;
}
});
}
return JsonUtils.toBundle(getJsonObjectFromAdObject("ah_parameters", null));
}
@Override // com.applovin.impl.sdk.nativeAd.AppLovinNativeAd
public void registerViewsForInteraction(List<View> list, ViewGroup viewGroup) {
this.nativeAdView = viewGroup;
if (z3.e() && this.nativeAdView.isAttachedToWindow()) {
maybeHandleOnAttachedToWindow(this.nativeAdView);
} else if (!z3.e() && this.nativeAdView.getParent() != null) {
maybeHandleOnAttachedToWindow(this.nativeAdView);
} else {
this.nativeAdView.addOnAttachStateChangeListener(this.onAttachStateChangeHandler);
}
this.sdk.J();
if (n.a()) {
this.sdk.J().a(this.tag, "Registered ad view for impressions: " + this.nativeAdView);
}
if (this.clickDestinationUri == null && this.clickDestinationBackupUri == null) {
this.sdk.J();
if (n.a()) {
this.sdk.J().a(this.tag, "Skipping click registration - no click URLs provided");
return;
}
return;
}
for (View view : list) {
if (view.hasOnClickListeners()) {
this.sdk.J();
if (n.a()) {
this.sdk.J().k(this.tag, "View has an onClickListener already - " + view);
}
}
if (!view.isClickable()) {
this.sdk.J();
if (n.a()) {
this.sdk.J().k(this.tag, "View is not clickable - " + view);
}
}
if (!view.isEnabled()) {
this.sdk.J();
if (n.a()) {
this.sdk.J().b(this.tag, "View is not enabled - " + view);
}
}
if (view instanceof Button) {
this.sdk.J();
if (n.a()) {
this.sdk.J().a(this.tag, "Registering click for button: " + view);
}
} else {
this.sdk.J();
if (n.a()) {
this.sdk.J().a(this.tag, "Registering click for view: " + view);
}
}
if (((Boolean) this.sdk.a(sj.Y2)).booleanValue()) {
view.setOnTouchListener(new AppLovinTouchToClickListener(this.sdk, sj.G0, viewGroup.getContext(), this));
} else {
view.setOnClickListener(this);
}
this.registeredViews.add(view);
}
this.sdk.J();
if (n.a()) {
this.sdk.J().a(this.tag, "Registered views: " + this.registeredViews);
}
}
private void handleNativeAdClick(Uri uri, @Nullable Uri uri2, Context context) {
if (this.clickTrackingRequests.size() > 0) {
Iterator<e> it = this.clickTrackingRequests.iterator();
while (it.hasNext()) {
this.sdk.Y().dispatchPostbackRequest(it.next(), null);
}
} else {
Iterator<String> it2 = this.clickTrackingUrls.iterator();
while (it2.hasNext()) {
this.sdk.Y().dispatchPostbackAsync(it2.next(), null);
}
}
gc.b(this.eventListener, this);
if (isDirectDownloadEnabled()) {
this.sdk.m().startDirectInstallOrDownloadProcess(this, null, new a(uri, uri2, context));
} else {
launchUri(uri, uri2, context);
}
}
@Override // com.applovin.impl.adview.AppLovinTouchToClickListener.OnClickListener
public void onClick(View view, MotionEvent motionEvent) {
Context context;
this.sdk.J();
if (n.a()) {
this.sdk.J().a(this.tag, "Handle view clicked");
}
this.sdk.i().maybeSubmitPersistentPostbacks(getDirectClickTrackingPostbacks());
if (((Boolean) this.sdk.a(sj.F)).booleanValue()) {
context = zq.a(this.nativeAdView, this.sdk);
if (context == null) {
context = view.getContext();
}
} else {
context = view.getContext();
}
handleNativeAdClick(this.clickDestinationUri, this.clickDestinationBackupUri, motionEvent, context);
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ List lambda$getDirectClickTrackingPostbacks$1(tl tlVar) {
return yp.a(tlVar.a("click_tracking_urls", new JSONObject()), getClCode(), tlVar.a("click_tracking_url", (String) null), this.sdk);
}
/* JADX INFO: Access modifiers changed from: private */
public static /* synthetic */ List lambda$getOpenMeasurementVerificationScriptResources$3(Function function, tl tlVar) {
return (List) function.apply(tlVar.a("omid_verification_script_resources", (JSONArray) null));
}
/* JADX INFO: Access modifiers changed from: private */
public static /* synthetic */ Bundle lambda$getDirectDownloadParameters$4(tl tlVar) {
return JsonUtils.toBundle(tlVar.a("ah_parameters", (JSONObject) null));
}
public static class Builder {
private final JSONObject adObject;
private String advertiser;
private String body;
private String callToAction;
private Uri clickDestinationBackupUri;
private Uri clickDestinationUri;
private List<e> clickTrackingRequests;
private List<String> clickTrackingUrls;
private final JSONObject fullResponse;
private Uri iconUri;
private List<e> impressionRequests;
private List<String> jsTrackers;
private Uri mainImageUri;
private Uri privacyDestinationUri;
private Uri privacyIconUri;
private final j sdk;
private Double starRating;
private String title;
private aq vastAd;
private List<e> viewableMRC100Requests;
private List<e> viewableMRC50Requests;
private List<e> viewableVideo50Requests;
public Builder(JSONObject jSONObject, JSONObject jSONObject2, j jVar) {
this.adObject = jSONObject;
this.fullResponse = jSONObject2;
this.sdk = jVar;
}
public AppLovinNativeAdImpl build() {
return new AppLovinNativeAdImpl(this, null);
}
public Builder setAdvertiser(String str) {
this.advertiser = str;
return this;
}
public Builder setBody(String str) {
this.body = str;
return this;
}
public Builder setCallToAction(String str) {
this.callToAction = str;
return this;
}
public Builder setClickDestinationBackupUri(Uri uri) {
this.clickDestinationBackupUri = uri;
return this;
}
public Builder setClickDestinationUri(Uri uri) {
this.clickDestinationUri = uri;
return this;
}
public Builder setClickTrackingRequests(List<e> list) {
this.clickTrackingRequests = list;
return this;
}
public Builder setClickTrackingUrls(List<String> list) {
this.clickTrackingUrls = list;
return this;
}
public Builder setIconUri(Uri uri) {
this.iconUri = uri;
return this;
}
public Builder setImpressionRequests(List<e> list) {
this.impressionRequests = list;
return this;
}
public Builder setJsTrackers(List<String> list) {
this.jsTrackers = list;
return this;
}
public Builder setMainImageUri(Uri uri) {
this.mainImageUri = uri;
return this;
}
public Builder setPrivacyDestinationUri(Uri uri) {
this.privacyDestinationUri = uri;
return this;
}
public Builder setPrivacyIconUri(Uri uri) {
this.privacyIconUri = uri;
return this;
}
public Builder setStarRating(Double d) {
this.starRating = d;
return this;
}
public Builder setTitle(String str) {
this.title = str;
return this;
}
public Builder setVastAd(aq aqVar) {
this.vastAd = aqVar;
return this;
}
public Builder setViewableMRC100Requests(List<e> list) {
this.viewableMRC100Requests = list;
return this;
}
public Builder setViewableMRC50Requests(List<e> list) {
this.viewableMRC50Requests = list;
return this;
}
public Builder setViewableVideo50Requests(List<e> list) {
this.viewableVideo50Requests = list;
return this;
}
}
}

View File

@@ -0,0 +1,10 @@
package com.applovin.impl.sdk.nativeAd;
import com.applovin.impl.sdk.AppLovinError;
/* loaded from: classes2.dex */
public interface AppLovinNativeAdLoadListener {
void onNativeAdLoadFailed(AppLovinError appLovinError);
void onNativeAdLoaded(AppLovinNativeAd appLovinNativeAd);
}

View File

@@ -0,0 +1,73 @@
package com.applovin.impl.sdk.nativeAd;
import android.text.TextUtils;
import com.applovin.impl.e4;
import com.applovin.impl.gc;
import com.applovin.impl.nm;
import com.applovin.impl.sdk.AppLovinError;
import com.applovin.impl.sdk.j;
import com.applovin.impl.sdk.n;
import com.applovin.impl.sdk.utils.JsonUtils;
import com.applovin.impl.tm;
import com.applovin.impl.w;
import com.applovin.impl.yl;
import com.applovin.impl.ym;
import org.json.JSONArray;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public class AppLovinNativeAdService {
private static final String TAG = "AppLovinNativeAdService";
private final n logger;
private final j sdk;
public AppLovinNativeAdService(j jVar) {
this.sdk = jVar;
this.logger = jVar.J();
}
public void loadNextAdForAdToken(String str, AppLovinNativeAdLoadListener appLovinNativeAdLoadListener) {
String trim = str != null ? str.trim() : null;
if (TextUtils.isEmpty(trim)) {
n.h(TAG, "Empty ad token");
gc.b(appLovinNativeAdLoadListener, new AppLovinError(-8, "Empty ad token"));
return;
}
w wVar = new w(trim, this.sdk);
if (wVar.c() == w.a.REGULAR) {
if (n.a()) {
this.logger.a(TAG, "Loading next ad for token: " + wVar);
}
this.sdk.j0().a((yl) new nm(wVar, appLovinNativeAdLoadListener, this.sdk), tm.b.CORE);
return;
}
if (wVar.c() != w.a.AD_RESPONSE_JSON) {
AppLovinError appLovinError = new AppLovinError(-8, "Invalid token type");
n.h(TAG, "Invalid token type");
gc.b(appLovinNativeAdLoadListener, appLovinError);
return;
}
JSONObject a = wVar.a();
if (a == null) {
String str2 = "Unable to retrieve ad response JSON from token: " + wVar.b();
AppLovinError appLovinError2 = new AppLovinError(-8, str2);
n.h(TAG, str2);
gc.b(appLovinNativeAdLoadListener, appLovinError2);
return;
}
e4.c(a, this.sdk);
e4.b(a, this.sdk);
e4.a(a, this.sdk);
if (JsonUtils.getJSONArray(a, com.mbridge.msdk.foundation.entity.b.JSON_KEY_ADS, new JSONArray()).length() > 0) {
if (n.a()) {
this.logger.a(TAG, "Rendering ad for token: " + wVar);
}
this.sdk.j0().a((yl) new ym(a, appLovinNativeAdLoadListener, this.sdk), tm.b.CORE);
return;
}
if (n.a()) {
this.logger.b(TAG, "No ad returned from the server for token: " + wVar);
}
gc.b(appLovinNativeAdLoadListener, AppLovinError.NO_FILL);
}
}

View File

@@ -0,0 +1,45 @@
package com.applovin.impl.sdk.nativeAd;
import android.annotation.SuppressLint;
import android.content.Context;
import android.net.Uri;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
import com.applovin.impl.sdk.j;
import com.applovin.impl.sdk.utils.ImageViewUtils;
import com.applovin.impl.tp;
import com.applovin.sdk.R;
@SuppressLint({"ViewConstructor"})
/* loaded from: classes2.dex */
public class AppLovinOptionsView extends FrameLayout implements View.OnClickListener {
private final Uri privacyDestinationUri;
private final j sdk;
public AppLovinOptionsView(AppLovinNativeAdImpl appLovinNativeAdImpl, j jVar, Context context) {
super(context);
this.sdk = jVar;
this.privacyDestinationUri = appLovinNativeAdImpl.getPrivacyDestinationUri();
ImageView imageView = new ImageView(getContext());
imageView.setLayoutParams(new FrameLayout.LayoutParams(-1, -1));
Uri privacyIconUri = appLovinNativeAdImpl.getPrivacyIconUri();
if (privacyIconUri != null) {
ImageViewUtils.setImageUri(imageView, privacyIconUri, jVar);
} else {
imageView.setImageResource(R.drawable.applovin_ic_privacy_icon_layered_list);
}
addView(imageView);
setOnClickListener(this);
}
public void destroy() {
setOnClickListener(null);
removeAllViews();
}
@Override // android.view.View.OnClickListener
public void onClick(View view) {
tp.a(this.privacyDestinationUri, j.l(), this.sdk);
}
}

View File

@@ -0,0 +1,137 @@
package com.applovin.impl.sdk.nativeAd;
import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.PointF;
import android.graphics.RectF;
import android.view.View;
import com.applovin.impl.t3;
import com.applovin.sdk.AppLovinSdkUtils;
import com.applovin.sdk.R;
import java.util.ArrayList;
import java.util.List;
@SuppressLint({"ViewConstructor"})
/* loaded from: classes2.dex */
public class AppLovinStarRatingView extends View {
private static final int DEFAULT_PADDING_DP = 2;
private static final float DEFAULT_STROKE_WIDTH = 0.5f;
private static final int DEFAULT_TOTAL_NUMBER_OF_STARS = 5;
private static final float INTERNAL_ANGLE_OF_PENTAGON_RADIANS = 1.8849556f;
private static final float SUM_OF_CENTRAL_ANGLES_IN_CIRCLE_RADIANS = 6.2831855f;
private static final float TWELVE_OCLOCK_POSITION_RADIANS = 4.712389f;
private static final Paint emptyStarPaint = new Paint(1);
private static final Paint filledStarPaint = new Paint(1);
private final float interStarsSpacingDp;
private final float paddingDp;
private float sideLength;
private final Double starRating;
public AppLovinStarRatingView(Double d, Context context) {
super(context);
this.starRating = d;
this.paddingDp = AppLovinSdkUtils.dpToPx(context, 2);
this.interStarsSpacingDp = AppLovinSdkUtils.dpToPx(context, 2);
setupPaints();
}
private void drawEmptyStars(Canvas canvas, Path path) {
canvas.drawPath(path, emptyStarPaint);
}
private void drawFilledStars(Canvas canvas, Path path) {
if (this.starRating.doubleValue() == 0.0d) {
return;
}
float roundUpToNearestHalfInt = ((float) roundUpToNearestHalfInt(this.starRating.doubleValue())) / 5.0f;
float ceil = (float) (this.paddingDp + (Math.ceil(r0 - 1.0f) * this.interStarsSpacingDp));
canvas.clipPath(path);
canvas.drawRect(new RectF(0.0f, 0.0f, ceil + (roundUpToNearestHalfInt * 5.0f * this.sideLength), getHeight()), filledStarPaint);
}
private Path getCombinedPathForAllStarsWithSide(float f) {
PointF pointF = new PointF(0.0f, this.paddingDp);
float f2 = pointF.x + this.paddingDp;
Path path = new Path();
for (int i = 0; i < 5; i++) {
float f3 = pointF.y;
Path starPath = getStarPath(new RectF(f2, f3, f2 + f, f3 + f));
f2 += this.interStarsSpacingDp + f;
path.addPath(starPath);
}
return path;
}
private static float getDistanceBetweenPoints(PointF pointF, PointF pointF2) {
return (float) Math.sqrt(Math.pow(pointF.x - pointF2.x, 2.0d) + Math.pow(pointF.y - pointF2.y, 2.0d));
}
private static PointF getMidpointBetweenPoints(PointF pointF, PointF pointF2) {
return new PointF((float) (pointF.x + ((pointF2.x - pointF.x) * 0.5d)), (float) (pointF.y + ((pointF2.y - pointF.y) * 0.5d)));
}
private Path getStarPath(RectF rectF) {
PointF pointF = new PointF(rectF.centerX(), rectF.centerY());
List<PointF> starPointsOnACircle = getStarPointsOnACircle(pointF, (float) (rectF.width() * 0.5d), TWELVE_OCLOCK_POSITION_RADIANS);
PointF pointF2 = starPointsOnACircle.get(0);
List<PointF> starPointsOnACircle2 = getStarPointsOnACircle(pointF, getDistanceBetweenPoints(pointF, getMidpointBetweenPoints(pointF2, starPointsOnACircle.get(1))) - ((float) (getDistanceBetweenPoints(pointF2, r3) / Math.tan(0.9424778f))), 5.340708f);
Path path = new Path();
path.moveTo(pointF2.x, pointF2.y);
for (int i = 0; i < 5; i++) {
PointF pointF3 = starPointsOnACircle.get(i);
PointF pointF4 = starPointsOnACircle2.get(i);
path.lineTo(pointF3.x, pointF3.y);
path.lineTo(pointF4.x, pointF4.y);
}
path.close();
return path;
}
private List<PointF> getStarPointsOnACircle(PointF pointF, float f, float f2) {
float f3 = SUM_OF_CENTRAL_ANGLES_IN_CIRCLE_RADIANS / 5;
ArrayList arrayList = new ArrayList(5);
for (int i = 0; i < 5; i++) {
double d = f;
double d2 = f2;
arrayList.add(new PointF((float) (pointF.x + (Math.cos(d2) * d)), (float) (pointF.y + (d * Math.sin(d2)))));
f2 += f3;
}
return arrayList;
}
private double getTotalHorizontalSpacing() {
return (this.paddingDp * 2.0f) + (this.interStarsSpacingDp * 4.0f);
}
private double roundUpToNearestHalfInt(double d) {
return Math.ceil(d * 2.0d) / 2.0d;
}
private void setupPaints() {
Paint paint = emptyStarPaint;
paint.setColor(t3.a(R.color.applovin_sdk_starColor, getContext()));
paint.setStyle(Paint.Style.STROKE);
paint.setStrokeWidth(DEFAULT_STROKE_WIDTH);
Paint paint2 = filledStarPaint;
paint2.setColor(t3.a(R.color.applovin_sdk_starColor, getContext()));
paint2.setStyle(Paint.Style.FILL);
}
@Override // android.view.View
public void onDraw(Canvas canvas) {
if (this.starRating == null) {
return;
}
float min = (float) Math.min((getWidth() - getTotalHorizontalSpacing()) / 5.0d, getHeight() - (this.paddingDp * 2.0f));
this.sideLength = min;
if (min <= 0.0f) {
return;
}
Path combinedPathForAllStarsWithSide = getCombinedPathForAllStarsWithSide(min);
drawEmptyStars(canvas, combinedPathForAllStarsWithSide);
drawFilledStars(canvas, combinedPathForAllStarsWithSide);
}
}

View File

@@ -0,0 +1,710 @@
package com.applovin.impl.sdk.nativeAd;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.graphics.drawable.AnimatedVectorDrawable;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.SystemClock;
import android.view.MotionEvent;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import androidx.annotation.Nullable;
import androidx.core.view.ViewCompat;
import com.applovin.communicator.AppLovinCommunicator;
import com.applovin.communicator.AppLovinCommunicatorMessage;
import com.applovin.communicator.AppLovinCommunicatorSubscriber;
import com.applovin.exoplayer2.ui.d;
import com.applovin.impl.adview.AppLovinTouchToClickListener;
import com.applovin.impl.aq;
import com.applovin.impl.be;
import com.applovin.impl.bi;
import com.applovin.impl.ck;
import com.applovin.impl.fq;
import com.applovin.impl.gq;
import com.applovin.impl.kq;
import com.applovin.impl.lq;
import com.applovin.impl.mq;
import com.applovin.impl.nh;
import com.applovin.impl.oq;
import com.applovin.impl.p;
import com.applovin.impl.qh;
import com.applovin.impl.r;
import com.applovin.impl.sdk.j;
import com.applovin.impl.sdk.n;
import com.applovin.impl.sdk.nativeAd.AppLovinVastMediaView;
import com.applovin.impl.sdk.utils.ImageViewUtils;
import com.applovin.impl.sdk.utils.StringUtils;
import com.applovin.impl.sj;
import com.applovin.impl.td;
import com.applovin.impl.tp;
import com.applovin.impl.v4;
import com.applovin.impl.w5;
import com.applovin.impl.xp;
import com.applovin.impl.yp;
import com.applovin.impl.z3;
import com.applovin.impl.zq;
import com.applovin.sdk.AppLovinSdkUtils;
import com.applovin.sdk.R;
import com.mbridge.msdk.foundation.entity.CampaignEx;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
@SuppressLint({"ViewConstructor"})
/* loaded from: classes2.dex */
public class AppLovinVastMediaView extends AppLovinMediaView implements AppLovinCommunicatorSubscriber {
private static final String COUNTDOWN_IDENTIFIER_PROGRESS_TRACKING = "PROGRESS_TRACKING";
private static final long FADE_ANIMATION_DURATION_MILLIS = 250;
private static final String TAG = "AppLovinVastMediaView";
private final AtomicBoolean automaticPauseHandled;
private final AtomicBoolean automaticResumeHandled;
private final Handler countdownHandler;
private final v4 countdownManager;
@Nullable
private ImageView industryIconImageView;
private final AtomicBoolean initialOnAttachedToWindowHandled;
private boolean isVideoMuted;
private boolean isVideoPausedByUser;
private final boolean isVideoStream;
private long lastVideoPositionFromPauseMillis;
private final p lifecycleCallbacksAdapter;
private final AtomicBoolean mediaErrorHandled;
private final ck mediaPlayer;
@Nullable
private ImageView muteButtonImageView;
@Nullable
private ImageView playPauseButtonImageView;
@Nullable
private FrameLayout replayIconContainer;
private int savedVideoPercentViewed;
private long startTimeMillis;
private final aq vastAd;
private long videoDurationMillis;
private final AtomicBoolean videoEndListenerNotified;
private final Set<kq> videoProgressTrackers;
private final com.applovin.exoplayer2.ui.e videoView;
private boolean videoWasCompleted;
@Nullable
private LinearLayout videoWidgetLinearLayout;
private Activity viewActivity;
public class a extends p {
public a() {
}
@Override // com.applovin.impl.p, android.app.Application.ActivityLifecycleCallbacks
public void onActivityPaused(Activity activity) {
if (activity.equals(AppLovinVastMediaView.this.viewActivity)) {
AppLovinVastMediaView.this.maybeHandlePause();
}
}
@Override // com.applovin.impl.p, android.app.Application.ActivityLifecycleCallbacks
public void onActivityResumed(Activity activity) {
if (!activity.equals(AppLovinVastMediaView.this.viewActivity) || AppLovinVastMediaView.this.isVideoPausedByUser) {
return;
}
AppLovinVastMediaView.this.maybeHandleResume();
}
}
public class b implements v4.b {
public b() {
}
@Override // com.applovin.impl.v4.b
public void a() {
long seconds = TimeUnit.MILLISECONDS.toSeconds(AppLovinVastMediaView.this.videoDurationMillis - (AppLovinVastMediaView.this.mediaPlayer.getDuration() - AppLovinVastMediaView.this.mediaPlayer.getCurrentPosition()));
int videoPercentViewed = AppLovinVastMediaView.this.getVideoPercentViewed();
HashSet hashSet = new HashSet();
Iterator it = new HashSet(AppLovinVastMediaView.this.videoProgressTrackers).iterator();
while (it.hasNext()) {
kq kqVar = (kq) it.next();
if (kqVar.a(seconds, videoPercentViewed)) {
hashSet.add(kqVar);
AppLovinVastMediaView.this.videoProgressTrackers.remove(kqVar);
}
}
AppLovinVastMediaView.this.maybeFireTrackers(hashSet);
if (videoPercentViewed >= 25 && videoPercentViewed < 50) {
AppLovinVastMediaView.this.vastAd.getAdEventTracker().x();
return;
}
if (videoPercentViewed >= 50 && videoPercentViewed < 75) {
AppLovinVastMediaView.this.vastAd.getAdEventTracker().y();
} else if (videoPercentViewed >= 75) {
AppLovinVastMediaView.this.vastAd.getAdEventTracker().C();
}
}
@Override // com.applovin.impl.v4.b
public boolean b() {
return !AppLovinVastMediaView.this.videoWasCompleted;
}
}
public class c implements View.OnClickListener {
private c() {
}
@Override // android.view.View.OnClickListener
public void onClick(View view) {
Uri b;
gq p1 = AppLovinVastMediaView.this.vastAd.p1();
if (p1 == null || (b = p1.b()) == null) {
return;
}
n nVar = AppLovinVastMediaView.this.logger;
if (n.a()) {
AppLovinVastMediaView.this.logger.a(AppLovinVastMediaView.TAG, "Industry icon clicked, opening URL: " + b);
}
AppLovinVastMediaView.this.maybeFireTrackers(aq.d.INDUSTRY_ICON_CLICK);
tp.a(b, view.getContext(), AppLovinVastMediaView.this.sdk);
}
public /* synthetic */ c(AppLovinVastMediaView appLovinVastMediaView, a aVar) {
this();
}
}
public class d implements AppLovinTouchToClickListener.OnClickListener {
private final AppLovinNativeAdImpl a;
public d(AppLovinNativeAdImpl appLovinNativeAdImpl) {
this.a = appLovinNativeAdImpl;
}
@Override // com.applovin.impl.adview.AppLovinTouchToClickListener.OnClickListener
public void onClick(View view, MotionEvent motionEvent) {
Uri k0;
AppLovinVastMediaView.this.maybeFireTrackers(aq.d.VIDEO_CLICK);
AppLovinVastMediaView.this.vastAd.getAdEventTracker().v();
if (AppLovinVastMediaView.this.vastAd.H0() && (k0 = AppLovinVastMediaView.this.vastAd.k0()) != null) {
n nVar = AppLovinVastMediaView.this.logger;
if (n.a()) {
AppLovinVastMediaView.this.logger.a(AppLovinVastMediaView.TAG, "Clicking through video");
}
AppLovinVastMediaView.this.sdk.i().maybeSubmitPersistentPostbacks(AppLovinVastMediaView.this.vastAd.a(motionEvent, false));
this.a.handleNativeAdClick(k0, null, motionEvent, (!((Boolean) AppLovinVastMediaView.this.sdk.a(sj.F)).booleanValue() || AppLovinVastMediaView.this.viewActivity == null) ? AppLovinVastMediaView.this.getContext() : AppLovinVastMediaView.this.viewActivity);
}
}
}
public class e implements qh.c, d.e {
private e() {
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void c() {
AppLovinVastMediaView.this.mediaPlayer.a(0L);
}
@Override // com.applovin.impl.qh.c
public void b(int i) {
n nVar = AppLovinVastMediaView.this.logger;
if (n.a()) {
AppLovinVastMediaView.this.logger.a(AppLovinVastMediaView.TAG, "Player state changed to state " + i + " and will play when ready: " + AppLovinVastMediaView.this.mediaPlayer.l());
}
if (i != 3) {
if (i == 4) {
n nVar2 = AppLovinVastMediaView.this.logger;
if (n.a()) {
AppLovinVastMediaView.this.logger.a(AppLovinVastMediaView.TAG, "Video completed");
}
AppLovinVastMediaView.this.videoWasCompleted = true;
AppLovinVastMediaView.this.finishVideo();
if (AppLovinVastMediaView.this.replayIconContainer != null) {
zq.a(AppLovinVastMediaView.this.replayIconContainer, AppLovinVastMediaView.FADE_ANIMATION_DURATION_MILLIS, new Runnable() { // from class: com.applovin.impl.sdk.nativeAd.AppLovinVastMediaView$e$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
AppLovinVastMediaView.e.this.c();
}
});
return;
} else {
AppLovinVastMediaView.this.showMediaImageView();
return;
}
}
return;
}
AppLovinVastMediaView.this.mediaPlayer.a(!AppLovinVastMediaView.this.isVideoMuted ? 1 : 0);
AppLovinVastMediaView appLovinVastMediaView = AppLovinVastMediaView.this;
appLovinVastMediaView.videoDurationMillis = appLovinVastMediaView.mediaPlayer.getDuration();
AppLovinVastMediaView.this.vastAd.getAdEventTracker().b(TimeUnit.MILLISECONDS.toSeconds(AppLovinVastMediaView.this.videoDurationMillis), yp.e(AppLovinVastMediaView.this.sdk));
n nVar3 = AppLovinVastMediaView.this.logger;
if (n.a()) {
AppLovinVastMediaView.this.logger.a(AppLovinVastMediaView.TAG, "MediaPlayer prepared: " + AppLovinVastMediaView.this.mediaPlayer);
}
AppLovinVastMediaView.this.countdownManager.b();
}
@Override // com.applovin.exoplayer2.ui.d.e
public void d(int i) {
if (i == 0) {
AppLovinVastMediaView.this.videoView.c();
}
}
public /* synthetic */ e(AppLovinVastMediaView appLovinVastMediaView, a aVar) {
this();
}
@Override // com.applovin.impl.qh.c
public void a(nh nhVar) {
AppLovinVastMediaView.this.handleMediaError("Video view error (" + yp.a(nhVar) + ")");
}
}
public class f implements View.OnClickListener {
private f() {
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void a() {
AppLovinVastMediaView.this.videoWasCompleted = false;
AppLovinVastMediaView.this.automaticResumeHandled.set(false);
AppLovinVastMediaView.this.sdk.e().a(AppLovinVastMediaView.this.lifecycleCallbacksAdapter);
AppLovinVastMediaView.this.maybeHandleResume();
}
@Override // android.view.View.OnClickListener
public void onClick(View view) {
if (view == AppLovinVastMediaView.this.playPauseButtonImageView) {
if (AppLovinVastMediaView.this.mediaPlayer.isPlaying()) {
AppLovinVastMediaView.this.isVideoPausedByUser = true;
AppLovinVastMediaView.this.maybeHandlePause();
return;
} else {
AppLovinVastMediaView.this.isVideoPausedByUser = false;
AppLovinVastMediaView.this.maybeHandleResume();
return;
}
}
if (view != AppLovinVastMediaView.this.muteButtonImageView) {
if (view == AppLovinVastMediaView.this.replayIconContainer) {
zq.b(AppLovinVastMediaView.this.replayIconContainer, AppLovinVastMediaView.FADE_ANIMATION_DURATION_MILLIS, new Runnable() { // from class: com.applovin.impl.sdk.nativeAd.AppLovinVastMediaView$f$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
AppLovinVastMediaView.f.this.a();
}
});
}
} else {
boolean z = AppLovinVastMediaView.this.isVideoMuted;
boolean z2 = !z;
AppLovinVastMediaView.this.isVideoMuted = z2;
AppLovinVastMediaView.this.mediaPlayer.a(z ? 1.0f : 0.0f);
AppLovinVastMediaView.this.populateMuteImage(z2);
}
}
public /* synthetic */ f(AppLovinVastMediaView appLovinVastMediaView, a aVar) {
this();
}
}
public AppLovinVastMediaView(AppLovinNativeAdImpl appLovinNativeAdImpl, j jVar, Context context) {
super(appLovinNativeAdImpl, jVar, context);
int i;
Handler handler = new Handler(Looper.getMainLooper());
this.countdownHandler = handler;
this.countdownManager = new v4(handler, this.sdk);
this.videoEndListenerNotified = new AtomicBoolean();
this.mediaErrorHandled = new AtomicBoolean();
this.initialOnAttachedToWindowHandled = new AtomicBoolean();
this.automaticPauseHandled = new AtomicBoolean();
this.automaticResumeHandled = new AtomicBoolean();
this.isVideoMuted = true;
this.lastVideoPositionFromPauseMillis = -1L;
HashSet hashSet = new HashSet();
this.videoProgressTrackers = hashSet;
this.lifecycleCallbacksAdapter = new a();
aq vastAd = appLovinNativeAdImpl.getVastAd();
this.vastAd = vastAd;
boolean I0 = vastAd.I0();
this.isVideoStream = I0;
if (I0) {
AppLovinCommunicator.getInstance(context).subscribe(this, "video_caching_failed");
}
a aVar = null;
if (vastAd.v1()) {
this.industryIconImageView = gq.a(vastAd.p1().d(), context, jVar);
int dpToPx = AppLovinSdkUtils.dpToPx(context, ((Integer) jVar.a(sj.a5)).intValue());
this.industryIconImageView.setLayoutParams(new FrameLayout.LayoutParams(dpToPx, dpToPx, ((Integer) jVar.a(sj.c5)).intValue()));
this.industryIconImageView.setOnClickListener(new c(this, aVar));
addView(this.industryIconImageView);
}
if (((Boolean) jVar.a(sj.h5)).booleanValue()) {
LinearLayout linearLayout = new LinearLayout(context);
this.videoWidgetLinearLayout = linearLayout;
linearLayout.setOrientation(0);
this.videoWidgetLinearLayout.setBackgroundResource(R.drawable.applovin_rounded_black_background);
this.videoWidgetLinearLayout.setAlpha(((Float) jVar.a(sj.g5)).floatValue());
ImageView imageView = new ImageView(context);
this.playPauseButtonImageView = imageView;
imageView.setClickable(true);
f fVar = new f(this, aVar);
this.playPauseButtonImageView.setOnClickListener(fVar);
int dpToPx2 = AppLovinSdkUtils.dpToPx(context, ((Integer) jVar.a(sj.e5)).intValue());
this.playPauseButtonImageView.setLayoutParams(new FrameLayout.LayoutParams(dpToPx2, dpToPx2));
populatePlayPauseImage(false);
this.videoWidgetLinearLayout.addView(this.playPauseButtonImageView);
this.muteButtonImageView = new ImageView(context);
if (populateMuteImage(this.isVideoMuted)) {
i = AppLovinSdkUtils.dpToPx(context, ((Integer) jVar.a(sj.d5)).intValue());
this.muteButtonImageView.setClickable(true);
this.muteButtonImageView.setOnClickListener(fVar);
this.muteButtonImageView.setLayoutParams(new FrameLayout.LayoutParams(i, i));
this.videoWidgetLinearLayout.addView(this.muteButtonImageView);
} else {
i = 0;
}
int dpToPx3 = AppLovinSdkUtils.dpToPx(context, ((Integer) jVar.a(sj.f5)).intValue());
this.videoWidgetLinearLayout.setPadding(dpToPx3, dpToPx3, dpToPx3, dpToPx3);
int i2 = dpToPx3 * 2;
this.videoWidgetLinearLayout.setLayoutParams(new FrameLayout.LayoutParams(dpToPx2 + i + i2, Math.max(dpToPx2, i) + i2, 8388691));
addView(this.videoWidgetLinearLayout);
}
if (((Boolean) jVar.a(sj.i5)).booleanValue()) {
FrameLayout frameLayout = new FrameLayout(getContext());
this.replayIconContainer = frameLayout;
frameLayout.setBackgroundColor(ViewCompat.MEASURED_STATE_MASK);
this.replayIconContainer.setLayoutParams(new FrameLayout.LayoutParams(-1, -1));
this.replayIconContainer.setVisibility(4);
this.replayIconContainer.setOnClickListener(new f(this, aVar));
ImageView imageView2 = new ImageView(getContext());
int dpToPx4 = AppLovinSdkUtils.dpToPx(context, ((Integer) jVar.a(sj.j5)).intValue());
imageView2.setLayoutParams(new FrameLayout.LayoutParams(dpToPx4, dpToPx4, 17));
imageView2.setImageResource(R.drawable.applovin_ic_replay_icon);
imageView2.setAdjustViewBounds(true);
imageView2.setMaxHeight(this.replayIconContainer.getHeight());
imageView2.setMaxWidth(this.replayIconContainer.getWidth());
this.replayIconContainer.addView(imageView2);
addView(this.replayIconContainer);
}
ck a2 = new ck.b(getContext()).a();
this.mediaPlayer = a2;
e eVar = new e(this, aVar);
a2.a((qh.c) eVar);
a2.a(0);
com.applovin.exoplayer2.ui.e eVar2 = new com.applovin.exoplayer2.ui.e(getContext());
this.videoView = eVar2;
eVar2.c();
eVar2.setControllerVisibilityListener(eVar);
eVar2.setPlayer(a2);
eVar2.setOnTouchListener(new AppLovinTouchToClickListener(jVar, sj.E0, getContext(), new d(appLovinNativeAdImpl)));
addView(eVar2);
bringChildToFront(this.industryIconImageView);
bringChildToFront(this.videoWidgetLinearLayout);
prepareMediaPlayer();
appLovinNativeAdImpl.setVideoView(eVar2);
hashSet.addAll(vastAd.a(aq.d.VIDEO, lq.a));
}
private void checkCachedAdResourcesImmediately(boolean z) {
if (yp.a(z, this.vastAd, this.sdk, getContext()).isEmpty()) {
return;
}
handleUnavailableCachedResources();
}
/* JADX INFO: Access modifiers changed from: private */
public void finishVideo() {
maybeFireTrackers(aq.d.VIDEO, "close");
maybeHandlePause();
this.sdk.e().b(this.lifecycleCallbacksAdapter);
if (this.videoWasCompleted) {
maybeFireRemainingCompletionTrackers();
this.vastAd.getAdEventTracker().w();
}
if (this.videoEndListenerNotified.compareAndSet(false, true)) {
this.sdk.i().trackVideoEnd(this.vastAd, TimeUnit.MILLISECONDS.toSeconds(SystemClock.elapsedRealtime() - this.startTimeMillis), getVideoPercentViewed(), this.isVideoStream);
}
}
/* JADX INFO: Access modifiers changed from: private */
public int getVideoPercentViewed() {
long currentPosition = this.mediaPlayer.getCurrentPosition();
if (this.videoWasCompleted) {
return 100;
}
return currentPosition > 0 ? (int) ((currentPosition / this.videoDurationMillis) * 100.0f) : this.savedVideoPercentViewed;
}
/* JADX INFO: Access modifiers changed from: private */
public void handleMediaError(String str) {
if (n.a()) {
this.logger.b(TAG, str);
}
if (!StringUtils.containsAtLeastOneSubstring(str, this.sdk.c(sj.l5))) {
maybeFireTrackers(aq.d.ERROR, fq.MEDIA_FILE_ERROR);
this.vastAd.getAdEventTracker().b(str);
} else if (n.a()) {
this.logger.a(TAG, "Not firing trackers for media error: " + str);
}
if (!StringUtils.containsAtLeastOneSubstring(str, this.sdk.c(sj.X2))) {
if (this.mediaErrorHandled.compareAndSet(false, true)) {
this.sdk.E().a("handleVastVideoError", str, this.vastAd);
finishVideo();
showMediaImageView();
return;
}
return;
}
if (n.a()) {
this.logger.a(TAG, "Ignoring media error: " + str);
}
}
private void handleUnavailableCachedResources() {
if (n.a()) {
this.logger.b(TAG, "Video failed due to unavailable resources");
}
finishVideo();
showMediaImageView();
}
private void maybeFireRemainingCompletionTrackers() {
if (getVideoPercentViewed() < this.vastAd.n0() || this.videoProgressTrackers.isEmpty()) {
return;
}
if (n.a()) {
this.logger.k(TAG, "Firing " + this.videoProgressTrackers.size() + " un-fired video progress trackers when video was completed.");
}
maybeFireTrackers(this.videoProgressTrackers);
}
private void maybeHandleOnAttachedToWindow() {
if (this.initialOnAttachedToWindowHandled.compareAndSet(false, true)) {
if (this.industryIconImageView != null && this.vastAd.v1()) {
maybeFireTrackers(aq.d.INDUSTRY_ICON_IMPRESSION);
this.industryIconImageView.setVisibility(0);
}
this.startTimeMillis = SystemClock.elapsedRealtime();
maybeFireTrackers(aq.d.IMPRESSION);
maybeFireTrackers(aq.d.VIDEO, "creativeView");
this.vastAd.getAdEventTracker().g();
this.vastAd.setHasShown(true);
this.sdk.i().trackImpression(this.vastAd);
this.viewActivity = r.a(zq.b(this));
this.sdk.e().a(this.lifecycleCallbacksAdapter);
this.mediaPlayer.a(true);
this.countdownManager.a(COUNTDOWN_IDENTIFIER_PROGRESS_TRACKING, TimeUnit.SECONDS.toMillis(1L), new b());
}
}
/* JADX INFO: Access modifiers changed from: private */
public void maybeHandlePause() {
if (this.automaticPauseHandled.compareAndSet(false, true)) {
maybeFireTrackers(aq.d.VIDEO, CampaignEx.JSON_NATIVE_VIDEO_PAUSE);
this.vastAd.getAdEventTracker().z();
pauseVideo();
populatePlayPauseImage(true);
this.automaticResumeHandled.set(false);
}
}
/* JADX INFO: Access modifiers changed from: private */
public void maybeHandleResume() {
if (this.automaticResumeHandled.compareAndSet(false, true)) {
maybeFireTrackers(aq.d.VIDEO, CampaignEx.JSON_NATIVE_VIDEO_RESUME);
this.vastAd.getAdEventTracker().A();
if (this.lastVideoPositionFromPauseMillis >= 0) {
if (n.a()) {
this.logger.a(TAG, "Resuming video at position " + this.lastVideoPositionFromPauseMillis);
}
this.mediaPlayer.a(true);
this.countdownManager.b();
this.lastVideoPositionFromPauseMillis = -1L;
} else if (n.a()) {
this.logger.a(TAG, "Invalid last video position, isVideoPlaying=" + this.mediaPlayer.isPlaying());
}
populatePlayPauseImage(false);
this.automaticPauseHandled.set(false);
}
}
private void pauseVideo() {
if (n.a()) {
this.logger.a(TAG, "Pausing video");
}
this.savedVideoPercentViewed = getVideoPercentViewed();
this.lastVideoPositionFromPauseMillis = this.mediaPlayer.getCurrentPosition();
this.mediaPlayer.a(false);
this.countdownManager.c();
if (n.a()) {
this.logger.a(TAG, "Paused video at position " + this.lastVideoPositionFromPauseMillis + " ms");
}
}
private void prepareMediaPlayer() {
checkCachedAdResourcesImmediately(!this.isVideoStream);
bi a2 = new bi.b(new w5(getContext(), xp.a(getContext(), "com.applovin.sdk"))).a(td.a(this.vastAd.t0()));
this.mediaPlayer.a(!this.isVideoMuted ? 1 : 0);
this.mediaPlayer.a((be) a2);
this.mediaPlayer.b();
this.mediaPlayer.a(false);
}
/* JADX INFO: Access modifiers changed from: private */
public void showMediaImageView() {
if (this.imageView.getDrawable() == null) {
return;
}
this.imageView.setVisibility(0);
this.videoView.setVisibility(8);
LinearLayout linearLayout = this.videoWidgetLinearLayout;
if (linearLayout != null) {
linearLayout.setVisibility(8);
}
ImageView imageView = this.industryIconImageView;
if (imageView != null) {
imageView.setVisibility(8);
}
}
@Override // com.applovin.impl.sdk.nativeAd.AppLovinMediaView
public void destroy() {
finishVideo();
ImageView imageView = this.industryIconImageView;
if (imageView != null) {
imageView.setOnClickListener(null);
}
ImageView imageView2 = this.playPauseButtonImageView;
if (imageView2 != null) {
imageView2.setOnClickListener(null);
}
ImageView imageView3 = this.muteButtonImageView;
if (imageView3 != null) {
imageView3.setOnClickListener(null);
}
FrameLayout frameLayout = this.replayIconContainer;
if (frameLayout != null) {
frameLayout.setOnClickListener(null);
}
this.videoView.setOnTouchListener(null);
this.viewActivity = null;
this.mediaPlayer.V();
this.vastAd.getAdEventTracker().f();
this.countdownManager.a();
this.countdownHandler.removeCallbacksAndMessages(null);
if (this.isVideoStream) {
AppLovinCommunicator.getInstance(getContext()).unsubscribe(this, "video_caching_failed");
}
super.destroy();
}
@Override // com.applovin.communicator.AppLovinCommunicatorEntity
public String getCommunicatorId() {
return TAG;
}
@Override // android.view.ViewGroup, android.view.View
public void onAttachedToWindow() {
super.onAttachedToWindow();
maybeHandleOnAttachedToWindow();
if (this.isVideoPausedByUser) {
return;
}
maybeHandleResume();
}
@Override // android.view.ViewGroup, android.view.View
public void onDetachedFromWindow() {
maybeHandlePause();
super.onDetachedFromWindow();
}
@Override // com.applovin.communicator.AppLovinCommunicatorSubscriber
public void onMessageReceived(AppLovinCommunicatorMessage appLovinCommunicatorMessage) {
if ("video_caching_failed".equals(appLovinCommunicatorMessage.getTopic())) {
Bundle messageData = appLovinCommunicatorMessage.getMessageData();
if (messageData.getLong("ad_id") == this.vastAd.getAdIdNumber() && this.isVideoStream) {
int i = messageData.getInt("load_response_code");
String string = messageData.getString("load_exception_message");
if ((string == null && i >= 200 && i < 300) || this.videoWasCompleted || this.mediaPlayer.isPlaying()) {
return;
}
handleMediaError("Video cache error during stream. ResponseCode=" + i + ", exception=" + string);
}
}
}
/* JADX INFO: Access modifiers changed from: private */
public boolean populateMuteImage(boolean z) {
if (this.muteButtonImageView == null) {
return false;
}
if (z3.f()) {
AnimatedVectorDrawable animatedVectorDrawable = (AnimatedVectorDrawable) getContext().getDrawable(z ? R.drawable.applovin_ic_unmute_to_mute : R.drawable.applovin_ic_mute_to_unmute);
if (animatedVectorDrawable != null) {
this.muteButtonImageView.setImageDrawable(animatedVectorDrawable);
animatedVectorDrawable.start();
return true;
}
}
Uri L = z ? this.vastAd.L() : this.vastAd.f0();
if (L == null) {
return false;
}
ImageViewUtils.setImageUri(this.muteButtonImageView, L, this.sdk);
return true;
}
private void populatePlayPauseImage(boolean z) {
ImageView imageView = this.playPauseButtonImageView;
if (imageView == null) {
return;
}
imageView.setImageResource(z ? R.drawable.applovin_ic_play_icon : R.drawable.applovin_ic_pause_icon);
}
/* JADX INFO: Access modifiers changed from: private */
public void maybeFireTrackers(aq.d dVar) {
maybeFireTrackers(dVar, fq.UNSPECIFIED);
}
private void maybeFireTrackers(aq.d dVar, fq fqVar) {
maybeFireTrackers(dVar, "", fqVar);
}
private void maybeFireTrackers(aq.d dVar, String str) {
maybeFireTrackers(dVar, str, fq.UNSPECIFIED);
}
private void maybeFireTrackers(aq.d dVar, String str, fq fqVar) {
maybeFireTrackers((Set<kq>) this.vastAd.a(dVar, str), fqVar);
}
private void maybeFireTrackers(Set<kq> set, fq fqVar) {
if (set == null || set.isEmpty()) {
return;
}
long seconds = TimeUnit.MILLISECONDS.toSeconds(this.mediaPlayer.getCurrentPosition());
oq u1 = this.vastAd.u1();
Uri c2 = u1 != null ? u1.c() : null;
if (n.a()) {
this.logger.a(TAG, "Firing " + set.size() + " tracker(s): " + set);
}
mq.a(set, seconds, c2, fqVar, this.sdk);
}
/* JADX INFO: Access modifiers changed from: private */
public void maybeFireTrackers(Set<kq> set) {
maybeFireTrackers(set, fq.UNSPECIFIED);
}
}

View File

@@ -0,0 +1,77 @@
package com.applovin.impl.sdk.nativeAd;
import android.net.Uri;
import com.applovin.impl.sdk.j;
import com.applovin.impl.sdk.n;
import com.applovin.impl.sdk.utils.StringUtils;
import com.applovin.impl.u2;
import com.applovin.impl.yl;
import java.io.File;
import java.util.Collections;
/* loaded from: classes2.dex */
public class a extends yl {
private final u2 h;
private final AppLovinNativeAdImpl i;
private final InterfaceC0039a j;
/* renamed from: com.applovin.impl.sdk.nativeAd.a$a, reason: collision with other inner class name */
public interface InterfaceC0039a {
void a(AppLovinNativeAdImpl appLovinNativeAdImpl);
}
public a(AppLovinNativeAdImpl appLovinNativeAdImpl, j jVar, InterfaceC0039a interfaceC0039a) {
super("TaskCacheNativeAd", jVar);
this.h = new u2();
this.i = appLovinNativeAdImpl;
this.j = interfaceC0039a;
}
private Uri a(Uri uri) {
if (uri == null) {
return null;
}
if (n.a()) {
this.c.a(this.b, "Attempting to cache resource: " + uri);
}
String a = this.a.B().a(a(), uri.toString(), this.i.getCachePrefix(), Collections.emptyList(), false, false, this.h, 1);
if (StringUtils.isValidString(a)) {
File a2 = this.a.B().a(a, a());
if (a2 != null) {
Uri fromFile = Uri.fromFile(a2);
if (fromFile != null) {
return fromFile;
}
if (n.a()) {
this.c.b(this.b, "Unable to extract Uri from image file");
}
} else if (n.a()) {
this.c.b(this.b, "Unable to retrieve File from cached image filename = " + a);
}
}
return null;
}
@Override // java.lang.Runnable
public void run() {
if (n.a()) {
this.c.a(this.b, "Begin caching ad #" + this.i.getAdIdNumber() + "...");
}
Uri a = a(this.i.getIconUri());
if (a != null) {
this.i.setIconUri(a);
}
Uri a2 = a(this.i.getMainImageUri());
if (a2 != null) {
this.i.setMainImageUri(a2);
}
Uri a3 = a(this.i.getPrivacyIconUri());
if (a3 != null) {
this.i.setPrivacyIconUri(a3);
}
if (n.a()) {
this.c.a(this.b, "Finished caching ad #" + this.i.getAdIdNumber());
}
this.j.a(this.i);
}
}

View File

@@ -0,0 +1,432 @@
package com.applovin.impl.sdk.nativeAd;
import android.net.Uri;
import android.text.TextUtils;
import android.webkit.URLUtil;
import androidx.core.app.NotificationCompat;
import com.applovin.impl.aq;
import com.applovin.impl.sdk.AppLovinError;
import com.applovin.impl.sdk.j;
import com.applovin.impl.sdk.n;
import com.applovin.impl.sdk.nativeAd.AppLovinNativeAdImpl;
import com.applovin.impl.sdk.nativeAd.a;
import com.applovin.impl.sdk.network.e;
import com.applovin.impl.sdk.utils.JsonUtils;
import com.applovin.impl.sdk.utils.StringUtils;
import com.applovin.impl.sj;
import com.applovin.impl.tm;
import com.applovin.impl.yl;
import com.applovin.impl.yp;
import com.applovin.impl.zm;
import com.applovin.sdk.AppLovinAd;
import com.applovin.sdk.AppLovinAdLoadListener;
import com.applovin.sdk.AppLovinSdkUtils;
import com.mbridge.msdk.foundation.entity.CampaignEx;
import java.util.ArrayList;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public class b extends yl implements a.InterfaceC0039a, AppLovinAdLoadListener {
private final List A;
private final List B;
private final List C;
private final JSONObject h;
private final JSONObject i;
private final AppLovinNativeAdLoadListener j;
private String k;
private String l;
private String m;
private Double n;
private String o;
private Uri p;
private Uri q;
private aq r;
private Uri s;
private Uri t;
private Uri u;
private Uri v;
private final List w;
private final List x;
private final List y;
private final List z;
public b(JSONObject jSONObject, JSONObject jSONObject2, AppLovinNativeAdLoadListener appLovinNativeAdLoadListener, j jVar) {
super("TaskRenderNativeAd", jVar);
this.k = "";
this.l = "";
this.m = "";
this.n = null;
this.o = "";
this.p = null;
this.q = null;
this.s = null;
this.t = null;
this.u = null;
this.v = null;
this.w = new ArrayList();
this.x = new ArrayList();
this.y = new ArrayList();
this.z = new ArrayList();
this.A = new ArrayList();
this.B = new ArrayList();
this.C = new ArrayList();
this.h = jSONObject;
this.i = jSONObject2;
this.j = appLovinNativeAdLoadListener;
}
private void a(JSONObject jSONObject) {
if (jSONObject == null) {
return;
}
String string = JsonUtils.getString(jSONObject, "url", null);
if (StringUtils.isValidString(string)) {
this.u = Uri.parse(string);
if (n.a()) {
this.c.a(this.b, "Processed click destination URL: " + this.u);
}
}
String string2 = JsonUtils.getString(jSONObject, "fallback", null);
if (StringUtils.isValidString(string2)) {
this.v = Uri.parse(string2);
if (n.a()) {
this.c.a(this.b, "Processed click destination backup URL: " + this.v);
}
}
JSONArray jSONArray = JsonUtils.getJSONArray(jSONObject, "clicktrackers", null);
if (jSONArray != null) {
if (!JsonUtils.getBoolean(this.h, "use_requests_for_native_ad_click_postbacks", (Boolean) this.a.a(sj.h3)).booleanValue()) {
try {
this.w.addAll(JsonUtils.toList(jSONArray));
if (n.a()) {
this.c.a(this.b, "Processed click tracking URLs: " + this.w);
return;
}
return;
} catch (Throwable th) {
if (n.a()) {
this.c.a(this.b, "Failed to render click tracking URLs", th);
return;
}
return;
}
}
for (int i = 0; i < jSONArray.length(); i++) {
Object objectAtIndex = JsonUtils.getObjectAtIndex(jSONArray, i, null);
if (objectAtIndex instanceof String) {
String str = (String) objectAtIndex;
if (!TextUtils.isEmpty(str)) {
this.y.add(new e.a(this.a).b(str).b(false).a(false).h(f()).a());
}
}
}
if (n.a()) {
this.c.a(this.b, "Processed click tracking requests: " + this.y);
}
}
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void b(AppLovinNativeAdImpl appLovinNativeAdImpl) {
if (n.a()) {
this.c.a(this.b, "Preparing native ad view components...");
}
try {
appLovinNativeAdImpl.setUpNativeAdViewComponents();
if (n.a()) {
this.c.a(this.b, "Successfully prepared native ad view components");
}
appLovinNativeAdImpl.getAdEventTracker().h();
this.j.onNativeAdLoaded(appLovinNativeAdImpl);
} catch (Throwable th) {
if (n.a()) {
this.c.a(this.b, "Failed to prepare native ad view components", th);
}
b(th.getMessage());
this.a.E().a(this.b, "prepareNativeComponents", th);
}
}
private void c(final AppLovinNativeAdImpl appLovinNativeAdImpl) {
AppLovinSdkUtils.runOnUiThread(new Runnable() { // from class: com.applovin.impl.sdk.nativeAd.b$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
b.this.b(appLovinNativeAdImpl);
}
});
}
private void e() {
AppLovinNativeAdImpl build = new AppLovinNativeAdImpl.Builder(JsonUtils.shallowCopy(this.h), JsonUtils.shallowCopy(this.i), this.a).setTitle(this.k).setAdvertiser(this.l).setBody(this.m).setCallToAction(this.o).setStarRating(this.n).setIconUri(this.p).setMainImageUri(this.q).setPrivacyIconUri(this.s).setVastAd(this.r).setPrivacyDestinationUri(this.t).setClickDestinationUri(this.u).setClickDestinationBackupUri(this.v).setClickTrackingUrls(this.w).setJsTrackers(this.x).setClickTrackingRequests(this.y).setImpressionRequests(this.z).setViewableMRC50Requests(this.A).setViewableMRC100Requests(this.B).setViewableVideo50Requests(this.C).build();
build.getAdEventTracker().e();
if (n.a()) {
this.c.a(this.b, "Starting cache task for type: " + build.getType() + "...");
}
this.a.j0().a((yl) new a(build, this.a, this), tm.b.CORE);
}
private boolean f() {
return JsonUtils.getBoolean(this.h, "fire_native_ad_postbacks_from_webview", (Boolean) this.a.a(sj.g3)).booleanValue();
}
@Override // com.applovin.sdk.AppLovinAdLoadListener
public void adReceived(AppLovinAd appLovinAd) {
if (n.a()) {
this.c.a(this.b, "VAST ad rendered successfully");
}
this.r = (aq) appLovinAd;
e();
}
@Override // com.applovin.sdk.AppLovinAdLoadListener
public void failedToReceiveAd(int i) {
if (n.a()) {
this.c.b(this.b, "VAST ad failed to render");
}
e();
}
/* JADX WARN: Type inference failed for: r3v0 */
/* JADX WARN: Type inference failed for: r3v12, types: [java.lang.String, org.json.JSONObject] */
/* JADX WARN: Type inference failed for: r3v19 */
/* JADX WARN: Type inference failed for: r3v5, types: [java.lang.String, org.json.JSONObject] */
/* JADX WARN: Type inference failed for: r3v64 */
/* JADX WARN: Type inference failed for: r3v9 */
@Override // java.lang.Runnable
public void run() {
?? r3 = 0;
String string = JsonUtils.getString(this.h, "privacy_icon_url", null);
if (URLUtil.isValidUrl(string)) {
this.s = Uri.parse(string);
}
String string2 = JsonUtils.getString(this.h, CampaignEx.JSON_KEY_PRIVACY_URL, null);
if (URLUtil.isValidUrl(string2)) {
this.t = Uri.parse(string2);
}
JSONObject jSONObject = JsonUtils.getJSONObject(this.h, "ortb_response", (JSONObject) null);
if (jSONObject == null || jSONObject.length() == 0) {
if (n.a()) {
this.c.b(this.b, "No oRtb response provided: " + this.h);
}
b("No oRtb response provided");
return;
}
String string3 = JsonUtils.getString(jSONObject, "version", null);
JSONObject jSONObject2 = JsonUtils.getJSONObject(jSONObject, "value", (JSONObject) null);
if (n.a()) {
this.c.a(this.b, "Rendering native ad for oRTB version: " + string3);
}
JSONObject jSONObject3 = JsonUtils.getJSONObject(jSONObject2, "native", jSONObject2);
a(JsonUtils.getJSONObject(jSONObject3, "link", (JSONObject) null));
JSONArray jSONArray = JsonUtils.getJSONArray(jSONObject3, "assets", null);
if (jSONArray == null || jSONArray.length() == 0) {
if (n.a()) {
this.c.b(this.b, "Unable to retrieve assets - failing ad load: " + this.h);
}
b("Unable to retrieve assets");
return;
}
String str = "";
int i = 0;
while (i < jSONArray.length()) {
JSONObject jSONObject4 = JsonUtils.getJSONObject(jSONArray, i, (JSONObject) r3);
if (jSONObject4.has("title")) {
this.k = JsonUtils.getString(JsonUtils.getJSONObject(jSONObject4, "title", (JSONObject) r3), "text", r3);
if (n.a()) {
this.c.a(this.b, "Processed title: " + this.k);
}
} else if (jSONObject4.has("link")) {
a(JsonUtils.getJSONObject(jSONObject4, "link", (JSONObject) r3));
} else if (jSONObject4.has("img")) {
int i2 = JsonUtils.getInt(jSONObject4, "id", -1);
JSONObject jSONObject5 = JsonUtils.getJSONObject(jSONObject4, "img", (JSONObject) r3);
int i3 = JsonUtils.getInt(jSONObject5, "type", -1);
String string4 = JsonUtils.getString(jSONObject5, "url", r3);
if (i3 == 1 || 3 == i2) {
this.p = Uri.parse(string4);
if (n.a()) {
this.c.a(this.b, "Processed icon URL: " + this.p);
}
} else if (i3 == 3 || 2 == i2) {
this.q = Uri.parse(string4);
if (n.a()) {
this.c.a(this.b, "Processed main image URL: " + this.q);
}
} else {
if (n.a()) {
this.c.k(this.b, "Unrecognized image: " + jSONObject4);
}
int i4 = JsonUtils.getInt(jSONObject5, "w", -1);
int i5 = JsonUtils.getInt(jSONObject5, "h", -1);
if (i4 <= 0 || i5 <= 0) {
if (n.a()) {
this.c.k(this.b, "Skipping...");
}
} else if (i4 / i5 > 1.0d) {
if (n.a()) {
this.c.a(this.b, "Inferring main image from " + i4 + "x" + i5 + "...");
}
this.q = Uri.parse(string4);
} else {
if (n.a()) {
this.c.a(this.b, "Inferring icon image from " + i4 + "x" + i5 + "...");
}
this.p = Uri.parse(string4);
}
}
} else if (jSONObject4.has("video")) {
String string5 = JsonUtils.getString(JsonUtils.getJSONObject(jSONObject4, "video", (JSONObject) null), "vasttag", null);
if (StringUtils.isValidString(string5)) {
if (n.a()) {
this.c.a(this.b, "Processed VAST video");
}
} else if (n.a()) {
this.c.k(this.b, "Ignoring invalid \"vasttag\" for video: " + jSONObject4);
}
str = string5;
} else if (jSONObject4.has("data")) {
int i6 = JsonUtils.getInt(jSONObject4, "id", -1);
JSONObject jSONObject6 = JsonUtils.getJSONObject(jSONObject4, "data", (JSONObject) null);
int i7 = JsonUtils.getInt(jSONObject6, "type", -1);
String string6 = JsonUtils.getString(jSONObject6, "value", null);
if (i7 == 1 || i6 == 8) {
this.l = string6;
if (n.a()) {
this.c.a(this.b, "Processed advertiser: " + this.l);
}
} else if (i7 == 2 || i6 == 4) {
this.m = string6;
if (n.a()) {
this.c.a(this.b, "Processed body: " + this.m);
}
} else if (i7 == 12 || i6 == 5) {
this.o = string6;
if (n.a()) {
this.c.a(this.b, "Processed cta: " + this.o);
}
} else if (i7 == 3 || i6 == 6) {
double a = yp.a(string6, -1.0d);
if (a != -1.0d) {
this.n = Double.valueOf(a);
if (n.a()) {
this.c.a(this.b, "Processed star rating: " + this.n);
}
} else if (n.a()) {
this.c.a(this.b, "Received invalid star rating: " + string6);
}
} else if (n.a()) {
this.c.k(this.b, "Skipping unsupported data: " + jSONObject4);
}
} else if (n.a()) {
this.c.b(this.b, "Unsupported asset object: " + jSONObject4);
}
i++;
r3 = 0;
}
String string7 = JsonUtils.getString(jSONObject3, "jstracker", null);
if (StringUtils.isValidString(string7)) {
this.x.add(string7);
if (n.a()) {
this.c.a(this.b, "Processed jstracker: " + string7);
}
}
Object obj = null;
JSONArray jSONArray2 = JsonUtils.getJSONArray(jSONObject3, "imptrackers", null);
if (jSONArray2 != null) {
int i8 = 0;
while (i8 < jSONArray2.length()) {
Object objectAtIndex = JsonUtils.getObjectAtIndex(jSONArray2, i8, obj);
if (objectAtIndex instanceof String) {
String str2 = (String) objectAtIndex;
if (!TextUtils.isEmpty(str2)) {
this.z.add(new e.a(this.a).b(str2).b(false).a(false).h(f()).a());
if (n.a()) {
this.c.a(this.b, "Processed imptracker URL: " + str2);
}
}
}
i8++;
obj = null;
}
}
?? r32 = 0;
JSONArray jSONArray3 = JsonUtils.getJSONArray(jSONObject3, "eventtrackers", null);
if (jSONArray3 != null) {
int i9 = 0;
while (i9 < jSONArray3.length()) {
JSONObject jSONObject7 = JsonUtils.getJSONObject(jSONArray3, i9, (JSONObject) r32);
int i10 = JsonUtils.getInt(jSONObject7, NotificationCompat.CATEGORY_EVENT, -1);
int i11 = JsonUtils.getInt(jSONObject7, "method", -1);
String string8 = JsonUtils.getString(jSONObject7, "url", r32);
if (!TextUtils.isEmpty(string8)) {
if (i11 == 1 || i11 == 2) {
if (i11 == 2 && string8.startsWith("<script")) {
this.x.add(string8);
} else {
e a2 = new e.a(this.a).b(string8).b(false).a(false).h(f() || i11 == 2).a();
if (i10 == 1) {
this.z.add(a2);
if (n.a()) {
this.c.a(this.b, "Processed impression URL: " + string8);
}
} else if (i10 == 2) {
this.A.add(a2);
if (n.a()) {
this.c.a(this.b, "Processed viewable MRC50 URL: " + string8);
}
} else if (i10 == 3) {
this.B.add(a2);
if (n.a()) {
this.c.a(this.b, "Processed viewable MRC100 URL: " + string8);
}
} else {
if (i10 == 4) {
this.C.add(a2);
if (n.a()) {
this.c.a(this.b, "Processed viewable video 50 URL: " + string8);
}
} else if (i10 == 555) {
if (n.a()) {
this.c.a(this.b, "Ignoring processing of OMID URL: " + string8);
}
} else if (n.a()) {
this.c.b(this.b, "Unsupported event tracker: " + jSONObject7);
}
i9++;
r32 = 0;
}
i9++;
r32 = 0;
}
} else if (n.a()) {
this.c.b(this.b, "Unsupported method for event tracker: " + jSONObject7);
}
}
i9++;
r32 = 0;
}
}
if (!StringUtils.isValidString(str)) {
e();
return;
}
if (n.a()) {
this.c.a(this.b, "Processing VAST video...");
}
this.a.j0().a(zm.a(str, JsonUtils.shallowCopy(this.h), JsonUtils.shallowCopy(this.i), this, this.a));
}
private void b(String str) {
this.j.onNativeAdLoadFailed(new AppLovinError(-6, str));
}
@Override // com.applovin.impl.sdk.nativeAd.a.InterfaceC0039a
public void a(AppLovinNativeAdImpl appLovinNativeAdImpl) {
if (n.a()) {
this.c.a(this.b, "Successfully cached and loaded ad");
}
c(appLovinNativeAdImpl);
}
}

View File

@@ -0,0 +1,51 @@
package com.applovin.impl.sdk.network;
import androidx.core.app.NotificationCompat;
import com.applovin.impl.gm;
import com.applovin.impl.sdk.EventServiceImpl;
import com.applovin.impl.sdk.j;
import com.applovin.impl.tm;
import com.applovin.impl.yl;
import com.applovin.sdk.AppLovinPostbackListener;
import com.applovin.sdk.AppLovinPostbackService;
import java.util.Map;
/* loaded from: classes2.dex */
public class PostbackServiceImpl implements AppLovinPostbackService {
private final j a;
public PostbackServiceImpl(j jVar) {
this.a = jVar;
}
private boolean a(e eVar) {
Map i = eVar.i();
if (i == null) {
return false;
}
Object obj = i.get(NotificationCompat.CATEGORY_EVENT);
if ("postinstall".equals(obj)) {
obj = i.get("sub_event");
}
return EventServiceImpl.ALLOW_PRE_INIT_EVENT_TYPES.contains(obj);
}
@Override // com.applovin.sdk.AppLovinPostbackService
public void dispatchPostbackAsync(String str, AppLovinPostbackListener appLovinPostbackListener) {
dispatchPostbackRequest(e.b(this.a).b(str).a(false).a(), appLovinPostbackListener);
}
public String toString() {
return "PostbackService{}";
}
public void dispatchPostbackRequest(e eVar, tm.b bVar, AppLovinPostbackListener appLovinPostbackListener) {
gm gmVar = new gm(eVar, bVar, this.a, appLovinPostbackListener);
gmVar.a(a(eVar));
this.a.j0().a((yl) gmVar, bVar);
}
public void dispatchPostbackRequest(e eVar, AppLovinPostbackListener appLovinPostbackListener) {
dispatchPostbackRequest(eVar, tm.b.OTHER, appLovinPostbackListener);
}
}

View File

@@ -0,0 +1,330 @@
package com.applovin.impl.sdk.network;
import com.applovin.impl.sdk.j;
import com.applovin.impl.sj;
import com.applovin.impl.vi;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public class a {
private String a;
private String b;
private Map c;
private Map d;
private final JSONObject e;
private String f;
private final Object g;
private final int h;
private int i;
private final int j;
private final int k;
private final boolean l;
private final boolean m;
private final boolean n;
private final boolean o;
private final vi.a p;
private final boolean q;
private final boolean r;
public a(C0040a c0040a) {
this.a = c0040a.b;
this.b = c0040a.a;
this.c = c0040a.d;
this.d = c0040a.e;
this.e = c0040a.f;
this.f = c0040a.c;
this.g = c0040a.g;
int i = c0040a.h;
this.h = i;
this.i = i;
this.j = c0040a.i;
this.k = c0040a.j;
this.l = c0040a.k;
this.m = c0040a.l;
this.n = c0040a.m;
this.o = c0040a.n;
this.p = c0040a.q;
this.q = c0040a.o;
this.r = c0040a.p;
}
public String a() {
return this.f;
}
public void a(int i) {
this.i = i;
}
public void a(String str) {
this.a = str;
}
public JSONObject b() {
return this.e;
}
public void b(String str) {
this.b = str;
}
public int c() {
return this.h - this.i;
}
public Object d() {
return this.g;
}
public vi.a e() {
return this.p;
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof a)) {
return false;
}
a aVar = (a) obj;
String str = this.a;
if (str == null ? aVar.a != null : !str.equals(aVar.a)) {
return false;
}
Map map = this.c;
if (map == null ? aVar.c != null : !map.equals(aVar.c)) {
return false;
}
Map map2 = this.d;
if (map2 == null ? aVar.d != null : !map2.equals(aVar.d)) {
return false;
}
String str2 = this.f;
if (str2 == null ? aVar.f != null : !str2.equals(aVar.f)) {
return false;
}
String str3 = this.b;
if (str3 == null ? aVar.b != null : !str3.equals(aVar.b)) {
return false;
}
JSONObject jSONObject = this.e;
if (jSONObject == null ? aVar.e != null : !jSONObject.equals(aVar.e)) {
return false;
}
Object obj2 = this.g;
if (obj2 == null ? aVar.g == null : obj2.equals(aVar.g)) {
return this.h == aVar.h && this.i == aVar.i && this.j == aVar.j && this.k == aVar.k && this.l == aVar.l && this.m == aVar.m && this.n == aVar.n && this.o == aVar.o && this.p == aVar.p && this.q == aVar.q && this.r == aVar.r;
}
return false;
}
public String f() {
return this.a;
}
public Map g() {
return this.d;
}
public String h() {
return this.b;
}
public int hashCode() {
int hashCode = super.hashCode() * 31;
String str = this.a;
int hashCode2 = (hashCode + (str != null ? str.hashCode() : 0)) * 31;
String str2 = this.f;
int hashCode3 = (hashCode2 + (str2 != null ? str2.hashCode() : 0)) * 31;
String str3 = this.b;
int hashCode4 = (hashCode3 + (str3 != null ? str3.hashCode() : 0)) * 31;
Object obj = this.g;
int hashCode5 = ((((((((((((((((((((((hashCode4 + (obj != null ? obj.hashCode() : 0)) * 31) + this.h) * 31) + this.i) * 31) + this.j) * 31) + this.k) * 31) + (this.l ? 1 : 0)) * 31) + (this.m ? 1 : 0)) * 31) + (this.n ? 1 : 0)) * 31) + (this.o ? 1 : 0)) * 31) + this.p.b()) * 31) + (this.q ? 1 : 0)) * 31) + (this.r ? 1 : 0);
Map map = this.c;
if (map != null) {
hashCode5 = (hashCode5 * 31) + map.hashCode();
}
Map map2 = this.d;
if (map2 != null) {
hashCode5 = (hashCode5 * 31) + map2.hashCode();
}
JSONObject jSONObject = this.e;
if (jSONObject == null) {
return hashCode5;
}
char[] charArray = jSONObject.toString().toCharArray();
Arrays.sort(charArray);
return (hashCode5 * 31) + new String(charArray).hashCode();
}
public Map i() {
return this.c;
}
public int j() {
return this.i;
}
public int k() {
return this.k;
}
public int l() {
return this.j;
}
public boolean m() {
return this.o;
}
public boolean n() {
return this.l;
}
public boolean o() {
return this.r;
}
public boolean p() {
return this.m;
}
public boolean q() {
return this.n;
}
public boolean r() {
return this.q;
}
public String toString() {
return "HttpRequest {endpoint=" + this.a + ", backupEndpoint=" + this.f + ", httpMethod=" + this.b + ", httpHeaders=" + this.d + ", body=" + this.e + ", emptyResponse=" + this.g + ", initialRetryAttempts=" + this.h + ", retryAttemptsLeft=" + this.i + ", timeoutMillis=" + this.j + ", retryDelayMillis=" + this.k + ", exponentialRetries=" + this.l + ", retryOnAllErrors=" + this.m + ", retryOnNoConnection=" + this.n + ", encodingEnabled=" + this.o + ", encodingType=" + this.p + ", trackConnectionSpeed=" + this.q + ", gzipBodyEncoding=" + this.r + '}';
}
public static C0040a a(j jVar) {
return new C0040a(jVar);
}
/* renamed from: com.applovin.impl.sdk.network.a$a, reason: collision with other inner class name */
public static class C0040a {
String a;
String b;
String c;
Map e;
JSONObject f;
Object g;
int i;
int j;
boolean k;
boolean m;
boolean n;
boolean o;
boolean p;
vi.a q;
int h = 1;
boolean l = true;
Map d = new HashMap();
public C0040a(j jVar) {
this.i = ((Integer) jVar.a(sj.k3)).intValue();
this.j = ((Integer) jVar.a(sj.j3)).intValue();
this.m = ((Boolean) jVar.a(sj.H3)).booleanValue();
this.n = ((Boolean) jVar.a(sj.o5)).booleanValue();
this.q = vi.a.a(((Integer) jVar.a(sj.p5)).intValue());
this.p = ((Boolean) jVar.a(sj.M5)).booleanValue();
}
public C0040a a(int i) {
this.h = i;
return this;
}
public C0040a a(vi.a aVar) {
this.q = aVar;
return this;
}
public C0040a a(Object obj) {
this.g = obj;
return this;
}
public C0040a a(String str) {
this.c = str;
return this;
}
public C0040a a(Map map) {
this.e = map;
return this;
}
public C0040a a(JSONObject jSONObject) {
this.f = jSONObject;
return this;
}
public C0040a a(boolean z) {
this.n = z;
return this;
}
public C0040a b(int i) {
this.j = i;
return this;
}
public C0040a b(String str) {
this.b = str;
return this;
}
public C0040a b(Map map) {
this.d = map;
return this;
}
public C0040a b(boolean z) {
this.p = z;
return this;
}
public C0040a c(int i) {
this.i = i;
return this;
}
public C0040a c(String str) {
this.a = str;
return this;
}
public C0040a c(boolean z) {
this.k = z;
return this;
}
public C0040a d(boolean z) {
this.l = z;
return this;
}
public C0040a e(boolean z) {
this.m = z;
return this;
}
public C0040a f(boolean z) {
this.o = z;
return this;
}
public a a() {
return new a(this);
}
}
}

View File

@@ -0,0 +1,306 @@
package com.applovin.impl.sdk.network;
import android.content.Intent;
import android.content.IntentFilter;
import android.text.TextUtils;
import com.applovin.impl.gc;
import com.applovin.impl.jn;
import com.applovin.impl.sdk.AppLovinBroadcastManager;
import com.applovin.impl.sdk.SessionTracker;
import com.applovin.impl.sdk.j;
import com.applovin.impl.sdk.n;
import com.applovin.impl.sj;
import com.applovin.impl.tm;
import com.applovin.impl.yl;
import com.applovin.impl.yp;
import com.applovin.sdk.AppLovinPostbackListener;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public class b implements AppLovinBroadcastManager.Receiver {
private final j a;
private final n b;
private final int c;
private final c d;
private final Object f = new Object();
private final List g;
private final Set h;
private final List i;
public class a implements AppLovinPostbackListener {
final /* synthetic */ d a;
final /* synthetic */ AppLovinPostbackListener b;
public a(d dVar, AppLovinPostbackListener appLovinPostbackListener) {
this.a = dVar;
this.b = appLovinPostbackListener;
}
@Override // com.applovin.sdk.AppLovinPostbackListener
public void onPostbackFailure(String str, int i) {
n unused = b.this.b;
if (n.a()) {
b.this.b.d("PersistentPostbackManager", "Failed to submit postback: " + this.a + " with error code: " + i + "; will retry later...");
}
b.this.d(this.a);
gc.a(this.b, str, i);
if (this.a.c() == 1) {
b.this.a.E().a("dispatchPostback", str, i);
}
}
@Override // com.applovin.sdk.AppLovinPostbackListener
public void onPostbackSuccess(String str) {
b.this.a(this.a);
n unused = b.this.b;
if (n.a()) {
b.this.b.a("PersistentPostbackManager", "Successfully submit postback: " + this.a);
}
b.this.c();
gc.a(this.b, str);
}
}
public b(j jVar) {
ArrayList arrayList = new ArrayList();
this.g = arrayList;
this.h = new HashSet();
this.i = new ArrayList();
if (jVar == null) {
throw new IllegalArgumentException("No sdk specified");
}
this.a = jVar;
this.b = jVar.J();
int intValue = ((Integer) jVar.a(sj.c3)).intValue();
this.c = intValue;
if (!((Boolean) jVar.a(sj.f3)).booleanValue()) {
this.d = null;
return;
}
c cVar = new c(this, jVar);
this.d = cVar;
if (yp.a(sj.m1, jVar) && yp.h()) {
a(new Runnable() { // from class: com.applovin.impl.sdk.network.b$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
b.this.f();
}
}, true, true);
} else {
arrayList.addAll(cVar.a(intValue));
}
AppLovinBroadcastManager.registerReceiver(this, new IntentFilter(SessionTracker.ACTION_APPLICATION_PAUSED));
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void f() {
synchronized (this.f) {
this.g.addAll(0, this.d.a(this.c));
}
}
public List d() {
ArrayList arrayList = new ArrayList();
synchronized (this.f) {
try {
if (((Boolean) this.a.a(sj.e3)).booleanValue()) {
arrayList.ensureCapacity(this.i.size());
arrayList.addAll(this.i);
} else {
arrayList.ensureCapacity(this.g.size());
arrayList.addAll(this.g);
}
} catch (Throwable th) {
throw th;
}
}
return arrayList;
}
public void e(d dVar) {
a(dVar, true);
}
@Override // com.applovin.impl.sdk.AppLovinBroadcastManager.Receiver
public void onReceive(Intent intent, Map map) {
this.a.j0().a((yl) this.d, tm.b.OTHER);
}
private void c(d dVar) {
synchronized (this.f) {
while (this.g.size() > this.c) {
try {
this.g.remove(0);
} catch (Throwable th) {
throw th;
}
}
this.g.add(dVar);
}
if (n.a()) {
this.b.a("PersistentPostbackManager", "Enqueued postback: " + dVar);
}
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void e() {
synchronized (this.f) {
try {
Iterator it = new ArrayList(this.g).iterator();
while (it.hasNext()) {
b((d) it.next());
}
} catch (Throwable th) {
throw th;
}
}
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void b(d dVar, AppLovinPostbackListener appLovinPostbackListener) {
synchronized (this.f) {
c(dVar);
a(dVar, appLovinPostbackListener);
}
}
public void a(d dVar, boolean z) {
a(dVar, z, (AppLovinPostbackListener) null);
}
public void a(final d dVar, boolean z, final AppLovinPostbackListener appLovinPostbackListener) {
if (TextUtils.isEmpty(dVar.k())) {
if (n.a()) {
this.b.b("PersistentPostbackManager", "Requested a postback dispatch for empty URL; nothing to do...");
}
} else {
if (z) {
dVar.a();
}
a(new Runnable() { // from class: com.applovin.impl.sdk.network.b$$ExternalSyntheticLambda1
@Override // java.lang.Runnable
public final void run() {
b.this.b(dVar, appLovinPostbackListener);
}
}, yp.h(), dVar.m());
}
}
public void b() {
a(new Runnable() { // from class: com.applovin.impl.sdk.network.b$$ExternalSyntheticLambda2
@Override // java.lang.Runnable
public final void run() {
b.this.e();
}
}, true, false);
}
private void b(d dVar) {
a(dVar, (AppLovinPostbackListener) null);
}
/* JADX INFO: Access modifiers changed from: private */
public void c() {
synchronized (this.f) {
try {
Iterator it = this.i.iterator();
while (it.hasNext()) {
b((d) it.next());
}
this.i.clear();
} catch (Throwable th) {
throw th;
}
}
}
/* JADX INFO: Access modifiers changed from: private */
public void d(d dVar) {
synchronized (this.f) {
this.h.remove(dVar);
this.i.add(dVar);
}
}
public void a() {
synchronized (this.f) {
this.g.clear();
this.i.clear();
}
this.a.j0().a((yl) this.d, tm.b.OTHER);
}
private void a(d dVar, AppLovinPostbackListener appLovinPostbackListener) {
if (n.a()) {
this.b.a("PersistentPostbackManager", "Preparing to submit postback: " + dVar);
}
if (this.a.x0() && !dVar.m()) {
if (n.a()) {
this.b.a("PersistentPostbackManager", "Skipping postback dispatch because SDK is still initializing - postback will be dispatched afterwards");
return;
}
return;
}
if (TextUtils.isEmpty(dVar.k())) {
if (n.a()) {
this.b.b("PersistentPostbackManager", "Skipping empty postback dispatch...");
return;
}
return;
}
synchronized (this.f) {
try {
if (this.h.contains(dVar)) {
if (n.a()) {
this.b.a("PersistentPostbackManager", "Skipping in progress postback: " + dVar.k());
}
return;
}
dVar.l();
Integer num = (Integer) this.a.a(sj.b3);
if (dVar.c() > num.intValue()) {
if (n.a()) {
this.b.k("PersistentPostbackManager", "Exceeded maximum persisted attempt count of " + num + ". Dequeuing postback: " + dVar);
}
a(dVar);
return;
}
synchronized (this.f) {
this.h.add(dVar);
}
e a2 = e.b(this.a).b(dVar.k()).a(dVar.d()).b(dVar.i()).c(dVar.h()).a(dVar.g()).a(dVar.j() != null ? new JSONObject(dVar.j()) : null).b(dVar.o()).a(dVar.n()).a(dVar.f()).h(dVar.p()).e(dVar.e()).a();
if (n.a()) {
this.b.a("PersistentPostbackManager", "Submitting postback: " + dVar);
}
this.a.Y().dispatchPostbackRequest(a2, new a(dVar, appLovinPostbackListener));
} catch (Throwable th) {
throw th;
}
}
}
/* JADX INFO: Access modifiers changed from: private */
public void a(d dVar) {
synchronized (this.f) {
this.h.remove(dVar);
this.g.remove(dVar);
}
if (n.a()) {
this.b.a("PersistentPostbackManager", "Dequeued postback: " + dVar);
}
}
private void a(Runnable runnable, boolean z, boolean z2) {
if (z) {
this.a.j0().a((yl) new jn(this.a, z2, "runPostbackTask", runnable), tm.b.OTHER);
} else {
runnable.run();
}
}
}

View File

@@ -0,0 +1,132 @@
package com.applovin.impl.sdk.network;
import android.text.TextUtils;
import com.applovin.impl.sdk.j;
import com.applovin.impl.sdk.l;
import com.applovin.impl.sdk.n;
import com.applovin.impl.sj;
import com.applovin.impl.yl;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
import org.json.JSONArray;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public class c extends yl {
private final b h;
private final n i;
private AtomicBoolean j;
private boolean k;
public c(b bVar, j jVar) {
super("PersistentPostbackQueueSaveTask", jVar);
this.j = new AtomicBoolean();
this.k = false;
this.h = bVar;
this.i = jVar.J();
}
public List a(int i) {
ArrayList arrayList = new ArrayList();
l B = this.a.B();
if (!B.b("persistent_postback_cache.json", j.l())) {
n.h("PersistentPostbackQueueSaveTask", "Postbacks queue file does not exist.");
return arrayList;
}
File a = B.a("persistent_postback_cache.json", j.l());
String e = B.e(a);
if (TextUtils.isEmpty(e)) {
n.h("PersistentPostbackQueueSaveTask", "Postbacks queue file has no content.");
return arrayList;
}
boolean z = false;
try {
JSONArray jSONArray = new JSONObject(e).getJSONArray("pb");
if (n.a()) {
this.i.a("PersistentPostbackQueueSaveTask", "Deserializing " + jSONArray.length() + " postback(s)...");
}
arrayList.ensureCapacity(Math.max(1, jSONArray.length()));
Integer num = (Integer) this.a.a(sj.b3);
for (int i2 = 0; i2 < jSONArray.length() && arrayList.size() < i; i2++) {
try {
d dVar = new d(jSONArray.getJSONObject(i2), this.a);
if (dVar.c() < num.intValue()) {
arrayList.add(dVar);
} else {
n.h("PersistentPostbackQueueSaveTask", "Skipping deserialization because maximum attempt count exceeded for postback: " + dVar);
}
} catch (Throwable th) {
n.c("PersistentPostbackQueueSaveTask", "Unable to deserialize postback from json", th);
this.a.E().a("PersistentPostbackQueueSaveTask", "deserializePostback", th);
}
}
if (n.a()) {
this.i.a("PersistentPostbackQueueSaveTask", "Successfully loaded postback queue with " + arrayList.size() + " postback(s).");
}
} catch (Throwable th2) {
try {
n.c("PersistentPostbackQueueSaveTask", "Failed to load postback queue", th2);
try {
this.a.E().a("PersistentPostbackQueueSaveTask", "deserializePostbackQueue", th2);
if (((Boolean) this.a.a(sj.g1)).booleanValue()) {
B.a(a, "removeAfterDeserializationFail");
}
} catch (Throwable th3) {
th = th3;
z = true;
if (z && ((Boolean) this.a.a(sj.g1)).booleanValue()) {
B.a(a, "removeAfterDeserializationFail");
}
throw th;
}
} catch (Throwable th4) {
th = th4;
}
}
this.k = arrayList.isEmpty();
return arrayList;
}
@Override // java.lang.Runnable
public void run() {
a(this.h.d());
}
private void a(List list) {
if (!(this.k && list.isEmpty()) && this.j.compareAndSet(false, true)) {
JSONArray jSONArray = new JSONArray();
Iterator it = list.iterator();
while (it.hasNext()) {
d dVar = (d) it.next();
try {
jSONArray.put(dVar.q());
} catch (Throwable th) {
n.c("PersistentPostbackQueueSaveTask", "Unable to serialize postback to JSON: " + dVar, th);
this.a.E().a("PersistentPostbackQueueSaveTask", "serializePostback", th);
}
}
try {
JSONObject jSONObject = new JSONObject();
jSONObject.put("pb", jSONArray);
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(jSONObject.toString().getBytes("UTF-8"));
l B = this.a.B();
if (B.a((InputStream) byteArrayInputStream, B.a("persistent_postback_cache.json", j.l()), true)) {
if (n.a()) {
this.i.a("PersistentPostbackQueueSaveTask", "Exported postback queue to disk.");
}
} else if (n.a()) {
this.i.b("PersistentPostbackQueueSaveTask", "Unable to export postback queue to disk.");
}
} catch (Throwable th2) {
n.c("PersistentPostbackQueueSaveTask", "Unable to export postbacks to disk: " + jSONArray, th2);
this.a.E().a("PersistentPostbackQueueSaveTask", "serializePostbackQueue", th2);
}
this.j.set(false);
}
}
}

View File

@@ -0,0 +1,259 @@
package com.applovin.impl.sdk.network;
import com.applovin.impl.sdk.j;
import com.applovin.impl.sdk.utils.CollectionUtils;
import com.applovin.impl.sdk.utils.JsonUtils;
import com.applovin.impl.vi;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public class d {
private String a;
private String b;
private String c;
private String d;
private Map e;
private Map f;
private Map g;
private vi.a h;
private boolean i;
private boolean j;
private boolean k;
private boolean l;
private String m;
private int n;
public static b b() {
return new b();
}
public void a() {
Map map = CollectionUtils.map(this.e);
map.put("postback_ts", String.valueOf(System.currentTimeMillis()));
this.e = map;
}
public int c() {
return this.n;
}
public String d() {
return this.d;
}
public String e() {
return this.m;
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null || getClass() != obj.getClass()) {
return false;
}
return this.a.equals(((d) obj).a);
}
public vi.a f() {
return this.h;
}
public Map g() {
return this.f;
}
public String h() {
return this.b;
}
public int hashCode() {
return this.a.hashCode();
}
public Map i() {
return this.e;
}
public Map j() {
return this.g;
}
public String k() {
return this.c;
}
public void l() {
this.n++;
}
public boolean m() {
return this.k;
}
public boolean n() {
return this.i;
}
public boolean o() {
return this.j;
}
public boolean p() {
return this.l;
}
public JSONObject q() {
JSONObject jSONObject = new JSONObject();
jSONObject.put("uniqueId", this.a);
jSONObject.put("communicatorRequestId", this.m);
jSONObject.put("httpMethod", this.b);
jSONObject.put("targetUrl", this.c);
jSONObject.put("backupUrl", this.d);
jSONObject.put("encodingType", this.h);
jSONObject.put("isEncodingEnabled", this.i);
jSONObject.put("gzipBodyEncoding", this.j);
jSONObject.put("isAllowedPreInitEvent", this.k);
jSONObject.put("attemptNumber", this.n);
if (this.e != null) {
jSONObject.put("parameters", new JSONObject(this.e));
}
if (this.f != null) {
jSONObject.put("httpHeaders", new JSONObject(this.f));
}
if (this.g != null) {
jSONObject.put("requestBody", new JSONObject(this.g));
}
return jSONObject;
}
public String toString() {
return "PostbackRequest{uniqueId='" + this.a + "', communicatorRequestId='" + this.m + "', httpMethod='" + this.b + "', targetUrl='" + this.c + "', backupUrl='" + this.d + "', attemptNumber=" + this.n + ", isEncodingEnabled=" + this.i + ", isGzipBodyEncoding=" + this.j + ", isAllowedPreInitEvent=" + this.k + ", shouldFireInWebView=" + this.l + '}';
}
public d(JSONObject jSONObject, j jVar) {
String string = JsonUtils.getString(jSONObject, "uniqueId", UUID.randomUUID().toString());
String string2 = JsonUtils.getString(jSONObject, "communicatorRequestId", "");
String string3 = JsonUtils.getString(jSONObject, "httpMethod", "");
String string4 = jSONObject.getString("targetUrl");
String string5 = JsonUtils.getString(jSONObject, "backupUrl", "");
int i = jSONObject.getInt("attemptNumber");
Map synchronizedMap = JsonUtils.valueExists(jSONObject, "parameters") ? Collections.synchronizedMap(JsonUtils.toStringMap(jSONObject.getJSONObject("parameters"))) : new HashMap();
Map synchronizedMap2 = JsonUtils.valueExists(jSONObject, "httpHeaders") ? Collections.synchronizedMap(JsonUtils.toStringMap(jSONObject.getJSONObject("httpHeaders"))) : new HashMap();
Map synchronizedMap3 = JsonUtils.valueExists(jSONObject, "requestBody") ? Collections.synchronizedMap(JsonUtils.toStringObjectMap(jSONObject.getJSONObject("requestBody"))) : new HashMap();
this.a = string;
this.b = string3;
this.m = string2;
this.c = string4;
this.d = string5;
this.e = synchronizedMap;
this.f = synchronizedMap2;
this.g = synchronizedMap3;
this.h = vi.a.a(jSONObject.optInt("encodingType", vi.a.DEFAULT.b()));
this.i = jSONObject.optBoolean("isEncodingEnabled", false);
this.j = jSONObject.optBoolean("gzipBodyEncoding", false);
this.k = jSONObject.optBoolean("isAllowedPreInitEvent", false);
this.l = jSONObject.optBoolean("shouldFireInWebView", false);
this.n = i;
}
private d(b bVar) {
this.a = UUID.randomUUID().toString();
this.b = bVar.b;
this.c = bVar.c;
this.d = bVar.d;
this.e = bVar.e;
this.f = bVar.f;
this.g = bVar.g;
this.h = bVar.h;
this.i = bVar.i;
this.j = bVar.j;
this.k = bVar.k;
this.l = bVar.l;
this.m = bVar.a;
this.n = 0;
}
public static class b {
private String a;
private String b;
private String c;
private String d;
private Map e;
private Map f;
private Map g;
private vi.a h;
private boolean i;
private boolean j;
private boolean k;
private boolean l;
public b a(vi.a aVar) {
this.h = aVar;
return this;
}
public b a(String str) {
this.d = str;
return this;
}
public b a(Map map) {
this.f = map;
return this;
}
public b a(boolean z) {
this.i = z;
return this;
}
public b b(String str) {
this.a = str;
return this;
}
public b b(Map map) {
this.e = map;
return this;
}
public b b(boolean z) {
this.l = z;
return this;
}
public b c(String str) {
this.b = str;
return this;
}
public b c(Map map) {
this.g = map;
return this;
}
public b c(boolean z) {
this.j = z;
return this;
}
public b d(String str) {
this.c = str;
return this;
}
public b d(boolean z) {
this.k = z;
return this;
}
public d a() {
return new d(this);
}
}
}

View File

@@ -0,0 +1,155 @@
package com.applovin.impl.sdk.network;
import com.applovin.impl.sdk.j;
import com.applovin.impl.sdk.network.a;
import com.applovin.impl.sj;
import com.applovin.impl.vi;
import java.util.Map;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public class e extends com.applovin.impl.sdk.network.a {
private String s;
private boolean t;
public e(a aVar) {
super(aVar);
this.s = aVar.r;
this.t = aVar.s;
}
public static a b(j jVar) {
return new a(jVar);
}
public String s() {
return this.s;
}
public boolean t() {
return this.s != null;
}
public boolean u() {
return this.t;
}
public static class a extends a.C0040a {
private String r;
private boolean s;
public a(j jVar) {
super(jVar);
this.h = ((Integer) jVar.a(sj.a3)).intValue();
this.i = ((Integer) jVar.a(sj.Z2)).intValue();
this.j = ((Integer) jVar.a(sj.j3)).intValue();
}
@Override // com.applovin.impl.sdk.network.a.C0040a
/* renamed from: b, reason: merged with bridge method [inline-methods] */
public a a(vi.a aVar) {
this.q = aVar;
return this;
}
@Override // com.applovin.impl.sdk.network.a.C0040a
/* renamed from: b, reason: merged with bridge method [inline-methods] */
public a a(Object obj) {
this.g = obj;
return this;
}
@Override // com.applovin.impl.sdk.network.a.C0040a
/* renamed from: b, reason: merged with bridge method [inline-methods] */
public a a(JSONObject jSONObject) {
this.f = jSONObject;
return this;
}
@Override // com.applovin.impl.sdk.network.a.C0040a
/* renamed from: c, reason: merged with bridge method [inline-methods] */
public a a(Map map) {
this.e = map;
return this;
}
@Override // com.applovin.impl.sdk.network.a.C0040a
/* renamed from: d, reason: merged with bridge method [inline-methods] */
public a a(int i) {
this.h = i;
return this;
}
@Override // com.applovin.impl.sdk.network.a.C0040a
/* renamed from: d, reason: merged with bridge method [inline-methods] */
public a a(String str) {
this.c = str;
return this;
}
@Override // com.applovin.impl.sdk.network.a.C0040a
/* renamed from: d, reason: merged with bridge method [inline-methods] */
public a b(Map map) {
this.d = map;
return this;
}
@Override // com.applovin.impl.sdk.network.a.C0040a
/* renamed from: e, reason: merged with bridge method [inline-methods] */
public a b(int i) {
this.j = i;
return this;
}
public a e(String str) {
this.r = str;
return this;
}
@Override // com.applovin.impl.sdk.network.a.C0040a
/* renamed from: f, reason: merged with bridge method [inline-methods] */
public a c(int i) {
this.i = i;
return this;
}
@Override // com.applovin.impl.sdk.network.a.C0040a
/* renamed from: f, reason: merged with bridge method [inline-methods] */
public a b(String str) {
this.b = str;
return this;
}
@Override // com.applovin.impl.sdk.network.a.C0040a
/* renamed from: g, reason: merged with bridge method [inline-methods] */
public a c(String str) {
this.a = str;
return this;
}
@Override // com.applovin.impl.sdk.network.a.C0040a
/* renamed from: g, reason: merged with bridge method [inline-methods] */
public a a(boolean z) {
this.n = z;
return this;
}
public a h(boolean z) {
this.s = z;
return this;
}
@Override // com.applovin.impl.sdk.network.a.C0040a
/* renamed from: i, reason: merged with bridge method [inline-methods] */
public a b(boolean z) {
this.p = z;
return this;
}
@Override // com.applovin.impl.sdk.network.a.C0040a
/* renamed from: b, reason: merged with bridge method [inline-methods] */
public e a() {
return new e(this);
}
}
}

View File

@@ -0,0 +1,178 @@
package com.applovin.impl.sdk;
import com.applovin.impl.ge;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
/* loaded from: classes2.dex */
public class o {
private final n a;
private final Map b = new HashMap(5);
private final Object c = new Object();
private final Map d = Collections.synchronizedMap(new HashMap(5));
private final Map e = Collections.synchronizedMap(new HashMap(5));
public static class a {
private final String a;
private final String b;
private final String c;
private String d;
private String e;
public a(String str, String str2, String str3) {
this.a = str;
this.b = str2;
this.c = str3;
}
public String a() {
return this.b;
}
public boolean a(Object obj) {
return obj instanceof a;
}
public String b() {
return this.a;
}
public String c() {
return this.c;
}
public String d() {
return this.d;
}
public String e() {
return this.e;
}
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof a)) {
return false;
}
a aVar = (a) obj;
if (!aVar.a(this)) {
return false;
}
String b = b();
String b2 = aVar.b();
if (b != null ? !b.equals(b2) : b2 != null) {
return false;
}
String a = a();
String a2 = aVar.a();
if (a != null ? !a.equals(a2) : a2 != null) {
return false;
}
String c = c();
String c2 = aVar.c();
if (c != null ? !c.equals(c2) : c2 != null) {
return false;
}
String d = d();
String d2 = aVar.d();
if (d != null ? !d.equals(d2) : d2 != null) {
return false;
}
String e = e();
String e2 = aVar.e();
return e != null ? e.equals(e2) : e2 == null;
}
public int hashCode() {
String b = b();
int hashCode = b == null ? 43 : b.hashCode();
String a = a();
int hashCode2 = ((hashCode + 59) * 59) + (a == null ? 43 : a.hashCode());
String c = c();
int hashCode3 = (hashCode2 * 59) + (c == null ? 43 : c.hashCode());
String d = d();
int hashCode4 = (hashCode3 * 59) + (d == null ? 43 : d.hashCode());
String e = e();
return (hashCode4 * 59) + (e != null ? e.hashCode() : 43);
}
public String toString() {
return "MediationWaterfallWinnerTracker.WinningAd(bCode=" + b() + ", adapterName=" + a() + ", networkName=" + c() + ", secondWinnerAdapterName=" + d() + ", secondWinnerNetworkName=" + e() + ")";
}
}
public o(j jVar) {
this.a = jVar.J();
}
public void c(ge geVar) {
a(geVar, null);
}
public a c(String str) {
a aVar;
synchronized (this.c) {
aVar = (a) this.b.get(str);
}
return aVar;
}
public void b(ge geVar) {
this.d.put(geVar.getAdUnitId(), geVar.S());
}
public String b(String str) {
return (String) this.d.get(str);
}
public void a(ge geVar) {
synchronized (this.c) {
try {
String adUnitId = geVar.getAdUnitId();
a aVar = (a) this.b.get(adUnitId);
if (aVar == null) {
if (n.a()) {
this.a.a("MediationWaterfallWinnerTracker", "No previous winner to clear.");
}
return;
}
if (geVar.B().equals(aVar.b())) {
if (n.a()) {
this.a.a("MediationWaterfallWinnerTracker", "Clearing previous winning ad: " + aVar);
}
this.b.remove(adUnitId);
} else if (n.a()) {
this.a.a("MediationWaterfallWinnerTracker", "Previous winner not cleared for ad: " + geVar + " , since it could have already been updated with a new ad: " + aVar);
}
} catch (Throwable th) {
throw th;
}
}
}
public void a(ge geVar, ge geVar2) {
synchronized (this.c) {
try {
if (n.a()) {
this.a.a("MediationWaterfallWinnerTracker", "Tracking winning ad: " + geVar);
}
a aVar = new a(geVar.B(), geVar.c(), geVar.getNetworkName());
if (geVar2 != null) {
aVar.d = geVar2.c();
aVar.e = geVar2.getNetworkName();
}
this.b.put(geVar.getAdUnitId(), aVar);
} catch (Throwable th) {
throw th;
}
}
this.e.put(geVar.getAdUnitId(), geVar.S());
}
public String a(String str) {
return (String) this.e.get(str);
}
}

View File

@@ -0,0 +1,67 @@
package com.applovin.impl.sdk;
import com.applovin.impl.sdk.ad.AppLovinAdImpl;
import java.util.LinkedList;
import java.util.Queue;
/* loaded from: classes2.dex */
class p {
private final Queue a = new LinkedList();
private final Object b = new Object();
public void a(AppLovinAdImpl appLovinAdImpl) {
synchronized (this.b) {
try {
if (b() <= 25) {
this.a.offer(appLovinAdImpl);
} else {
n.h("AppLovinSdk", "Maximum queue capacity reached - discarding ad...");
}
} catch (Throwable th) {
throw th;
}
}
}
public int b() {
int size;
synchronized (this.b) {
size = this.a.size();
}
return size;
}
public boolean c() {
boolean z;
synchronized (this.b) {
z = b() == 0;
}
return z;
}
public AppLovinAdImpl d() {
AppLovinAdImpl appLovinAdImpl;
synchronized (this.b) {
appLovinAdImpl = (AppLovinAdImpl) this.a.peek();
}
return appLovinAdImpl;
}
public void b(AppLovinAdImpl appLovinAdImpl) {
synchronized (this.b) {
this.a.remove(appLovinAdImpl);
}
}
public AppLovinAdImpl a() {
AppLovinAdImpl appLovinAdImpl;
synchronized (this.b) {
try {
appLovinAdImpl = !c() ? (AppLovinAdImpl) this.a.poll() : null;
} catch (Throwable th) {
throw th;
}
}
return appLovinAdImpl;
}
}

View File

@@ -0,0 +1,323 @@
package com.applovin.impl.sdk;
import android.adservices.measurement.MeasurementManager;
import android.adservices.topics.GetTopicsRequest;
import android.adservices.topics.GetTopicsResponse;
import android.adservices.topics.Topic;
import android.adservices.topics.TopicsManager;
import android.content.Context;
import android.net.Uri;
import android.os.OutcomeReceiver;
import android.text.TextUtils;
import android.view.InputEvent;
import androidx.privacysandbox.ads.adservices.measurement.MeasurementManager$Api33Ext5Impl$$ExternalSyntheticApiModelOutline23;
import androidx.privacysandbox.ads.adservices.measurement.MeasurementManager$Api33Ext5Impl$$ExternalSyntheticApiModelOutline24;
import androidx.privacysandbox.ads.adservices.topics.TopicsManagerApi33Ext4Impl$$ExternalSyntheticApiModelOutline0;
import androidx.privacysandbox.ads.adservices.topics.TopicsManagerApi33Ext4Impl$$ExternalSyntheticApiModelOutline1;
import androidx.privacysandbox.ads.adservices.topics.TopicsManagerApi33Ext5Impl$$ExternalSyntheticApiModelOutline3;
import androidx.privacysandbox.ads.adservices.topics.TopicsManagerImplCommon$$ExternalSyntheticApiModelOutline1;
import androidx.privacysandbox.ads.adservices.topics.TopicsManagerImplCommon$$ExternalSyntheticApiModelOutline3;
import com.applovin.impl.jn;
import com.applovin.impl.sdk.utils.JsonUtils;
import com.applovin.impl.sj;
import com.applovin.impl.tm;
import com.applovin.impl.wh;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.concurrent.Executor;
import java.util.concurrent.atomic.AtomicReference;
import org.json.JSONArray;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public class q {
private final j a;
private final Executor b;
private final MeasurementManager e;
private final TopicsManager h;
private final Set c = new HashSet();
private final Object d = new Object();
private final AtomicReference f = new AtomicReference(new JSONArray());
private final d g = new d(this, null);
public class a implements OutcomeReceiver {
public a() {
}
/* renamed from: a, reason: merged with bridge method [inline-methods] */
public void onError(Exception exc) {
q.this.a.J();
if (n.a()) {
q.this.a.J().a("PrivacySandboxService", "Failed to register impression", exc);
}
}
public void onResult(Object obj) {
q.this.a.J();
if (n.a()) {
q.this.a.J().a("PrivacySandboxService", "Successfully registered impression");
}
}
}
public class b implements OutcomeReceiver {
public b() {
}
/* renamed from: a, reason: merged with bridge method [inline-methods] */
public void onError(Exception exc) {
q.this.a.J();
if (n.a()) {
q.this.a.J().a("PrivacySandboxService", "Failed to register click", exc);
}
}
public void onResult(Object obj) {
q.this.a.J();
if (n.a()) {
q.this.a.J().a("PrivacySandboxService", "Successfully registered click");
}
}
}
public class c implements OutcomeReceiver {
public c() {
}
/* renamed from: a, reason: merged with bridge method [inline-methods] */
public void onError(Exception exc) {
q.this.a.J();
if (n.a()) {
q.this.a.J().a("PrivacySandboxService", "Failed to register conversion", exc);
}
}
public void onResult(Object obj) {
q.this.a.J();
if (n.a()) {
q.this.a.J().a("PrivacySandboxService", "Successfully registered conversion");
}
}
}
public class d implements OutcomeReceiver {
private d() {
}
public void a(GetTopicsResponse getTopicsResponse) {
List topics;
int topicId;
long modelVersion;
long taxonomyVersion;
topics = getTopicsResponse.getTopics();
int size = topics.size();
q.this.a.J();
if (n.a()) {
q.this.a.J().d("PrivacySandboxService", size + " topic(s) received");
}
JSONArray jSONArray = new JSONArray();
Iterator it = topics.iterator();
while (it.hasNext()) {
Topic m = TopicsManagerImplCommon$$ExternalSyntheticApiModelOutline3.m(it.next());
JSONObject jSONObject = new JSONObject();
topicId = m.getTopicId();
JsonUtils.putInt(jSONObject, "id", topicId);
modelVersion = m.getModelVersion();
JsonUtils.putLong(jSONObject, "model", modelVersion);
taxonomyVersion = m.getTaxonomyVersion();
JsonUtils.putLong(jSONObject, "taxonomy", taxonomyVersion);
jSONArray.put(jSONObject);
}
q.this.f.set(jSONArray);
q.this.b(((Boolean) q.this.a.a(sj.K6)).booleanValue(), ((Long) q.this.a.a(sj.I6)).longValue());
}
public /* bridge */ /* synthetic */ void onResult(Object obj) {
a(TopicsManagerImplCommon$$ExternalSyntheticApiModelOutline1.m(obj));
}
public /* synthetic */ d(q qVar, a aVar) {
this();
}
/* renamed from: a, reason: merged with bridge method [inline-methods] */
public void onError(Exception exc) {
String str;
Long l = (Long) q.this.a.a(sj.J6);
boolean z = l.longValue() == -1;
q.this.a.J();
if (n.a()) {
n J = q.this.a.J();
StringBuilder sb = new StringBuilder();
sb.append("Failed to retrieve topics");
if (z) {
str = "";
} else {
str = ", retrying in " + l + " ms";
}
sb.append(str);
J.a("PrivacySandboxService", sb.toString(), exc);
}
if (z) {
return;
}
q.this.b(((Boolean) q.this.a.a(sj.L6)).booleanValue(), l.longValue());
}
}
public q(j jVar) {
this.a = jVar;
this.b = jVar.j0().a();
Context l = j.l();
this.e = MeasurementManager$Api33Ext5Impl$$ExternalSyntheticApiModelOutline24.m(l.getSystemService(MeasurementManager$Api33Ext5Impl$$ExternalSyntheticApiModelOutline23.m()));
this.h = TopicsManagerApi33Ext4Impl$$ExternalSyntheticApiModelOutline1.m(l.getSystemService(TopicsManagerApi33Ext4Impl$$ExternalSyntheticApiModelOutline0.m()));
if (((Boolean) jVar.a(sj.H6)).booleanValue()) {
b(((Boolean) jVar.a(sj.K6)).booleanValue(), 0L);
}
}
private boolean c(String str) {
synchronized (this.d) {
try {
if (this.c.contains(str)) {
return false;
}
this.c.add(str);
return true;
} catch (Throwable th) {
throw th;
}
}
}
public void b(final List list) {
a("register impression", new Runnable() { // from class: com.applovin.impl.sdk.q$$ExternalSyntheticLambda1
@Override // java.lang.Runnable
public final void run() {
q.this.a(list);
}
});
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void a(List list) {
if (list == null || list.isEmpty() || this.e == null || !wh.e(j.w0)) {
return;
}
this.a.J();
if (n.a()) {
this.a.J().a("PrivacySandboxService", "Registering impression...");
}
Iterator it = list.iterator();
while (it.hasNext()) {
this.e.registerSource(Uri.parse((String) it.next()), null, this.b, new a());
}
}
public void b(final List list, final InputEvent inputEvent) {
a("register click", new Runnable() { // from class: com.applovin.impl.sdk.q$$ExternalSyntheticLambda3
@Override // java.lang.Runnable
public final void run() {
q.this.a(list, inputEvent);
}
});
}
public void b(final String str) {
a("register conversion trigger event", new Runnable() { // from class: com.applovin.impl.sdk.q$$ExternalSyntheticLambda2
@Override // java.lang.Runnable
public final void run() {
q.this.a(str);
}
});
}
/* JADX INFO: Access modifiers changed from: private */
public void b(final boolean z, final long j) {
a("retrieve topics", new Runnable() { // from class: com.applovin.impl.sdk.q$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
q.this.a(z, j);
}
});
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void a(List list, InputEvent inputEvent) {
if (list == null || list.isEmpty() || this.e == null || !wh.e(j.w0)) {
return;
}
this.a.J();
if (n.a()) {
this.a.J().a("PrivacySandboxService", "Registering click...");
}
Iterator it = list.iterator();
while (it.hasNext()) {
this.e.registerSource(Uri.parse((String) it.next()), inputEvent, this.b, new b());
}
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void a(String str) {
if (TextUtils.isEmpty(str) || this.e == null || !wh.e(j.w0)) {
return;
}
this.a.J();
if (n.a()) {
this.a.J().a("PrivacySandboxService", "Registering conversion: " + str);
}
this.e.registerTrigger(Uri.parse(str), this.b, new c());
}
public JSONArray a() {
return (JSONArray) this.f.get();
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void a(boolean z, long j) {
GetTopicsRequest.Builder shouldRecordObservation;
GetTopicsRequest.Builder adsSdkName;
final GetTopicsRequest build;
if (this.h == null) {
return;
}
shouldRecordObservation = TopicsManagerApi33Ext5Impl$$ExternalSyntheticApiModelOutline3.m().setShouldRecordObservation(z);
adsSdkName = shouldRecordObservation.setAdsSdkName("AppLovin");
build = adsSdkName.build();
if (j > 0) {
this.a.j0().a(new jn(this.a, true, "getTopics", new Runnable() { // from class: com.applovin.impl.sdk.q$$ExternalSyntheticLambda4
@Override // java.lang.Runnable
public final void run() {
q.this.a(build);
}
}), tm.b.OTHER, j);
} else {
this.h.getTopics(build, this.b, this.g);
}
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void a(GetTopicsRequest getTopicsRequest) {
this.h.getTopics(getTopicsRequest, this.b, this.g);
}
private void a(String str, Runnable runnable) {
try {
this.a.J();
if (n.a()) {
this.a.J().a("PrivacySandboxService", "Running operation: " + str);
}
runnable.run();
} catch (Throwable th) {
this.a.J();
if (n.a()) {
this.a.J().a("PrivacySandboxService", "Failed to run operation: " + str, th);
}
if (c(str)) {
this.a.E().a("PrivacySandboxService", str, th);
}
}
}
}

View File

@@ -0,0 +1,448 @@
package com.applovin.impl.sdk.utils;
import android.os.Bundle;
import android.os.Parcelable;
import android.text.TextUtils;
import androidx.annotation.Nullable;
import com.applovin.impl.sdk.n;
import com.applovin.sdk.AppLovinSdkUtils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public class BundleUtils {
public static boolean containsAtLeastOneKey(Set<String> set, Bundle bundle) {
if (set != null && !set.isEmpty()) {
Iterator<String> it = set.iterator();
while (it.hasNext()) {
if (bundle.containsKey(it.next())) {
return true;
}
}
}
return false;
}
public static boolean getBoolean(String str, Bundle bundle) {
return getBoolean(str, false, bundle);
}
public static Bundle getBundle(String str, Bundle bundle) {
return getBundle(str, null, bundle);
}
public static int getInt(String str, Bundle bundle) {
return getInt(str, 0, bundle);
}
public static long getLong(String str, Bundle bundle) {
return getLong(str, 0L, bundle);
}
public static String getString(String str, Bundle bundle) {
return getString(str, null, bundle);
}
public static void put(String str, @Nullable Object obj, Bundle bundle) {
if (obj == null) {
n.h("AppLovinSdk", "Skipped insertion into Bundle because value is null.");
return;
}
if (obj instanceof String) {
putString(str, (String) obj, bundle);
return;
}
if (obj instanceof Boolean) {
putBoolean(str, (Boolean) obj, bundle);
return;
}
if (obj instanceof Integer) {
putInt(str, (Integer) obj, bundle);
return;
}
if (obj instanceof Long) {
putLong(str, (Long) obj, bundle);
return;
}
if (obj instanceof Double) {
putDouble(str, (Double) obj, bundle);
return;
}
if (obj instanceof Byte) {
putByte(str, (Byte) obj, bundle);
return;
}
if (obj instanceof Character) {
putChar(str, (Character) obj, bundle);
return;
}
if (obj instanceof Float) {
putFloat(str, (Float) obj, bundle);
return;
}
if (obj instanceof Short) {
putShort(str, (Short) obj, bundle);
return;
}
if (obj instanceof CharSequence) {
putCharSequence(str, (CharSequence) obj, bundle);
return;
}
if (obj instanceof String[]) {
putStringArray(str, (String[]) obj, bundle);
return;
}
if (obj instanceof boolean[]) {
putBooleanArray(str, (boolean[]) obj, bundle);
return;
}
if (obj instanceof int[]) {
putIntArray(str, (int[]) obj, bundle);
return;
}
if (obj instanceof long[]) {
putLongArray(str, (long[]) obj, bundle);
return;
}
if (obj instanceof double[]) {
putDoubleArray(str, (double[]) obj, bundle);
return;
}
if (obj instanceof byte[]) {
putByteArray(str, (byte[]) obj, bundle);
return;
}
if (obj instanceof char[]) {
putCharArray(str, (char[]) obj, bundle);
return;
}
if (obj instanceof float[]) {
putFloatArray(str, (float[]) obj, bundle);
return;
}
if (obj instanceof short[]) {
putShortArray(str, (short[]) obj, bundle);
return;
}
if (obj instanceof CharSequence[]) {
putCharSequenceArray(str, (CharSequence[]) obj, bundle);
return;
}
if (obj instanceof ArrayList) {
ArrayList arrayList = (ArrayList) obj;
if (arrayList.size() > 0) {
if (arrayList.get(0) instanceof String) {
putStringArrayList(str, arrayList, bundle);
return;
} else if (arrayList.get(0) instanceof Integer) {
putIntegerArrayList(str, arrayList, bundle);
return;
} else {
if (arrayList.get(0) instanceof CharSequence) {
putCharSequenceArrayList(str, arrayList, bundle);
return;
}
return;
}
}
}
n.h("AppLovinSdk", "Skipped insertion of " + obj + " into Bundle");
}
public static void putBoolean(String str, @Nullable Boolean bool, Bundle bundle) {
if (bool != null) {
bundle.putBoolean(str, bool.booleanValue());
}
}
public static void putBooleanArray(String str, @Nullable boolean[] zArr, Bundle bundle) {
if (zArr != null) {
bundle.putBooleanArray(str, zArr);
}
}
public static void putByte(String str, @Nullable Byte b, Bundle bundle) {
if (b != null) {
bundle.putByte(str, b.byteValue());
}
}
public static void putByteArray(String str, @Nullable byte[] bArr, Bundle bundle) {
if (bArr != null) {
bundle.putByteArray(str, bArr);
}
}
public static void putChar(String str, @Nullable Character ch, Bundle bundle) {
if (ch != null) {
bundle.putChar(str, ch.charValue());
}
}
public static void putCharArray(String str, @Nullable char[] cArr, Bundle bundle) {
if (cArr != null) {
bundle.putCharArray(str, cArr);
}
}
public static void putCharSequence(String str, @Nullable CharSequence charSequence, Bundle bundle) {
if (charSequence != null) {
bundle.putCharSequence(str, charSequence);
}
}
public static void putCharSequenceArray(String str, @Nullable CharSequence[] charSequenceArr, Bundle bundle) {
if (charSequenceArr != null) {
bundle.putCharSequenceArray(str, charSequenceArr);
}
}
public static void putCharSequenceArrayList(String str, @Nullable ArrayList<CharSequence> arrayList, Bundle bundle) {
if (arrayList != null) {
bundle.putCharSequenceArrayList(str, arrayList);
}
}
public static void putDouble(String str, @Nullable Double d, Bundle bundle) {
if (d != null) {
bundle.putDouble(str, d.doubleValue());
}
}
public static void putDoubleArray(String str, @Nullable double[] dArr, Bundle bundle) {
if (dArr != null) {
bundle.putDoubleArray(str, dArr);
}
}
public static void putFloat(String str, @Nullable Float f, Bundle bundle) {
if (f != null) {
bundle.putFloat(str, f.floatValue());
}
}
public static void putFloatArray(String str, @Nullable float[] fArr, Bundle bundle) {
if (fArr != null) {
bundle.putFloatArray(str, fArr);
}
}
public static void putInt(String str, @Nullable Integer num, Bundle bundle) {
if (num != null) {
bundle.putInt(str, num.intValue());
}
}
public static void putIntArray(String str, @Nullable int[] iArr, Bundle bundle) {
if (iArr != null) {
bundle.putIntArray(str, iArr);
}
}
public static void putIntegerArrayList(String str, @Nullable ArrayList<Integer> arrayList, Bundle bundle) {
if (arrayList != null) {
bundle.putIntegerArrayList(str, arrayList);
}
}
public static void putLong(String str, @Nullable Long l, Bundle bundle) {
if (l != null) {
bundle.putLong(str, l.longValue());
}
}
public static void putLongArray(String str, @Nullable long[] jArr, Bundle bundle) {
if (jArr != null) {
bundle.putLongArray(str, jArr);
}
}
public static void putShort(String str, @Nullable Short sh, Bundle bundle) {
if (sh != null) {
bundle.putShort(str, sh.shortValue());
}
}
public static void putShortArray(String str, @Nullable short[] sArr, Bundle bundle) {
if (sArr != null) {
bundle.putShortArray(str, sArr);
}
}
public static void putString(String str, @Nullable String str2, Bundle bundle) {
if (str2 != null) {
bundle.putString(str, str2);
}
}
public static void putStringArray(String str, @Nullable String[] strArr, Bundle bundle) {
if (strArr != null) {
bundle.putStringArray(str, strArr);
}
}
public static void putStringArrayList(String str, @Nullable ArrayList<String> arrayList, Bundle bundle) {
if (arrayList != null) {
bundle.putStringArrayList(str, arrayList);
}
}
public static void putStringIfValid(String str, @Nullable String str2, Bundle bundle) {
if (AppLovinSdkUtils.isValidString(str2)) {
bundle.putString(str, str2);
}
}
public static JSONObject toJSONObject(Bundle bundle) {
if (bundle == null) {
return new JSONObject();
}
JSONObject jSONObject = new JSONObject();
try {
for (String str : bundle.keySet()) {
Object obj = bundle.get(str);
if (obj != null) {
if (obj instanceof Bundle) {
jSONObject.put(str, toJSONObject((Bundle) obj));
} else {
if (!(obj instanceof Collection) && !(obj instanceof Parcelable[])) {
jSONObject.put(str, obj);
}
Collection asList = obj instanceof Collection ? (Collection) obj : Arrays.asList((Parcelable[]) obj);
JSONArray jSONArray = new JSONArray();
for (Object obj2 : asList) {
if (obj2 instanceof Bundle) {
jSONArray.put(toJSONObject((Bundle) obj2));
} else {
jSONArray.put(obj2);
}
}
jSONObject.put(str, jSONArray);
}
}
}
} catch (JSONException e) {
n.c("AppLovinSdk", "Failed to convert Bundle to JSONObject", e);
}
return jSONObject;
}
public static Map<String, Object> toMap(Bundle bundle) {
if (bundle == null) {
return new HashMap();
}
HashMap hashMap = new HashMap(bundle.size());
for (String str : bundle.keySet()) {
Object obj = bundle.get(str);
if (obj != null) {
if (obj instanceof Bundle) {
hashMap.put(str, toMap((Bundle) obj));
} else {
boolean z = obj instanceof Collection;
if (z || (obj instanceof Parcelable[])) {
Collection asList = z ? (Collection) obj : Arrays.asList((Parcelable[]) obj);
ArrayList arrayList = new ArrayList();
for (Object obj2 : asList) {
if (obj2 instanceof Bundle) {
arrayList.add(toMap((Bundle) obj2));
} else {
arrayList.add(obj2);
}
}
hashMap.put(str, arrayList);
} else {
hashMap.put(str, obj);
}
}
}
}
return hashMap;
}
public static Map<String, String> toStringMap(Bundle bundle) {
if (bundle == null) {
return new HashMap(0);
}
HashMap hashMap = new HashMap(bundle.size());
for (String str : bundle.keySet()) {
hashMap.put(str, String.valueOf(bundle.get(str)));
}
return hashMap;
}
public static boolean getBoolean(String str, boolean z, Bundle bundle) {
if (!TextUtils.isEmpty(str) && bundle != null && bundle.containsKey(str)) {
Object obj = bundle.get(str);
if (obj instanceof Boolean) {
return ((Boolean) obj).booleanValue();
}
if (obj instanceof Number) {
return ((Number) obj).intValue() != 0;
}
if (obj instanceof String) {
String str2 = (String) obj;
if (str2.equalsIgnoreCase("true") || str2.equalsIgnoreCase("1")) {
return true;
}
if (str2.equalsIgnoreCase("false") || str2.equalsIgnoreCase("0")) {
return false;
}
return z;
}
}
return z;
}
public static Bundle getBundle(String str, Bundle bundle, Bundle bundle2) {
Bundle bundle3;
return (TextUtils.isEmpty(str) || bundle2 == null || (bundle3 = bundle2.getBundle(str)) == null) ? bundle : bundle3;
}
public static int getInt(String str, int i, Bundle bundle) {
if (!TextUtils.isEmpty(str) && bundle != null && bundle.containsKey(str)) {
Object obj = bundle.get(str);
if (obj instanceof Number) {
return ((Number) obj).intValue();
}
if (obj instanceof String) {
try {
return Integer.parseInt((String) obj);
} catch (NumberFormatException unused) {
}
}
}
return i;
}
public static long getLong(String str, long j, Bundle bundle) {
if (!TextUtils.isEmpty(str) && bundle != null && bundle.containsKey(str)) {
Object obj = bundle.get(str);
if (obj instanceof Number) {
return ((Number) obj).longValue();
}
if (obj instanceof String) {
try {
return Long.parseLong((String) obj);
} catch (NumberFormatException unused) {
}
}
}
return j;
}
public static String getString(String str, String str2, Bundle bundle) {
if (TextUtils.isEmpty(str) || bundle == null || !bundle.containsKey(str)) {
return str2;
}
Object obj = bundle.get(str);
return obj instanceof String ? (String) obj : String.valueOf(obj);
}
}

View File

@@ -0,0 +1,274 @@
package com.applovin.impl.sdk.utils;
import android.os.Bundle;
import android.os.Parcelable;
import android.text.TextUtils;
import androidx.annotation.Nullable;
import com.applovin.impl.sdk.n;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public class CollectionUtils {
public static <T> boolean addObjectIfExists(@Nullable T t, List<T> list) {
if (t != null) {
return list.add(t);
}
return false;
}
public static <T> boolean addUniqueObjectIfExists(@Nullable T t, List<T> list) {
if (t == null || list.contains(t)) {
return false;
}
return list.add(t);
}
public static <T> void addUniqueObjectsIfExists(@Nullable List<T> list, List<T> list2) {
if (list == null) {
return;
}
for (T t : list) {
if (!list2.contains(t)) {
list2.add(t);
}
}
}
public static List<String> explode(String str) {
return explode(str, ",\\s*");
}
public static boolean getBoolean(Map<String, Object> map, String str) {
return getBoolean(map, str, false);
}
@Nullable
public static <T> Set<T> getDifferenceSet(@Nullable Set<T> set, @Nullable Set<T> set2) {
if (set == null) {
return null;
}
if (set2 == null) {
return new HashSet(set);
}
HashSet hashSet = new HashSet(set);
hashSet.removeAll(set2);
return hashSet;
}
public static HashMap<String, String> hashMap(String str, String str2) {
return (HashMap) map(str, str2);
}
public static String implode(Collection<String> collection, int i) {
return implode(collection, ",", i);
}
public static <K, V> boolean isEmpty(@Nullable Map<K, V> map) {
return map == null || map.isEmpty();
}
public static <K, V> Map<K, V> map(Map<K, V> map) {
return map == null ? new HashMap() : new HashMap(map);
}
public static void putBooleanIfValid(String str, Boolean bool, Map map) {
if (!StringUtils.isValidString(str) || bool == null) {
return;
}
map.put(str, bool);
}
public static void putDoubleIfValid(String str, Double d, Map map) {
if (!StringUtils.isValidString(str) || d == null) {
return;
}
map.put(str, d);
}
public static void putFloatIfValid(String str, Float f, Map map) {
if (!StringUtils.isValidString(str) || f == null) {
return;
}
map.put(str, f);
}
public static void putIntegerIfValid(String str, Integer num, Map map) {
if (!StringUtils.isValidString(str) || num == null) {
return;
}
map.put(str, num);
}
public static void putJsonArrayIfValid(String str, JSONArray jSONArray, Map map) {
if (!StringUtils.isValidString(str) || jSONArray == null || jSONArray.length() <= 0) {
return;
}
map.put(str, jSONArray);
}
public static void putLongIfValid(String str, Long l, Map map) {
if (!StringUtils.isValidString(str) || l == null) {
return;
}
map.put(str, l);
}
public static void putObjectToStringIfValid(String str, Object obj, Map map) {
if (obj == null) {
return;
}
putStringIfValid(str, obj.toString(), map);
}
public static void putStringIfValid(String str, String str2, Map map) {
if (StringUtils.isValidString(str) && StringUtils.isValidString(str2)) {
map.put(str, str2);
}
}
public static List<String> removeTrimmedEmptyStrings(List<String> list) {
if (list == null) {
return null;
}
ArrayList arrayList = new ArrayList();
Iterator<String> it = list.iterator();
while (it.hasNext()) {
String trim = it.next().trim();
if (!TextUtils.isEmpty(trim)) {
arrayList.add(trim);
}
}
return arrayList;
}
public static <T> List<T> synchronizedList() {
return synchronizedList(-1);
}
public static Bundle toBundle(Map<String, ?> map) {
if (map == null || map.size() == 0) {
return new Bundle();
}
Bundle bundle = new Bundle();
for (String str : map.keySet()) {
Object obj = map.get(str);
if (obj instanceof Map) {
bundle.putBundle(str, toBundle((Map) obj));
} else if (obj instanceof Boolean) {
bundle.putBoolean(str, ((Boolean) obj).booleanValue());
} else if (obj instanceof String) {
bundle.putString(str, (String) obj);
} else if (obj instanceof Integer) {
bundle.putInt(str, ((Integer) obj).intValue());
} else if (obj instanceof Long) {
bundle.putLong(str, ((Long) obj).longValue());
} else if (obj instanceof Double) {
bundle.putDouble(str, ((Double) obj).doubleValue());
} else if (obj instanceof Parcelable) {
bundle.putParcelable(str, (Parcelable) obj);
}
}
return bundle;
}
@Nullable
public static JSONArray toJSONArray(String[] strArr) {
if (strArr == null) {
return null;
}
JSONArray jSONArray = new JSONArray();
for (String str : strArr) {
jSONArray.put(str);
}
return jSONArray;
}
public static JSONObject toJson(Map<String, ?> map) throws JSONException {
if (map == null) {
return new JSONObject();
}
JSONObject jSONObject = new JSONObject();
for (Map.Entry<String, ?> entry : map.entrySet()) {
jSONObject.put(entry.getKey(), entry.getValue());
}
return jSONObject;
}
public static String toJsonString(Map<String, String> map, String str) {
try {
return toJson(map).toString();
} catch (JSONException e) {
n.c("CollectionUtils", "Failed to convert map '" + map + "' to JSON string.", e);
return str;
}
}
public static List<String> explode(String str, String str2) {
return TextUtils.isEmpty(str) ? Collections.emptyList() : Arrays.asList(str.split(str2));
}
public static boolean getBoolean(Map<String, Object> map, String str, boolean z) {
if (map != null && map.containsKey(str)) {
Object obj = map.get(str);
if (obj instanceof String) {
return Boolean.parseBoolean((String) obj);
}
if (obj instanceof Boolean) {
return ((Boolean) obj).booleanValue();
}
if (obj instanceof Number) {
return ((Number) obj).intValue() >= 1;
}
}
return z;
}
public static String implode(Collection<String> collection, String str, int i) {
if (str == null) {
throw new IllegalArgumentException("No glue specified");
}
if (collection == null || collection.size() < 1) {
return "";
}
StringBuilder sb = new StringBuilder();
int i2 = 0;
for (String str2 : collection) {
if (i2 >= i) {
break;
}
i2++;
sb.append(str2);
sb.append(str);
}
if (sb.length() > str.length()) {
sb.setLength(sb.length() - str.length());
}
return sb.toString();
}
public static <E> boolean isEmpty(@Nullable Collection<E> collection) {
return collection == null || collection.isEmpty();
}
public static <T> List<T> synchronizedList(int i) {
return i >= 0 ? Collections.synchronizedList(new ArrayList(i)) : Collections.synchronizedList(new ArrayList());
}
public static <K, V> Map<K, V> map(K k, V v) {
HashMap hashMap = new HashMap(1);
hashMap.put(k, v);
return hashMap;
}
}

View File

@@ -0,0 +1,200 @@
package com.applovin.impl.sdk.utils;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Point;
import android.graphics.drawable.BitmapDrawable;
import android.net.Uri;
import android.os.StrictMode;
import android.webkit.URLUtil;
import android.widget.ImageView;
import com.applovin.impl.sdk.j;
import com.applovin.impl.sdk.n;
import com.applovin.impl.sj;
import com.applovin.impl.yp;
import com.applovin.impl.z3;
import com.applovin.sdk.AppLovinSdkUtils;
import com.google.firebase.perf.network.FirebasePerfUrlConnection;
import java.io.InputStream;
import java.net.URL;
/* loaded from: classes2.dex */
public class ImageViewUtils {
/* JADX INFO: Access modifiers changed from: private */
public static /* synthetic */ void a(final j jVar, String str, final ImageView imageView, Uri uri) {
if (!((Boolean) jVar.a(sj.D)).booleanValue()) {
InputStream inputStream = null;
try {
inputStream = FirebasePerfUrlConnection.openStream(new URL(str));
final Bitmap decodeStream = BitmapFactory.decodeStream(inputStream);
AppLovinSdkUtils.runOnUiThread(new Runnable() { // from class: com.applovin.impl.sdk.utils.ImageViewUtils$$ExternalSyntheticLambda1
@Override // java.lang.Runnable
public final void run() {
ImageViewUtils.b(j.this, decodeStream, imageView);
}
});
return;
} catch (Throwable th) {
try {
jVar.J();
if (n.a()) {
jVar.J().a("ImageViewUtils", "Failed to fetch image: " + uri, th);
}
return;
} finally {
yp.a(inputStream, jVar);
}
}
}
try {
InputStream openStream = FirebasePerfUrlConnection.openStream(new URL(str));
try {
final Bitmap decodeStream2 = BitmapFactory.decodeStream(openStream);
AppLovinSdkUtils.runOnUiThread(new Runnable() { // from class: com.applovin.impl.sdk.utils.ImageViewUtils$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
ImageViewUtils.a(j.this, decodeStream2, imageView);
}
});
if (openStream != null) {
openStream.close();
}
} finally {
}
} catch (Throwable th2) {
jVar.J();
if (n.a()) {
jVar.J().a("ImageViewUtils", "Failed to fetch image: " + uri, th2);
}
jVar.J().a("ImageViewUtils", th2);
jVar.E().a("ImageViewUtils", "setImageUri", th2);
}
}
/* JADX INFO: Access modifiers changed from: private */
public static /* synthetic */ void b(ImageView imageView, Uri uri) {
StrictMode.ThreadPolicy allowThreadDiskReads = StrictMode.allowThreadDiskReads();
imageView.setImageURI(uri);
StrictMode.setThreadPolicy(allowThreadDiskReads);
}
public static void setAndDownscaleBitmap(final ImageView imageView, final Uri uri) {
if (uri == null || imageView == null) {
return;
}
j jVar = j.v0;
if (jVar == null) {
n.h("ImageViewUtils", "SDK has not been initialized");
} else {
jVar.j0().b().execute(new Runnable() { // from class: com.applovin.impl.sdk.utils.ImageViewUtils$$ExternalSyntheticLambda2
@Override // java.lang.Runnable
public final void run() {
ImageViewUtils.a(uri, imageView);
}
});
}
}
public static void setAndDownscaleImageUri(final ImageView imageView, final Uri uri) {
if (uri == null || imageView == null) {
return;
}
if (imageView.getHeight() <= 0 || imageView.getWidth() <= 0) {
imageView.post(new Runnable() { // from class: com.applovin.impl.sdk.utils.ImageViewUtils$$ExternalSyntheticLambda3
@Override // java.lang.Runnable
public final void run() {
ImageViewUtils.setAndDownscaleBitmap(imageView, uri);
}
});
} else {
setAndDownscaleBitmap(imageView, uri);
}
}
public static void setImageUri(final ImageView imageView, final Uri uri, final j jVar) {
if (imageView == null || uri == null) {
return;
}
final String uri2 = uri.toString();
if (URLUtil.isFileUrl(uri2) || URLUtil.isContentUrl(uri2)) {
AppLovinSdkUtils.runOnUiThread(new Runnable() { // from class: com.applovin.impl.sdk.utils.ImageViewUtils$$ExternalSyntheticLambda6
@Override // java.lang.Runnable
public final void run() {
ImageViewUtils.b(imageView, uri);
}
});
return;
}
if (jVar == null) {
return;
}
jVar.J();
if (n.a()) {
jVar.J().a("ImageViewUtils", "Fetching image: " + uri);
}
jVar.j0().b().execute(new Runnable() { // from class: com.applovin.impl.sdk.utils.ImageViewUtils$$ExternalSyntheticLambda5
@Override // java.lang.Runnable
public final void run() {
ImageViewUtils.a(j.this, uri2, imageView, uri);
}
});
}
/* JADX INFO: Access modifiers changed from: private */
public static /* synthetic */ void b(j jVar, Bitmap bitmap, ImageView imageView) {
jVar.J();
if (n.a()) {
jVar.J().a("ImageViewUtils", "Image fetched");
}
imageView.setImageDrawable(new BitmapDrawable(j.l().getResources(), bitmap));
}
/* JADX INFO: Access modifiers changed from: private */
public static /* synthetic */ void a(j jVar, Bitmap bitmap, ImageView imageView) {
jVar.J();
if (n.a()) {
jVar.J().a("ImageViewUtils", "Image fetched");
}
imageView.setImageDrawable(new BitmapDrawable(j.l().getResources(), bitmap));
}
/* JADX INFO: Access modifiers changed from: private */
public static /* synthetic */ void a(Uri uri, final ImageView imageView) {
BitmapFactory.Options options = new BitmapFactory.Options();
int i = 1;
options.inJustDecodeBounds = true;
BitmapFactory.decodeFile(uri.getPath(), options);
int height = imageView.getHeight();
int width = imageView.getWidth();
if (height <= 0 || width <= 0) {
Point b = z3.b(imageView.getContext());
height = Math.min(b.x, b.y);
width = height;
}
int i2 = options.outHeight;
int i3 = options.outWidth;
if (i2 > height || i3 > width) {
while (true) {
int i4 = i * 2;
if (i2 / i4 < height && i3 / i4 < width) {
break;
} else {
i = i4;
}
}
}
options.inSampleSize = i;
options.inJustDecodeBounds = false;
j.v0.J();
if (n.a()) {
j.v0.J().a("ImageViewUtils", "Loading image: " + uri.getLastPathSegment() + "...");
}
final Bitmap decodeFile = BitmapFactory.decodeFile(uri.getPath(), options);
AppLovinSdkUtils.runOnUiThread(new Runnable() { // from class: com.applovin.impl.sdk.utils.ImageViewUtils$$ExternalSyntheticLambda4
@Override // java.lang.Runnable
public final void run() {
imageView.setImageBitmap(decodeFile);
}
});
}
}

View File

@@ -0,0 +1,686 @@
package com.applovin.impl.sdk.utils;
import android.os.Bundle;
import android.text.TextUtils;
import androidx.annotation.Nullable;
import com.applovin.impl.sdk.n;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public class JsonUtils {
public static final String EMPTY_JSON = "{}";
private static List a(JSONArray jSONArray, List list) {
if (jSONArray == null) {
return list;
}
ArrayList arrayList = new ArrayList(jSONArray.length());
for (int i = 0; i < jSONArray.length(); i++) {
arrayList.add(a(jSONArray.get(i)));
}
return arrayList;
}
public static boolean containsCaseInsensitiveString(String str, JSONArray jSONArray) {
for (int i = 0; i < jSONArray.length(); i++) {
try {
Object obj = jSONArray.get(i);
if ((obj instanceof String) && ((String) obj).equalsIgnoreCase(str)) {
return true;
}
} catch (JSONException unused) {
}
}
return false;
}
public static boolean containsJSONObjectContainingInt(JSONArray jSONArray, int i, String str) {
if (jSONArray != null && jSONArray.length() != 0) {
for (int i2 = 0; i2 < jSONArray.length(); i2++) {
JSONObject optJSONObject = jSONArray.optJSONObject(i2);
if (optJSONObject != null && optJSONObject.optInt(str) == i) {
return true;
}
}
}
return false;
}
public static JSONObject deepCopy(JSONObject jSONObject) {
JSONObject jSONObject2 = new JSONObject();
Iterator<String> keys = jSONObject.keys();
while (keys.hasNext()) {
String next = keys.next();
try {
Object obj = jSONObject.get(next);
if (obj instanceof JSONObject) {
jSONObject2.put(next, deepCopy((JSONObject) obj));
} else if (obj instanceof JSONArray) {
jSONObject2.put(next, deepCopy((JSONArray) obj));
} else {
jSONObject2.put(next, obj);
}
} catch (JSONException unused) {
n.l("JsonUtils", "Failed to copy over item for key '" + next + "' to JSONObject deep copy");
}
}
return jSONObject2;
}
@Nullable
public static JSONObject deserialize(String str) {
if (TextUtils.isEmpty(str)) {
return null;
}
try {
return new JSONObject(str);
} catch (Throwable th) {
n.b("JsonUtils", "Failed to deserialize into JSON: " + str, th);
return null;
}
}
public static Boolean getBoolean(JSONObject jSONObject, String str, Boolean bool) {
if (jSONObject == null || !jSONObject.has(str)) {
return bool;
}
try {
return Boolean.valueOf(jSONObject.getBoolean(str));
} catch (JSONException unused) {
return Boolean.valueOf(getInt(jSONObject, str, (bool == null || !bool.booleanValue()) ? 0 : 1) > 0);
}
}
public static double getDouble(JSONObject jSONObject, String str, double d) {
if (jSONObject == null || !jSONObject.has(str)) {
return d;
}
try {
return jSONObject.getDouble(str);
} catch (JSONException e) {
n.b("JsonUtils", "Failed to retrieve double property for key = " + str, e);
return d;
}
}
public static float getFloat(JSONObject jSONObject, String str, float f) {
if (jSONObject == null || !jSONObject.has(str)) {
return f;
}
try {
double d = jSONObject.getDouble(str);
return (-3.4028234663852886E38d >= d || d >= 3.4028234663852886E38d) ? f : (float) d;
} catch (JSONException e) {
n.b("JsonUtils", "Failed to retrieve float property for key = " + str, e);
return f;
}
}
public static int getInt(JSONObject jSONObject, String str, int i) {
if (jSONObject == null || !jSONObject.has(str)) {
return i;
}
try {
return jSONObject.getInt(str);
} catch (JSONException e) {
n.b("JsonUtils", "Failed to retrieve int property for key = " + str, e);
return i;
}
}
@Nullable
public static Integer getInteger(@Nullable JSONObject jSONObject, String str, @Nullable Integer num) {
if (jSONObject == null || !jSONObject.has(str)) {
return num;
}
try {
return Integer.valueOf(jSONObject.getInt(str));
} catch (JSONException e) {
n.b("JsonUtils", "Failed to retrieve int property for key = " + str, e);
return num;
}
}
public static List<Integer> getIntegerList(JSONObject jSONObject, String str, List<Integer> list) {
JSONArray jSONArray = getJSONArray(jSONObject, str, null);
return jSONArray != null ? toIntegerList(jSONArray) : list;
}
public static JSONArray getJSONArray(JSONObject jSONObject, String str, JSONArray jSONArray) {
if (jSONObject == null || !jSONObject.has(str)) {
return jSONArray;
}
try {
return jSONObject.getJSONArray(str);
} catch (JSONException e) {
n.b("JsonUtils", "Failed to retrieve JSON array for key = " + str, e);
return jSONArray;
}
}
@Nullable
public static JSONObject getJSONObject(JSONObject jSONObject, String str) {
return getJSONObject(jSONObject, str, (JSONObject) null);
}
public static List getList(JSONObject jSONObject, String str, List list) {
try {
JSONArray jSONArray = getJSONArray(jSONObject, str, null);
return jSONArray != null ? toList(jSONArray) : list;
} catch (JSONException unused) {
return list;
}
}
public static long getLong(JSONObject jSONObject, String str, long j) {
if (jSONObject == null || !jSONObject.has(str)) {
return j;
}
try {
return jSONObject.getLong(str);
} catch (JSONException e) {
n.b("JsonUtils", "Failed to retrieve long property for key = " + str, e);
return j;
}
}
public static Object getObject(JSONObject jSONObject, String str, Object obj) {
if (jSONObject == null || !jSONObject.has(str)) {
return obj;
}
try {
Object obj2 = jSONObject.get(str);
return obj2 != null ? obj2 : obj;
} catch (JSONException e) {
n.b("JsonUtils", "Failed to retrieve Object for key = " + str, e);
return obj;
}
}
public static Object getObjectAtIndex(JSONArray jSONArray, int i, Object obj) {
if (jSONArray == null || jSONArray.length() <= i) {
return obj;
}
try {
return jSONArray.get(i);
} catch (JSONException e) {
n.b("JsonUtils", "Failed to retrieve object at index " + i + " for JSON array", e);
return obj;
}
}
public static String getString(JSONObject jSONObject, String str, String str2) {
if (jSONObject == null) {
return str2;
}
try {
return jSONObject.has(str) ? jSONObject.getString(str) : str2;
} catch (Exception e) {
n.b("JsonUtils", "Failed to retrieve string property for key = " + str, e);
return str2;
}
}
public static List<String> getStringList(JSONObject jSONObject, String str, List<String> list) {
JSONArray jSONArray = getJSONArray(jSONObject, str, null);
return jSONArray != null ? toStringList(jSONArray) : list;
}
public static JSONObject jsonObjectFromJsonString(String str, JSONObject jSONObject) {
try {
return new JSONObject(str);
} catch (JSONException e) {
n.b("JsonUtils", "Failed to convert JSON string '" + str + "' to JSONObject", e);
return jSONObject;
}
}
public static String maybeConvertToIndentedString(JSONObject jSONObject) {
if (jSONObject == null) {
return null;
}
try {
return jSONObject.toString(4);
} catch (JSONException unused) {
return jSONObject.toString();
}
}
public static <T> List<T> optList(JSONArray jSONArray, List<T> list) {
try {
return a(jSONArray, list);
} catch (JSONException unused) {
return list;
}
}
public static void putAll(JSONObject jSONObject, JSONObject jSONObject2) {
if (jSONObject == null || jSONObject2 == null) {
return;
}
Iterator<String> keys = jSONObject2.keys();
while (keys.hasNext()) {
String next = keys.next();
Object object = getObject(jSONObject2, next, null);
if (object != null) {
putObject(jSONObject, next, object);
}
}
}
public static void putBoolean(JSONObject jSONObject, String str, boolean z) {
if (jSONObject != null) {
try {
jSONObject.put(str, z);
} catch (JSONException e) {
n.b("JsonUtils", "Failed to put boolean property for key = " + str, e);
}
}
}
public static void putBooleanIfValid(JSONObject jSONObject, String str, Boolean bool) {
if (!StringUtils.isValidString(str) || bool == null) {
return;
}
putBoolean(jSONObject, str, bool.booleanValue());
}
public static void putDouble(JSONObject jSONObject, String str, double d) {
if (jSONObject != null) {
try {
jSONObject.put(str, d);
} catch (JSONException e) {
n.b("JsonUtils", "Failed to put double property for key = " + str, e);
}
}
}
public static void putInt(JSONObject jSONObject, String str, int i) {
if (jSONObject != null) {
try {
jSONObject.put(str, i);
} catch (JSONException e) {
n.b("JsonUtils", "Failed to put int property for key = " + str, e);
}
}
}
public static void putJSONObject(JSONObject jSONObject, String str, JSONObject jSONObject2) {
if (jSONObject != null) {
try {
jSONObject.put(str, jSONObject2);
} catch (JSONException e) {
n.b("JsonUtils", "Failed to put JSON property for key = " + str, e);
}
}
}
public static void putJSONObjectIfValid(JSONObject jSONObject, String str, JSONObject jSONObject2) {
if (jSONObject2 == null || jSONObject2.length() == 0) {
return;
}
putJSONObject(jSONObject, str, jSONObject2);
}
public static void putJsonArray(JSONObject jSONObject, String str, JSONArray jSONArray) {
if (jSONObject != null) {
try {
jSONObject.put(str, jSONArray);
} catch (JSONException e) {
n.b("JsonUtils", "Failed to put JSONArray property for key = " + str, e);
}
}
}
public static void putJsonArrayIfValid(JSONObject jSONObject, String str, JSONArray jSONArray) {
if (jSONArray == null || jSONArray.length() == 0) {
return;
}
putJsonArray(jSONObject, str, jSONArray);
}
public static void putLong(JSONObject jSONObject, String str, long j) {
if (jSONObject != null) {
try {
jSONObject.put(str, j);
} catch (JSONException e) {
n.b("JsonUtils", "Failed to put long property for key = " + str, e);
}
}
}
public static void putObject(JSONObject jSONObject, String str, Object obj) {
if (jSONObject != null) {
try {
jSONObject.put(str, obj);
} catch (JSONException e) {
n.b("JsonUtils", "Failed to put Object property for key = " + str, e);
}
}
}
public static void putString(JSONObject jSONObject, String str, String str2) {
if (jSONObject != null) {
try {
jSONObject.put(str, str2);
} catch (JSONException e) {
n.b("JsonUtils", "Failed to put String property for key = " + str, e);
}
}
}
public static void putStringIfValid(JSONArray jSONArray, String str) {
if (StringUtils.isValidString(str)) {
jSONArray.put(str);
}
}
public static void removeObjectsForKeys(JSONObject jSONObject, String[] strArr) {
for (String str : strArr) {
jSONObject.remove(str);
}
}
public static JSONObject shallowCopy(JSONObject jSONObject) {
JSONObject jSONObject2 = new JSONObject();
Iterator<String> keys = jSONObject.keys();
while (keys.hasNext()) {
String next = keys.next();
try {
jSONObject2.put(next, jSONObject.get(next));
} catch (JSONException unused) {
n.l("JsonUtils", "Failed to copy over item for key '" + next + "' to JSONObject copy");
}
}
return jSONObject2;
}
public static Bundle toBundle(Object obj) {
JSONObject jSONObject;
if (obj instanceof JSONObject) {
jSONObject = (JSONObject) obj;
} else {
if (obj instanceof String) {
try {
jSONObject = new JSONObject((String) obj);
} catch (JSONException unused) {
}
}
jSONObject = null;
}
return toBundle(jSONObject);
}
public static List<Integer> toIntegerList(JSONArray jSONArray) {
ArrayList arrayList = new ArrayList();
for (int i = 0; i < jSONArray.length(); i++) {
try {
arrayList.add((Integer) jSONArray.get(i));
} catch (Throwable unused) {
}
}
return arrayList;
}
public static <T> List<T> toList(JSONArray jSONArray) throws JSONException {
return a(jSONArray, new ArrayList());
}
public static List<String> toStringList(JSONArray jSONArray) {
ArrayList arrayList = new ArrayList();
for (int i = 0; i < jSONArray.length(); i++) {
try {
arrayList.add((String) jSONArray.get(i));
} catch (Throwable unused) {
}
}
return arrayList;
}
public static Map<String, String> toStringMap(JSONObject jSONObject) throws JSONException {
HashMap hashMap = new HashMap();
Iterator<String> keys = jSONObject.keys();
while (keys.hasNext()) {
String next = keys.next();
hashMap.put(next, a(jSONObject.get(next)).toString());
}
return hashMap;
}
public static Map<String, Object> toStringObjectMap(JSONObject jSONObject) throws JSONException {
HashMap hashMap = new HashMap();
Iterator<String> keys = jSONObject.keys();
while (keys.hasNext()) {
String next = keys.next();
hashMap.put(next, a(jSONObject.get(next)));
}
return hashMap;
}
public static Map<String, String> tryToStringMap(JSONObject jSONObject) {
HashMap hashMap = new HashMap();
Iterator<String> keys = jSONObject.keys();
while (keys.hasNext()) {
String next = keys.next();
try {
Object a = a(jSONObject.get(next));
hashMap.put(next, a != null ? a.toString() : null);
} catch (Throwable unused) {
}
}
return hashMap;
}
public static boolean valueExists(JSONObject jSONObject, String str) {
return jSONObject != null && jSONObject.has(str);
}
@Nullable
public static JSONObject getJSONObject(JSONObject jSONObject, String str, @Nullable JSONObject jSONObject2) {
if (jSONObject == null || !jSONObject.has(str)) {
return jSONObject2;
}
try {
return jSONObject.getJSONObject(str);
} catch (JSONException e) {
n.b("JsonUtils", "Failed to retrieve JSON property for key = " + str, e);
return jSONObject2;
}
}
public static boolean valueExists(JSONArray jSONArray, Object obj) {
if (jSONArray != null && obj != null) {
for (int i = 0; i < jSONArray.length(); i++) {
if (obj.equals(getObjectAtIndex(jSONArray, i, null))) {
return true;
}
}
}
return false;
}
public static void putStringIfValid(JSONObject jSONObject, String str, String str2) {
if (StringUtils.isValidString(str) && StringUtils.isValidString(str2)) {
putString(jSONObject, str, str2);
}
}
private static Object a(Object obj) {
if (obj == JSONObject.NULL) {
return null;
}
if (obj instanceof JSONObject) {
return toStringObjectMap((JSONObject) obj);
}
return obj instanceof JSONArray ? toList((JSONArray) obj) : obj;
}
public static String maybeConvertToIndentedString(String str, int i) {
if (TextUtils.isEmpty(str)) {
return str;
}
try {
return new JSONObject(str).toString(i);
} catch (JSONException unused) {
return str;
}
}
public static Map<String, Object> toStringObjectMap(String str) {
try {
return toStringObjectMap(new JSONObject(str));
} catch (JSONException e) {
n.b("JsonUtils", "Failed to convert json string '" + str + "' to map", e);
return new HashMap();
}
}
@Nullable
public static Double getDouble(JSONObject jSONObject, String str, @Nullable Double d) {
if (jSONObject == null || !jSONObject.has(str)) {
return d;
}
try {
return Double.valueOf(jSONObject.getDouble(str));
} catch (JSONException e) {
n.b("JsonUtils", "Failed to retrieve Double property for key = " + str, e);
return d;
}
}
public static JSONArray getJSONArray(Object obj) {
if (obj == null) {
return new JSONArray();
}
JSONArray jSONArray = new JSONArray();
jSONArray.put(obj);
return jSONArray;
}
public static JSONObject getJSONObject(JSONArray jSONArray, int i, JSONObject jSONObject) {
if (jSONArray == null || i >= jSONArray.length()) {
return jSONObject;
}
try {
return jSONArray.getJSONObject(i);
} catch (JSONException e) {
n.b("JsonUtils", "Failed to retrieve JSON object from array for index = " + i, e);
return jSONObject;
}
}
public static void putAll(JSONObject jSONObject, Map<String, ?> map) {
if (jSONObject == null || map == null) {
return;
}
for (Map.Entry<String, ?> entry : map.entrySet()) {
String key = entry.getKey();
Object value = entry.getValue();
if (value != null) {
putObject(jSONObject, key, value);
}
}
}
@Nullable
public static Float getFloat(JSONObject jSONObject, String str, @Nullable Float f) {
if (jSONObject == null || !jSONObject.has(str)) {
return f;
}
try {
double d = jSONObject.getDouble(str);
return (-3.4028234663852886E38d >= d || d >= 3.4028234663852886E38d) ? f : Float.valueOf((float) d);
} catch (JSONException e) {
n.b("JsonUtils", "Failed to retrieve float property for key = " + str, e);
return f;
}
}
public static JSONArray shallowCopy(JSONArray jSONArray) {
JSONArray jSONArray2 = new JSONArray();
for (int i = 0; i < jSONArray.length(); i++) {
jSONArray2.put(jSONArray.opt(i));
}
return jSONArray2;
}
public static Bundle toBundle(JSONObject jSONObject) {
if (jSONObject != null && jSONObject.length() != 0) {
Bundle bundle = new Bundle();
Iterator<String> keys = jSONObject.keys();
while (keys.hasNext()) {
String next = keys.next();
if (jSONObject.isNull(next)) {
bundle.putString(next, null);
} else {
Object opt = jSONObject.opt(next);
if (opt instanceof JSONObject) {
bundle.putBundle(next, toBundle((JSONObject) opt));
} else if (opt instanceof JSONArray) {
JSONArray jSONArray = (JSONArray) opt;
if (jSONArray.length() == 0) {
bundle.putStringArrayList(next, new ArrayList<>(0));
} else if (getObjectAtIndex(jSONArray, 0, null) instanceof String) {
ArrayList<String> arrayList = new ArrayList<>(jSONArray.length());
for (int i = 0; i < jSONArray.length(); i++) {
arrayList.add((String) getObjectAtIndex(jSONArray, i, null));
}
bundle.putStringArrayList(next, arrayList);
} else {
bundle.putParcelableArrayList(next, toBundle(jSONArray));
}
} else if (opt instanceof Boolean) {
bundle.putBoolean(next, ((Boolean) opt).booleanValue());
} else if (opt instanceof String) {
bundle.putString(next, (String) opt);
} else if (opt instanceof Integer) {
bundle.putInt(next, ((Integer) opt).intValue());
} else if (opt instanceof Long) {
bundle.putLong(next, ((Long) opt).longValue());
} else if (opt instanceof Double) {
bundle.putDouble(next, ((Double) opt).doubleValue());
}
}
}
return bundle;
}
return new Bundle();
}
public static JSONArray deepCopy(JSONArray jSONArray) {
JSONArray jSONArray2 = new JSONArray();
for (int i = 0; i < jSONArray.length(); i++) {
try {
Object obj = jSONArray.get(i);
if (obj instanceof JSONObject) {
jSONArray2.put(i, deepCopy((JSONObject) obj));
} else if (obj instanceof JSONArray) {
jSONArray2.put(i, deepCopy((JSONArray) obj));
} else {
jSONArray2.put(i, obj);
}
} catch (JSONException unused) {
n.l("JsonUtils", "Failed to copy over item at index " + i + " to JSONArray deep copy");
}
}
return jSONArray2;
}
public static ArrayList<Bundle> toBundle(JSONArray jSONArray) {
if (jSONArray != null && jSONArray.length() != 0) {
ArrayList<Bundle> arrayList = new ArrayList<>(jSONArray.length());
for (int i = 0; i < jSONArray.length(); i++) {
arrayList.add(toBundle(jSONArray.optJSONObject(i)));
}
return arrayList;
}
return new ArrayList<>();
}
}

View File

@@ -0,0 +1,341 @@
package com.applovin.impl.sdk.utils;
import android.net.Uri;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.SpannedString;
import android.text.TextUtils;
import android.text.style.AbsoluteSizeSpan;
import android.text.style.ClickableSpan;
import android.text.style.ForegroundColorSpan;
import android.text.style.StyleSpan;
import com.applovin.exoplayer2.common.base.Ascii;
import com.unity3d.ads.core.data.datasource.AndroidStaticDeviceInfoDataSource;
import csdk.gluads.Consts;
import java.security.MessageDigest;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.TreeMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/* loaded from: classes2.dex */
public class StringUtils {
private static final char[] a = "0123456789abcdef".toCharArray();
public class a implements Comparator {
@Override // java.util.Comparator
/* renamed from: a, reason: merged with bridge method [inline-methods] */
public int compare(String str, String str2) {
return str.compareToIgnoreCase(str2);
}
}
private static String a(String str, Integer num) {
if (TextUtils.isEmpty(str)) {
return "";
}
try {
MessageDigest messageDigest = MessageDigest.getInstance(AndroidStaticDeviceInfoDataSource.ALGORITHM_SHA1);
messageDigest.update(str.getBytes("UTF-8"));
String hexString = toHexString(messageDigest.digest());
return num.intValue() > 0 ? hexString.substring(0, Math.min(num.intValue(), hexString.length())) : hexString;
} catch (Throwable th) {
throw new RuntimeException("SHA-1 for \"" + str + "\" failed.", th);
}
}
public static void addLinks(Spannable spannable, Pattern pattern, ClickableSpan clickableSpan, boolean z) {
Matcher matcher = pattern.matcher(spannable);
while (matcher.find()) {
int start = matcher.start();
int end = matcher.end();
spannable.setSpan(clickableSpan, start, end, 33);
if (z) {
spannable.setSpan(new StyleSpan(1), start, end, 256);
}
}
}
public static String appendQueryParameter(String str, String str2, String str3) {
if (TextUtils.isEmpty(str) || TextUtils.isEmpty(str2)) {
return str;
}
Uri.Builder buildUpon = Uri.parse(str).buildUpon();
buildUpon.appendQueryParameter(str2, str3);
return buildUpon.build().toString();
}
public static String appendQueryParameters(String str, Map<String, String> map, boolean z) {
if (TextUtils.isEmpty(str) || map == null || map.isEmpty()) {
return str;
}
if (z) {
TreeMap treeMap = new TreeMap(new a());
treeMap.putAll(map);
map = treeMap;
}
Uri.Builder buildUpon = Uri.parse(str).buildUpon();
for (Map.Entry<String, String> entry : map.entrySet()) {
buildUpon.appendQueryParameter(entry.getKey(), entry.getValue());
}
return buildUpon.build().toString();
}
public static boolean containsAtLeastOneSubstring(String str, List<String> list) {
Iterator<String> it = list.iterator();
while (it.hasNext()) {
if (str.contains(it.next())) {
return true;
}
}
return false;
}
public static boolean containsIgnoreCase(String str, String str2) {
return isValidString(str) && isValidString(str2) && str.toLowerCase().contains(str2.toLowerCase());
}
public static SpannedString createListItemDetailSpannedString(String str, int i) {
return createSpannedString(str, i, 16);
}
public static SpannedString createListItemDetailSubSpannedString(String str, int i) {
return createSpannedString(str, i, 12, 1);
}
public static SpannedString createSpannedString(String str, int i, int i2) {
return createSpannedString(str, i, i2, 0);
}
public static String emptyIfNull(String str) {
return str == null ? "" : str;
}
public static String encodeUriString(String str) {
return isValidString(str) ? Uri.encode(str) : "";
}
public static Boolean endsWith(String str, List<String> list) {
Iterator<String> it = list.iterator();
while (it.hasNext()) {
if (str.endsWith(it.next())) {
return Boolean.TRUE;
}
}
return Boolean.FALSE;
}
public static String getHost(String str) {
return Uri.parse(str).getHost();
}
public static String getHostAndPath(String str) {
Uri parse = Uri.parse(str);
return parse.getHost() + parse.getPath();
}
public static List<String> getRegexMatches(Matcher matcher, int i) {
matcher.reset();
ArrayList arrayList = new ArrayList();
while (matcher.find()) {
String group = matcher.group(i);
if (isValidString(group)) {
arrayList.add(group);
}
}
return arrayList;
}
public static boolean isAlphaNumeric(String str) {
if (isValidString(str)) {
return str.matches("^[a-zA-Z0-9]*$");
}
return false;
}
public static boolean isNumeric(String str) {
if (TextUtils.isEmpty(str)) {
return false;
}
char charAt = str.charAt(0);
int i = (charAt == '-' || charAt == '+') ? 1 : 0;
int length = str.length();
if (i == 1 && length == 1) {
return false;
}
while (i < length) {
if (!Character.isDigit(str.charAt(i))) {
return false;
}
i++;
}
return true;
}
public static boolean isValidString(String str) {
return !TextUtils.isEmpty(str);
}
public static String join(CharSequence charSequence, List<?> list) {
if (list == null || list.isEmpty()) {
return "";
}
StringBuilder sb = new StringBuilder();
Iterator<?> it = list.iterator();
while (it.hasNext()) {
sb.append(it.next());
sb.append(charSequence);
}
sb.delete((sb.length() - 1) - charSequence.length(), sb.length());
return sb.toString();
}
public static Matcher match(String str, String str2) {
return Pattern.compile(str2).matcher(str);
}
public static int parseInt(String str) {
return parseInt(str, 0);
}
public static long parseLong(String str, long j) {
return isNumeric(str) ? Long.parseLong(str) : j;
}
public static String prefixToIndex(int i, String str) {
if (TextUtils.isEmpty(str)) {
return str;
}
if (i > str.length()) {
i = str.length();
}
return str.substring(0, i);
}
public static String replace(String str, String str2, String str3) {
if (str3 == null) {
throw new IllegalArgumentException("No replacement target specified");
}
if (str == null || str.length() < 1 || str2 == null || str2.length() < 1) {
return str;
}
StringBuilder sb = new StringBuilder(str);
int indexOf = sb.indexOf(str2);
while (indexOf != -1) {
sb.replace(indexOf, str2.length() + indexOf, str3);
indexOf = sb.indexOf(str2, indexOf + str3.length());
}
return sb.toString();
}
public static void replaceAll(StringBuffer stringBuffer, String str, String str2) {
if (TextUtils.isEmpty(stringBuffer) || TextUtils.isEmpty(str)) {
return;
}
if (TextUtils.isEmpty(str2)) {
throw new IllegalArgumentException("No replacement target specified");
}
int indexOf = stringBuffer.indexOf(str);
while (indexOf != -1) {
stringBuffer.replace(indexOf, str.length() + indexOf, str2);
indexOf = stringBuffer.indexOf(str, indexOf + str2.length());
}
}
public static boolean startsWithAtLeastOnePrefix(String str, List<String> list) {
Iterator<String> it = list.iterator();
while (it.hasNext()) {
if (str.startsWith(it.next())) {
return true;
}
}
return false;
}
public static String toDigitsOnlyVersionString(String str) {
if (TextUtils.isEmpty(str)) {
return "";
}
String[] split = str.split("\\.");
ArrayList arrayList = new ArrayList(split.length);
for (String str2 : split) {
if (isValidString(str2)) {
String[] split2 = str2.split("[^0-9]+");
if (split2.length > 0) {
arrayList.add(split2[0]);
}
}
}
return TextUtils.join(Consts.STRING_PERIOD, arrayList);
}
public static String toFullSHA1Hash(String str) {
return a(str, -1);
}
public static String toHexString(byte[] bArr) {
if (bArr == null) {
throw new IllegalArgumentException("No data specified");
}
char[] cArr = new char[bArr.length * 2];
for (int i = 0; i < bArr.length; i++) {
int i2 = i * 2;
char[] cArr2 = a;
byte b = bArr[i];
cArr[i2] = cArr2[(b & 240) >>> 4];
cArr[i2 + 1] = cArr2[b & Ascii.SI];
}
return new String(cArr);
}
public static String toHumanReadableString(String str) {
if (!isValidString(str)) {
return "";
}
StringBuilder sb = new StringBuilder(str.length());
for (String str2 : str.split("_")) {
if (isValidString(str2)) {
if (str2.equals("id")) {
sb.append(str2.toUpperCase(Locale.ENGLISH));
} else {
String substring = str2.substring(0, 1);
Locale locale = Locale.ENGLISH;
sb.append(substring.toUpperCase(locale));
sb.append(str2.substring(1).toLowerCase(locale));
}
sb.append(" ");
}
}
return sb.deleteCharAt(sb.length() - 1).toString();
}
public static String toShortSHA1Hash(String str) {
return a(str, 16);
}
public static SpannedString createSpannedString(String str, int i, int i2, int i3) {
SpannableString spannableString = new SpannableString(str);
spannableString.setSpan(new ForegroundColorSpan(i), 0, spannableString.length(), 33);
spannableString.setSpan(new AbsoluteSizeSpan(i2, true), 0, spannableString.length(), 33);
spannableString.setSpan(new StyleSpan(i3), 0, spannableString.length(), 33);
return new SpannedString(spannableString);
}
public static int parseInt(String str, int i) {
return isNumeric(str) ? Integer.parseInt(str) : i;
}
public static String replace(String str, Map<String, String> map) {
if (str != null && map != null) {
for (Map.Entry<String, String> entry : map.entrySet()) {
str = str.replace(entry.getKey(), entry.getValue());
}
}
return str;
}
}