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,72 @@
package com.applovin.impl.mediation;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.applovin.impl.ge;
import com.applovin.mediation.MaxAd;
import com.applovin.mediation.MaxAdWaterfallInfo;
import com.applovin.mediation.MaxNetworkResponseInfo;
import java.util.List;
/* loaded from: classes2.dex */
public class MaxAdWaterfallInfoImpl implements MaxAdWaterfallInfo {
private final ge a;
private final String b;
private final String c;
private final List d;
private final long e;
private final List f;
private final String g;
@Override // com.applovin.mediation.MaxAdWaterfallInfo
public long getLatencyMillis() {
return this.e;
}
@Override // com.applovin.mediation.MaxAdWaterfallInfo
public MaxAd getLoadedAd() {
return this.a;
}
public String getMCode() {
return this.g;
}
@Override // com.applovin.mediation.MaxAdWaterfallInfo
public String getName() {
return this.b;
}
@Override // com.applovin.mediation.MaxAdWaterfallInfo
public List<MaxNetworkResponseInfo> getNetworkResponses() {
return this.d;
}
public List<String> getPostbackUrls() {
return this.f;
}
@Override // com.applovin.mediation.MaxAdWaterfallInfo
public String getTestName() {
return this.c;
}
@NonNull
public String toString() {
return "MaxAdWaterfallInfo{name=" + this.b + ", testName=" + this.c + ", networkResponses=" + this.d + ", latencyMillis=" + this.e + '}';
}
public MaxAdWaterfallInfoImpl(ge geVar, long j, List<MaxNetworkResponseInfo> list, String str) {
this(geVar, geVar.X(), geVar.Y(), j, list, geVar.W(), str);
}
public MaxAdWaterfallInfoImpl(@Nullable ge geVar, String str, String str2, long j, List<MaxNetworkResponseInfo> list, List<String> list2, String str3) {
this.a = geVar;
this.b = str;
this.c = str2;
this.d = list;
this.e = j;
this.f = list2;
this.g = str3;
}
}

View File

@@ -0,0 +1,128 @@
package com.applovin.impl.mediation;
import android.os.Bundle;
import androidx.annotation.Nullable;
import com.applovin.impl.ge;
import com.applovin.impl.pe;
import com.applovin.impl.zj;
import com.applovin.mediation.MaxAdFormat;
import com.applovin.mediation.adapter.parameters.MaxAdapterInitializationParameters;
import com.applovin.mediation.adapter.parameters.MaxAdapterResponseParameters;
import com.applovin.mediation.adapter.parameters.MaxAdapterSignalCollectionParameters;
import java.util.Map;
/* loaded from: classes2.dex */
public class MaxAdapterParametersImpl implements MaxAdapterResponseParameters, MaxAdapterSignalCollectionParameters, MaxAdapterInitializationParameters {
private String a;
private Map b;
private Bundle c;
private Bundle d;
private Boolean e;
private Boolean f;
private String g;
private boolean h;
private String i;
private String j;
private long k;
private MaxAdFormat l;
private MaxAdapterParametersImpl() {
}
@Override // com.applovin.mediation.adapter.parameters.MaxAdapterSignalCollectionParameters
public MaxAdFormat getAdFormat() {
return this.l;
}
@Override // com.applovin.mediation.adapter.parameters.MaxAdapterParameters
public String getAdUnitId() {
return this.a;
}
@Override // com.applovin.mediation.adapter.parameters.MaxAdapterResponseParameters
public long getBidExpirationMillis() {
return this.k;
}
@Override // com.applovin.mediation.adapter.parameters.MaxAdapterResponseParameters
public String getBidResponse() {
return this.j;
}
@Override // com.applovin.mediation.adapter.parameters.MaxAdapterParameters
@Nullable
public String getConsentString() {
return this.g;
}
@Override // com.applovin.mediation.adapter.parameters.MaxAdapterParameters
public Bundle getCustomParameters() {
return this.d;
}
@Override // com.applovin.mediation.adapter.parameters.MaxAdapterParameters
public Map<String, Object> getLocalExtraParameters() {
return this.b;
}
@Override // com.applovin.mediation.adapter.parameters.MaxAdapterParameters
public Bundle getServerParameters() {
return this.c;
}
@Override // com.applovin.mediation.adapter.parameters.MaxAdapterResponseParameters
public String getThirdPartyAdPlacementId() {
return this.i;
}
@Override // com.applovin.mediation.adapter.parameters.MaxAdapterParameters
@Nullable
public Boolean hasUserConsent() {
return this.e;
}
@Override // com.applovin.mediation.adapter.parameters.MaxAdapterParameters
@Nullable
public Boolean isAgeRestrictedUser() {
return null;
}
@Override // com.applovin.mediation.adapter.parameters.MaxAdapterParameters
@Nullable
public Boolean isDoNotSell() {
return this.f;
}
@Override // com.applovin.mediation.adapter.parameters.MaxAdapterParameters
public boolean isTesting() {
return this.h;
}
public static MaxAdapterParametersImpl a(ge geVar) {
MaxAdapterParametersImpl a = a((pe) geVar);
a.i = geVar.U();
a.j = geVar.D();
a.k = geVar.C();
return a;
}
public static MaxAdapterParametersImpl a(zj zjVar, String str, MaxAdFormat maxAdFormat) {
MaxAdapterParametersImpl a = a(zjVar);
a.a = str;
a.l = maxAdFormat;
return a;
}
public static MaxAdapterParametersImpl a(pe peVar) {
MaxAdapterParametersImpl maxAdapterParametersImpl = new MaxAdapterParametersImpl();
maxAdapterParametersImpl.a = peVar.getAdUnitId();
maxAdapterParametersImpl.e = peVar.n();
maxAdapterParametersImpl.f = peVar.o();
maxAdapterParametersImpl.g = peVar.d();
maxAdapterParametersImpl.b = peVar.i();
maxAdapterParametersImpl.c = peVar.l();
maxAdapterParametersImpl.d = peVar.f();
maxAdapterParametersImpl.h = peVar.p();
return maxAdapterParametersImpl;
}
}

View File

@@ -0,0 +1,111 @@
package com.applovin.impl.mediation;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.applovin.impl.sdk.utils.StringUtils;
import com.applovin.mediation.MaxAdWaterfallInfo;
import com.applovin.mediation.MaxError;
/* loaded from: classes2.dex */
public class MaxErrorImpl implements MaxError {
@Nullable
private String adLoadFailureInfo;
private final int errorCode;
private final String errorMessage;
private String loadTag;
private final int mediatedNetworkErrorCode;
private final String mediatedNetworkErrorMessage;
private long requestLatencyMillis;
private MaxAdWaterfallInfo waterfall;
public MaxErrorImpl(int i) {
this(i, "");
}
@Override // com.applovin.mediation.MaxError
@Nullable
public String getAdLoadFailureInfo() {
return this.adLoadFailureInfo;
}
@Override // com.applovin.mediation.MaxError
public int getCode() {
return this.errorCode;
}
public int getErrorCode() {
return this.errorCode;
}
public String getErrorMessage() {
return this.errorMessage;
}
@Nullable
public String getLoadTag() {
return this.loadTag;
}
@Override // com.applovin.mediation.MaxError
public int getMediatedNetworkErrorCode() {
return this.mediatedNetworkErrorCode;
}
@Override // com.applovin.mediation.MaxError
public String getMediatedNetworkErrorMessage() {
return this.mediatedNetworkErrorMessage;
}
@Override // com.applovin.mediation.MaxError
public String getMessage() {
return this.errorMessage;
}
@Override // com.applovin.mediation.MaxError
public long getRequestLatencyMillis() {
return this.requestLatencyMillis;
}
@Override // com.applovin.mediation.MaxError
@Nullable
public MaxAdWaterfallInfo getWaterfall() {
return this.waterfall;
}
public void setAdLoadFailureInfo(@Nullable String str) {
this.adLoadFailureInfo = str;
}
public void setLoadTag(@Nullable String str) {
this.loadTag = str;
}
public void setRequestLatencyMillis(long j) {
this.requestLatencyMillis = j;
}
public void setWaterfall(MaxAdWaterfallInfo maxAdWaterfallInfo) {
this.waterfall = maxAdWaterfallInfo;
}
@NonNull
public String toString() {
return "MaxError{code=" + getCode() + ", message=\"" + getMessage() + "\", mediatedNetworkErrorCode=" + getMediatedNetworkErrorCode() + ", mediatedNetworkErrorMessage=\"" + getMediatedNetworkErrorMessage() + "\"}";
}
public MaxErrorImpl(String str) {
this(-1, str);
}
public MaxErrorImpl(int i, String str) {
this(i, str, -1, "");
}
public MaxErrorImpl(int i, String str, int i2, String str2) {
this.errorCode = i;
this.errorMessage = StringUtils.emptyIfNull(str);
this.mediatedNetworkErrorCode = i2;
this.mediatedNetworkErrorMessage = StringUtils.emptyIfNull(str2);
}
}

View File

@@ -0,0 +1,40 @@
package com.applovin.impl.mediation;
import androidx.annotation.NonNull;
import com.applovin.impl.sdk.utils.JsonUtils;
import com.applovin.mediation.MaxMediatedNetworkInfo;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public class MaxMediatedNetworkInfoImpl implements MaxMediatedNetworkInfo {
private final JSONObject a;
public MaxMediatedNetworkInfoImpl(JSONObject jSONObject) {
this.a = jSONObject;
}
@Override // com.applovin.mediation.MaxMediatedNetworkInfo
public String getAdapterClassName() {
return JsonUtils.getString(this.a, "class", "");
}
@Override // com.applovin.mediation.MaxMediatedNetworkInfo
public String getAdapterVersion() {
return JsonUtils.getString(this.a, "version", "");
}
@Override // com.applovin.mediation.MaxMediatedNetworkInfo
public String getName() {
return JsonUtils.getString(this.a, "name", "");
}
@Override // com.applovin.mediation.MaxMediatedNetworkInfo
public String getSdkVersion() {
return JsonUtils.getString(this.a, "sdk_version", "");
}
@NonNull
public String toString() {
return "MaxMediatedNetworkInfo{name=" + getName() + ", adapterClassName=" + getAdapterClassName() + ", adapterVersion=" + getAdapterVersion() + ", sdkVersion=" + getSdkVersion() + '}';
}
}

View File

@@ -0,0 +1,197 @@
package com.applovin.impl.mediation;
import android.os.Bundle;
import androidx.annotation.Nullable;
import com.applovin.mediation.MaxError;
import com.applovin.mediation.MaxMediatedNetworkInfo;
import com.applovin.mediation.MaxNetworkResponseInfo;
/* loaded from: classes2.dex */
public class MaxNetworkResponseInfoImpl implements MaxNetworkResponseInfo {
private final MaxNetworkResponseInfo.AdLoadState a;
private final MaxMediatedNetworkInfo b;
private final Bundle c;
private final boolean d;
private final long e;
private final String f;
private final MaxError g;
public static /* synthetic */ class a {
static final /* synthetic */ int[] a;
static {
int[] iArr = new int[MaxNetworkResponseInfo.AdLoadState.values().length];
a = iArr;
try {
iArr[MaxNetworkResponseInfo.AdLoadState.FAILED_TO_LOAD.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
a[MaxNetworkResponseInfo.AdLoadState.AD_LOADED.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
}
}
public MaxNetworkResponseInfoImpl(MaxNetworkResponseInfo.AdLoadState adLoadState, MaxMediatedNetworkInfo maxMediatedNetworkInfo, Bundle bundle, boolean z, long j, String str, @Nullable MaxError maxError) {
this.a = adLoadState;
this.b = maxMediatedNetworkInfo;
this.c = bundle;
this.d = z;
this.e = j;
this.f = str;
this.g = maxError;
}
public boolean canEqual(Object obj) {
return obj instanceof MaxNetworkResponseInfoImpl;
}
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof MaxNetworkResponseInfoImpl)) {
return false;
}
MaxNetworkResponseInfoImpl maxNetworkResponseInfoImpl = (MaxNetworkResponseInfoImpl) obj;
if (!maxNetworkResponseInfoImpl.canEqual(this) || isBidding() != maxNetworkResponseInfoImpl.isBidding() || getLatencyMillis() != maxNetworkResponseInfoImpl.getLatencyMillis()) {
return false;
}
MaxNetworkResponseInfo.AdLoadState adLoadState = getAdLoadState();
MaxNetworkResponseInfo.AdLoadState adLoadState2 = maxNetworkResponseInfoImpl.getAdLoadState();
if (adLoadState != null ? !adLoadState.equals(adLoadState2) : adLoadState2 != null) {
return false;
}
MaxMediatedNetworkInfo mediatedNetwork = getMediatedNetwork();
MaxMediatedNetworkInfo mediatedNetwork2 = maxNetworkResponseInfoImpl.getMediatedNetwork();
if (mediatedNetwork != null ? !mediatedNetwork.equals(mediatedNetwork2) : mediatedNetwork2 != null) {
return false;
}
Bundle credentials = getCredentials();
Bundle credentials2 = maxNetworkResponseInfoImpl.getCredentials();
if (credentials != null ? !credentials.equals(credentials2) : credentials2 != null) {
return false;
}
String bCode = getBCode();
String bCode2 = maxNetworkResponseInfoImpl.getBCode();
if (bCode != null ? !bCode.equals(bCode2) : bCode2 != null) {
return false;
}
MaxError error = getError();
MaxError error2 = maxNetworkResponseInfoImpl.getError();
return error != null ? error.equals(error2) : error2 == null;
}
@Override // com.applovin.mediation.MaxNetworkResponseInfo
public MaxNetworkResponseInfo.AdLoadState getAdLoadState() {
return this.a;
}
public String getBCode() {
return this.f;
}
@Override // com.applovin.mediation.MaxNetworkResponseInfo
public Bundle getCredentials() {
return this.c;
}
@Override // com.applovin.mediation.MaxNetworkResponseInfo
@Nullable
public MaxError getError() {
return this.g;
}
@Override // com.applovin.mediation.MaxNetworkResponseInfo
public long getLatencyMillis() {
return this.e;
}
@Override // com.applovin.mediation.MaxNetworkResponseInfo
public MaxMediatedNetworkInfo getMediatedNetwork() {
return this.b;
}
public int hashCode() {
int i = isBidding() ? 79 : 97;
long latencyMillis = getLatencyMillis();
int i2 = ((i + 59) * 59) + ((int) (latencyMillis ^ (latencyMillis >>> 32)));
MaxNetworkResponseInfo.AdLoadState adLoadState = getAdLoadState();
int hashCode = (i2 * 59) + (adLoadState == null ? 43 : adLoadState.hashCode());
MaxMediatedNetworkInfo mediatedNetwork = getMediatedNetwork();
int hashCode2 = (hashCode * 59) + (mediatedNetwork == null ? 43 : mediatedNetwork.hashCode());
Bundle credentials = getCredentials();
int hashCode3 = (hashCode2 * 59) + (credentials == null ? 43 : credentials.hashCode());
String bCode = getBCode();
int hashCode4 = (hashCode3 * 59) + (bCode == null ? 43 : bCode.hashCode());
MaxError error = getError();
return (hashCode4 * 59) + (error != null ? error.hashCode() : 43);
}
@Override // com.applovin.mediation.MaxNetworkResponseInfo
public boolean isBidding() {
return this.d;
}
/* JADX WARN: Code restructure failed: missing block: B:4:0x0044, code lost:
if (r1 != 2) goto L9;
*/
@androidx.annotation.NonNull
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public java.lang.String toString() {
/*
r3 = this;
java.lang.StringBuilder r0 = new java.lang.StringBuilder
java.lang.StringBuilder r1 = new java.lang.StringBuilder
r1.<init>()
java.lang.String r2 = "MaxResponseInfo{adLoadState="
r1.append(r2)
com.applovin.mediation.MaxNetworkResponseInfo$AdLoadState r2 = r3.a
r1.append(r2)
java.lang.String r2 = ", mediatedNetwork="
r1.append(r2)
com.applovin.mediation.MaxMediatedNetworkInfo r2 = r3.b
r1.append(r2)
java.lang.String r2 = ", credentials="
r1.append(r2)
android.os.Bundle r2 = r3.c
r1.append(r2)
java.lang.String r2 = ", isBidding="
r1.append(r2)
boolean r2 = r3.d
r1.append(r2)
java.lang.String r1 = r1.toString()
r0.<init>(r1)
int[] r1 = com.applovin.impl.mediation.MaxNetworkResponseInfoImpl.a.a
com.applovin.mediation.MaxNetworkResponseInfo$AdLoadState r2 = r3.a
int r2 = r2.ordinal()
r1 = r1[r2]
r2 = 1
if (r1 == r2) goto L47
r2 = 2
if (r1 == r2) goto L51
goto L5b
L47:
java.lang.String r1 = ", error="
r0.append(r1)
com.applovin.mediation.MaxError r1 = r3.g
r0.append(r1)
L51:
java.lang.String r1 = ", latencyMillis="
r0.append(r1)
long r1 = r3.e
r0.append(r1)
L5b:
java.lang.String r1 = "}"
r0.append(r1)
java.lang.String r0 = r0.toString()
return r0
*/
throw new UnsupportedOperationException("Method not decompiled: com.applovin.impl.mediation.MaxNetworkResponseInfoImpl.toString():java.lang.String");
}
}

View File

@@ -0,0 +1,41 @@
package com.applovin.impl.mediation;
import androidx.annotation.NonNull;
import com.applovin.mediation.MaxReward;
/* loaded from: classes2.dex */
public class MaxRewardImpl implements MaxReward {
private final String a;
private final int b;
private MaxRewardImpl(int i, String str) {
if (i < 0) {
throw new IllegalArgumentException("Reward amount must be greater than or equal to 0");
}
this.a = str;
this.b = i;
}
public static MaxReward create(int i, String str) {
return new MaxRewardImpl(i, str);
}
public static MaxReward createDefault() {
return create(0, "");
}
@Override // com.applovin.mediation.MaxReward
public final int getAmount() {
return this.b;
}
@Override // com.applovin.mediation.MaxReward
public final String getLabel() {
return this.a;
}
@NonNull
public String toString() {
return "MaxReward{amount=" + this.b + ", label=" + this.a + "}";
}
}

View File

@@ -0,0 +1,51 @@
package com.applovin.impl.mediation;
import com.applovin.mediation.MaxSegment;
import com.applovin.mediation.MaxSegmentCollection;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/* loaded from: classes2.dex */
public class MaxSegmentCollectionImpl implements MaxSegmentCollection {
private final List a;
private final Map b;
public static class BuilderImpl implements MaxSegmentCollection.Builder {
private final List a = new ArrayList();
@Override // com.applovin.mediation.MaxSegmentCollection.Builder
public MaxSegmentCollection.Builder addSegment(MaxSegment maxSegment) {
this.a.add(maxSegment);
return this;
}
@Override // com.applovin.mediation.MaxSegmentCollection.Builder
public MaxSegmentCollection build() {
return new MaxSegmentCollectionImpl(this);
}
}
public Map<String, List<Integer>> getJsonData() {
return this.b;
}
@Override // com.applovin.mediation.MaxSegmentCollection
public List<MaxSegment> getSegments() {
return this.a;
}
public String toString() {
return "MaxSegmentColletionImpl{segments=" + this.a + "}";
}
private MaxSegmentCollectionImpl(BuilderImpl builderImpl) {
List<MaxSegment> list = builderImpl.a;
this.a = list;
this.b = new HashMap();
for (MaxSegment maxSegment : list) {
this.b.put("segment_" + maxSegment.getKey(), maxSegment.getValues());
}
}
}

View File

@@ -0,0 +1,995 @@
package com.applovin.impl.mediation;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.os.SystemClock;
import android.text.TextUtils;
import android.util.Log;
import android.view.ViewGroup;
import androidx.annotation.Nullable;
import androidx.lifecycle.Lifecycle;
import com.applovin.impl.an;
import com.applovin.impl.ca;
import com.applovin.impl.fi;
import com.applovin.impl.fn;
import com.applovin.impl.gc;
import com.applovin.impl.ge;
import com.applovin.impl.ie;
import com.applovin.impl.la;
import com.applovin.impl.ln;
import com.applovin.impl.ma;
import com.applovin.impl.mediation.MediationServiceImpl;
import com.applovin.impl.mediation.ads.a;
import com.applovin.impl.mediation.d;
import com.applovin.impl.mediation.g;
import com.applovin.impl.ne;
import com.applovin.impl.pe;
import com.applovin.impl.rm;
import com.applovin.impl.sdk.AppLovinBroadcastManager;
import com.applovin.impl.sdk.e;
import com.applovin.impl.sdk.j;
import com.applovin.impl.sdk.m;
import com.applovin.impl.sdk.n;
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.ve;
import com.applovin.impl.we;
import com.applovin.impl.xe;
import com.applovin.impl.xj;
import com.applovin.impl.yj;
import com.applovin.impl.yl;
import com.applovin.impl.yp;
import com.applovin.impl.zj;
import com.applovin.mediation.MaxAd;
import com.applovin.mediation.MaxAdFormat;
import com.applovin.mediation.MaxAdListener;
import com.applovin.mediation.MaxAdRequestListener;
import com.applovin.mediation.MaxAdRevenueListener;
import com.applovin.mediation.MaxAdViewAdListener;
import com.applovin.mediation.MaxError;
import com.applovin.mediation.MaxMediatedNetworkInfo;
import com.applovin.mediation.MaxNetworkResponseInfo;
import com.applovin.mediation.MaxReward;
import com.applovin.mediation.MaxRewardedAdListener;
import com.applovin.mediation.adapter.MaxAdapter;
import com.applovin.mediation.adapter.MaxAdapterError;
import com.applovin.sdk.AppLovinSdkUtils;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicReference;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public class MediationServiceImpl implements AppLovinBroadcastManager.Receiver {
private final j a;
private final n b;
private final xj c;
private final AtomicReference d = new AtomicReference();
public static /* synthetic */ class c {
static final /* synthetic */ int[] a;
static {
int[] iArr = new int[MaxAdapter.InitializationStatus.values().length];
a = iArr;
try {
iArr[MaxAdapter.InitializationStatus.DOES_NOT_APPLY.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
a[MaxAdapter.InitializationStatus.INITIALIZED_SUCCESS.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
a[MaxAdapter.InitializationStatus.INITIALIZED_UNKNOWN.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
try {
a[MaxAdapter.InitializationStatus.INITIALIZED_FAILURE.ordinal()] = 4;
} catch (NoSuchFieldError unused4) {
}
try {
a[MaxAdapter.InitializationStatus.NOT_INITIALIZED.ordinal()] = 5;
} catch (NoSuchFieldError unused5) {
}
try {
a[MaxAdapter.InitializationStatus.INITIALIZING.ordinal()] = 6;
} catch (NoSuchFieldError unused6) {
}
}
}
public class d implements MaxAdListener, MaxRewardedAdListener, MaxAdViewAdListener, MaxAdRevenueListener, a.InterfaceC0026a {
private final ge a;
private a.InterfaceC0026a b;
public void a(a.InterfaceC0026a interfaceC0026a) {
this.b = interfaceC0026a;
}
public void b(MaxAd maxAd, Bundle bundle) {
this.a.a(bundle);
gc.b(this.b, maxAd);
}
public void c(MaxAd maxAd, Bundle bundle) {
this.a.a(bundle);
n unused = MediationServiceImpl.this.b;
if (n.a()) {
MediationServiceImpl.this.b.a("MediationService", "Scheduling impression for ad via callback...");
}
MediationServiceImpl.this.processCallbackAdImpressionPostback(this.a, this.b);
if (!((Boolean) MediationServiceImpl.this.a.a(ve.Z7)).booleanValue() || this.a.u().compareAndSet(false, true)) {
MediationServiceImpl.this.a.j().a(this.a, e.c.SHOW);
MediationServiceImpl.this.a.D().c(ca.f);
MediationServiceImpl.this.a.D().c(ca.i);
if (!maxAd.getFormat().isFullscreenAd()) {
MediationServiceImpl.this.a.p().b(this.a, "DID_DISPLAY");
gc.c(this.b, maxAd);
return;
}
ie ieVar = (ie) maxAd;
if (ieVar.s0()) {
MediationServiceImpl.this.a.p().b(this.a, "DID_DISPLAY");
MediationServiceImpl.this.a.C().a(this.a);
gc.c(this.b, maxAd);
return;
}
n unused2 = MediationServiceImpl.this.b;
if (n.a()) {
n nVar = MediationServiceImpl.this.b;
StringBuilder sb = new StringBuilder();
sb.append("Received ad display callback before attempting show");
sb.append(ieVar.a0() ? " for hybrid ad" : "");
nVar.k("MediationService", sb.toString());
}
}
}
public void d(MaxAd maxAd, Bundle bundle) {
this.a.a(bundle);
gc.d(this.b, maxAd);
}
public void e(final MaxAd maxAd, Bundle bundle) {
this.a.a(bundle);
MediationServiceImpl.this.a.E().a(la.A, this.a);
MediationServiceImpl.this.a.j().a(this.a, e.c.HIDE);
MediationServiceImpl.this.a.p().b((ge) maxAd, "DID_HIDE");
AppLovinSdkUtils.runOnUiThreadDelayed(new Runnable() { // from class: com.applovin.impl.mediation.MediationServiceImpl$d$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
MediationServiceImpl.d.this.a(maxAd);
}
}, maxAd instanceof ie ? ((ie) maxAd).j0() : 0L);
}
public void f(MaxAd maxAd, Bundle bundle) {
this.a.a(bundle);
this.a.f0();
MediationServiceImpl.this.a.j().a(this.a, e.c.LOAD);
MediationServiceImpl.this.a(this.a);
gc.f(this.b, maxAd);
}
@Override // com.applovin.mediation.MaxAdListener
public void onAdClicked(MaxAd maxAd) {
a(maxAd, null);
}
@Override // com.applovin.mediation.MaxAdViewAdListener
public void onAdCollapsed(MaxAd maxAd) {
b(maxAd, null);
}
@Override // com.applovin.mediation.MaxAdListener
public void onAdDisplayFailed(MaxAd maxAd, MaxError maxError) {
a(maxAd, maxError, (Bundle) null);
}
@Override // com.applovin.mediation.MaxAdListener
public void onAdDisplayed(MaxAd maxAd) {
c(maxAd, null);
}
@Override // com.applovin.mediation.MaxAdViewAdListener
public void onAdExpanded(MaxAd maxAd) {
d(maxAd, null);
}
@Override // com.applovin.mediation.MaxAdListener
public void onAdHidden(MaxAd maxAd) {
e(maxAd, null);
}
@Override // com.applovin.mediation.MaxAdListener
public void onAdLoadFailed(String str, MaxError maxError) {
this.a.f0();
MediationServiceImpl.this.b(this.a, maxError, this.b);
}
@Override // com.applovin.mediation.MaxAdListener
public void onAdLoaded(MaxAd maxAd) {
f(maxAd, null);
}
@Override // com.applovin.mediation.MaxAdRequestListener
public void onAdRequestStarted(String str) {
}
@Override // com.applovin.mediation.MaxAdRevenueListener
public void onAdRevenuePaid(MaxAd maxAd) {
}
@Override // com.applovin.mediation.MaxRewardedAdListener
public void onUserRewarded(MaxAd maxAd, MaxReward maxReward) {
a(maxAd, maxReward, (Bundle) null);
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void a(MaxAd maxAd) {
if (maxAd.getFormat().isFullscreenAd()) {
MediationServiceImpl.this.a.C().b(maxAd);
}
gc.e(this.b, maxAd);
}
public void a(MaxAd maxAd, Bundle bundle) {
this.a.a(bundle);
MediationServiceImpl.this.a.j().a(this.a, e.c.CLICK);
MediationServiceImpl.this.a(this.a, this.b);
gc.a((MaxAdListener) this.b, maxAd);
}
public void a(MaxAd maxAd, MaxError maxError, Bundle bundle) {
this.a.a(bundle);
MediationServiceImpl.this.a(this.a, maxError, this.b);
if ((maxAd.getFormat() == MaxAdFormat.REWARDED || maxAd.getFormat() == MaxAdFormat.REWARDED_INTERSTITIAL) && (maxAd instanceof ie)) {
((ie) maxAd).h0();
}
}
public void a(MaxAd maxAd, MaxReward maxReward, Bundle bundle) {
this.a.a(bundle);
gc.a(this.b, maxAd, maxReward);
MediationServiceImpl.this.a.j0().a((yl) new fn((ie) maxAd, MediationServiceImpl.this.a), tm.b.OTHER);
}
public d(ge geVar, a.InterfaceC0026a interfaceC0026a) {
this.a = geVar;
this.b = interfaceC0026a;
}
}
public MediationServiceImpl(j jVar) {
this.a = jVar;
this.b = jVar.J();
this.c = new xj(jVar);
AppLovinBroadcastManager.registerReceiver(this, new IntentFilter("com.applovin.render_process_gone"));
}
public void destroyAd(MaxAd maxAd) {
if (maxAd instanceof ge) {
if (n.a()) {
this.b.d("MediationService", "Destroying " + maxAd);
}
ge geVar = (ge) maxAd;
g A = geVar.A();
if (A != null) {
A.a();
geVar.t();
}
this.a.h().c(geVar.S());
this.a.j().a(geVar, e.c.DESTROY);
}
}
public JSONObject getAndResetCustomPostBodyData() {
return (JSONObject) this.d.getAndSet(null);
}
public void loadAd(String str, @Nullable String str2, MaxAdFormat maxAdFormat, d.b bVar, Map<String, Object> map, Map<String, Object> map2, Context context, a.InterfaceC0026a interfaceC0026a) {
if (TextUtils.isEmpty(str)) {
throw new IllegalArgumentException("No Ad Unit ID specified");
}
if (context == null) {
throw new IllegalArgumentException("No context specified");
}
if (interfaceC0026a == null) {
throw new IllegalArgumentException("No listener specified");
}
if (TextUtils.isEmpty(this.a.O())) {
n.h("AppLovinSdk", "Mediation provider is null. Please set AppLovin SDK mediation provider via AppLovinSdk.getInstance(context).setMediationProvider()");
}
if (!this.a.u0()) {
n.j("AppLovinSdk", "Attempted to load ad before SDK initialization. Please wait until after the SDK has initialized, e.g. AppLovinSdk.initializeSdk(Context, SdkInitializationListener).");
}
List<String> initializationAdUnitIds = this.a.z0().get() ? this.a.g0().getInitializationAdUnitIds() : this.a.H() != null ? this.a.H().getAdUnitIds() : null;
boolean startsWith = str.startsWith("test_mode");
if (initializationAdUnitIds != null && initializationAdUnitIds.size() > 0 && !initializationAdUnitIds.contains(str) && !startsWith) {
if (yp.c(this.a)) {
String str3 = "Ad Unit ID " + str + " has not been initialized. When you use selective init, any ad units that you do not explicitly specify are excluded from serving ads for the current session. For more information visit our docs: https://developers.applovin.com/en/android/overview/terms-and-privacy-policy-flow";
if (((Boolean) this.a.a(sj.t6)).booleanValue()) {
throw new RuntimeException(str3);
}
if (n.a()) {
this.b.b("MediationService", str3);
}
}
this.a.E().a(la.L, "uninitialized_ad_unit_id", CollectionUtils.hashMap("ad_unit_id", str), "uninitialized_ad_unit_id" + str);
}
this.a.c();
if (str.length() != 16 && !startsWith && !this.a.b0().startsWith("05TMD")) {
n.h("MediationService", "Please double-check the ad unit " + str + " for " + maxAdFormat.getLabel() + " : " + Log.getStackTraceString(new Throwable("")));
}
if (!this.a.a(maxAdFormat)) {
this.a.S0();
gc.a((MaxAdRequestListener) interfaceC0026a, str, true);
this.a.K().a(str, str2, maxAdFormat, bVar, map, map2, context, interfaceC0026a);
return;
}
n.h("MediationService", "Ad load failed due to disabled ad format " + maxAdFormat.getLabel());
gc.a(interfaceC0026a, str, new MaxErrorImpl(-1, "Disabled ad format " + maxAdFormat.getLabel()));
}
@Override // com.applovin.impl.sdk.AppLovinBroadcastManager.Receiver
public void onReceive(Intent intent, @Nullable Map<String, Object> map) {
if ("com.applovin.render_process_gone".equals(intent.getAction())) {
Object a2 = this.a.C().a();
if (a2 instanceof ge) {
a((MaxError) MaxAdapterError.WEBVIEW_ERROR, (ge) a2, true);
}
}
}
public void processWaterfallInfoPostback(String str, MaxAdFormat maxAdFormat, MaxAdWaterfallInfoImpl maxAdWaterfallInfoImpl, @Nullable MaxError maxError, long j, long j2) {
HashMap hashMap = new HashMap();
CollectionUtils.putStringIfValid("ad_format", maxAdFormat.getLabel(), hashMap);
CollectionUtils.putStringIfValid("ad_unit_id", str, hashMap);
CollectionUtils.putStringIfValid("duration_ms", String.valueOf(j2), hashMap);
if (maxError != null) {
hashMap.putAll(ma.a(maxError));
}
this.a.E().a(la.x, (Map) hashMap);
if (CollectionUtils.isEmpty(maxAdWaterfallInfoImpl.getPostbackUrls())) {
return;
}
HashMap hashMap2 = new HashMap(8);
CollectionUtils.putStringIfValid("mcode", maxAdWaterfallInfoImpl.getMCode(), hashMap2);
CollectionUtils.putStringIfValid("ad_unit_id", str, hashMap2);
CollectionUtils.putStringIfValid("ad_format", maxAdFormat.getLabel(), hashMap2);
CollectionUtils.putStringIfValid("name", maxAdWaterfallInfoImpl.getName(), hashMap2);
CollectionUtils.putLongIfValid("request_latency_ms", Long.valueOf(j2), hashMap2);
CollectionUtils.putLongIfValid("request_start_timestamp_ms", Long.valueOf(j), hashMap2);
CollectionUtils.putLongIfValid("wf_latency_ms", Long.valueOf(maxAdWaterfallInfoImpl.getLatencyMillis()), hashMap2);
List<MaxNetworkResponseInfo> networkResponses = maxAdWaterfallInfoImpl.getNetworkResponses();
ArrayList arrayList = new ArrayList(networkResponses.size());
for (MaxNetworkResponseInfo maxNetworkResponseInfo : networkResponses) {
MaxMediatedNetworkInfo mediatedNetwork = maxNetworkResponseInfo.getMediatedNetwork();
HashMap hashMap3 = new HashMap(5);
CollectionUtils.putStringIfValid("bcode", ((MaxNetworkResponseInfoImpl) maxNetworkResponseInfo).getBCode(), hashMap3);
hashMap3.put("name", mediatedNetwork.getName());
CollectionUtils.putLongIfValid("latency_ms", Long.valueOf(maxNetworkResponseInfo.getLatencyMillis()), hashMap3);
hashMap3.put("load_state", Integer.valueOf(maxNetworkResponseInfo.getAdLoadState().ordinal()));
MaxErrorImpl maxErrorImpl = (MaxErrorImpl) maxNetworkResponseInfo.getError();
if (maxErrorImpl != null) {
HashMap hashMap4 = new HashMap(4);
hashMap4.put("error_code", Integer.valueOf(maxErrorImpl.getCode()));
hashMap4.put("error_message", maxErrorImpl.getMessage());
hashMap4.put("third_party_sdk_error_code", Integer.valueOf(maxErrorImpl.getMediatedNetworkErrorCode()));
hashMap4.put("third_party_sdk_error_message", maxErrorImpl.getMediatedNetworkErrorMessage());
hashMap3.put("error_info", hashMap4);
}
arrayList.add(hashMap3);
}
hashMap2.put("ads_info", arrayList);
a("mwf_info", maxAdWaterfallInfoImpl.getPostbackUrls(), Collections.EMPTY_MAP, hashMap2, null, null, false);
}
public void setCustomPostBodyData(JSONObject jSONObject) {
this.d.set(jSONObject);
}
public void showFullscreenAd(final ie ieVar, final Activity activity, final a.InterfaceC0026a interfaceC0026a) {
if (ieVar != null) {
if (activity == null && MaxAdFormat.APP_OPEN != ieVar.getFormat()) {
throw new IllegalArgumentException("No activity specified");
}
this.a.C().a(true);
final g b2 = b(ieVar);
long p0 = ieVar.p0();
if (n.a()) {
this.b.d("MediationService", "Showing ad " + ieVar.getAdUnitId() + " with delay of " + p0 + "ms...");
}
AppLovinSdkUtils.runOnUiThreadDelayed(new Runnable() { // from class: com.applovin.impl.mediation.MediationServiceImpl$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
MediationServiceImpl.this.a(ieVar, b2, activity, interfaceC0026a);
}
}, p0);
return;
}
throw new IllegalArgumentException("No ad specified");
}
public void loadThirdPartyMediatedAd(final String str, final ge geVar, boolean z, final Activity activity, final a.InterfaceC0026a interfaceC0026a) {
fi fiVar;
if (geVar != null) {
if (n.a()) {
this.b.a("MediationService", "Loading " + geVar + "...");
}
if (!z) {
this.a.E().a(la.u, geVar);
this.a.p().b(geVar, "WILL_LOAD");
}
final g a2 = this.a.M().a(geVar);
if (a2 != null) {
final MaxAdapterParametersImpl a3 = MaxAdapterParametersImpl.a(geVar);
if (geVar.d0()) {
fiVar = this.a.L().a(geVar, activity);
} else {
if (geVar.e0()) {
this.a.L().b(geVar, activity);
}
fiVar = null;
}
final ge a4 = geVar.a(a2);
a2.a(str, a4);
a4.g0();
if (fiVar != null) {
fiVar.a(new fi.a() { // from class: com.applovin.impl.mediation.MediationServiceImpl$$ExternalSyntheticLambda2
@Override // com.applovin.impl.fi.a
public final void a(Object obj) {
MediationServiceImpl.this.a(geVar, interfaceC0026a, (String) obj);
}
});
fiVar.a(new Runnable() { // from class: com.applovin.impl.mediation.MediationServiceImpl$$ExternalSyntheticLambda3
@Override // java.lang.Runnable
public final void run() {
MediationServiceImpl.this.a(a2, str, a3, a4, activity, interfaceC0026a);
}
});
return;
} else {
a2.a(str, a3, a4, activity, new d(a4, interfaceC0026a));
return;
}
}
String str2 = "Failed to load " + geVar + ": adapter not loaded";
n.h("MediationService", str2);
b(geVar, new MaxErrorImpl(-5001, str2), interfaceC0026a);
return;
}
throw new IllegalArgumentException("No mediated ad specified");
}
public void collectSignal(String str, MaxAdFormat maxAdFormat, zj zjVar, Context context, yj.a aVar) {
if (zjVar == null) {
throw new IllegalArgumentException("No spec specified");
}
if (context == null) {
throw new IllegalArgumentException("No context specified");
}
if (aVar != null) {
yj b2 = this.c.b(zjVar, str, maxAdFormat);
if (b2 != null) {
aVar.a(yj.a(b2));
return;
}
g a2 = this.a.M().a(zjVar, zjVar.A());
if (a2 != null) {
if (((Boolean) this.a.a(ve.Y7)).booleanValue()) {
a(str, maxAdFormat, zjVar, context, aVar, a2);
return;
}
Activity n0 = context instanceof Activity ? (Activity) context : this.a.n0();
MaxAdapterParametersImpl a3 = MaxAdapterParametersImpl.a(zjVar, str, maxAdFormat);
if (zjVar.z()) {
this.a.L().b(zjVar, n0);
}
a aVar2 = new a(a2, str, SystemClock.elapsedRealtime(), zjVar, maxAdFormat, aVar);
if (zjVar.v()) {
if (this.a.L().b(zjVar)) {
if (n.a()) {
this.b.a("MediationService", "Collecting signal for now-initialized adapter: " + a2.g());
}
a2.a(a3, zjVar, n0, aVar2);
return;
}
if (n.a()) {
this.b.b("MediationService", "Skip collecting signal for not-initialized adapter: " + a2.g());
}
aVar.a(yj.a(zjVar, new MaxErrorImpl("Adapter not initialized yet")));
return;
}
if (n.a()) {
this.b.a("MediationService", "Collecting signal for adapter: " + a2.g());
}
a2.a(a3, zjVar, n0, aVar2);
return;
}
aVar.a(yj.a(zjVar, new MaxErrorImpl("Could not load adapter")));
return;
}
throw new IllegalArgumentException("No callback specified");
}
public class a implements g.c {
final /* synthetic */ g a;
final /* synthetic */ String b;
final /* synthetic */ long c;
final /* synthetic */ zj d;
final /* synthetic */ MaxAdFormat e;
final /* synthetic */ yj.a f;
@Override // com.applovin.impl.mediation.g.c
public void a(MaxError maxError) {
n unused = MediationServiceImpl.this.b;
if (n.a()) {
MediationServiceImpl.this.b.b("MediationService", "Signal collection failed from: " + this.a.g() + " for Ad Unit ID: " + this.b + " with error message: \"" + maxError.getMessage() + "\"");
}
long elapsedRealtime = SystemClock.elapsedRealtime();
long j = this.c;
yj a = yj.a(this.d, this.a, maxError, j, elapsedRealtime - j);
MediationServiceImpl.this.a(a, this.d, this.a);
this.f.a(a);
this.a.a();
}
@Override // com.applovin.impl.mediation.g.c
public void onSignalCollected(String str) {
n unused = MediationServiceImpl.this.b;
if (n.a()) {
MediationServiceImpl.this.b.a("MediationService", "Signal collection successful from: " + this.a.g() + " for Ad Unit ID: " + this.b + " with signal: \"" + str + "\"");
}
long elapsedRealtime = SystemClock.elapsedRealtime();
long j = this.c;
long j2 = elapsedRealtime - j;
yj a = yj.a(this.d, this.a, str, j, j2);
MediationServiceImpl.this.c.a(a, this.d, this.b, this.e);
HashMap hashMap = new HashMap();
CollectionUtils.putStringIfValid("network_name", this.d.c(), hashMap);
CollectionUtils.putStringIfValid("adapter_class", this.d.b(), hashMap);
CollectionUtils.putStringIfValid("adapter_version", this.a.b(), hashMap);
CollectionUtils.putStringIfValid("duration_ms", String.valueOf(j2), hashMap);
CollectionUtils.putStringIfValid("ad_format", String.valueOf(this.e.getLabel()), hashMap);
CollectionUtils.putStringIfValid("ad_unit_id", this.b, hashMap);
MediationServiceImpl.this.a.E().a(la.p, (Map) hashMap);
this.f.a(a);
this.a.a();
}
public a(g gVar, String str, long j, zj zjVar, MaxAdFormat maxAdFormat, yj.a aVar) {
this.a = gVar;
this.b = str;
this.c = j;
this.d = zjVar;
this.e = maxAdFormat;
this.f = aVar;
}
}
public void showFullscreenAd(final ie ieVar, final ViewGroup viewGroup, final Lifecycle lifecycle, final Activity activity, final a.InterfaceC0026a interfaceC0026a) {
if (ieVar == null) {
throw new IllegalArgumentException("No ad specified");
}
if (activity != null) {
this.a.C().a(true);
final g b2 = b(ieVar);
long p0 = ieVar.p0();
if (n.a()) {
this.b.d("MediationService", "Showing ad " + ieVar.getAdUnitId() + " with delay of " + p0 + "ms...");
}
AppLovinSdkUtils.runOnUiThreadDelayed(new Runnable() { // from class: com.applovin.impl.mediation.MediationServiceImpl$$ExternalSyntheticLambda1
@Override // java.lang.Runnable
public final void run() {
MediationServiceImpl.this.a(ieVar, b2, viewGroup, lifecycle, activity, interfaceC0026a);
}
}, p0);
return;
}
throw new IllegalArgumentException("No activity specified");
}
public class b implements g.c {
final /* synthetic */ fi a;
@Override // com.applovin.impl.mediation.g.c
public void a(MaxError maxError) {
this.a.a(maxError);
}
@Override // com.applovin.impl.mediation.g.c
public void onSignalCollected(String str) {
this.a.b(str);
}
public b(fi fiVar) {
this.a = fiVar;
}
}
public void processAdapterInitializationPostback(pe peVar, long j, MaxAdapter.InitializationStatus initializationStatus, String str) {
HashMap hashMap = new HashMap(2);
hashMap.put("{INIT_STATUS}", String.valueOf(initializationStatus.getCode()));
hashMap.put("{INIT_TIME_MS}", String.valueOf(j));
a("minit", hashMap, new MaxErrorImpl(str), peVar);
Map a2 = ma.a(peVar);
CollectionUtils.putStringIfValid("adapter_init_status", String.valueOf(initializationStatus.getCode()), a2);
CollectionUtils.putStringIfValid("error_message", str, a2);
CollectionUtils.putStringIfValid("duration_ms", String.valueOf(j), a2);
switch (c.a[initializationStatus.ordinal()]) {
case 1:
case 2:
case 3:
this.a.E().a(la.n, a2);
break;
case 4:
this.a.E().a(la.o, a2);
break;
case 5:
case 6:
this.a.J();
if (n.a()) {
this.a.J().k("MediationService", "Adapter init postback called while the adapter is not fully initialized.");
}
this.a.E().a(la.d, "adapterNotInitializedForPostback", a2);
break;
}
}
/* JADX INFO: Access modifiers changed from: private */
public void b(ge geVar, MaxError maxError, MaxAdListener maxAdListener) {
a(maxError, geVar);
destroyAd(geVar);
gc.a(maxAdListener, geVar.getAdUnitId(), maxError);
}
private void a(final String str, final MaxAdFormat maxAdFormat, final zj zjVar, Context context, final yj.a aVar, final g gVar) {
final fi fiVar = new fi();
final long elapsedRealtime = SystemClock.elapsedRealtime();
fiVar.a(new fi.b() { // from class: com.applovin.impl.mediation.MediationServiceImpl$$ExternalSyntheticLambda5
@Override // com.applovin.impl.fi.b
public final void a(boolean z, Object obj, Object obj2) {
MediationServiceImpl.this.a(elapsedRealtime, gVar, str, zjVar, maxAdFormat, aVar, z, (String) obj, (MaxError) obj2);
}
});
an.a(zjVar.m(), fiVar, new MaxErrorImpl(MaxAdapterError.ERROR_CODE_SIGNAL_COLLECTION_TIMEOUT, "The adapter (" + zjVar.c() + ") timed out collecting signal"), "MediationService", this.a);
final g.c bVar = new b(fiVar);
final Activity n0 = context instanceof Activity ? (Activity) context : this.a.n0();
final MaxAdapterParametersImpl a2 = MaxAdapterParametersImpl.a(zjVar, str, maxAdFormat);
if (zjVar.v()) {
fi a3 = this.a.L().a(zjVar, n0);
a3.a(new Runnable() { // from class: com.applovin.impl.mediation.MediationServiceImpl$$ExternalSyntheticLambda6
@Override // java.lang.Runnable
public final void run() {
MediationServiceImpl.this.a(fiVar, gVar, a2, zjVar, n0, bVar);
}
});
a3.a(new fi.a() { // from class: com.applovin.impl.mediation.MediationServiceImpl$$ExternalSyntheticLambda7
@Override // com.applovin.impl.fi.a
public final void a(Object obj) {
MediationServiceImpl.this.a(gVar, fiVar, (String) obj);
}
});
return;
}
if (zjVar.w()) {
fi a4 = this.a.L().a(zjVar, n0);
if (a4.d() && !zjVar.y()) {
if (n.a()) {
this.b.b("MediationService", "Skip collecting signal for failed-initialized adapter: " + gVar.g());
}
fiVar.a(new MaxErrorImpl("Could not initialize adapter: " + ((String) a4.a())));
return;
}
}
if (n.a()) {
this.b.a("MediationService", "Collecting signal for adapter: " + gVar.g());
}
gVar.a(a2, zjVar, n0, bVar);
}
public void processRawAdImpression(ge geVar, a.InterfaceC0026a interfaceC0026a) {
this.a.p().b(geVar, "WILL_DISPLAY");
if (geVar.Q().endsWith("mimp")) {
this.a.p().b(geVar);
gc.a((MaxAdRevenueListener) interfaceC0026a, (MaxAd) geVar);
}
if (((Boolean) this.a.a(sj.Q4)).booleanValue()) {
this.a.R().a(we.d, xe.a(geVar), Long.valueOf(System.currentTimeMillis() - this.a.I()));
}
HashMap hashMap = new HashMap(2);
if (geVar instanceof ie) {
hashMap.put("{TIME_TO_SHOW_MS}", String.valueOf(((ie) geVar).n0()));
}
String emptyIfNull = StringUtils.emptyIfNull(this.a.q0().c());
if (!((Boolean) this.a.a(sj.Y3)).booleanValue()) {
emptyIfNull = "";
}
hashMap.put("{CUID}", emptyIfNull);
a("mimp", hashMap, geVar);
}
public void processViewabilityAdImpressionPostback(ne neVar, long j, a.InterfaceC0026a interfaceC0026a) {
if (neVar.Q().endsWith("vimp")) {
this.a.p().b(neVar);
gc.a((MaxAdRevenueListener) interfaceC0026a, (MaxAd) neVar);
}
HashMap hashMap = new HashMap(3);
hashMap.put("{VIEWABILITY_FLAGS}", String.valueOf(j));
hashMap.put("{USED_VIEWABILITY_TIMER}", String.valueOf(neVar.o0()));
String emptyIfNull = StringUtils.emptyIfNull(this.a.q0().c());
if (!((Boolean) this.a.a(sj.Y3)).booleanValue()) {
emptyIfNull = "";
}
hashMap.put("{CUID}", emptyIfNull);
a("mvimp", hashMap, neVar);
}
public void processCallbackAdImpressionPostback(ge geVar, a.InterfaceC0026a interfaceC0026a) {
if (geVar.Q().endsWith("cimp")) {
this.a.p().b(geVar);
gc.a((MaxAdRevenueListener) interfaceC0026a, (MaxAd) geVar);
}
HashMap hashMap = new HashMap(1);
String emptyIfNull = StringUtils.emptyIfNull(this.a.q0().c());
if (!((Boolean) this.a.a(sj.Y3)).booleanValue()) {
emptyIfNull = "";
}
hashMap.put("{CUID}", emptyIfNull);
a("mcimp", hashMap, geVar);
this.a.E().a(la.y, geVar);
}
public void processAdDisplayErrorPostbackForUserError(MaxError maxError, ge geVar) {
a(maxError, geVar, false);
}
private g b(ie ieVar) {
g A = ieVar.A();
if (A != null) {
return A;
}
this.a.C().a(false);
if (n.a()) {
this.b.k("MediationService", "Failed to show " + ieVar + ": adapter not found");
}
n.h("MediationService", "There may be an integration problem with the adapter for Ad Unit ID '" + ieVar.getAdUnitId() + "'. Please check if you have a supported version of that SDK integrated into your project.");
throw new IllegalStateException("Could not find adapter for provided ad");
}
private void a(ie ieVar, a.InterfaceC0026a interfaceC0026a) {
this.a.C().a(false);
a(ieVar, (MaxAdListener) interfaceC0026a);
if (n.a()) {
this.b.a("MediationService", "Scheduling impression for ad manually...");
}
processRawAdImpression(ieVar, interfaceC0026a);
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void a(long j, g gVar, String str, zj zjVar, MaxAdFormat maxAdFormat, yj.a aVar, boolean z, String str2, MaxError maxError) {
yj a2;
long elapsedRealtime = SystemClock.elapsedRealtime() - j;
if (z) {
if (n.a()) {
this.b.a("MediationService", "Signal collection successful from: " + gVar.g() + " for Ad Unit ID: " + str + " with signal: \"" + str2 + "\"");
}
a2 = yj.a(zjVar, gVar, str2, j, elapsedRealtime);
this.c.a(a2, zjVar, str, maxAdFormat);
HashMap hashMap = new HashMap();
CollectionUtils.putStringIfValid("network_name", zjVar.c(), hashMap);
CollectionUtils.putStringIfValid("adapter_class", zjVar.b(), hashMap);
CollectionUtils.putStringIfValid("adapter_version", gVar.b(), hashMap);
CollectionUtils.putStringIfValid("duration_ms", String.valueOf(elapsedRealtime), hashMap);
CollectionUtils.putStringIfValid("ad_format", String.valueOf(maxAdFormat.getLabel()), hashMap);
CollectionUtils.putStringIfValid("ad_unit_id", str, hashMap);
this.a.E().a(la.p, (Map) hashMap);
} else {
if (n.a()) {
this.b.b("MediationService", "Signal collection failed from: " + gVar.g() + " for Ad Unit ID: " + str + " with error message: \"" + maxError.getMessage() + "\"");
}
a2 = yj.a(zjVar, gVar, maxError, j, elapsedRealtime);
a(a2, zjVar, gVar);
}
aVar.a(a2);
gVar.a();
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void a(fi fiVar, g gVar, MaxAdapterParametersImpl maxAdapterParametersImpl, zj zjVar, Activity activity, g.c cVar) {
if (fiVar.c()) {
return;
}
if (n.a()) {
this.b.a("MediationService", "Collecting signal for now-initialized adapter: " + gVar.g());
}
gVar.a(maxAdapterParametersImpl, zjVar, activity, cVar);
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void a(g gVar, String str, MaxAdapterParametersImpl maxAdapterParametersImpl, ge geVar, Activity activity, a.InterfaceC0026a interfaceC0026a) {
gVar.a(str, maxAdapterParametersImpl, geVar, activity, new d(geVar, interfaceC0026a));
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void a(ie ieVar, Long l, MaxAdListener maxAdListener) {
if (ieVar.u().get()) {
return;
}
String str = "Ad (" + ieVar.k() + ") has not been displayed after " + l + "ms. Failing ad display...";
n.h("MediationService", str);
a(ieVar, new MaxErrorImpl(-1, str), maxAdListener);
this.a.C().b(ieVar);
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void a(ie ieVar, g gVar, Activity activity, a.InterfaceC0026a interfaceC0026a) {
ieVar.a(true);
a(ieVar);
gVar.c(ieVar, activity);
a(ieVar, interfaceC0026a);
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void a(ie ieVar, g gVar, ViewGroup viewGroup, Lifecycle lifecycle, Activity activity, a.InterfaceC0026a interfaceC0026a) {
ieVar.a(true);
a(ieVar);
gVar.a(ieVar, viewGroup, lifecycle, activity);
a(ieVar, interfaceC0026a);
}
private void a(final ie ieVar, final MaxAdListener maxAdListener) {
final Long l = (Long) this.a.a(ve.v7);
if (l.longValue() <= 0) {
return;
}
AppLovinSdkUtils.runOnUiThreadDelayed(new Runnable() { // from class: com.applovin.impl.mediation.MediationServiceImpl$$ExternalSyntheticLambda4
@Override // java.lang.Runnable
public final void run() {
MediationServiceImpl.this.a(ieVar, l, maxAdListener);
}
}, l.longValue());
}
private void a(ie ieVar) {
if (ieVar.getFormat() == MaxAdFormat.REWARDED || ieVar.getFormat() == MaxAdFormat.REWARDED_INTERSTITIAL) {
this.a.j0().a((yl) new ln(ieVar, this.a), tm.b.OTHER);
}
}
/* JADX INFO: Access modifiers changed from: private */
public void a(ge geVar, MaxError maxError, MaxAdListener maxAdListener) {
this.a.j().a(geVar, e.c.SHOW_ERROR);
this.a.p().b(geVar, "DID_FAIL_DISPLAY");
a(maxError, geVar, true);
if (geVar.u().compareAndSet(false, true)) {
gc.a(maxAdListener, geVar, maxError);
}
}
/* JADX INFO: Access modifiers changed from: private */
public void a(ge geVar, a.InterfaceC0026a interfaceC0026a) {
this.a.p().b(geVar, "DID_CLICKED");
this.a.p().b(geVar, "DID_CLICK");
if (geVar.Q().endsWith("click")) {
this.a.p().b(geVar);
gc.a((MaxAdRevenueListener) interfaceC0026a, (MaxAd) geVar);
}
HashMap hashMap = new HashMap(1);
String emptyIfNull = StringUtils.emptyIfNull(this.a.q0().c());
if (!((Boolean) this.a.a(sj.Y3)).booleanValue()) {
emptyIfNull = "";
}
hashMap.put("{CUID}", emptyIfNull);
a("mclick", hashMap, geVar);
}
private void a(MaxError maxError, ge geVar, boolean z) {
a("mierr", Collections.EMPTY_MAP, maxError, geVar, z);
if (!z || geVar == null) {
return;
}
this.a.E().a(la.z, geVar, maxError);
}
private void a(MaxError maxError, ge geVar) {
HashMap hashMap = new HashMap(3);
long G = geVar.G();
hashMap.put("{LOAD_TIME_MS}", String.valueOf(G));
if (geVar.getFormat().isFullscreenAd()) {
m.a b2 = this.a.C().b(geVar.getAdUnitId());
hashMap.put("{SHOW_ATTEMPT_COUNT}", String.valueOf(b2.a()));
hashMap.put("{SHOW_ATTEMPT_TIMESTAMP_MS}", String.valueOf(b2.b()));
}
a("mlerr", hashMap, maxError, geVar);
Map a2 = ma.a(geVar);
a2.putAll(ma.a(maxError));
a2.put("duration_ms", String.valueOf(G));
this.a.E().a(la.w, a2);
}
/* JADX INFO: Access modifiers changed from: private */
public void a(ge geVar) {
this.a.p().b(geVar, "DID_LOAD");
if (geVar.Q().endsWith("load")) {
this.a.p().b(geVar);
}
HashMap hashMap = new HashMap(3);
long G = geVar.G();
hashMap.put("{LOAD_TIME_MS}", String.valueOf(G));
if (geVar.getFormat().isFullscreenAd()) {
m.a b2 = this.a.C().b(geVar.getAdUnitId());
hashMap.put("{SHOW_ATTEMPT_COUNT}", String.valueOf(b2.a()));
hashMap.put("{SHOW_ATTEMPT_TIMESTAMP_MS}", String.valueOf(b2.b()));
}
a("load", hashMap, geVar);
Map a2 = ma.a(geVar);
a2.put("duration_ms", String.valueOf(G));
this.a.E().a(la.v, a2);
}
/* JADX INFO: Access modifiers changed from: private */
public void a(yj yjVar, zj zjVar, g gVar) {
long b2 = yjVar.b();
HashMap hashMap = new HashMap(3);
hashMap.put("{LOAD_TIME_MS}", String.valueOf(b2));
CollectionUtils.putStringIfValid("{ADAPTER_VERSION}", gVar.b(), hashMap);
CollectionUtils.putStringIfValid("{SDK_VERSION}", gVar.i(), hashMap);
a("serr", hashMap, yjVar.c(), zjVar);
HashMap hashMap2 = new HashMap();
CollectionUtils.putStringIfValid("network_name", zjVar.c(), hashMap2);
CollectionUtils.putStringIfValid("adapter_class", zjVar.b(), hashMap2);
CollectionUtils.putStringIfValid("adapter_version", gVar.b(), hashMap2);
CollectionUtils.putStringIfValid("duration_ms", String.valueOf(b2), hashMap2);
this.a.E().a(la.q, (Map) hashMap2);
}
private void a(String str, List list, Map map, Map map2, MaxError maxError, pe peVar, boolean z) {
this.a.j0().a((yl) new rm(str, list, map, map2, maxError, peVar, this.a, z), tm.b.OTHER);
}
private void a(String str, Map map, pe peVar) {
a(str, map, (MaxError) null, peVar);
}
private void a(String str, Map map, MaxError maxError, pe peVar) {
a(str, map, maxError, peVar, true);
}
private void a(String str, Map map, MaxError maxError, pe peVar, boolean z) {
Map map2 = CollectionUtils.map(map);
map2.put("{PLACEMENT}", z ? StringUtils.emptyIfNull(peVar.getPlacement()) : "");
map2.put("{CUSTOM_DATA}", z ? StringUtils.emptyIfNull(peVar.e()) : "");
if (peVar instanceof ge) {
map2.put("{CREATIVE_ID}", z ? StringUtils.emptyIfNull(((ge) peVar).getCreativeId()) : "");
}
a(str, null, map2, null, maxError, peVar, z);
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void a(ge geVar, a.InterfaceC0026a interfaceC0026a, String str) {
String str2 = "Failed to load " + geVar + ": adapter init failed with error: " + str;
if (n.a()) {
this.b.k("MediationService", str2);
}
b(geVar, new MaxErrorImpl(MaxAdapterError.NOT_INITIALIZED.getErrorCode(), "Adapter initialization failed"), interfaceC0026a);
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void a(g gVar, fi fiVar, String str) {
if (n.a()) {
this.b.b("MediationService", "Skip collecting signal for failed-initialized adapter: " + gVar.g());
}
fiVar.a(new MaxErrorImpl(MaxAdapterError.ERROR_CODE_NOT_INITIALIZED, "Could not initialize adapter: " + str));
}
}

View File

@@ -0,0 +1,103 @@
package com.applovin.impl.mediation;
import android.app.Activity;
import android.os.Bundle;
import com.applovin.impl.ie;
import com.applovin.impl.p;
import com.applovin.impl.q;
import com.applovin.impl.sdk.j;
import com.applovin.impl.sdk.n;
import com.applovin.impl.yp;
/* loaded from: classes2.dex */
public class a extends p {
private final q a;
private final n b;
private final String c = yp.l(j.l());
private InterfaceC0025a d;
private ie e;
private boolean f;
private int g;
private boolean h;
/* renamed from: com.applovin.impl.mediation.a$a, reason: collision with other inner class name */
public interface InterfaceC0025a {
void b(ie ieVar);
}
public a(j jVar) {
this.b = jVar.J();
this.a = jVar.e();
}
public void a(boolean z) {
this.f = z;
}
@Override // com.applovin.impl.p, android.app.Application.ActivityLifecycleCallbacks
public void onActivityCreated(Activity activity, Bundle bundle) {
if (activity.getClass().getName().equals(this.c) && (this.e.v0() || this.f)) {
if (n.a()) {
this.b.a("AdActivityObserver", "App relaunched via launcher without an ad hidden callback, manually invoking ad hidden");
}
if (this.d != null) {
if (n.a()) {
this.b.a("AdActivityObserver", "Invoking callback...");
}
this.d.b(this.e);
}
a();
return;
}
if (!this.h) {
this.h = true;
}
this.g++;
if (n.a()) {
this.b.a("AdActivityObserver", "Created Activity: " + activity + ", counter is " + this.g);
}
}
public void a(ie ieVar, InterfaceC0025a interfaceC0025a) {
if (n.a()) {
this.b.a("AdActivityObserver", "Starting for ad " + ieVar.getAdUnitId() + "...");
}
a();
this.d = interfaceC0025a;
this.e = ieVar;
this.a.a(this);
}
@Override // com.applovin.impl.p, android.app.Application.ActivityLifecycleCallbacks
public void onActivityDestroyed(Activity activity) {
if (this.h) {
this.g--;
if (n.a()) {
this.b.a("AdActivityObserver", "Destroyed Activity: " + activity + ", counter is " + this.g);
}
if (this.g <= 0) {
if (n.a()) {
this.b.a("AdActivityObserver", "Last ad Activity destroyed");
}
if (this.d != null) {
if (n.a()) {
this.b.a("AdActivityObserver", "Invoking callback...");
}
this.d.b(this.e);
}
a();
}
}
}
public void a() {
if (n.a()) {
this.b.a("AdActivityObserver", "Cancelling...");
}
this.a.b(this);
this.d = null;
this.e = null;
this.g = 0;
this.h = false;
}
}

View File

@@ -0,0 +1,939 @@
package com.applovin.impl.mediation.ads;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;
import com.applovin.impl.ar;
import com.applovin.impl.br;
import com.applovin.impl.e0;
import com.applovin.impl.gc;
import com.applovin.impl.ge;
import com.applovin.impl.he;
import com.applovin.impl.jn;
import com.applovin.impl.la;
import com.applovin.impl.mediation.MaxErrorImpl;
import com.applovin.impl.mediation.ads.a;
import com.applovin.impl.mediation.d;
import com.applovin.impl.sdk.d;
import com.applovin.impl.sdk.j;
import com.applovin.impl.sdk.n;
import com.applovin.impl.sdk.utils.CollectionUtils;
import com.applovin.impl.sdk.utils.StringUtils;
import com.applovin.impl.tm;
import com.applovin.impl.v;
import com.applovin.impl.ve;
import com.applovin.impl.yl;
import com.applovin.impl.yp;
import com.applovin.impl.z3;
import com.applovin.impl.zq;
import com.applovin.mediation.MaxAd;
import com.applovin.mediation.MaxAdFormat;
import com.applovin.mediation.MaxAdListener;
import com.applovin.mediation.MaxAdRevenueListener;
import com.applovin.mediation.MaxAdViewAdListener;
import com.applovin.mediation.MaxError;
import com.applovin.mediation.ads.MaxAdView;
import com.applovin.sdk.AppLovinSdkUtils;
import com.google.ar.core.ImageMetadata;
import csdk.gluads.Consts;
import java.util.Locale;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
/* loaded from: classes2.dex */
public class MaxAdViewImpl extends com.applovin.impl.mediation.ads.a implements d.a, br.a, v.b {
private boolean A;
private final Context a;
private final MaxAdView b;
private final String c;
private final View d;
private long e;
private he f;
private String g;
private String h;
private final b i;
private final d j;
private final com.applovin.impl.sdk.d k;
private final ar l;
private final br m;
private final Object n;
private final Object o;
private he p;
private boolean q;
private boolean r;
private final AtomicBoolean s;
private boolean t;
private boolean u;
private boolean v;
private boolean w;
private boolean x;
private boolean y;
private boolean z;
public class b extends c {
private b() {
super();
}
@Override // com.applovin.mediation.MaxAdListener
public void onAdLoadFailed(String str, MaxError maxError) {
n nVar = MaxAdViewImpl.this.logger;
if (n.a()) {
MaxAdViewImpl maxAdViewImpl = MaxAdViewImpl.this;
maxAdViewImpl.logger.a(maxAdViewImpl.tag, "MaxAdListener.onAdLoadFailed(adUnitId=" + str + ", error=" + maxError + "), listener=" + MaxAdViewImpl.this.adListener);
}
gc.a(MaxAdViewImpl.this.adListener, str, maxError, true);
MaxAdViewImpl.this.a(maxError);
}
@Override // com.applovin.mediation.MaxAdListener
public void onAdLoaded(MaxAd maxAd) {
if (MaxAdViewImpl.this.a()) {
n nVar = MaxAdViewImpl.this.logger;
if (n.a()) {
MaxAdViewImpl maxAdViewImpl = MaxAdViewImpl.this;
maxAdViewImpl.logger.a(maxAdViewImpl.tag, "Precache ad with ad unit ID '" + MaxAdViewImpl.this.adUnitId + "' loaded after MaxAdView was destroyed. Destroying the ad.");
}
MaxAdViewImpl.this.sdk.Q().destroyAd(maxAd);
return;
}
he heVar = (he) maxAd;
heVar.g(MaxAdViewImpl.this.g);
heVar.f(MaxAdViewImpl.this.h);
if (heVar.y() == null) {
MaxAdViewImpl.this.sdk.Q().destroyAd(heVar);
onAdLoadFailed(heVar.getAdUnitId(), new MaxErrorImpl(-5001, "Ad view not fully loaded"));
return;
}
if (heVar.u0()) {
long p0 = heVar.p0();
MaxAdViewImpl.this.sdk.J();
if (n.a()) {
MaxAdViewImpl.this.sdk.J().a(MaxAdViewImpl.this.tag, "Scheduling banner ad refresh " + p0 + " milliseconds from now for '" + MaxAdViewImpl.this.adUnitId + "'...");
}
MaxAdViewImpl.this.k.a(p0);
if (MaxAdViewImpl.this.k.g() || MaxAdViewImpl.this.r) {
n nVar2 = MaxAdViewImpl.this.logger;
if (n.a()) {
MaxAdViewImpl maxAdViewImpl2 = MaxAdViewImpl.this;
maxAdViewImpl2.logger.a(maxAdViewImpl2.tag, "Pausing ad refresh for publisher");
}
MaxAdViewImpl.this.k.j();
}
}
n nVar3 = MaxAdViewImpl.this.logger;
if (n.a()) {
MaxAdViewImpl maxAdViewImpl3 = MaxAdViewImpl.this;
maxAdViewImpl3.logger.a(maxAdViewImpl3.tag, "MaxAdListener.onAdLoaded(ad=" + maxAd + "), listener=" + MaxAdViewImpl.this.adListener);
}
gc.f(MaxAdViewImpl.this.adListener, maxAd, true);
MaxAdViewImpl.this.d(heVar);
}
}
public abstract class c implements MaxAdListener, MaxAdViewAdListener, MaxAdRevenueListener, a.InterfaceC0026a {
private boolean a;
private c() {
}
@Override // com.applovin.mediation.MaxAdListener
public void onAdClicked(MaxAd maxAd) {
if (maxAd.equals(MaxAdViewImpl.this.p)) {
n nVar = MaxAdViewImpl.this.logger;
if (n.a()) {
MaxAdViewImpl maxAdViewImpl = MaxAdViewImpl.this;
maxAdViewImpl.logger.a(maxAdViewImpl.tag, "MaxAdListener.onAdClicked(ad=" + maxAd + "), listener=" + MaxAdViewImpl.this.adListener);
}
gc.a(MaxAdViewImpl.this.adListener, maxAd, true);
}
}
@Override // com.applovin.mediation.MaxAdViewAdListener
public void onAdCollapsed(MaxAd maxAd) {
if (maxAd.equals(MaxAdViewImpl.this.p)) {
if ((MaxAdViewImpl.this.p.v0() || MaxAdViewImpl.this.y) && this.a) {
this.a = false;
MaxAdViewImpl.this.startAutoRefresh();
}
n nVar = MaxAdViewImpl.this.logger;
if (n.a()) {
MaxAdViewImpl maxAdViewImpl = MaxAdViewImpl.this;
maxAdViewImpl.logger.a(maxAdViewImpl.tag, "MaxAdViewAdListener.onAdCollapsed(ad=" + maxAd + "), listener=" + MaxAdViewImpl.this.adListener);
}
gc.b(MaxAdViewImpl.this.adListener, maxAd, true);
}
}
@Override // com.applovin.mediation.MaxAdListener
public void onAdDisplayFailed(MaxAd maxAd, MaxError maxError) {
if (maxAd.equals(MaxAdViewImpl.this.p)) {
n nVar = MaxAdViewImpl.this.logger;
if (n.a()) {
MaxAdViewImpl maxAdViewImpl = MaxAdViewImpl.this;
maxAdViewImpl.logger.a(maxAdViewImpl.tag, "MaxAdListener.onAdDisplayFailed(ad=" + maxAd + ", error=" + maxError + "), listener=" + MaxAdViewImpl.this.adListener);
}
gc.a(MaxAdViewImpl.this.adListener, maxAd, maxError, true);
}
}
@Override // com.applovin.mediation.MaxAdListener
public void onAdDisplayed(MaxAd maxAd) {
if (maxAd.equals(MaxAdViewImpl.this.p)) {
n nVar = MaxAdViewImpl.this.logger;
if (n.a()) {
MaxAdViewImpl maxAdViewImpl = MaxAdViewImpl.this;
maxAdViewImpl.logger.a(maxAdViewImpl.tag, "MaxAdListener.onAdDisplayed(ad=" + maxAd + "), listener=" + MaxAdViewImpl.this.adListener);
}
gc.c(MaxAdViewImpl.this.adListener, maxAd, true);
}
}
@Override // com.applovin.mediation.MaxAdViewAdListener
public void onAdExpanded(MaxAd maxAd) {
if (maxAd.equals(MaxAdViewImpl.this.p)) {
if ((MaxAdViewImpl.this.p.v0() || MaxAdViewImpl.this.y) && !MaxAdViewImpl.this.k.g()) {
this.a = true;
MaxAdViewImpl.this.stopAutoRefresh();
}
n nVar = MaxAdViewImpl.this.logger;
if (n.a()) {
MaxAdViewImpl maxAdViewImpl = MaxAdViewImpl.this;
maxAdViewImpl.logger.a(maxAdViewImpl.tag, "MaxAdViewAdListener.onAdExpanded(ad=" + maxAd + "), listener=" + MaxAdViewImpl.this.adListener);
}
gc.d(MaxAdViewImpl.this.adListener, maxAd, true);
}
}
@Override // com.applovin.mediation.MaxAdListener
public void onAdHidden(MaxAd maxAd) {
if (maxAd.equals(MaxAdViewImpl.this.p)) {
n nVar = MaxAdViewImpl.this.logger;
if (n.a()) {
MaxAdViewImpl maxAdViewImpl = MaxAdViewImpl.this;
maxAdViewImpl.logger.a(maxAdViewImpl.tag, "MaxAdListener.onAdHidden(ad=" + maxAd + "), listener=" + MaxAdViewImpl.this.adListener);
}
gc.e(MaxAdViewImpl.this.adListener, maxAd, true);
}
}
@Override // com.applovin.mediation.MaxAdRequestListener
public void onAdRequestStarted(String str) {
n nVar = MaxAdViewImpl.this.logger;
if (n.a()) {
MaxAdViewImpl maxAdViewImpl = MaxAdViewImpl.this;
maxAdViewImpl.logger.a(maxAdViewImpl.tag, "MaxAdRequestListener.onAdRequestStarted(adUnitId=" + str + "), listener=" + MaxAdViewImpl.this.requestListener);
}
gc.a(MaxAdViewImpl.this.requestListener, str, true);
}
@Override // com.applovin.mediation.MaxAdRevenueListener
public void onAdRevenuePaid(MaxAd maxAd) {
n nVar = MaxAdViewImpl.this.logger;
if (n.a()) {
MaxAdViewImpl maxAdViewImpl = MaxAdViewImpl.this;
maxAdViewImpl.logger.a(maxAdViewImpl.tag, "MaxAdRevenueListener.onAdRevenuePaid(ad=" + maxAd + "), listener=" + MaxAdViewImpl.this.revenueListener);
}
gc.a(MaxAdViewImpl.this.revenueListener, maxAd, true);
}
}
public class d extends c {
private d() {
super();
}
@Override // com.applovin.mediation.MaxAdListener
public void onAdLoadFailed(String str, MaxError maxError) {
n nVar = MaxAdViewImpl.this.logger;
if (n.a()) {
MaxAdViewImpl maxAdViewImpl = MaxAdViewImpl.this;
maxAdViewImpl.logger.a(maxAdViewImpl.tag, "Failed to precache ad for refresh with error code: " + maxError.getCode());
}
MaxAdViewImpl.this.a(maxError);
}
@Override // com.applovin.mediation.MaxAdListener
public void onAdLoaded(MaxAd maxAd) {
if (!MaxAdViewImpl.this.u) {
n nVar = MaxAdViewImpl.this.logger;
if (n.a()) {
MaxAdViewImpl maxAdViewImpl = MaxAdViewImpl.this;
maxAdViewImpl.logger.a(maxAdViewImpl.tag, "Successfully precached ad for refresh");
}
if (((Boolean) MaxAdViewImpl.this.sdk.a(ve.j7)).booleanValue()) {
MaxAdViewImpl.this.b(maxAd);
return;
} else {
MaxAdViewImpl.this.a(maxAd);
return;
}
}
n nVar2 = MaxAdViewImpl.this.logger;
if (n.a()) {
MaxAdViewImpl maxAdViewImpl2 = MaxAdViewImpl.this;
maxAdViewImpl2.logger.a(maxAdViewImpl2.tag, "Ad with ad unit ID '" + MaxAdViewImpl.this.adUnitId + "' loaded after MaxAdView was destroyed. Destroying the ad.");
}
MaxAdViewImpl.this.sdk.Q().destroyAd(maxAd);
}
}
public MaxAdViewImpl(String str, MaxAdFormat maxAdFormat, MaxAdView maxAdView, View view, j jVar, Context context) {
super(str, maxAdFormat, "MaxAdView", jVar);
this.c = UUID.randomUUID().toString().toLowerCase(Locale.US);
this.e = Long.MAX_VALUE;
this.n = new Object();
this.o = new Object();
this.p = null;
this.s = new AtomicBoolean();
this.u = false;
if (context == null) {
throw new IllegalArgumentException("No context specified");
}
this.a = context.getApplicationContext();
this.b = maxAdView;
this.d = view;
this.i = new b();
this.j = new d();
this.k = new com.applovin.impl.sdk.d(jVar, this);
this.l = new ar(maxAdView, jVar);
this.m = new br(maxAdView, jVar, this);
jVar.h().a(this);
if (n.a()) {
this.logger.a(this.tag, "Created new MaxAdView (" + this + ")");
}
}
@Override // com.applovin.impl.mediation.ads.a
public void destroy() {
g();
if (this.f != null) {
this.sdk.Q().destroyAd(this.f);
}
synchronized (this.n) {
this.u = true;
}
this.k.a();
this.sdk.h().b(this);
this.sdk.K().c(this.adUnitId, this.c);
super.destroy();
}
public MaxAdFormat getAdFormat() {
return this.adFormat;
}
public String getPlacement() {
return this.g;
}
public void loadAd() {
loadAd(d.b.PUBLISHER_INITIATED);
}
@Override // com.applovin.impl.sdk.d.a
public void onAdRefresh() {
if (((Boolean) this.sdk.a(ve.j7)).booleanValue()) {
f();
} else {
e();
}
}
@Override // com.applovin.impl.v.b
public void onCreativeIdGenerated(String str, String str2) {
he heVar = this.p;
if (heVar != null && heVar.S().equalsIgnoreCase(str)) {
this.p.h(str2);
gc.b(this.adReviewListener, str2, this.p);
return;
}
he heVar2 = this.f;
if (heVar2 == null || !heVar2.S().equalsIgnoreCase(str)) {
return;
}
this.f.h(str2);
}
@Override // com.applovin.impl.br.a
public void onLogVisibilityImpression() {
a(this.p, this.l.a(this.p));
}
public void onWindowVisibilityChanged(int i) {
if (((Boolean) this.sdk.a(ve.g7)).booleanValue() && this.k.h()) {
if (zq.b(i)) {
if (n.a()) {
this.logger.a(this.tag, "Ad view visible");
}
this.k.d();
} else {
if (n.a()) {
this.logger.a(this.tag, "Ad view hidden");
}
this.k.c();
}
}
}
@Override // com.applovin.impl.mediation.ads.a
public void setExtraParameter(String str, String str2) {
super.setExtraParameter(str, str2);
a(str, str2);
}
public void setPublisherBackgroundColor(int i) {
this.e = i;
}
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("MaxAdView{adUnitId='");
sb.append(this.adUnitId);
sb.append('\'');
sb.append(", adListener=");
Object obj = this.adListener;
if (obj == this.b) {
obj = "this";
}
sb.append(obj);
sb.append(", isDestroyed=");
sb.append(a());
sb.append('}');
return sb.toString();
}
private void e() {
this.s.set(false);
if (this.f != null) {
h();
return;
}
if (!b()) {
if (n.a()) {
this.logger.a(this.tag, "Refreshing ad from network...");
}
loadAd(d.b.REFRESH);
} else if (this.q) {
if (n.a()) {
this.logger.a(this.tag, "Refreshing ad from network due to viewability requirements not met for refresh request...");
}
loadAd(d.b.REFRESH);
} else {
if (n.a()) {
this.logger.b(this.tag, "Ignoring attempt to refresh ad - either still waiting for precache or did not attempt request due to visibility requirement not met");
}
this.s.set(true);
}
}
private void f() {
boolean z;
boolean z2;
synchronized (this.o) {
try {
z = false;
this.s.set(false);
z2 = this.f != null;
if (!z2) {
if (b()) {
if (!this.q) {
if (n.a()) {
this.logger.b(this.tag, "Ignoring attempt to refresh ad - either still waiting for precache or did not attempt request due to visibility requirement not met");
}
this.s.set(true);
} else if (n.a()) {
this.logger.a(this.tag, "Refreshing ad from network due to viewability requirements not met for refresh request...");
}
} else if (n.a()) {
this.logger.a(this.tag, "Refreshing ad from network...");
}
z = true;
}
} catch (Throwable th) {
throw th;
}
}
if (z2) {
h();
} else if (z) {
loadAd(d.b.REFRESH);
}
}
private void h() {
if (n.a()) {
this.logger.a(this.tag, "Rendering for cached ad: " + this.f + "...");
}
this.i.onAdLoaded(this.f);
this.f = null;
}
public void loadAd(d.b bVar) {
if (n.a()) {
this.logger.a(this.tag, "" + this + " Loading ad for " + this.adUnitId + "...");
}
boolean z = this.v || ((Boolean) this.sdk.a(ve.i7)).booleanValue();
if (z && !this.k.g() && this.k.h()) {
n.h(this.tag, "Unable to load a new ad. An ad refresh has already been scheduled in " + TimeUnit.MILLISECONDS.toSeconds(this.k.b()) + " seconds.");
return;
}
if (!z) {
if (n.a()) {
this.logger.a(this.tag, "Loading ad...");
}
a(bVar, this.i);
} else if (this.f != null) {
if (n.a()) {
this.logger.a(this.tag, "Rendering cached ad");
}
h();
} else if (this.t) {
if (n.a()) {
this.logger.a(this.tag, "Waiting for precache ad to load to render");
}
this.s.set(true);
} else {
if (n.a()) {
this.logger.a(this.tag, "Loading ad...");
}
a(bVar, this.i);
}
}
public void setCustomData(String str) {
if (this.p != null && n.a()) {
this.logger.k(this.tag, "Setting custom data (" + str + ") for Ad Unit ID (" + this.adUnitId + ") after an ad has been loaded already.");
}
yp.b(str, this.tag);
this.h = str;
}
public void setPlacement(String str) {
if (this.p != null && n.a()) {
this.logger.k(this.tag, "Setting placement (" + str + ") for Ad Unit ID (" + this.adUnitId + ") after an ad has been loaded already.");
}
this.g = str;
}
public void startAutoRefresh() {
this.r = false;
if (this.k.g()) {
this.k.m();
if (n.a()) {
this.logger.a(this.tag, "Resumed auto-refresh with remaining time: " + this.k.b() + "ms");
return;
}
return;
}
if (n.a()) {
this.logger.a(this.tag, "Ignoring call to startAutoRefresh() - ad refresh is not paused");
}
}
public void stopAutoRefresh() {
if (this.p != null) {
if (n.a()) {
this.logger.a(this.tag, "Pausing auto-refresh with remaining time: " + this.k.b() + "ms");
}
this.k.j();
return;
}
if (this.v || ((Boolean) this.sdk.a(ve.i7)).booleanValue()) {
this.r = true;
} else {
n.j(this.tag, "Stopping auto-refresh has no effect until after the first ad has been loaded.");
}
}
private void g() {
he heVar;
MaxAdView maxAdView = this.b;
if (maxAdView != null) {
e0.a(maxAdView, this.d);
}
this.m.b();
synchronized (this.n) {
heVar = this.p;
}
if (heVar != null) {
this.sdk.Q().destroyAd(heVar);
}
}
/* JADX INFO: Access modifiers changed from: private */
public void d(final he heVar) {
AppLovinSdkUtils.runOnUiThread(new Runnable() { // from class: com.applovin.impl.mediation.ads.MaxAdViewImpl$$ExternalSyntheticLambda2
@Override // java.lang.Runnable
public final void run() {
MaxAdViewImpl.this.b(heVar);
}
});
}
private void d() {
if (b()) {
if (n.a()) {
this.logger.a(this.tag, "Scheduling refresh precache request now");
}
this.t = true;
this.sdk.j0().a((yl) new jn(this.sdk, "loadMaxAdForPrecacheRequest", new Runnable() { // from class: com.applovin.impl.mediation.ads.MaxAdViewImpl$$ExternalSyntheticLambda3
@Override // java.lang.Runnable
public final void run() {
MaxAdViewImpl.this.c();
}
}), tm.b.MEDIATION);
}
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void b(final he heVar) {
View y = heVar.y();
String str = y == null ? "MaxAdView does not have a loaded ad view" : null;
MaxAdView maxAdView = this.b;
if (maxAdView == null) {
str = "MaxAdView does not have a parent view";
}
if (str != null) {
if (n.a()) {
this.logger.b(this.tag, str);
}
MaxErrorImpl maxErrorImpl = new MaxErrorImpl(-1, str);
if (n.a()) {
this.logger.a(this.tag, "MaxAdListener.onAdDisplayFailed(ad=" + heVar + ", error=" + maxErrorImpl + "), listener=" + this.adListener);
}
gc.a(this.adListener, (MaxAd) heVar, (MaxError) maxErrorImpl, true);
this.sdk.Q().processAdDisplayErrorPostbackForUserError(maxErrorImpl, heVar);
return;
}
g();
a((ge) heVar);
if (heVar.o0()) {
this.m.a(heVar);
}
maxAdView.setDescendantFocusability(ImageMetadata.HOT_PIXEL_MODE);
if (heVar.q0() != Long.MAX_VALUE) {
this.d.setBackgroundColor((int) heVar.q0());
} else {
long j = this.e;
if (j != Long.MAX_VALUE) {
this.d.setBackgroundColor((int) j);
} else {
this.d.setBackgroundColor(0);
}
}
maxAdView.addView(y);
a(y, heVar);
this.sdk.w().d(heVar);
c(heVar);
synchronized (this.n) {
this.p = heVar;
}
if (n.a()) {
this.logger.a(this.tag, "Scheduling impression for ad manually...");
}
this.sdk.Q().processRawAdImpression(heVar, this.i);
if (StringUtils.isValidString(this.p.getAdReviewCreativeId())) {
gc.a(this.adReviewListener, this.p.getAdReviewCreativeId(), (MaxAd) this.p, true);
}
AppLovinSdkUtils.runOnUiThreadDelayed(new Runnable() { // from class: com.applovin.impl.mediation.ads.MaxAdViewImpl$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
MaxAdViewImpl.this.a(heVar);
}
}, heVar.s0());
}
/* JADX INFO: Access modifiers changed from: private */
public void b(MaxAd maxAd) {
boolean compareAndSet;
this.t = false;
synchronized (this.o) {
try {
compareAndSet = this.s.compareAndSet(true, false);
if (!compareAndSet) {
if (n.a()) {
this.logger.a(this.tag, "Saving precache ad...");
}
he heVar = (he) maxAd;
this.f = heVar;
heVar.g(this.g);
this.f.f(this.h);
}
} catch (Throwable th) {
throw th;
}
}
if (compareAndSet) {
if (n.a()) {
this.logger.a(this.tag, "Rendering precache request ad: " + maxAd.getAdUnitId() + "...");
}
this.i.onAdLoaded(maxAd);
}
}
private boolean b() {
if (this.x) {
return false;
}
return ((Boolean) this.sdk.a(ve.o7)).booleanValue();
}
private void c(he heVar) {
int height = this.b.getHeight();
int width = this.b.getWidth();
if (height > 0 || width > 0) {
int pxToDp = AppLovinSdkUtils.pxToDp(this.a, height);
int pxToDp2 = AppLovinSdkUtils.pxToDp(this.a, width);
MaxAdFormat format = heVar.getFormat();
int height2 = (this.A ? format.getAdaptiveSize(pxToDp2, this.b.getContext()) : format.getSize()).getHeight();
int min = Math.min(format.getSize().getWidth(), z3.b(this.a).x);
if (pxToDp < height2 || pxToDp2 < min) {
StringBuilder sb = new StringBuilder();
sb.append("\n**************************************************\n`MaxAdView` size ");
sb.append(pxToDp2);
sb.append("x");
sb.append(pxToDp);
sb.append(" dp smaller than required ");
sb.append(this.A ? "adaptive " : "");
sb.append("size: ");
sb.append(min);
sb.append("x");
sb.append(height2);
sb.append(" dp\nSome mediated networks (e.g. Google Ad Manager) may not render correctly\n**************************************************\n");
String sb2 = sb.toString();
if (n.a()) {
this.logger.b("AppLovinSdk", sb2);
}
}
}
}
private void a(View view, he heVar) {
int t0 = heVar.t0();
int r0 = heVar.r0();
int dpToPx = t0 == -1 ? -1 : AppLovinSdkUtils.dpToPx(view.getContext(), t0);
int dpToPx2 = r0 != -1 ? AppLovinSdkUtils.dpToPx(view.getContext(), r0) : -1;
ViewGroup.LayoutParams layoutParams = view.getLayoutParams();
if (layoutParams == null) {
layoutParams = new RelativeLayout.LayoutParams(dpToPx, dpToPx2);
} else {
layoutParams.width = dpToPx;
layoutParams.height = dpToPx2;
}
if (layoutParams instanceof RelativeLayout.LayoutParams) {
if (n.a()) {
this.logger.a(this.tag, "Pinning ad view to MAX ad view with width: " + dpToPx + " and height: " + dpToPx2 + Consts.STRING_PERIOD);
}
RelativeLayout.LayoutParams layoutParams2 = (RelativeLayout.LayoutParams) layoutParams;
for (int i : zq.a(this.b.getGravity(), 10, 14)) {
layoutParams2.addRule(i);
}
}
view.setLayoutParams(layoutParams);
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void c() {
if (n.a()) {
this.logger.a(this.tag, "Loading ad for precache request...");
}
a(d.b.SEQUENTIAL_OR_PRECACHE, this.j);
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void a(he heVar) {
long a2 = this.l.a(heVar);
if (!heVar.o0()) {
a(heVar, a2);
}
a(a2);
}
private void a(final d.b bVar, final a.InterfaceC0026a interfaceC0026a) {
if (a()) {
boolean c2 = yp.c(this.sdk);
this.sdk.E().a(la.L, "attemptingToLoadDestroyedAdView", (Map) CollectionUtils.hashMap("details", "debug=" + c2));
if (!c2) {
n.h(this.tag, "Failed to load new ad - this instance is already destroyed");
return;
}
throw new IllegalStateException("Failed to load new ad - this instance is already destroyed for ad unit ID: " + this.adUnitId);
}
AppLovinSdkUtils.runOnUiThread(true, new Runnable() { // from class: com.applovin.impl.mediation.ads.MaxAdViewImpl$$ExternalSyntheticLambda1
@Override // java.lang.Runnable
public final void run() {
MaxAdViewImpl.this.a(interfaceC0026a, bVar);
}
});
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void a(a.InterfaceC0026a interfaceC0026a, d.b bVar) {
he heVar = this.p;
if (heVar != null) {
long a2 = this.l.a(heVar);
this.extraParameters.put("visible_ad_ad_unit_id", this.p.getAdUnitId());
this.extraParameters.put("viewability_flags", Long.valueOf(a2));
} else {
this.extraParameters.remove("visible_ad_ad_unit_id");
this.extraParameters.remove("viewability_flags");
}
int pxToDp = AppLovinSdkUtils.pxToDp(this.b.getContext(), this.b.getWidth());
int pxToDp2 = AppLovinSdkUtils.pxToDp(this.b.getContext(), this.b.getHeight());
this.extraParameters.put("viewport_width", Integer.valueOf(pxToDp));
this.extraParameters.put("viewport_height", Integer.valueOf(pxToDp2));
this.extraParameters.put("auto_refresh_stopped", Boolean.valueOf(this.k.g() || this.r));
this.extraParameters.put("auto_retries_disabled", Boolean.valueOf(this.w));
if (n.a()) {
this.logger.a(this.tag, "Loading " + this.adFormat.getLabel().toLowerCase(Locale.ENGLISH) + " ad for '" + this.adUnitId + "' and notifying " + interfaceC0026a + "...");
}
this.sdk.Q().loadAd(this.adUnitId, this.c, this.adFormat, bVar, this.localExtraParameters, this.extraParameters, this.a, interfaceC0026a);
}
private void a(String str, String str2) {
if ("allow_pause_auto_refresh_immediately".equalsIgnoreCase(str)) {
if (n.a()) {
this.logger.a(this.tag, "Updated allow immediate auto-refresh pause and ad load to: " + str2);
}
this.v = Boolean.parseBoolean(str2);
return;
}
if ("disable_auto_retries".equalsIgnoreCase(str)) {
if (n.a()) {
this.logger.a(this.tag, "Updated disable auto-retries to: " + str2);
}
this.w = Boolean.parseBoolean(str2);
return;
}
if ("disable_precache".equalsIgnoreCase(str)) {
if (n.a()) {
this.logger.a(this.tag, "Updated precached disabled to: " + str2);
}
this.x = Boolean.parseBoolean(str2);
return;
}
if ("should_stop_auto_refresh_on_ad_expand".equals(str)) {
if (n.a()) {
this.logger.a(this.tag, "Updated should stop auto-refresh on ad expand to: " + str2);
}
this.y = Boolean.parseBoolean(str2);
return;
}
if ("force_precache".equals(str)) {
if (n.a()) {
this.logger.a(this.tag, "Updated force precache to: " + str2);
}
this.z = Boolean.parseBoolean(str2);
return;
}
if ("adaptive_banner".equalsIgnoreCase(str)) {
if (n.a()) {
this.logger.a(this.tag, "Updated is adaptive banner to: " + str2);
}
this.A = Boolean.parseBoolean(str2);
setLocalExtraParameter(str, str2);
}
}
/* JADX INFO: Access modifiers changed from: private */
public void a(MaxError maxError) {
if (a()) {
if (n.a()) {
this.logger.a(this.tag, "Ad load failure with ad unit ID '" + this.adUnitId + "' occured after MaxAdView was destroyed.");
return;
}
return;
}
if (this.sdk.c(ve.c7).contains(String.valueOf(maxError.getCode()))) {
this.sdk.J();
if (n.a()) {
this.sdk.J().a(this.tag, "Ignoring banner ad refresh for error code " + maxError.getCode());
return;
}
return;
}
if (!this.r && !this.k.g()) {
this.q = true;
this.t = false;
long longValue = ((Long) this.sdk.a(ve.b7)).longValue();
if (longValue >= 0) {
this.sdk.J();
if (n.a()) {
this.sdk.J().a(this.tag, "Scheduling failed banner ad refresh " + longValue + " milliseconds from now for '" + this.adUnitId + "'...");
}
this.k.a(longValue);
return;
}
return;
}
if (this.t) {
if (n.a()) {
this.logger.a(this.tag, "Refresh precache failed when auto-refresh is stopped");
}
this.t = false;
}
if (this.s.get()) {
if (n.a()) {
this.logger.a(this.tag, "Refresh precache failed - MaxAdListener.onAdLoadFailed(adUnitId=" + this.adUnitId + ", error=" + maxError + "), listener=" + this.adListener);
}
gc.a(this.adListener, this.adUnitId, maxError, true);
}
}
private void a(he heVar, long j) {
if (n.a()) {
this.logger.a(this.tag, "Scheduling viewability impression for ad...");
}
this.sdk.Q().processViewabilityAdImpressionPostback(heVar, j, this.i);
}
private void a(long j) {
if (yp.a(j, ((Long) this.sdk.a(ve.n7)).longValue()) && !this.z) {
if (n.a()) {
this.logger.a(this.tag, "Undesired flags matched - current: " + Long.toBinaryString(j) + ", undesired: " + Long.toBinaryString(j));
}
if (n.a()) {
this.logger.a(this.tag, "Waiting for refresh timer to manually fire request");
}
this.q = true;
return;
}
if (n.a()) {
this.logger.a(this.tag, "No undesired viewability flags matched or forcing precache - scheduling viewability");
}
this.q = false;
d();
}
/* JADX INFO: Access modifiers changed from: private */
public void a(MaxAd maxAd) {
this.t = false;
if (this.s.compareAndSet(true, false)) {
if (n.a()) {
this.logger.a(this.tag, "Rendering precache request ad: " + maxAd.getAdUnitId() + "...");
}
this.i.onAdLoaded(maxAd);
return;
}
if (n.a()) {
this.logger.a(this.tag, "Saving precache ad...");
}
he heVar = (he) maxAd;
this.f = heVar;
heVar.g(this.g);
this.f.f(this.h);
}
/* JADX INFO: Access modifiers changed from: private */
public boolean a() {
boolean z;
synchronized (this.n) {
z = this.u;
}
return z;
}
}

View File

@@ -0,0 +1,842 @@
package com.applovin.impl.mediation.ads;
import android.app.Activity;
import android.content.Context;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.lifecycle.Lifecycle;
import com.applovin.impl.gc;
import com.applovin.impl.ge;
import com.applovin.impl.ie;
import com.applovin.impl.j8;
import com.applovin.impl.jn;
import com.applovin.impl.la;
import com.applovin.impl.lf;
import com.applovin.impl.mediation.MaxErrorImpl;
import com.applovin.impl.mediation.MediationServiceImpl;
import com.applovin.impl.mediation.ads.MaxFullscreenAdImpl;
import com.applovin.impl.mediation.ads.a;
import com.applovin.impl.mediation.d;
import com.applovin.impl.sdk.a;
import com.applovin.impl.sdk.j;
import com.applovin.impl.sdk.n;
import com.applovin.impl.sdk.utils.CollectionUtils;
import com.applovin.impl.tm;
import com.applovin.impl.v;
import com.applovin.impl.ve;
import com.applovin.impl.yp;
import com.applovin.mediation.MaxAd;
import com.applovin.mediation.MaxAdFormat;
import com.applovin.mediation.MaxAdListener;
import com.applovin.mediation.MaxAdRevenueListener;
import com.applovin.mediation.MaxError;
import com.applovin.mediation.MaxReward;
import com.applovin.mediation.MaxRewardedAdListener;
import com.applovin.mediation.adapter.MaxAdapterError;
import com.applovin.sdk.AppLovinSdkUtils;
import java.lang.ref.WeakReference;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
/* loaded from: classes2.dex */
public class MaxFullscreenAdImpl extends com.applovin.impl.mediation.ads.a implements a.InterfaceC0037a, v.b {
private final b a;
private final WeakReference b;
private final c c;
private final com.applovin.impl.mediation.b d;
private final Object e;
private ie f;
private d g;
private final AtomicBoolean h;
private final AtomicBoolean i;
private boolean j;
private boolean k;
private String l;
private String m;
private WeakReference n;
private WeakReference o;
private WeakReference p;
public interface b {
Activity getActivity();
}
public class c implements MaxAdListener, MaxRewardedAdListener, MaxAdRevenueListener, a.InterfaceC0026a {
private c() {
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void b(MaxAd maxAd) {
if (MaxFullscreenAdImpl.this.k) {
MaxFullscreenAdImpl.this.d();
return;
}
n nVar = MaxFullscreenAdImpl.this.logger;
if (n.a()) {
MaxFullscreenAdImpl maxFullscreenAdImpl = MaxFullscreenAdImpl.this;
maxFullscreenAdImpl.logger.a(maxFullscreenAdImpl.tag, "MaxAdListener.onAdLoaded(ad=" + maxAd + "), listener=" + MaxFullscreenAdImpl.this.adListener);
}
gc.f(MaxFullscreenAdImpl.this.adListener, maxAd, true);
}
@Override // com.applovin.mediation.MaxAdListener
public void onAdClicked(MaxAd maxAd) {
n nVar = MaxFullscreenAdImpl.this.logger;
if (n.a()) {
MaxFullscreenAdImpl maxFullscreenAdImpl = MaxFullscreenAdImpl.this;
maxFullscreenAdImpl.logger.a(maxFullscreenAdImpl.tag, "MaxAdListener.onAdClicked(ad=" + maxAd + "), listener=" + MaxFullscreenAdImpl.this.adListener);
}
gc.a(MaxFullscreenAdImpl.this.adListener, maxAd, true);
}
@Override // com.applovin.mediation.MaxAdListener
public void onAdDisplayFailed(final MaxAd maxAd, final MaxError maxError) {
final boolean z = MaxFullscreenAdImpl.this.k;
MaxFullscreenAdImpl.this.k = false;
final ie ieVar = (ie) maxAd;
MaxFullscreenAdImpl.this.a(d.IDLE, new e() { // from class: com.applovin.impl.mediation.ads.MaxFullscreenAdImpl$c$$ExternalSyntheticLambda0
@Override // com.applovin.impl.mediation.ads.MaxFullscreenAdImpl.e
public final void a() {
MaxFullscreenAdImpl.c.this.a(maxAd, z, ieVar, maxError);
}
});
}
@Override // com.applovin.mediation.MaxAdListener
public void onAdDisplayed(MaxAd maxAd) {
final ie ieVar = (ie) maxAd;
MaxFullscreenAdImpl.this.k = false;
MaxFullscreenAdImpl.this.sdk.f().a(ieVar);
if (((Integer) MaxFullscreenAdImpl.this.sdk.a(ve.V7)).intValue() > 0) {
MaxFullscreenAdImpl.this.sdk.j0().b(new jn(MaxFullscreenAdImpl.this.sdk, "ReportAdHiddenCallbackNotCalled", new Runnable() { // from class: com.applovin.impl.mediation.ads.MaxFullscreenAdImpl$c$$ExternalSyntheticLambda3
@Override // java.lang.Runnable
public final void run() {
MaxFullscreenAdImpl.c.this.a(ieVar);
}
}), tm.b.TIMEOUT, TimeUnit.SECONDS.toMillis(r1.intValue()));
}
n nVar = MaxFullscreenAdImpl.this.logger;
if (n.a()) {
MaxFullscreenAdImpl maxFullscreenAdImpl = MaxFullscreenAdImpl.this;
maxFullscreenAdImpl.logger.a(maxFullscreenAdImpl.tag, "MaxAdListener.onAdDisplayed(ad=" + maxAd + "), listener=" + MaxFullscreenAdImpl.this.adListener);
}
gc.c(MaxFullscreenAdImpl.this.adListener, maxAd, true);
}
@Override // com.applovin.mediation.MaxAdListener
public void onAdHidden(final MaxAd maxAd) {
MaxFullscreenAdImpl.this.k = false;
MaxFullscreenAdImpl.this.a(d.IDLE, new e() { // from class: com.applovin.impl.mediation.ads.MaxFullscreenAdImpl$c$$ExternalSyntheticLambda1
@Override // com.applovin.impl.mediation.ads.MaxFullscreenAdImpl.e
public final void a() {
MaxFullscreenAdImpl.c.this.a(maxAd);
}
});
}
@Override // com.applovin.mediation.MaxAdListener
public void onAdLoadFailed(final String str, final MaxError maxError) {
MaxFullscreenAdImpl.this.c();
MaxFullscreenAdImpl.this.a(d.IDLE, new e() { // from class: com.applovin.impl.mediation.ads.MaxFullscreenAdImpl$c$$ExternalSyntheticLambda5
@Override // com.applovin.impl.mediation.ads.MaxFullscreenAdImpl.e
public final void a() {
MaxFullscreenAdImpl.c.this.a(str, maxError);
}
});
}
@Override // com.applovin.mediation.MaxAdListener
public void onAdLoaded(final MaxAd maxAd) {
ie ieVar;
synchronized (MaxFullscreenAdImpl.this.e) {
ieVar = MaxFullscreenAdImpl.this.f;
}
MaxFullscreenAdImpl.this.sdk.C().a(MaxFullscreenAdImpl.this.adUnitId);
MaxFullscreenAdImpl.this.a((ie) maxAd);
if (!MaxFullscreenAdImpl.this.h.compareAndSet(true, false)) {
MaxFullscreenAdImpl.this.a(d.READY, new e() { // from class: com.applovin.impl.mediation.ads.MaxFullscreenAdImpl$c$$ExternalSyntheticLambda4
@Override // com.applovin.impl.mediation.ads.MaxFullscreenAdImpl.e
public final void a() {
MaxFullscreenAdImpl.c.this.b(maxAd);
}
});
return;
}
MaxFullscreenAdImpl.this.extraParameters.remove("expired_ad_ad_unit_id");
if (MaxFullscreenAdImpl.this.i.compareAndSet(true, false)) {
MaxFullscreenAdImpl.this.d();
}
n nVar = MaxFullscreenAdImpl.this.logger;
if (n.a()) {
MaxFullscreenAdImpl maxFullscreenAdImpl = MaxFullscreenAdImpl.this;
maxFullscreenAdImpl.logger.a(maxFullscreenAdImpl.tag, "MaxAdListener.onExpiredAdReloaded(expiredAd=" + ieVar + ", newAd=" + maxAd + "), listener=" + MaxFullscreenAdImpl.this.expirationListener);
}
gc.a(MaxFullscreenAdImpl.this.expirationListener, (MaxAd) ieVar, maxAd, true);
}
@Override // com.applovin.mediation.MaxAdRequestListener
public void onAdRequestStarted(String str) {
n nVar = MaxFullscreenAdImpl.this.logger;
if (n.a()) {
MaxFullscreenAdImpl maxFullscreenAdImpl = MaxFullscreenAdImpl.this;
maxFullscreenAdImpl.logger.a(maxFullscreenAdImpl.tag, "MaxAdRequestListener.onAdRequestStarted(adUnitId=" + str + "), listener=" + MaxFullscreenAdImpl.this.requestListener);
}
gc.a(MaxFullscreenAdImpl.this.requestListener, str, true);
}
@Override // com.applovin.mediation.MaxAdRevenueListener
public void onAdRevenuePaid(MaxAd maxAd) {
n nVar = MaxFullscreenAdImpl.this.logger;
if (n.a()) {
MaxFullscreenAdImpl maxFullscreenAdImpl = MaxFullscreenAdImpl.this;
maxFullscreenAdImpl.logger.a(maxFullscreenAdImpl.tag, "MaxAdRevenueListener.onAdRevenuePaid(ad=" + maxAd + "), listener=" + MaxFullscreenAdImpl.this.revenueListener);
}
gc.a(MaxFullscreenAdImpl.this.revenueListener, maxAd, true);
}
@Override // com.applovin.mediation.MaxRewardedAdListener
public void onUserRewarded(MaxAd maxAd, MaxReward maxReward) {
n nVar = MaxFullscreenAdImpl.this.logger;
if (n.a()) {
MaxFullscreenAdImpl maxFullscreenAdImpl = MaxFullscreenAdImpl.this;
maxFullscreenAdImpl.logger.a(maxFullscreenAdImpl.tag, "MaxRewardedAdListener.onUserRewarded(ad=" + maxAd + ", reward=" + maxReward + "), listener=" + MaxFullscreenAdImpl.this.adListener);
}
gc.a(MaxFullscreenAdImpl.this.adListener, maxAd, maxReward, true);
}
public /* synthetic */ c(MaxFullscreenAdImpl maxFullscreenAdImpl, a aVar) {
this();
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void a(MaxAd maxAd, boolean z, ie ieVar, MaxError maxError) {
MaxFullscreenAdImpl.this.a(maxAd);
if (!z && ieVar.w0() && MaxFullscreenAdImpl.this.sdk.K().d(MaxFullscreenAdImpl.this.adUnitId)) {
AppLovinSdkUtils.runOnUiThread(true, new Runnable() { // from class: com.applovin.impl.mediation.ads.MaxFullscreenAdImpl$c$$ExternalSyntheticLambda2
@Override // java.lang.Runnable
public final void run() {
MaxFullscreenAdImpl.c.this.a();
}
});
return;
}
n nVar = MaxFullscreenAdImpl.this.logger;
if (n.a()) {
MaxFullscreenAdImpl maxFullscreenAdImpl = MaxFullscreenAdImpl.this;
maxFullscreenAdImpl.logger.a(maxFullscreenAdImpl.tag, "MaxAdListener.onAdDisplayFailed(ad=" + maxAd + ", error=" + maxError + "), listener=" + MaxFullscreenAdImpl.this.adListener);
}
gc.a(MaxFullscreenAdImpl.this.adListener, maxAd, maxError, true);
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void a(ie ieVar) {
if (ieVar.w().get()) {
return;
}
MaxFullscreenAdImpl.this.sdk.E().a(la.B, ieVar);
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void a(String str, MaxError maxError) {
n nVar = MaxFullscreenAdImpl.this.logger;
if (n.a()) {
MaxFullscreenAdImpl maxFullscreenAdImpl = MaxFullscreenAdImpl.this;
maxFullscreenAdImpl.logger.a(maxFullscreenAdImpl.tag, "MaxAdListener.onAdLoadFailed(adUnitId=" + str + ", error=" + maxError + "), listener=" + MaxFullscreenAdImpl.this.adListener);
}
gc.a(MaxFullscreenAdImpl.this.adListener, str, maxError, true);
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void a(MaxAd maxAd) {
MaxFullscreenAdImpl.this.a(maxAd);
n nVar = MaxFullscreenAdImpl.this.logger;
if (n.a()) {
MaxFullscreenAdImpl maxFullscreenAdImpl = MaxFullscreenAdImpl.this;
maxFullscreenAdImpl.logger.a(maxFullscreenAdImpl.tag, "MaxAdListener.onAdHidden(ad=" + maxAd + "), listener=" + MaxFullscreenAdImpl.this.adListener);
}
gc.e(MaxFullscreenAdImpl.this.adListener, maxAd, true);
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void a() {
MaxFullscreenAdImpl.this.k = true;
MaxFullscreenAdImpl.this.loadAd();
}
}
public enum d {
IDLE,
LOADING,
READY,
SHOWING,
DESTROYED
}
public interface e {
void a();
default void a(MaxError maxError) {
}
}
public MaxFullscreenAdImpl(String str, MaxAdFormat maxAdFormat, b bVar, String str2, j jVar, Context context) {
super(str, maxAdFormat, str2, jVar);
this.e = new Object();
this.f = null;
this.g = d.IDLE;
this.h = new AtomicBoolean();
this.i = new AtomicBoolean();
this.n = new WeakReference(null);
this.o = new WeakReference(null);
this.p = new WeakReference(null);
this.a = bVar;
this.c = new c(this, null);
this.d = new com.applovin.impl.mediation.b(jVar);
this.b = new WeakReference(context);
jVar.h().a(this);
n.g(str2, "Created new " + str2 + " (" + this + ")");
}
@Override // com.applovin.impl.mediation.ads.a
public void destroy() {
a(d.DESTROYED, new e() { // from class: com.applovin.impl.mediation.ads.MaxFullscreenAdImpl$$ExternalSyntheticLambda0
@Override // com.applovin.impl.mediation.ads.MaxFullscreenAdImpl.e
public final void a() {
MaxFullscreenAdImpl.this.b();
}
});
}
public boolean isReady() {
boolean z;
synchronized (this.e) {
try {
ie ieVar = this.f;
z = ieVar != null && ieVar.c0() && this.g == d.READY;
} catch (Throwable th) {
throw th;
}
}
if (!z) {
this.sdk.C().c(this.adUnitId);
}
return z;
}
public void loadAd() {
loadAd(d.b.PUBLISHER_INITIATED);
}
@Override // com.applovin.impl.sdk.a.InterfaceC0037a
public void onAdExpired(j8 j8Var) {
if (n.a()) {
this.logger.a(this.tag, "Ad expired " + getAdUnitId());
}
this.h.set(true);
b bVar = this.a;
Activity activity = bVar != null ? bVar.getActivity() : null;
if (activity == null && (activity = this.sdk.e().b()) == null) {
c();
this.c.onAdLoadFailed(this.adUnitId, MaxAdapterError.MISSING_ACTIVITY);
} else {
this.extraParameters.put("expired_ad_ad_unit_id", getAdUnitId());
this.sdk.Q().loadAd(this.adUnitId, null, this.adFormat, d.b.EXPIRED, this.localExtraParameters, this.extraParameters, activity, this.c);
}
}
@Override // com.applovin.impl.v.b
public void onCreativeIdGenerated(String str, String str2) {
ie ieVar = this.f;
if (ieVar == null || !ieVar.S().equalsIgnoreCase(str)) {
return;
}
this.f.h(str2);
gc.b(this.adReviewListener, str2, this.f);
}
public void showAd(final String str, final String str2, final Activity activity) {
ie ieVar;
List b2 = this.sdk.l0().b();
if (!this.sdk.l0().d() || b2 == null || (ieVar = this.f) == null || b2.contains(ieVar.c())) {
if (activity == null) {
activity = this.sdk.n0();
}
if (a(activity, str)) {
a(d.SHOWING, new e() { // from class: com.applovin.impl.mediation.ads.MaxFullscreenAdImpl$$ExternalSyntheticLambda5
@Override // com.applovin.impl.mediation.ads.MaxFullscreenAdImpl.e
public final void a() {
MaxFullscreenAdImpl.this.a(str, str2, activity);
}
});
return;
}
return;
}
final String str3 = "Attempting to show ad from <" + this.f.c() + "> which is not in the list of selected ad networks " + b2;
n.h(this.tag, str3);
a(d.IDLE, new e() { // from class: com.applovin.impl.mediation.ads.MaxFullscreenAdImpl$$ExternalSyntheticLambda4
@Override // com.applovin.impl.mediation.ads.MaxFullscreenAdImpl.e
public final void a() {
MaxFullscreenAdImpl.this.b(str3);
}
});
}
@NonNull
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(this.tag);
sb.append("{adUnitId='");
sb.append(this.adUnitId);
sb.append('\'');
sb.append(", adListener=");
Object obj = this.adListener;
if (obj == this.a) {
obj = "this";
}
sb.append(obj);
sb.append(", revenueListener=");
sb.append(this.revenueListener);
sb.append(", requestListener");
sb.append(this.requestListener);
sb.append(", adReviewListener");
sb.append(this.adReviewListener);
sb.append(", isReady=");
sb.append(isReady());
sb.append('}');
return sb.toString();
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void b() {
synchronized (this.e) {
try {
if (this.f != null) {
if (n.a()) {
this.logger.a(this.tag, "Destroying ad for '" + this.adUnitId + "'; current ad: " + this.f + "...");
}
this.sdk.Q().destroyAd(this.f);
}
} catch (Throwable th) {
throw th;
}
}
this.sdk.h().b(this);
this.d.a();
super.destroy();
}
/* JADX INFO: Access modifiers changed from: private */
public void d() {
Activity activity = (Activity) this.n.get();
if (activity == null) {
activity = this.sdk.n0();
}
Activity activity2 = activity;
if (this.j) {
showAd(this.l, this.m, (ViewGroup) this.o.get(), (Lifecycle) this.p.get(), activity2);
} else {
showAd(this.l, this.m, activity2);
}
}
public void loadAd(d.b bVar) {
if (n.a()) {
this.logger.a(this.tag, "Loading ad for '" + this.adUnitId + "'...");
}
if (this.g == d.DESTROYED) {
boolean c2 = yp.c(this.sdk);
this.sdk.E().a(la.L, "attemptingToLoadDestroyedAd", (Map) CollectionUtils.hashMap("details", "debug=" + c2));
if (c2) {
throw new IllegalStateException("Failed to load new ad - this instance is already destroyed for ad unit ID: " + this.adUnitId);
}
}
if (!isReady()) {
b bVar2 = this.a;
a(d.LOADING, new a(bVar2 != null ? bVar2.getActivity() : null, (Context) this.b.get(), bVar));
return;
}
if (n.a()) {
this.logger.a(this.tag, "An ad is already loaded for '" + this.adUnitId + "'");
}
if (n.a()) {
this.logger.a(this.tag, "MaxAdListener.onAdLoaded(ad=" + this.f + "), listener=" + this.adListener);
}
gc.f(this.adListener, (MaxAd) this.f, true);
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void c(String str) {
ie ieVar = this.f;
a((MaxAd) ieVar);
MaxErrorImpl maxErrorImpl = new MaxErrorImpl(MaxAdapterError.ERROR_CODE_AD_DISPLAY_FAILED, str);
if (n.a()) {
this.logger.a(this.tag, "MaxAdListener.onAdDisplayFailed(ad=" + ieVar + ", error=" + maxErrorImpl + "), listener=" + this.adListener);
}
gc.a(this.adListener, (MaxAd) ieVar, (MaxError) maxErrorImpl, true);
this.sdk.Q().processAdDisplayErrorPostbackForUserError(maxErrorImpl, ieVar);
}
public class a implements e {
final /* synthetic */ Activity a;
final /* synthetic */ Context b;
final /* synthetic */ d.b c;
public a(Activity activity, Context context, d.b bVar) {
this.a = activity;
this.b = context;
this.c = bVar;
}
@Override // com.applovin.impl.mediation.ads.MaxFullscreenAdImpl.e
public void a() {
Context context = this.a;
if (context == null && (context = this.b) == null) {
if (MaxFullscreenAdImpl.this.sdk.n0() != null) {
context = MaxFullscreenAdImpl.this.sdk.n0();
} else {
context = j.l();
}
}
Context context2 = context;
MediationServiceImpl Q = MaxFullscreenAdImpl.this.sdk.Q();
MaxFullscreenAdImpl maxFullscreenAdImpl = MaxFullscreenAdImpl.this;
Q.loadAd(maxFullscreenAdImpl.adUnitId, null, maxFullscreenAdImpl.adFormat, this.c, maxFullscreenAdImpl.localExtraParameters, maxFullscreenAdImpl.extraParameters, context2, maxFullscreenAdImpl.c);
}
@Override // com.applovin.impl.mediation.ads.MaxFullscreenAdImpl.e
public void a(MaxError maxError) {
if (((Boolean) MaxFullscreenAdImpl.this.sdk.a(ve.U7)).booleanValue()) {
n nVar = MaxFullscreenAdImpl.this.logger;
if (n.a()) {
MaxFullscreenAdImpl maxFullscreenAdImpl = MaxFullscreenAdImpl.this;
maxFullscreenAdImpl.logger.a(maxFullscreenAdImpl.tag, "MaxAdListener.onAdLoadFailed(adUnitId=" + MaxFullscreenAdImpl.this.adUnitId + ", error=" + maxError + "), listener=" + MaxFullscreenAdImpl.this.adListener);
}
MaxFullscreenAdImpl maxFullscreenAdImpl2 = MaxFullscreenAdImpl.this;
gc.a(maxFullscreenAdImpl2.adListener, maxFullscreenAdImpl2.adUnitId, maxError, true);
}
}
}
/* JADX INFO: Access modifiers changed from: private */
public void c() {
ie ieVar;
if (this.h.compareAndSet(true, false)) {
synchronized (this.e) {
ieVar = this.f;
this.f = null;
}
this.sdk.Q().destroyAd(ieVar);
this.extraParameters.remove("expired_ad_ad_unit_id");
}
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void b(String str) {
ie ieVar = this.f;
a((MaxAd) ieVar);
MaxErrorImpl maxErrorImpl = new MaxErrorImpl(MaxAdapterError.ERROR_CODE_AD_DISPLAY_FAILED, str);
if (n.a()) {
this.logger.a(this.tag, "MaxAdListener.onAdDisplayFailed(ad=" + ieVar + ", error=" + maxErrorImpl + "), listener=" + this.adListener);
}
gc.a(this.adListener, (MaxAd) ieVar, (MaxError) maxErrorImpl, true);
this.sdk.Q().processAdDisplayErrorPostbackForUserError(maxErrorImpl, ieVar);
}
public void showAd(final String str, final String str2, final ViewGroup viewGroup, final Lifecycle lifecycle, Activity activity) {
ie ieVar;
if (viewGroup != null && lifecycle != null) {
if (!viewGroup.isShown() && ((Boolean) this.sdk.a(ve.M7)).booleanValue()) {
n.h(this.tag, "Attempting to show ad when containerView and/or its ancestors are not visible");
MaxErrorImpl maxErrorImpl = new MaxErrorImpl(-1, "Attempting to show ad when containerView and/or its ancestors are not visible");
gc.a(this.adListener, (MaxAd) this.f, (MaxError) maxErrorImpl, true);
this.sdk.Q().processAdDisplayErrorPostbackForUserError(maxErrorImpl, this.f);
return;
}
List b2 = this.sdk.l0().b();
if (this.sdk.l0().d() && b2 != null && (ieVar = this.f) != null && !b2.contains(ieVar.c())) {
final String str3 = "Attempting to show ad from <" + this.f.c() + "> which is not in the list of selected ad networks " + b2;
n.h(this.tag, str3);
a(d.IDLE, new e() { // from class: com.applovin.impl.mediation.ads.MaxFullscreenAdImpl$$ExternalSyntheticLambda1
@Override // com.applovin.impl.mediation.ads.MaxFullscreenAdImpl.e
public final void a() {
MaxFullscreenAdImpl.this.c(str3);
}
});
return;
}
if (activity == null) {
activity = this.sdk.n0();
}
final Activity activity2 = activity;
if (a(activity2, str)) {
a(d.SHOWING, new e() { // from class: com.applovin.impl.mediation.ads.MaxFullscreenAdImpl$$ExternalSyntheticLambda2
@Override // com.applovin.impl.mediation.ads.MaxFullscreenAdImpl.e
public final void a() {
MaxFullscreenAdImpl.this.a(str, str2, activity2, viewGroup, lifecycle);
}
});
return;
}
return;
}
n.h(this.tag, "Attempting to show ad with null containerView or lifecycle.");
MaxErrorImpl maxErrorImpl2 = new MaxErrorImpl(-1, "Attempting to show ad with null containerView or lifecycle.");
if (n.a()) {
this.logger.a(this.tag, "MaxAdListener.onAdDisplayFailed(ad=" + this.f + ", error=" + maxErrorImpl2 + "), listener=" + this.adListener);
}
gc.a(this.adListener, (MaxAd) this.f, (MaxError) maxErrorImpl2, true);
this.sdk.Q().processAdDisplayErrorPostbackForUserError(maxErrorImpl2, this.f);
}
/* JADX INFO: Access modifiers changed from: private */
public void a(ie ieVar) {
if (this.sdk.f().a(ieVar, this)) {
if (n.a()) {
this.logger.a(this.tag, "Handle ad loaded for regular ad: " + ieVar);
}
this.f = ieVar;
return;
}
if (n.a()) {
this.logger.a(this.tag, "Loaded an expired ad, running expire logic...");
}
onAdExpired(ieVar);
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void a(String str, String str2, Activity activity) {
a(str, str2);
this.j = false;
this.n = new WeakReference(activity);
this.sdk.Q().showFullscreenAd(this.f, activity, this.c);
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void a(String str, String str2, Activity activity, ViewGroup viewGroup, Lifecycle lifecycle) {
a(str, str2);
this.j = true;
this.n = new WeakReference(activity);
this.o = new WeakReference(viewGroup);
this.p = new WeakReference(lifecycle);
this.sdk.Q().showFullscreenAd(this.f, viewGroup, lifecycle, activity, this.c);
}
private boolean a(Activity activity, final String str) {
if (activity == null && MaxAdFormat.APP_OPEN != this.adFormat) {
throw new IllegalArgumentException("Attempting to show ad without a valid activity.");
}
if (this.g == d.DESTROYED) {
boolean c2 = yp.c(this.sdk);
this.sdk.E().a(la.L, "attemptingToShowDestroyedAd", (Map) CollectionUtils.hashMap("details", "debug=" + c2));
if (c2) {
throw new IllegalStateException("Attempting to show ad that is destroyed for ad unit ID: " + this.adUnitId);
}
}
if (!isReady()) {
String str2 = "Attempting to show ad before it is ready - please check ad readiness using " + this.tag + "#isReady()";
n.h(this.tag, str2);
MaxErrorImpl maxErrorImpl = new MaxErrorImpl(-24, str2);
lf lfVar = new lf(this.adUnitId, this.adFormat, str);
if (n.a()) {
this.logger.a(this.tag, "MaxAdListener.onAdDisplayFailed(ad=" + lfVar + ", error=" + maxErrorImpl + "), listener=" + this.adListener);
}
gc.a(this.adListener, (MaxAd) lfVar, (MaxError) maxErrorImpl, true);
if (this.f != null) {
this.sdk.Q().processAdDisplayErrorPostbackForUserError(maxErrorImpl, this.f);
}
return false;
}
Long l = (Long) this.sdk.a(ve.w7);
Long l2 = (Long) this.sdk.a(ve.p7);
if (l.longValue() > 0 && (this.f.getTimeToLiveMillis() < l2.longValue() || this.h.get())) {
this.i.set(true);
this.sdk.j0().a(new jn(this.sdk, "handleShowOnLoadTimeoutError", new Runnable() { // from class: com.applovin.impl.mediation.ads.MaxFullscreenAdImpl$$ExternalSyntheticLambda3
@Override // java.lang.Runnable
public final void run() {
MaxFullscreenAdImpl.this.a(str);
}
}), tm.b.TIMEOUT, l.longValue());
return false;
}
if (yp.a(j.l()) != 0 && this.sdk.g0().shouldFailAdDisplayIfDontKeepActivitiesIsEnabled()) {
if (!yp.c(this.sdk)) {
if (((Boolean) this.sdk.a(ve.L7)).booleanValue()) {
n.h(this.tag, "Ad failed to display! Please disable the \"Don't Keep Activities\" setting in your developer settings!");
MaxErrorImpl maxErrorImpl2 = new MaxErrorImpl(-5602, "Ad failed to display! Please disable the \"Don't Keep Activities\" setting in your developer settings!");
if (n.a()) {
this.logger.a(this.tag, "MaxAdListener.onAdDisplayFailed(ad=" + this.f + ", error=" + maxErrorImpl2 + "), listener=" + this.adListener);
}
gc.a(this.adListener, (MaxAd) this.f, (MaxError) maxErrorImpl2, true);
this.sdk.Q().processAdDisplayErrorPostbackForUserError(maxErrorImpl2, this.f);
return false;
}
} else {
throw new IllegalStateException("Ad failed to display! Please disable the \"Don't Keep Activities\" setting in your developer settings!");
}
}
if (!this.sdk.C().d() && !this.sdk.C().c()) {
return true;
}
n.h(this.tag, "Attempting to show ad when another fullscreen ad is already showing");
MaxErrorImpl maxErrorImpl3 = new MaxErrorImpl(-23, "Attempting to show ad when another fullscreen ad is already showing");
if (n.a()) {
this.logger.a(this.tag, "MaxAdListener.onAdDisplayFailed(ad=" + this.f + ", error=" + maxErrorImpl3 + "), listener=" + this.adListener);
}
gc.a(this.adListener, (MaxAd) this.f, (MaxError) maxErrorImpl3, true);
this.sdk.Q().processAdDisplayErrorPostbackForUserError(maxErrorImpl3, this.f);
return false;
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void a(String str) {
if (this.i.compareAndSet(true, false)) {
n.h(this.tag, "Failed to show an ad. Failed to load an ad in time to show.");
this.sdk.C().c(this.adUnitId);
MaxErrorImpl maxErrorImpl = new MaxErrorImpl(-24, "Failed to show an ad. Failed to load an ad in time to show.");
lf lfVar = new lf(this.adUnitId, this.adFormat, str);
if (n.a()) {
this.logger.a(this.tag, "MaxAdListener.onAdDisplayFailed(ad=" + lfVar + ", error=" + maxErrorImpl + "), listener=" + this.adListener);
}
gc.a(this.adListener, (MaxAd) lfVar, (MaxError) maxErrorImpl, true);
if (this.f != null) {
this.sdk.Q().processAdDisplayErrorPostbackForUserError(maxErrorImpl, this.f);
}
}
}
private void a(String str, String str2) {
this.d.e(this.f);
this.f.g(str);
this.f.f(str2);
this.l = str;
this.m = str2;
this.sdk.w().d(this.f);
if (n.a()) {
this.logger.a(this.tag, "Showing ad for '" + this.adUnitId + "'; loaded ad: " + this.f + "...");
}
a((ge) this.f);
}
private void a() {
ie ieVar;
synchronized (this.e) {
ieVar = this.f;
this.f = null;
}
this.sdk.Q().destroyAd(ieVar);
}
/* JADX INFO: Access modifiers changed from: private */
public void a(d dVar, e eVar) {
boolean z;
MaxErrorImpl maxErrorImpl = new MaxErrorImpl(-1);
d dVar2 = this.g;
synchronized (this.e) {
try {
d dVar3 = d.IDLE;
if (dVar2 == dVar3) {
if (dVar != d.LOADING && dVar != d.DESTROYED) {
if (dVar == d.SHOWING) {
n.h(this.tag, "No ad is loading or loaded");
} else if (n.a()) {
this.logger.b(this.tag, "Unable to transition to: " + dVar);
}
z = false;
}
z = true;
} else {
d dVar4 = d.LOADING;
if (dVar2 == dVar4) {
if (dVar != dVar3) {
if (dVar == dVar4) {
maxErrorImpl = new MaxErrorImpl(-26, "An ad is already loading");
n.h(this.tag, maxErrorImpl.getMessage());
} else if (dVar != d.READY) {
if (dVar == d.SHOWING) {
n.h(this.tag, "An ad is not ready to be shown yet");
} else if (dVar != d.DESTROYED) {
if (n.a()) {
this.logger.b(this.tag, "Unable to transition to: " + dVar);
}
}
}
z = false;
}
z = true;
} else {
d dVar5 = d.READY;
if (dVar2 == dVar5) {
if (dVar != dVar3) {
if (dVar == dVar4) {
n.h(this.tag, "An ad is already loaded");
} else if (dVar == dVar5) {
if (n.a()) {
this.logger.b(this.tag, "An ad is already marked as ready");
}
} else if (dVar != d.SHOWING && dVar != d.DESTROYED) {
if (n.a()) {
this.logger.b(this.tag, "Unable to transition to: " + dVar);
}
}
z = false;
}
z = true;
} else {
d dVar6 = d.SHOWING;
if (dVar2 == dVar6) {
if (dVar != dVar3) {
if (dVar == dVar4) {
maxErrorImpl = new MaxErrorImpl(-27, "Can not load another ad while the ad is showing");
n.h(this.tag, maxErrorImpl.getMessage());
} else if (dVar == dVar5) {
if (n.a()) {
this.logger.b(this.tag, "An ad is already showing, ignoring");
}
} else if (dVar == dVar6) {
n.h(this.tag, "The ad is already showing, not showing another one");
} else if (dVar != d.DESTROYED) {
if (n.a()) {
this.logger.b(this.tag, "Unable to transition to: " + dVar);
}
}
}
z = true;
} else if (dVar2 == d.DESTROYED) {
n.h(this.tag, "No operations are allowed on a destroyed instance");
} else if (n.a()) {
this.logger.b(this.tag, "Unknown state: " + this.g);
}
z = false;
}
}
}
if (z) {
if (n.a()) {
this.logger.a(this.tag, "Transitioning from " + this.g + " to " + dVar + "...");
}
this.g = dVar;
} else if (n.a()) {
this.logger.k(this.tag, "Not allowed to transition from " + this.g + " to " + dVar);
}
} catch (Throwable th) {
throw th;
}
}
if (z) {
eVar.a();
} else {
eVar.a(maxErrorImpl);
}
}
/* JADX INFO: Access modifiers changed from: private */
public void a(MaxAd maxAd) {
this.sdk.f().a((ie) maxAd);
this.d.a();
a();
this.sdk.T().a((ge) maxAd);
}
}

View File

@@ -0,0 +1,494 @@
package com.applovin.impl.mediation.ads;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.applovin.impl.gc;
import com.applovin.impl.ge;
import com.applovin.impl.j8;
import com.applovin.impl.je;
import com.applovin.impl.jn;
import com.applovin.impl.mediation.MaxErrorImpl;
import com.applovin.impl.mediation.ads.MaxNativeAdLoaderImpl;
import com.applovin.impl.mediation.ads.a;
import com.applovin.impl.mediation.d;
import com.applovin.impl.sdk.a;
import com.applovin.impl.sdk.j;
import com.applovin.impl.sdk.n;
import com.applovin.impl.sdk.utils.StringUtils;
import com.applovin.impl.tm;
import com.applovin.impl.v;
import com.applovin.impl.ve;
import com.applovin.impl.yl;
import com.applovin.impl.yp;
import com.applovin.impl.z3;
import com.applovin.mediation.MaxAd;
import com.applovin.mediation.MaxAdFormat;
import com.applovin.mediation.MaxError;
import com.applovin.mediation.nativeAds.MaxNativeAd;
import com.applovin.mediation.nativeAds.MaxNativeAdListener;
import com.applovin.mediation.nativeAds.MaxNativeAdView;
import com.applovin.sdk.AppLovinSdkUtils;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
/* loaded from: classes2.dex */
public class MaxNativeAdLoaderImpl extends com.applovin.impl.mediation.ads.a implements a.InterfaceC0037a, v.b {
public static final String KEY_EXTRA_PARAMETER_AD_REQUEST_TYPE = "ad_request_type";
private final c a;
private String b;
private String c;
private d.b d;
private final Object e;
private MaxNativeAdListener f;
private final Map g;
private final Set h;
public class a implements Runnable {
final /* synthetic */ MaxNativeAd a;
final /* synthetic */ List b;
final /* synthetic */ ViewGroup c;
public a(MaxNativeAd maxNativeAd, List list, ViewGroup viewGroup) {
this.a = maxNativeAd;
this.b = list;
this.c = viewGroup;
}
@Override // java.lang.Runnable
public void run() {
if (this.a.prepareForInteraction(this.b, this.c)) {
return;
}
n.h(MaxNativeAdLoaderImpl.this.tag, "Failed to prepare native ad for interaction...");
}
}
public class c implements a.InterfaceC0026a {
private c() {
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void a(MaxAd maxAd) {
n nVar = MaxNativeAdLoaderImpl.this.logger;
if (n.a()) {
MaxNativeAdLoaderImpl maxNativeAdLoaderImpl = MaxNativeAdLoaderImpl.this;
maxNativeAdLoaderImpl.logger.a(maxNativeAdLoaderImpl.tag, "Native ad loaded");
}
je jeVar = (je) maxAd;
jeVar.g(MaxNativeAdLoaderImpl.this.b);
jeVar.f(MaxNativeAdLoaderImpl.this.c);
MaxNativeAdLoaderImpl.this.sdk.w().d(jeVar);
synchronized (MaxNativeAdLoaderImpl.this.e) {
MaxNativeAdLoaderImpl.this.h.add(jeVar);
}
MaxNativeAdView a = MaxNativeAdLoaderImpl.this.a(jeVar.M());
if (a == null) {
n nVar2 = MaxNativeAdLoaderImpl.this.logger;
if (n.a()) {
MaxNativeAdLoaderImpl maxNativeAdLoaderImpl2 = MaxNativeAdLoaderImpl.this;
maxNativeAdLoaderImpl2.logger.a(maxNativeAdLoaderImpl2.tag, "No custom view provided, checking template");
}
String t0 = jeVar.t0();
if (StringUtils.isValidString(t0)) {
n nVar3 = MaxNativeAdLoaderImpl.this.logger;
if (n.a()) {
MaxNativeAdLoaderImpl maxNativeAdLoaderImpl3 = MaxNativeAdLoaderImpl.this;
maxNativeAdLoaderImpl3.logger.a(maxNativeAdLoaderImpl3.tag, "Using template: " + t0 + "...");
}
a = new MaxNativeAdView(t0, j.l());
}
}
if (a == null) {
n nVar4 = MaxNativeAdLoaderImpl.this.logger;
if (n.a()) {
MaxNativeAdLoaderImpl maxNativeAdLoaderImpl4 = MaxNativeAdLoaderImpl.this;
maxNativeAdLoaderImpl4.logger.a(maxNativeAdLoaderImpl4.tag, "No native ad view to render. Returning the native ad to be rendered later.");
}
n nVar5 = MaxNativeAdLoaderImpl.this.logger;
if (n.a()) {
MaxNativeAdLoaderImpl maxNativeAdLoaderImpl5 = MaxNativeAdLoaderImpl.this;
maxNativeAdLoaderImpl5.logger.a(maxNativeAdLoaderImpl5.tag, "MaxNativeAdListener.onNativeAdLoaded(nativeAdView=null, nativeAd=" + maxAd + "), listener=" + MaxNativeAdLoaderImpl.this.f);
}
gc.a(MaxNativeAdLoaderImpl.this.f, (MaxNativeAdView) null, maxAd, true);
MaxNativeAdLoaderImpl.this.a(jeVar);
return;
}
a(a);
MaxNativeAdLoaderImpl.this.a(a, jeVar, jeVar.getNativeAd());
n nVar6 = MaxNativeAdLoaderImpl.this.logger;
if (n.a()) {
MaxNativeAdLoaderImpl maxNativeAdLoaderImpl6 = MaxNativeAdLoaderImpl.this;
maxNativeAdLoaderImpl6.logger.a(maxNativeAdLoaderImpl6.tag, "MaxNativeAdListener.onNativeAdLoaded(nativeAdView=" + a + ", nativeAd=" + maxAd + "), listener=" + MaxNativeAdLoaderImpl.this.f);
}
gc.a(MaxNativeAdLoaderImpl.this.f, a, maxAd, true);
MaxNativeAdLoaderImpl.this.a(jeVar);
MaxNativeAdLoaderImpl.this.a(a);
}
@Override // com.applovin.mediation.MaxAdListener
public void onAdClicked(MaxAd maxAd) {
n nVar = MaxNativeAdLoaderImpl.this.logger;
if (n.a()) {
MaxNativeAdLoaderImpl maxNativeAdLoaderImpl = MaxNativeAdLoaderImpl.this;
maxNativeAdLoaderImpl.logger.a(maxNativeAdLoaderImpl.tag, "MaxNativeAdListener.onNativeAdClicked(nativeAd=" + maxAd + "), listener=" + MaxNativeAdLoaderImpl.this.f);
}
gc.a(MaxNativeAdLoaderImpl.this.f, maxAd, true);
}
@Override // com.applovin.mediation.MaxAdListener
public void onAdDisplayFailed(MaxAd maxAd, MaxError maxError) {
}
@Override // com.applovin.mediation.MaxAdListener
public void onAdDisplayed(MaxAd maxAd) {
}
@Override // com.applovin.mediation.MaxAdListener
public void onAdHidden(MaxAd maxAd) {
}
@Override // com.applovin.mediation.MaxAdListener
public void onAdLoadFailed(String str, MaxError maxError) {
MaxNativeAdLoaderImpl.this.a(((MaxErrorImpl) maxError).getLoadTag());
n nVar = MaxNativeAdLoaderImpl.this.logger;
if (n.a()) {
MaxNativeAdLoaderImpl maxNativeAdLoaderImpl = MaxNativeAdLoaderImpl.this;
maxNativeAdLoaderImpl.logger.a(maxNativeAdLoaderImpl.tag, "MaxNativeAdListener.onNativeAdLoadFailed(adUnitId=" + str + ", error=" + maxError + "), listener=" + MaxNativeAdLoaderImpl.this.f);
}
gc.a(MaxNativeAdLoaderImpl.this.f, str, maxError, true);
}
@Override // com.applovin.mediation.MaxAdListener
public void onAdLoaded(final MaxAd maxAd) {
AppLovinSdkUtils.runOnUiThread(new Runnable() { // from class: com.applovin.impl.mediation.ads.MaxNativeAdLoaderImpl$c$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
MaxNativeAdLoaderImpl.c.this.a(maxAd);
}
});
}
@Override // com.applovin.mediation.MaxAdRequestListener
public void onAdRequestStarted(String str) {
}
@Override // com.applovin.mediation.MaxAdRevenueListener
public void onAdRevenuePaid(MaxAd maxAd) {
n nVar = MaxNativeAdLoaderImpl.this.logger;
if (n.a()) {
MaxNativeAdLoaderImpl maxNativeAdLoaderImpl = MaxNativeAdLoaderImpl.this;
maxNativeAdLoaderImpl.logger.a(maxNativeAdLoaderImpl.tag, "MaxAdRevenueListener.onAdRevenuePaid(ad=" + maxAd + "), listener=" + MaxNativeAdLoaderImpl.this.revenueListener);
}
gc.a(MaxNativeAdLoaderImpl.this.revenueListener, maxAd, true);
}
public /* synthetic */ c(MaxNativeAdLoaderImpl maxNativeAdLoaderImpl, a aVar) {
this();
}
private void a(MaxNativeAdView maxNativeAdView) {
je b;
com.applovin.impl.mediation.ads.b adViewTracker = maxNativeAdView.getAdViewTracker();
if (adViewTracker == null || (b = adViewTracker.b()) == null) {
return;
}
n nVar = MaxNativeAdLoaderImpl.this.logger;
if (n.a()) {
MaxNativeAdLoaderImpl maxNativeAdLoaderImpl = MaxNativeAdLoaderImpl.this;
maxNativeAdLoaderImpl.logger.a(maxNativeAdLoaderImpl.tag, "Destroying previous ad");
}
MaxNativeAdLoaderImpl.this.destroy(b);
}
}
public MaxNativeAdLoaderImpl(String str, j jVar) {
super(str, MaxAdFormat.NATIVE, "MaxNativeAdLoader", jVar);
this.a = new c(this, null);
this.d = d.b.PUBLISHER_INITIATED;
this.e = new Object();
this.g = new HashMap();
this.h = new HashSet();
jVar.h().a(this);
if (n.a()) {
this.logger.a(this.tag, "Created new MaxNativeAdLoader (" + this + ")");
}
}
public String getPlacement() {
return this.b;
}
public void handleNativeAdViewRendered(MaxAd maxAd) {
MaxNativeAd nativeAd = ((je) maxAd).getNativeAd();
if (nativeAd == null) {
if (n.a()) {
this.logger.b(this.tag, "Failed to handle native ad rendered. Could not retrieve MaxNativeAd. The ad may have already been destroyed.");
return;
}
return;
}
com.applovin.impl.mediation.ads.b adViewTracker = nativeAd.getAdViewTracker();
if (adViewTracker != null) {
adViewTracker.c();
} else if (n.a()) {
this.logger.b(this.tag, "Failed to handle native ad rendered. Could not retrieve tracker. Ad might not have been registered via MaxNativeAdLoader.a(...).");
}
}
public void loadAd(@Nullable MaxNativeAdView maxNativeAdView) {
if (n.a()) {
this.logger.a(this.tag, "Loading native ad for '" + this.adUnitId + "' into '" + maxNativeAdView + "' and notifying " + this.a + "...");
}
this.extraParameters.put("integration_type", maxNativeAdView != null ? "custom_ad_view" : "no_ad_view");
String lowerCase = UUID.randomUUID().toString().toLowerCase(Locale.US);
a(lowerCase, maxNativeAdView);
this.sdk.Q().loadAd(this.adUnitId, lowerCase, MaxAdFormat.NATIVE, this.d, this.localExtraParameters, this.extraParameters, j.l(), this.a);
}
@Override // com.applovin.impl.sdk.a.InterfaceC0037a
public void onAdExpired(j8 j8Var) {
if (n.a()) {
this.logger.a(this.tag, "Ad expired for ad unit id " + getAdUnitId());
}
if (n.a()) {
this.logger.a(this.tag, "MaxNativeAdListener.onNativeAdExpired(nativeAd=" + j8Var + "), listener=" + this.f);
}
gc.b(this.f, (MaxAd) j8Var, true);
}
@Override // com.applovin.impl.v.b
public void onCreativeIdGenerated(String str, String str2) {
je jeVar;
Iterator it = this.h.iterator();
while (true) {
if (!it.hasNext()) {
jeVar = null;
break;
} else {
jeVar = (je) it.next();
if (jeVar.S().equalsIgnoreCase(str)) {
break;
}
}
}
if (jeVar != null) {
jeVar.h(str2);
gc.b(this.adReviewListener, str2, jeVar);
synchronized (this.e) {
this.h.remove(jeVar);
}
}
}
public void registerClickableViews(List<View> list, ViewGroup viewGroup, MaxAd maxAd) {
je jeVar = (je) maxAd;
MaxNativeAd nativeAd = jeVar.getNativeAd();
if (nativeAd == null) {
if (n.a()) {
this.logger.b(this.tag, "Failed to register native ad. Could not retrieve MaxNativeAd. The ad may have already been destroyed.");
return;
}
return;
}
jeVar.a(viewGroup);
this.sdk.w().d(jeVar);
a((ge) jeVar);
nativeAd.setClickableViews(list);
nativeAd.setAdViewTracker(new com.applovin.impl.mediation.ads.b(jeVar, viewGroup, this.a, this.sdk));
a aVar = new a(nativeAd, list, viewGroup);
if (nativeAd.shouldPrepareViewForInteractionOnMainThread()) {
AppLovinSdkUtils.runOnUiThread(aVar);
} else {
this.sdk.j0().a((yl) new jn(this.sdk, "renderMaxNativeAd", aVar), tm.b.MEDIATION);
}
}
public boolean render(MaxNativeAdView maxNativeAdView, MaxAd maxAd) {
if (!(maxAd instanceof je)) {
n.h(this.tag, "Failed to render native ad. `ad` needs to be of type `MediatedNativeAd` to render.");
return false;
}
if (maxNativeAdView == null) {
n.h(this.tag, "Failed to render native ad. `adView` to render cannot be null.");
return false;
}
je jeVar = (je) maxAd;
MaxNativeAd nativeAd = jeVar.getNativeAd();
if (nativeAd == null) {
if (n.a()) {
this.logger.b(this.tag, "Failed to render native ad. Could not retrieve MaxNativeAd. The ad may have already been destroyed.");
}
return false;
}
if (nativeAd.isExpired() && !((Boolean) this.sdk.a(ve.u7)).booleanValue()) {
n.h(this.tag, "Cancelled rendering for expired native ad. Check if an ad is expired before displaying using `MaxAd.getNativeAd().isExpired()`");
return false;
}
a(maxNativeAdView, jeVar, nativeAd);
a(maxNativeAdView);
return true;
}
public void setCustomData(String str) {
yp.b(str, this.tag);
this.c = str;
}
@Override // com.applovin.impl.mediation.ads.a
public void setLocalExtraParameter(String str, Object obj) {
super.setLocalExtraParameter(str, obj);
if (KEY_EXTRA_PARAMETER_AD_REQUEST_TYPE.equalsIgnoreCase(str) && (obj instanceof d.b)) {
this.d = (d.b) obj;
}
}
public void setNativeAdListener(MaxNativeAdListener maxNativeAdListener) {
if (n.a()) {
this.logger.a(this.tag, "Setting native ad listener: " + maxNativeAdListener);
}
this.f = maxNativeAdListener;
}
public void setPlacement(String str) {
this.b = str;
}
@NonNull
public String toString() {
return "MaxNativeAdLoader{adUnitId='" + this.adUnitId + "', nativeAdListener=" + this.f + ", revenueListener=" + this.revenueListener + '}';
}
@Override // com.applovin.impl.mediation.ads.a
public void destroy() {
this.f = null;
this.sdk.h().b(this);
synchronized (this.e) {
this.g.clear();
this.h.clear();
}
super.destroy();
}
public void destroy(MaxAd maxAd) {
com.applovin.impl.mediation.ads.b adViewTracker;
if (maxAd instanceof je) {
je jeVar = (je) maxAd;
if (jeVar.w0()) {
if (n.a()) {
this.logger.a(this.tag, "Native ad (" + jeVar + ") has already been destroyed");
return;
}
return;
}
synchronized (this.e) {
this.h.remove(jeVar);
}
MaxNativeAdView q0 = jeVar.q0();
if (q0 != null && (adViewTracker = q0.getAdViewTracker()) != null && maxAd.equals(adViewTracker.b())) {
q0.recycle();
}
MaxNativeAd nativeAd = jeVar.getNativeAd();
if (nativeAd != null && nativeAd.getAdViewTracker() != null) {
nativeAd.getAdViewTracker().a();
}
this.sdk.f().a(jeVar);
this.sdk.Q().destroyAd(jeVar);
this.sdk.K().c(this.adUnitId, jeVar.M());
return;
}
if (n.a()) {
this.logger.a(this.tag, "Destroy failed on non-native ad(" + maxAd + ")");
}
}
public class b implements Runnable {
final /* synthetic */ MaxNativeAdView a;
final /* synthetic */ je b;
final /* synthetic */ MaxNativeAd c;
@Override // java.lang.Runnable
public void run() {
n nVar = MaxNativeAdLoaderImpl.this.logger;
if (n.a()) {
MaxNativeAdLoaderImpl maxNativeAdLoaderImpl = MaxNativeAdLoaderImpl.this;
maxNativeAdLoaderImpl.logger.a(maxNativeAdLoaderImpl.tag, "Rendering native ad view: " + this.a);
}
this.a.render(this.b, MaxNativeAdLoaderImpl.this.a, MaxNativeAdLoaderImpl.this.sdk);
this.c.setNativeAdView(this.a);
if (this.c.prepareForInteraction(this.a.getClickableViews(), this.a)) {
return;
}
this.c.prepareViewForInteraction(this.a);
}
public b(MaxNativeAdView maxNativeAdView, je jeVar, MaxNativeAd maxNativeAd) {
this.a = maxNativeAdView;
this.b = jeVar;
this.c = maxNativeAd;
}
}
/* JADX INFO: Access modifiers changed from: private */
public void a(MaxNativeAdView maxNativeAdView, je jeVar, MaxNativeAd maxNativeAd) {
jeVar.a(maxNativeAdView);
a((ge) jeVar);
b bVar = new b(maxNativeAdView, jeVar, maxNativeAd);
if (maxNativeAd.shouldPrepareViewForInteractionOnMainThread()) {
AppLovinSdkUtils.runOnUiThread(bVar);
} else {
this.sdk.j0().a((yl) new jn(this.sdk, "renderMaxNativeAd", bVar), tm.b.MEDIATION);
}
}
/* JADX INFO: Access modifiers changed from: private */
public void a(je jeVar) {
if (jeVar.s0().get()) {
return;
}
this.sdk.f().a(jeVar, this);
}
private void a(String str, MaxNativeAdView maxNativeAdView) {
if (TextUtils.isEmpty(str)) {
return;
}
synchronized (this.e) {
this.g.put(str, maxNativeAdView);
}
}
/* JADX INFO: Access modifiers changed from: private */
public MaxNativeAdView a(String str) {
MaxNativeAdView maxNativeAdView;
if (TextUtils.isEmpty(str)) {
return null;
}
synchronized (this.e) {
maxNativeAdView = (MaxNativeAdView) this.g.remove(str);
}
return maxNativeAdView;
}
/* JADX INFO: Access modifiers changed from: private */
public void a(MaxNativeAdView maxNativeAdView) {
com.applovin.impl.mediation.ads.b adViewTracker = maxNativeAdView.getAdViewTracker();
if (adViewTracker != null) {
if (z3.e()) {
if (maxNativeAdView.isAttachedToWindow()) {
adViewTracker.c();
}
} else if (maxNativeAdView.getParent() != null) {
adViewTracker.c();
}
}
}
}

View File

@@ -0,0 +1,160 @@
package com.applovin.impl.mediation.ads;
import android.app.Activity;
import androidx.annotation.Nullable;
import com.applovin.impl.ge;
import com.applovin.impl.qc;
import com.applovin.impl.sdk.j;
import com.applovin.impl.sdk.n;
import com.applovin.impl.sdk.utils.StringUtils;
import com.applovin.impl.yp;
import com.applovin.mediation.MaxAdExpirationListener;
import com.applovin.mediation.MaxAdFormat;
import com.applovin.mediation.MaxAdListener;
import com.applovin.mediation.MaxAdRequestListener;
import com.applovin.mediation.MaxAdRevenueListener;
import com.applovin.mediation.MaxAdReviewListener;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
/* loaded from: classes2.dex */
public abstract class a {
protected final MaxAdFormat adFormat;
protected MaxAdListener adListener;
@Nullable
protected MaxAdReviewListener adReviewListener;
protected final String adUnitId;
@Nullable
protected MaxAdExpirationListener expirationListener;
protected final n logger;
@Nullable
protected MaxAdRequestListener requestListener;
@Nullable
protected MaxAdRevenueListener revenueListener;
protected final j sdk;
protected final String tag;
protected final Map<String, Object> localExtraParameters = Collections.synchronizedMap(new HashMap());
protected final Map<String, Object> extraParameters = Collections.synchronizedMap(new HashMap());
/* renamed from: com.applovin.impl.mediation.ads.a$a, reason: collision with other inner class name */
public interface InterfaceC0026a extends MaxAdListener, MaxAdRevenueListener, MaxAdRequestListener {
}
public a(String str, MaxAdFormat maxAdFormat, String str2, j jVar) {
this.adUnitId = str;
this.adFormat = maxAdFormat;
this.sdk = jVar;
this.tag = str2;
this.logger = jVar.J();
}
public void a(ge geVar) {
qc qcVar = new qc();
qcVar.a().a("MAX Ad").a(geVar).a();
if (n.a()) {
this.logger.a(this.tag, qcVar.toString());
}
}
public void destroy() {
this.localExtraParameters.clear();
this.adListener = null;
this.revenueListener = null;
this.requestListener = null;
this.expirationListener = null;
this.adReviewListener = null;
}
public String getAdUnitId() {
return this.adUnitId;
}
public void logApiCall(String str) {
if (n.a()) {
this.logger.a(this.tag, str);
}
}
public void setAdReviewListener(MaxAdReviewListener maxAdReviewListener) {
if (n.a()) {
this.logger.a(this.tag, "Setting Ad Review creative id listener: " + maxAdReviewListener);
}
this.adReviewListener = maxAdReviewListener;
}
public void setExpirationListener(@Nullable MaxAdExpirationListener maxAdExpirationListener) {
if (n.a()) {
this.logger.a(this.tag, "Setting expiration listener: " + maxAdExpirationListener);
}
this.expirationListener = maxAdExpirationListener;
}
public void setExtraParameter(String str, String str2) {
if (str == null) {
throw new IllegalArgumentException("No key specified");
}
if (yp.c(this.sdk) && ("amazon_ad_response".equals(str) || "amazon_ad_error".equals(str))) {
throw new IllegalArgumentException("`setExtraParameter()` is an incorrect method for passing `amazon_ad_response` or `amazon_ad_error`. Please use the following method: `setLocalExtraParameter()`. Also note that this exception occurs in development builds only.");
}
if (this.adFormat.isAdViewAd() && "ad_refresh_seconds".equals(str) && StringUtils.isValidString(str2)) {
int parseInt = Integer.parseInt(str2);
if (parseInt > TimeUnit.MINUTES.toSeconds(2L)) {
n.h(this.tag, "Attempting to set extra parameter \"ad_refresh_seconds\" to over 2 minutes (" + parseInt + "s) - this will be ignored");
}
}
this.extraParameters.put(str, str2);
}
public void setListener(MaxAdListener maxAdListener) {
if (n.a()) {
this.logger.a(this.tag, "Setting listener: " + maxAdListener);
}
this.adListener = maxAdListener;
}
public void setLocalExtraParameter(String str, Object obj) {
if (str == null) {
throw new IllegalArgumentException("No key specified");
}
if (obj instanceof Activity) {
if (n.a()) {
this.logger.b(this.tag, "Ignoring setting local extra parameter to Activity instance - please pass a WeakReference of it instead!");
}
} else {
if ("amazon_ad_response".equals(str) || "amazon_ad_error".equals(str)) {
setExtraParameter("is_amazon_integration", Boolean.toString(true));
}
this.localExtraParameters.put(str, obj);
}
}
public void setRequestListener(MaxAdRequestListener maxAdRequestListener) {
if (n.a()) {
this.logger.a(this.tag, "Setting request listener: " + maxAdRequestListener);
}
this.requestListener = maxAdRequestListener;
}
public void setRevenueListener(MaxAdRevenueListener maxAdRevenueListener) {
if (n.a()) {
this.logger.a(this.tag, "Setting revenue listener: " + maxAdRevenueListener);
}
this.revenueListener = maxAdRevenueListener;
}
public static void logApiCall(String str, String str2) {
j jVar = j.v0;
if (jVar != null) {
jVar.J();
if (n.a()) {
j.v0.J().a(str, str2);
}
}
}
}

View File

@@ -0,0 +1,74 @@
package com.applovin.impl.mediation.ads;
import android.view.ViewGroup;
import com.applovin.impl.ar;
import com.applovin.impl.br;
import com.applovin.impl.je;
import com.applovin.impl.mediation.ads.a;
import com.applovin.impl.sdk.j;
import com.applovin.impl.sdk.n;
/* loaded from: classes2.dex */
public class b implements br.a {
private final j a;
private final je b;
private final br c;
private final ar d;
private final a.InterfaceC0026a e;
public void a() {
this.c.b();
}
public je b() {
return this.b;
}
public void c() {
this.a.J();
if (n.a()) {
this.a.J().a("MaxNativeAdView", "Handling view attached to window");
}
if (this.b.s0().compareAndSet(false, true)) {
this.a.J();
if (n.a()) {
this.a.J().a("MaxNativeAdView", "Scheduling impression for ad manually...");
}
if (this.b.getNativeAd().isExpired()) {
n.h("MaxNativeAdView", "Attempting to display an expired native ad. Check if an ad is expired before displaying using `MaxAd.getNativeAd().isExpired()`");
} else {
this.a.f().a(this.b);
}
this.a.Q().processRawAdImpression(this.b, this.e);
}
}
@Override // com.applovin.impl.br.a
public void onLogVisibilityImpression() {
a(this.d.a(this.b));
}
private void a(long j) {
if (this.b.u0().compareAndSet(false, true)) {
this.a.J();
if (n.a()) {
this.a.J().a("MaxNativeAdView", "Scheduling viewability impression for ad...");
}
this.a.Q().processViewabilityAdImpressionPostback(this.b, j, this.e);
}
}
public b(je jeVar, ViewGroup viewGroup, a.InterfaceC0026a interfaceC0026a, j jVar) {
this.a = jVar;
this.b = jeVar;
this.e = interfaceC0026a;
this.d = new ar(viewGroup, jVar);
br brVar = new br(viewGroup, jVar, this);
this.c = brVar;
brVar.a(jeVar);
jVar.J();
if (n.a()) {
jVar.J().a("MaxNativeAdView", "Created new MaxNativeAdView (" + this + ")");
}
}
}

View File

@@ -0,0 +1,63 @@
package com.applovin.impl.mediation;
import com.applovin.impl.gc;
import com.applovin.impl.ie;
import com.applovin.impl.mediation.a;
import com.applovin.impl.mediation.c;
import com.applovin.impl.sdk.j;
import com.applovin.sdk.AppLovinSdkUtils;
/* loaded from: classes2.dex */
public class b implements a.InterfaceC0025a, c.a {
private final j a;
private final a b;
private final c c;
public b(j jVar) {
this.a = jVar;
this.b = new a(jVar);
this.c = new c(jVar, this);
}
public void e(ie ieVar) {
long l0 = ieVar.l0();
if (l0 >= 0) {
this.c.a(ieVar, l0);
}
boolean parseBoolean = Boolean.parseBoolean(this.a.g0().getExtraParameters().get("should_schedule_ad_hidden_on_ad_destroy"));
if (ieVar.u0() || ieVar.v0() || parseBoolean) {
this.b.a(parseBoolean);
this.b.a(ieVar, this);
}
}
@Override // com.applovin.impl.mediation.c.a
public void a(ie ieVar) {
c(ieVar);
}
public void a() {
this.c.a();
this.b.a();
}
@Override // com.applovin.impl.mediation.a.InterfaceC0025a
public void b(final ie ieVar) {
AppLovinSdkUtils.runOnUiThreadDelayed(new Runnable() { // from class: com.applovin.impl.mediation.b$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
b.this.c(ieVar);
}
}, ieVar.k0());
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: d, reason: merged with bridge method [inline-methods] */
public void c(ie ieVar) {
g A;
if (ieVar == null || (A = ieVar.A()) == null || !ieVar.w().compareAndSet(false, true)) {
return;
}
gc.e(A.c(), ieVar);
}
}

View File

@@ -0,0 +1,55 @@
package com.applovin.impl.mediation;
import com.applovin.impl.ie;
import com.applovin.impl.sdk.j;
import com.applovin.impl.sdk.n;
import com.applovin.impl.x1;
/* loaded from: classes2.dex */
public class c {
private final j a;
private final n b;
private final a c;
private x1 d;
public interface a {
void a(ie ieVar);
}
public c(j jVar, a aVar) {
this.a = jVar;
this.b = jVar.J();
this.c = aVar;
}
public void a(final ie ieVar, long j) {
if (n.a()) {
this.b.a("AdHiddenCallbackTimeoutManager", "Scheduling in " + j + "ms...");
}
this.d = x1.a(j, this.a, new Runnable() { // from class: com.applovin.impl.mediation.c$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
c.this.a(ieVar);
}
});
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void a(ie ieVar) {
if (n.a()) {
this.b.a("AdHiddenCallbackTimeoutManager", "Timing out...");
}
this.c.a(ieVar);
}
public void a() {
if (n.a()) {
this.b.a("AdHiddenCallbackTimeoutManager", "Cancelling timeout");
}
x1 x1Var = this.d;
if (x1Var != null) {
x1Var.a();
this.d = null;
}
}
}

View File

@@ -0,0 +1,435 @@
package com.applovin.impl.mediation;
import android.content.Context;
import android.os.SystemClock;
import com.applovin.impl.fm;
import com.applovin.impl.gc;
import com.applovin.impl.ge;
import com.applovin.impl.lm;
import com.applovin.impl.mediation.ads.a;
import com.applovin.impl.mediation.d;
import com.applovin.impl.sdk.j;
import com.applovin.impl.sdk.n;
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.ve;
import com.applovin.impl.yl;
import com.applovin.impl.yp;
import com.applovin.mediation.MaxAd;
import com.applovin.mediation.MaxAdFormat;
import com.applovin.mediation.MaxError;
import com.applovin.sdk.AppLovinSdkUtils;
import com.mbridge.msdk.mbsignalcommon.commonwebview.ToolBar;
import java.lang.ref.WeakReference;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import org.json.JSONArray;
/* loaded from: classes2.dex */
public class d {
private final j a;
private final Map b = new HashMap(4);
private final Object c = new Object();
private final Map d = new HashMap(4);
private final Object e = new Object();
private final Map f = new HashMap();
private final Object g = new Object();
public class a implements fm.b {
final /* synthetic */ long a;
final /* synthetic */ Map b;
final /* synthetic */ String c;
final /* synthetic */ MaxAdFormat d;
final /* synthetic */ Map e;
final /* synthetic */ Map f;
final /* synthetic */ Context g;
final /* synthetic */ a.InterfaceC0026a h;
public a(long j, Map map, String str, MaxAdFormat maxAdFormat, Map map2, Map map3, Context context, a.InterfaceC0026a interfaceC0026a) {
this.a = j;
this.b = map;
this.c = str;
this.d = maxAdFormat;
this.e = map2;
this.f = map3;
this.g = context;
this.h = interfaceC0026a;
}
@Override // com.applovin.impl.fm.b
public void a(JSONArray jSONArray) {
this.b.put("sct_ms", Long.valueOf(SystemClock.elapsedRealtime() - this.a));
this.b.put("calfc", Integer.valueOf(d.this.b(this.c)));
lm lmVar = new lm(this.c, this.d, this.e, this.f, this.b, jSONArray, this.g, d.this.a, this.h);
if (((Boolean) d.this.a.a(ve.T7)).booleanValue()) {
d.this.a.j0().a((yl) lmVar, tm.b.MEDIATION);
} else {
d.this.a.j0().a(lmVar);
}
}
}
public enum b {
PUBLISHER_INITIATED("publisher_initiated"),
SEQUENTIAL_OR_PRECACHE("sequential_or_precache"),
REFRESH(ToolBar.REFRESH),
EXPONENTIAL_RETRY("exponential_retry"),
EXPIRED("expired"),
NATIVE_AD_PLACER("native_ad_placer");
private final String a;
b(String str) {
this.a = str;
}
public String b() {
return this.a;
}
}
public static class c implements a.InterfaceC0026a {
private final j a;
private final WeakReference b;
private final d c;
private final C0027d d;
private final MaxAdFormat f;
private final Map g;
private final Map h;
private final Map i;
private final int j;
private long k;
private long l;
public /* synthetic */ c(Map map, Map map2, Map map3, C0027d c0027d, MaxAdFormat maxAdFormat, long j, long j2, d dVar, j jVar, Context context, a aVar) {
this(map, map2, map3, c0027d, maxAdFormat, j, j2, dVar, jVar, context);
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void a(int i, String str) {
this.h.put("retry_delay_sec", Integer.valueOf(i));
this.h.put("retry_attempt", Integer.valueOf(this.d.d));
Context context = (Context) this.b.get();
if (context == null) {
context = j.l();
}
Context context2 = context;
this.i.put("art", b.EXPONENTIAL_RETRY.b());
this.i.put("era", Integer.valueOf(this.d.d));
this.l = System.currentTimeMillis();
this.c.a(str, this.f, this.g, this.h, this.i, context2, this);
}
@Override // com.applovin.mediation.MaxAdListener
public void onAdClicked(MaxAd maxAd) {
}
@Override // com.applovin.mediation.MaxAdListener
public void onAdDisplayFailed(MaxAd maxAd, MaxError maxError) {
}
@Override // com.applovin.mediation.MaxAdListener
public void onAdDisplayed(MaxAd maxAd) {
}
@Override // com.applovin.mediation.MaxAdListener
public void onAdHidden(MaxAd maxAd) {
throw new IllegalStateException("Wrong callback invoked for ad: " + maxAd);
}
@Override // com.applovin.mediation.MaxAdListener
public void onAdLoadFailed(final String str, MaxError maxError) {
this.c.c(str);
if (((Boolean) this.a.a(ve.H7)).booleanValue() && this.d.c.get()) {
this.a.J();
if (n.a()) {
this.a.J().a("MediationAdLoadManager", "Ad failed to load but its load state was destroyed");
return;
}
return;
}
long elapsedRealtime = SystemClock.elapsedRealtime() - this.k;
MaxAdWaterfallInfoImpl maxAdWaterfallInfoImpl = (MaxAdWaterfallInfoImpl) maxError.getWaterfall();
if (maxAdWaterfallInfoImpl != null) {
this.a.Q().processWaterfallInfoPostback(str, this.f, maxAdWaterfallInfoImpl, maxError, this.l, elapsedRealtime);
}
boolean z = maxError.getCode() == -5603 && yp.c(this.a) && ((Boolean) this.a.a(sj.s6)).booleanValue();
if (this.a.a(ve.G7, this.f) && this.d.d < this.j && !z) {
C0027d.f(this.d);
final int pow = (int) Math.pow(2.0d, this.d.d);
AppLovinSdkUtils.runOnUiThreadDelayed(new Runnable() { // from class: com.applovin.impl.mediation.d$c$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
d.c.this.a(pow, str);
}
}, TimeUnit.SECONDS.toMillis(pow));
return;
}
this.d.d = 0;
this.d.b.set(false);
if (this.d.e != null) {
MaxErrorImpl maxErrorImpl = (MaxErrorImpl) maxError;
maxErrorImpl.setLoadTag(this.d.a);
maxErrorImpl.setRequestLatencyMillis(elapsedRealtime);
gc.a(this.d.e, str, maxError);
this.d.e = null;
}
}
@Override // com.applovin.mediation.MaxAdListener
public void onAdLoaded(MaxAd maxAd) {
if (((Boolean) this.a.a(ve.H7)).booleanValue() && this.d.c.get()) {
this.a.J();
if (n.a()) {
this.a.J().a("MediationAdLoadManager", "Ad loaded but its load state was destroyed");
}
this.a.Q().destroyAd(maxAd);
return;
}
ge geVar = (ge) maxAd;
geVar.i(this.d.a);
geVar.a(SystemClock.elapsedRealtime() - this.k);
MaxAdWaterfallInfoImpl maxAdWaterfallInfoImpl = (MaxAdWaterfallInfoImpl) geVar.getWaterfall();
if (maxAdWaterfallInfoImpl != null) {
this.a.Q().processWaterfallInfoPostback(geVar.getAdUnitId(), this.f, maxAdWaterfallInfoImpl, null, this.l, geVar.getRequestLatencyMillis());
}
this.c.a(maxAd.getAdUnitId());
this.d.d = 0;
if (this.d.e == null) {
this.c.a(geVar);
this.d.b.set(false);
return;
}
geVar.A().c().a(this.d.e);
this.d.e.onAdLoaded(geVar);
if (geVar.Q().endsWith("load")) {
this.d.e.onAdRevenuePaid(geVar);
}
this.d.e = null;
if ((!this.a.c(ve.E7).contains(maxAd.getAdUnitId()) && !this.a.a(ve.D7, maxAd.getFormat())) || this.a.l0().c() || this.a.l0().d()) {
this.d.b.set(false);
return;
}
Context context = (Context) this.b.get();
if (context == null) {
context = j.l();
}
Context context2 = context;
this.k = SystemClock.elapsedRealtime();
this.l = System.currentTimeMillis();
this.i.put("art", b.SEQUENTIAL_OR_PRECACHE.b());
this.c.a(maxAd.getAdUnitId(), maxAd.getFormat(), this.g, this.h, this.i, context2, this);
}
@Override // com.applovin.mediation.MaxAdRequestListener
public void onAdRequestStarted(String str) {
}
@Override // com.applovin.mediation.MaxAdRevenueListener
public void onAdRevenuePaid(MaxAd maxAd) {
}
private c(Map map, Map map2, Map map3, C0027d c0027d, MaxAdFormat maxAdFormat, long j, long j2, d dVar, j jVar, Context context) {
this.a = jVar;
this.b = new WeakReference(context);
this.c = dVar;
this.d = c0027d;
this.f = maxAdFormat;
this.h = map2;
this.g = map;
this.i = map3;
this.k = j;
this.l = j2;
if (CollectionUtils.getBoolean(map2, "disable_auto_retries")) {
this.j = -1;
} else if (maxAdFormat.isAdViewAd() && CollectionUtils.getBoolean(map2, "auto_refresh_stopped")) {
this.j = Math.min(2, ((Integer) jVar.a(ve.F7)).intValue());
} else {
this.j = ((Integer) jVar.a(ve.F7)).intValue();
}
}
}
/* renamed from: com.applovin.impl.mediation.d$d, reason: collision with other inner class name */
public static class C0027d {
private final String a;
private final AtomicBoolean b;
private final AtomicBoolean c;
private int d;
private volatile a.InterfaceC0026a e;
public /* synthetic */ C0027d(String str, a aVar) {
this(str);
}
public static /* synthetic */ int f(C0027d c0027d) {
int i = c0027d.d;
c0027d.d = i + 1;
return i;
}
private C0027d(String str) {
this.b = new AtomicBoolean();
this.c = new AtomicBoolean();
this.a = str;
}
}
public d(j jVar) {
this.a = jVar;
}
private String b(String str, String str2) {
String str3;
StringBuilder sb = new StringBuilder();
sb.append(str);
if (str2 != null) {
str3 = "-" + str2;
} else {
str3 = "";
}
sb.append(str3);
return sb.toString();
}
public void c(String str, String str2) {
synchronized (this.c) {
String b2 = b(str, str2);
a(str, str2).c.set(true);
this.b.remove(b2);
}
}
public boolean d(String str) {
boolean z;
synchronized (this.e) {
z = this.d.get(str) != null;
}
return z;
}
public int b(String str) {
int intValue;
synchronized (this.g) {
try {
Integer num = (Integer) this.f.get(str);
intValue = num != null ? num.intValue() : 0;
} catch (Throwable th) {
throw th;
}
}
return intValue;
}
public void c(String str) {
synchronized (this.g) {
try {
this.a.J();
if (n.a()) {
this.a.J().a("MediationAdLoadManager", "Incrementing ad load failures count for ad unit ID: " + str);
}
Integer num = (Integer) this.f.get(str);
if (num == null) {
num = 0;
}
this.f.put(str, Integer.valueOf(num.intValue() + 1));
} catch (Throwable th) {
throw th;
}
}
}
private ge e(String str) {
ge geVar;
synchronized (this.e) {
geVar = (ge) this.d.get(str);
this.d.remove(str);
}
return geVar;
}
/* JADX INFO: Access modifiers changed from: private */
public void a(ge geVar) {
synchronized (this.e) {
try {
if (this.d.containsKey(geVar.getAdUnitId())) {
n.h("AppLovinSdk", "Ad in cache already: " + geVar.getAdUnitId());
}
this.d.put(geVar.getAdUnitId(), geVar);
} catch (Throwable th) {
throw th;
}
}
}
public void a(String str, String str2, MaxAdFormat maxAdFormat, b bVar, Map map, Map map2, Context context, a.InterfaceC0026a interfaceC0026a) {
ge e = (this.a.l0().d() || yp.f(j.l())) ? null : e(str);
if (e != null) {
e.i(str2);
e.A().c().a(interfaceC0026a);
interfaceC0026a.onAdLoaded(e);
if (e.Q().endsWith("load")) {
interfaceC0026a.onAdRevenuePaid(e);
}
}
C0027d a2 = a(str, str2);
if (!a2.b.compareAndSet(false, true)) {
if (a2.e != null && a2.e != interfaceC0026a) {
n.j("MediationAdLoadManager", "Attempting to load ad for same ad unit id (" + str + ") while another ad load is already in progress!");
}
a2.e = interfaceC0026a;
return;
}
if (e == null) {
a2.e = interfaceC0026a;
}
Map synchronizedMap = Collections.synchronizedMap(new HashMap());
synchronizedMap.put("art", bVar.b());
if (StringUtils.isValidString(str2)) {
synchronizedMap.put("alt", str2);
}
a(str, maxAdFormat, map, map2, synchronizedMap, context, new c(map, map2, synchronizedMap, a2, maxAdFormat, SystemClock.elapsedRealtime(), System.currentTimeMillis(), this, this.a, context, null));
}
/* JADX INFO: Access modifiers changed from: private */
public void a(String str, MaxAdFormat maxAdFormat, Map map, Map map2, Map map3, Context context, a.InterfaceC0026a interfaceC0026a) {
this.a.j0().a((yl) new fm(str, maxAdFormat, map, context, this.a, new a(SystemClock.elapsedRealtime(), map3, str, maxAdFormat, map, map2, context, interfaceC0026a)), tm.b.MEDIATION);
}
private C0027d a(String str, String str2) {
C0027d c0027d;
synchronized (this.c) {
try {
String b2 = b(str, str2);
c0027d = (C0027d) this.b.get(b2);
if (c0027d == null) {
c0027d = new C0027d(str2, null);
this.b.put(b2, c0027d);
}
} catch (Throwable th) {
throw th;
}
}
return c0027d;
}
/* JADX INFO: Access modifiers changed from: private */
public void a(String str) {
synchronized (this.g) {
try {
this.a.J();
if (n.a()) {
this.a.J().a("MediationAdLoadManager", "Clearing ad load failures count for ad unit ID: " + str);
}
this.f.remove(str);
} catch (Throwable th) {
throw th;
}
}
}
}

View File

@@ -0,0 +1,120 @@
package com.applovin.impl.mediation.debugger.ui.testmode;
import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.drawable.GradientDrawable;
import android.util.AttributeSet;
import android.view.View;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.RelativeLayout;
import com.applovin.impl.o;
import com.applovin.impl.t3;
import com.applovin.mediation.MaxAdFormat;
import com.applovin.sdk.R;
/* loaded from: classes2.dex */
public class AdControlButton extends RelativeLayout implements View.OnClickListener {
private final GradientDrawable a;
private final Button b;
private final o c;
private b d;
private MaxAdFormat f;
private a g;
public interface a {
void onClick(AdControlButton adControlButton);
}
public enum b {
LOAD,
LOADING,
SHOW
}
public AdControlButton(Context context) {
this(context, null, 0);
}
private int a(b bVar) {
return b.LOAD == bVar ? t3.a(R.color.applovin_sdk_brand_color, getContext()) : b.LOADING == bVar ? t3.a(R.color.applovin_sdk_brand_color, getContext()) : t3.a(R.color.applovin_sdk_adControlbutton_brightBlueColor, getContext());
}
private String b(b bVar) {
return b.LOAD == bVar ? "Load" : b.LOADING == bVar ? "" : "Show";
}
private void c(b bVar) {
if (b.LOADING == bVar) {
setEnabled(false);
this.c.a();
} else {
setEnabled(true);
this.c.b();
}
this.b.setText(b(bVar));
this.a.setColor(a(bVar));
}
public b getControlState() {
return this.d;
}
public MaxAdFormat getFormat() {
return this.f;
}
public void setFormat(MaxAdFormat maxAdFormat) {
this.f = maxAdFormat;
}
public void setOnClickListener(a aVar) {
this.g = aVar;
}
public AdControlButton(Context context, AttributeSet attributeSet) {
this(context, attributeSet, 0);
}
public AdControlButton(Context context, AttributeSet attributeSet, int i) {
super(context, attributeSet, i);
GradientDrawable gradientDrawable = new GradientDrawable();
this.a = gradientDrawable;
Button button = new Button(getContext());
this.b = button;
o oVar = new o(getContext(), 20, android.R.attr.progressBarStyleSmall);
this.c = oVar;
b bVar = b.LOAD;
this.d = bVar;
setBackgroundColor(0);
FrameLayout frameLayout = new FrameLayout(context);
addView(frameLayout, new FrameLayout.LayoutParams(-1, -1, 17));
button.setOnClickListener(this);
frameLayout.addView(button, new FrameLayout.LayoutParams(-1, -1, 17));
gradientDrawable.setCornerRadius(20.0f);
button.setBackground(gradientDrawable);
a();
oVar.setColor(-1);
addView(oVar, new FrameLayout.LayoutParams(-1, -1, 17));
c(bVar);
}
@Override // android.view.View.OnClickListener
public void onClick(View view) {
a aVar = this.g;
if (aVar != null) {
aVar.onClick(this);
}
}
public void setControlState(b bVar) {
if (this.d != bVar) {
c(bVar);
}
this.d = bVar;
}
private void a() {
this.b.setTextColor(new ColorStateList(new int[][]{new int[]{android.R.attr.state_pressed}, new int[0]}, new int[]{t3.a(R.color.applovin_sdk_highlightTextColor, getContext()), -1}));
}
}

View File

@@ -0,0 +1,556 @@
package com.applovin.impl.mediation.debugger.ui.testmode;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.Switch;
import android.widget.TextView;
import androidx.annotation.NonNull;
import com.amazon.device.ads.AdError;
import com.amazon.device.ads.AdRegistration;
import com.amazon.device.ads.DTBAdResponse;
import com.applovin.impl.ke;
import com.applovin.impl.mediation.debugger.ui.testmode.AdControlButton;
import com.applovin.impl.o0;
import com.applovin.impl.p0;
import com.applovin.impl.sdk.j;
import com.applovin.impl.sdk.n;
import com.applovin.impl.sdk.utils.StringUtils;
import com.applovin.impl.se;
import com.applovin.impl.yp;
import com.applovin.mediation.MaxAd;
import com.applovin.mediation.MaxAdFormat;
import com.applovin.mediation.MaxAdRevenueListener;
import com.applovin.mediation.MaxAdViewAdListener;
import com.applovin.mediation.MaxError;
import com.applovin.mediation.MaxReward;
import com.applovin.mediation.MaxRewardedAdListener;
import com.applovin.mediation.ads.MaxAdView;
import com.applovin.mediation.ads.MaxAppOpenAd;
import com.applovin.mediation.ads.MaxInterstitialAd;
import com.applovin.mediation.ads.MaxRewardedAd;
import com.applovin.mediation.ads.MaxRewardedInterstitialAd;
import com.applovin.mediation.nativeAds.MaxNativeAdListener;
import com.applovin.mediation.nativeAds.MaxNativeAdLoader;
import com.applovin.mediation.nativeAds.MaxNativeAdView;
import com.applovin.sdk.AppLovinSdkUtils;
import com.applovin.sdk.R;
import com.ironsource.bt;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/* loaded from: classes2.dex */
public abstract class a extends se implements MaxRewardedAdListener, MaxAdViewAdListener, AdControlButton.a, MaxAdRevenueListener, o0.a {
private Map A;
private ke a;
private j b;
private MaxAdView c;
private MaxAdView d;
private MaxInterstitialAd f;
private MaxAppOpenAd g;
private MaxRewardedInterstitialAd h;
private MaxRewardedAd i;
private MaxAd j;
private MaxNativeAdLoader k;
private List l;
private String m;
private AdControlButton n;
private AdControlButton o;
private AdControlButton p;
private AdControlButton q;
private AdControlButton r;
private AdControlButton s;
private AdControlButton t;
private Button u;
private Button v;
private FrameLayout w;
private FrameLayout x;
private Switch y;
private Switch z;
/* renamed from: com.applovin.impl.mediation.debugger.ui.testmode.a$a, reason: collision with other inner class name */
public class C0028a extends MaxNativeAdListener {
public C0028a() {
}
@Override // com.applovin.mediation.nativeAds.MaxNativeAdListener
public void onNativeAdClicked(MaxAd maxAd) {
a.this.onAdClicked(maxAd);
}
@Override // com.applovin.mediation.nativeAds.MaxNativeAdListener
public void onNativeAdLoadFailed(String str, MaxError maxError) {
a.this.onAdLoadFailed(str, maxError);
}
@Override // com.applovin.mediation.nativeAds.MaxNativeAdListener
public void onNativeAdLoaded(MaxNativeAdView maxNativeAdView, MaxAd maxAd) {
if (a.this.j != null) {
a.this.k.destroy(a.this.j);
}
a.this.j = maxAd;
a.this.x.removeAllViews();
a.this.x.addView(maxNativeAdView);
a.this.onAdLoaded(maxAd);
}
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void d(View view) {
this.d.removeAllViews();
this.o.setControlState(AdControlButton.b.LOAD);
}
private void e() {
List r = this.a.r();
MaxAdFormat maxAdFormat = MaxAdFormat.REWARDED;
if (!r.contains(maxAdFormat)) {
findViewById(R.id.rewarded_control_view).setVisibility(8);
return;
}
String str = "test_mode_rewarded_" + this.a.m();
this.m = str;
MaxRewardedAd maxRewardedAd = MaxRewardedAd.getInstance(str, this.b.s0(), this);
this.i = maxRewardedAd;
maxRewardedAd.setExtraParameter("disable_auto_retries", "true");
this.i.setListener(this);
AdControlButton adControlButton = (AdControlButton) findViewById(R.id.rewarded_control_button);
this.s = adControlButton;
adControlButton.setOnClickListener(this);
this.s.setFormat(maxAdFormat);
}
@Override // com.applovin.impl.se
public j getSdk() {
return this.b;
}
public String getTestModeNetwork(MaxAdFormat maxAdFormat) {
return (this.a.x() == null || !this.a.x().containsKey(maxAdFormat)) ? this.a.m() : (String) this.a.x().get(maxAdFormat);
}
@Override // com.applovin.mediation.MaxAdListener
public void onAdClicked(@NonNull MaxAd maxAd) {
yp.a(bt.f, maxAd, this);
}
@Override // com.applovin.mediation.MaxAdViewAdListener
public void onAdCollapsed(@NonNull MaxAd maxAd) {
yp.a("onAdCollapsed", maxAd, this);
}
@Override // com.applovin.mediation.MaxAdListener
public void onAdDisplayFailed(@NonNull MaxAd maxAd, @NonNull MaxError maxError) {
a(maxAd.getAdUnitId()).setControlState(AdControlButton.b.LOAD);
yp.a("Failed to display " + maxAd.getFormat().getDisplayName(), "MAX Error\nCode: " + maxError.getCode() + "\nMessage: " + maxError.getMessage() + "\n\n" + maxAd.getNetworkName() + " Display Error\nCode: " + maxError.getMediatedNetworkErrorCode() + "\nMessage: " + maxError.getMediatedNetworkErrorMessage(), this);
}
@Override // com.applovin.mediation.MaxAdListener
public void onAdDisplayed(@NonNull MaxAd maxAd) {
yp.a("onAdDisplayed", maxAd, this);
}
@Override // com.applovin.mediation.MaxAdViewAdListener
public void onAdExpanded(@NonNull MaxAd maxAd) {
yp.a("onAdExpanded", maxAd, this);
}
@Override // com.applovin.mediation.MaxAdListener
public void onAdHidden(@NonNull MaxAd maxAd) {
yp.a("onAdHidden", maxAd, this);
}
@Override // com.applovin.mediation.MaxAdListener
public void onAdLoadFailed(@NonNull String str, @NonNull MaxError maxError) {
AdControlButton a = a(str);
a.setControlState(AdControlButton.b.LOAD);
yp.a(maxError, a.getFormat().getLabel(), this);
}
@Override // com.applovin.mediation.MaxAdListener
public void onAdLoaded(@NonNull MaxAd maxAd) {
AdControlButton a = a(maxAd.getAdUnitId());
if (maxAd.getFormat().isAdViewAd() || maxAd.getFormat().equals(MaxAdFormat.NATIVE)) {
a.setControlState(AdControlButton.b.LOAD);
} else {
a.setControlState(AdControlButton.b.SHOW);
}
}
@Override // com.applovin.impl.o0.a
public void onAdResponseLoaded(DTBAdResponse dTBAdResponse, MaxAdFormat maxAdFormat) {
if (MaxAdFormat.BANNER == maxAdFormat || MaxAdFormat.LEADER == maxAdFormat) {
this.c.setLocalExtraParameter("amazon_ad_response", dTBAdResponse);
} else if (MaxAdFormat.MREC == maxAdFormat) {
this.d.setLocalExtraParameter("amazon_ad_response", dTBAdResponse);
} else if (MaxAdFormat.INTERSTITIAL == maxAdFormat) {
this.f.setLocalExtraParameter("amazon_ad_response", dTBAdResponse);
} else if (MaxAdFormat.APP_OPEN == maxAdFormat) {
this.g.setLocalExtraParameter("amazon_ad_response", dTBAdResponse);
} else if (MaxAdFormat.REWARDED_INTERSTITIAL == maxAdFormat) {
this.h.setLocalExtraParameter("amazon_ad_response", dTBAdResponse);
} else if (MaxAdFormat.REWARDED == maxAdFormat) {
this.i.setLocalExtraParameter("amazon_ad_response", dTBAdResponse);
} else if (MaxAdFormat.NATIVE == maxAdFormat) {
this.k.setLocalExtraParameter("amazon_ad_response", dTBAdResponse);
}
a(maxAdFormat);
}
@Override // com.applovin.mediation.MaxAdRevenueListener
public void onAdRevenuePaid(@NonNull MaxAd maxAd) {
yp.a("onAdRevenuePaid", maxAd, this);
}
@Override // com.applovin.impl.mediation.debugger.ui.testmode.AdControlButton.a
public void onClick(AdControlButton adControlButton) {
MaxAdFormat format = adControlButton.getFormat();
AdControlButton.b bVar = AdControlButton.b.LOAD;
if (bVar != adControlButton.getControlState()) {
if (AdControlButton.b.SHOW == adControlButton.getControlState()) {
adControlButton.setControlState(bVar);
b(format);
return;
}
return;
}
adControlButton.setControlState(AdControlButton.b.LOADING);
Map map = this.A;
if (map == null || map.get(format) == null) {
a(format);
} else {
((o0) this.A.get(format)).a();
}
}
@Override // com.applovin.impl.se, android.app.Activity
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
if (this.a == null) {
n.h("MaxDebuggerMultiAdActivity", "Failed to initialize activity with a network model.");
return;
}
setContentView(R.layout.mediation_debugger_multi_ad_activity);
setTitle(this.a.g() + " Test Ads");
this.l = this.b.l0().b();
a();
c();
b();
e();
d();
findViewById(R.id.rewarded_interstitial_control_view).setVisibility(8);
findViewById(R.id.app_open_ad_control_view).setVisibility(8);
this.u = (Button) findViewById(R.id.show_mrec_button);
this.v = (Button) findViewById(R.id.show_native_button);
if (this.a.G() && this.a.r().contains(MaxAdFormat.MREC)) {
this.x.setVisibility(8);
this.u.setBackgroundColor(-1);
this.v.setBackgroundColor(-3355444);
this.u.setOnClickListener(new View.OnClickListener() { // from class: com.applovin.impl.mediation.debugger.ui.testmode.a$$ExternalSyntheticLambda0
@Override // android.view.View.OnClickListener
public final void onClick(View view) {
a.this.a(view);
}
});
this.v.setOnClickListener(new View.OnClickListener() { // from class: com.applovin.impl.mediation.debugger.ui.testmode.a$$ExternalSyntheticLambda1
@Override // android.view.View.OnClickListener
public final void onClick(View view) {
a.this.b(view);
}
});
} else {
this.u.setVisibility(8);
this.v.setVisibility(8);
}
this.y = (Switch) findViewById(R.id.native_banner_switch);
this.z = (Switch) findViewById(R.id.native_mrec_switch);
if (this.a.H()) {
this.y.setOnClickListener(new View.OnClickListener() { // from class: com.applovin.impl.mediation.debugger.ui.testmode.a$$ExternalSyntheticLambda2
@Override // android.view.View.OnClickListener
public final void onClick(View view) {
a.this.c(view);
}
});
this.z.setOnClickListener(new View.OnClickListener() { // from class: com.applovin.impl.mediation.debugger.ui.testmode.a$$ExternalSyntheticLambda3
@Override // android.view.View.OnClickListener
public final void onClick(View view) {
a.this.d(view);
}
});
} else {
this.y.setVisibility(8);
this.z.setVisibility(8);
}
if (StringUtils.isValidString(this.a.e()) && this.a.d() != null && this.a.d().size() > 0) {
AdRegistration.getInstance(this.a.e(), this);
AdRegistration.enableTesting(true);
AdRegistration.enableLogging(true);
HashMap hashMap = new HashMap(this.a.d().size());
for (MaxAdFormat maxAdFormat : this.a.d().keySet()) {
hashMap.put(maxAdFormat, new o0((p0) this.a.d().get(maxAdFormat), maxAdFormat, this));
}
this.A = hashMap;
}
try {
setRequestedOrientation(7);
} catch (Throwable th) {
n.c("AppLovinSdk", "Failed to set portrait orientation", th);
}
}
@Override // com.applovin.impl.se, android.app.Activity
public void onDestroy() {
MaxAd maxAd;
super.onDestroy();
this.b.l0().a(this.l);
MaxAdView maxAdView = this.c;
if (maxAdView != null) {
maxAdView.destroy();
}
MaxAdView maxAdView2 = this.d;
if (maxAdView2 != null) {
maxAdView2.destroy();
}
MaxInterstitialAd maxInterstitialAd = this.f;
if (maxInterstitialAd != null) {
maxInterstitialAd.destroy();
}
MaxRewardedAd maxRewardedAd = this.i;
if (maxRewardedAd != null) {
maxRewardedAd.destroy();
}
MaxNativeAdLoader maxNativeAdLoader = this.k;
if (maxNativeAdLoader == null || (maxAd = this.j) == null) {
return;
}
maxNativeAdLoader.destroy(maxAd);
}
@Override // com.applovin.mediation.MaxRewardedAdListener
public void onUserRewarded(@NonNull MaxAd maxAd, @NonNull MaxReward maxReward) {
yp.a("onUserRewarded", maxAd, this);
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void b(View view) {
this.x.setVisibility(0);
this.w.setVisibility(8);
this.v.setBackgroundColor(-1);
this.u.setBackgroundColor(-3355444);
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void c(View view) {
this.c.removeAllViews();
this.n.setControlState(AdControlButton.b.LOAD);
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void a(View view) {
this.w.setVisibility(0);
this.x.setVisibility(8);
this.u.setBackgroundColor(-1);
this.v.setBackgroundColor(-3355444);
}
private void d() {
this.x = (FrameLayout) findViewById(R.id.native_ad_view_container);
if (this.a.G()) {
MaxNativeAdLoader maxNativeAdLoader = new MaxNativeAdLoader("test_mode_native", this.b.s0(), this);
this.k = maxNativeAdLoader;
maxNativeAdLoader.setExtraParameter("disable_auto_retries", "true");
this.k.setNativeAdListener(new C0028a());
this.k.setRevenueListener(this);
AdControlButton adControlButton = (AdControlButton) findViewById(R.id.native_control_button);
this.t = adControlButton;
adControlButton.setOnClickListener(this);
this.t.setFormat(MaxAdFormat.NATIVE);
return;
}
findViewById(R.id.native_control_view).setVisibility(8);
this.x.setVisibility(8);
}
private void c() {
this.w = (FrameLayout) findViewById(R.id.mrec_ad_view_container);
List r = this.a.r();
MaxAdFormat maxAdFormat = MaxAdFormat.MREC;
if (r.contains(maxAdFormat)) {
MaxAdView maxAdView = new MaxAdView("test_mode_mrec", maxAdFormat, this.b.s0(), this);
this.d = maxAdView;
maxAdView.setExtraParameter("disable_auto_retries", "true");
this.d.setExtraParameter("disable_precache", "true");
this.d.setExtraParameter("allow_pause_auto_refresh_immediately", "true");
this.d.stopAutoRefresh();
this.d.setListener(this);
this.w.addView(this.d, new FrameLayout.LayoutParams(-1, -1));
AdControlButton adControlButton = (AdControlButton) findViewById(R.id.mrec_control_button);
this.o = adControlButton;
adControlButton.setOnClickListener(this);
this.o.setFormat(maxAdFormat);
return;
}
findViewById(R.id.mrec_control_view).setVisibility(8);
this.w.setVisibility(8);
}
@Override // com.applovin.impl.o0.a
public void onAdLoadFailed(AdError adError, MaxAdFormat maxAdFormat) {
if (MaxAdFormat.BANNER != maxAdFormat && MaxAdFormat.LEADER != maxAdFormat) {
if (MaxAdFormat.MREC == maxAdFormat) {
this.d.setLocalExtraParameter("amazon_ad_error", adError);
} else if (MaxAdFormat.INTERSTITIAL == maxAdFormat) {
this.f.setLocalExtraParameter("amazon_ad_error", adError);
} else if (MaxAdFormat.APP_OPEN == maxAdFormat) {
this.g.setLocalExtraParameter("amazon_ad_error", adError);
} else if (MaxAdFormat.REWARDED_INTERSTITIAL == maxAdFormat) {
this.h.setLocalExtraParameter("amazon_ad_error", adError);
} else if (MaxAdFormat.REWARDED == maxAdFormat) {
this.i.setLocalExtraParameter("amazon_ad_error", adError);
} else if (MaxAdFormat.NATIVE == maxAdFormat) {
this.k.setLocalExtraParameter("amazon_ad_error", adError);
}
} else {
this.c.setLocalExtraParameter("amazon_ad_error", adError);
}
a(maxAdFormat);
}
private void b() {
List r = this.a.r();
MaxAdFormat maxAdFormat = MaxAdFormat.INTERSTITIAL;
if (r.contains(maxAdFormat)) {
MaxInterstitialAd maxInterstitialAd = new MaxInterstitialAd("test_mode_interstitial", this.b.s0(), this);
this.f = maxInterstitialAd;
maxInterstitialAd.setExtraParameter("disable_auto_retries", "true");
this.f.setListener(this);
AdControlButton adControlButton = (AdControlButton) findViewById(R.id.interstitial_control_button);
this.p = adControlButton;
adControlButton.setOnClickListener(this);
this.p.setFormat(maxAdFormat);
return;
}
findViewById(R.id.interstitial_control_view).setVisibility(8);
}
private void a() {
MaxAdFormat maxAdFormat;
String str;
boolean isTablet = AppLovinSdkUtils.isTablet(this);
FrameLayout frameLayout = (FrameLayout) findViewById(R.id.banner_ad_view_container);
if (isTablet) {
maxAdFormat = MaxAdFormat.LEADER;
((TextView) findViewById(R.id.banner_label)).setText("Leader");
str = "test_mode_leader";
} else {
maxAdFormat = MaxAdFormat.BANNER;
str = "test_mode_banner";
}
if (this.a.r().contains(maxAdFormat)) {
MaxAdView maxAdView = new MaxAdView(str, maxAdFormat, this.b.s0(), this);
this.c = maxAdView;
maxAdView.setExtraParameter("adaptive_banner", "false");
this.c.setExtraParameter("disable_auto_retries", "true");
this.c.setExtraParameter("disable_precache", "true");
this.c.setExtraParameter("allow_pause_auto_refresh_immediately", "true");
this.c.stopAutoRefresh();
this.c.setListener(this);
frameLayout.addView(this.c, new FrameLayout.LayoutParams(AppLovinSdkUtils.dpToPx(this, maxAdFormat.getSize().getWidth()), AppLovinSdkUtils.dpToPx(this, maxAdFormat.getSize().getHeight())));
AdControlButton adControlButton = (AdControlButton) findViewById(R.id.banner_control_button);
this.n = adControlButton;
adControlButton.setOnClickListener(this);
this.n.setFormat(maxAdFormat);
return;
}
findViewById(R.id.banner_control_view).setVisibility(8);
frameLayout.setVisibility(8);
}
private void b(MaxAdFormat maxAdFormat) {
if (MaxAdFormat.INTERSTITIAL == maxAdFormat) {
this.f.showAd();
return;
}
if (MaxAdFormat.APP_OPEN == maxAdFormat) {
this.g.showAd();
} else if (MaxAdFormat.REWARDED_INTERSTITIAL == maxAdFormat) {
this.h.showAd();
} else if (MaxAdFormat.REWARDED == maxAdFormat) {
this.i.showAd();
}
}
private void a(MaxAdFormat maxAdFormat) {
MaxAdFormat maxAdFormat2 = MaxAdFormat.BANNER;
boolean z = false;
boolean z2 = (maxAdFormat2 == maxAdFormat || MaxAdFormat.LEADER == maxAdFormat) && this.y.isChecked();
MaxAdFormat maxAdFormat3 = MaxAdFormat.MREC;
if (maxAdFormat3 == maxAdFormat && this.z.isChecked()) {
z = true;
}
if (!z2 && !z) {
this.b.l0().a(getTestModeNetwork(maxAdFormat));
} else {
this.b.l0().a(this.a.w());
}
if (maxAdFormat2 == maxAdFormat || MaxAdFormat.LEADER == maxAdFormat) {
this.c.loadAd();
return;
}
if (maxAdFormat3 == maxAdFormat) {
this.d.loadAd();
this.u.callOnClick();
return;
}
if (MaxAdFormat.INTERSTITIAL == maxAdFormat) {
this.f.loadAd();
return;
}
if (MaxAdFormat.APP_OPEN == maxAdFormat) {
this.g.loadAd();
return;
}
if (MaxAdFormat.REWARDED_INTERSTITIAL == maxAdFormat) {
this.h.loadAd();
return;
}
if (MaxAdFormat.REWARDED == maxAdFormat) {
this.i.loadAd();
} else if (MaxAdFormat.NATIVE == maxAdFormat) {
this.k.loadAd();
this.v.callOnClick();
}
}
private AdControlButton a(String str) {
if (str.equals("test_mode_banner") || str.equals("test_mode_leader")) {
return this.n;
}
if (str.equals("test_mode_mrec")) {
return this.o;
}
if (str.equals("test_mode_interstitial")) {
return this.p;
}
if (str.equals("test_mode_app_open")) {
return this.q;
}
if (str.equals("test_mode_rewarded_interstitial")) {
return this.r;
}
if (str.equals(this.m)) {
return this.s;
}
if (str.equals("test_mode_native")) {
return this.t;
}
throw new IllegalArgumentException("Invalid test mode ad unit identifier provided " + str);
}
public void initialize(ke keVar) {
this.a = keVar;
this.b = keVar.o();
}
}

View File

@@ -0,0 +1,284 @@
package com.applovin.impl.mediation;
import android.app.Activity;
import com.applovin.impl.am;
import com.applovin.impl.an;
import com.applovin.impl.fi;
import com.applovin.impl.la;
import com.applovin.impl.ma;
import com.applovin.impl.pe;
import com.applovin.impl.q6;
import com.applovin.impl.sdk.j;
import com.applovin.impl.sdk.n;
import com.applovin.impl.sdk.utils.JsonUtils;
import com.applovin.impl.sdk.utils.StringUtils;
import com.applovin.impl.tm;
import com.applovin.impl.uj;
import com.applovin.impl.ve;
import com.applovin.mediation.adapter.MaxAdapter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public class e {
private final j a;
private final n b;
private final AtomicBoolean c = new AtomicBoolean();
private final Set d = new HashSet();
private final Object e = new Object();
private final JSONArray f = new JSONArray();
private final LinkedHashMap g = new LinkedHashMap();
private final Object h = new Object();
private final Map i = new HashMap();
private final Map j = new HashMap();
private final Object k = new Object();
private List l;
public e(j jVar) {
this.a = jVar;
this.b = jVar.J();
}
public void b(pe peVar, Activity activity) {
List list;
if (((Boolean) this.a.a(ve.Y7)).booleanValue()) {
a(peVar, activity);
return;
}
if (((Boolean) this.a.a(ve.X7)).booleanValue()) {
pe peVar2 = (pe) this.i.get(peVar.b());
if (peVar2 != null) {
peVar = peVar2;
}
} else {
if (this.a.l0().c() && (list = this.l) != null) {
Iterator it = list.iterator();
while (true) {
if (!it.hasNext()) {
peVar = null;
break;
}
pe peVar3 = (pe) it.next();
if (peVar3.b().equals(peVar.b())) {
peVar = peVar3;
break;
}
}
}
if (peVar == null) {
return;
}
}
g a = this.a.M().a(peVar);
if (a != null) {
if (n.a()) {
this.b.d("MediationAdapterInitializationManager", "Initializing adapter " + peVar);
}
c(peVar);
a.a(MaxAdapterParametersImpl.a(peVar), activity, (MaxAdapter.OnCompletionListener) null);
return;
}
n.h("MediationAdapterInitializationManager", "Mediation adapter could not be initialized, double check that the adapter is included in your build. Adapter spec: " + peVar);
}
public void a(pe peVar, long j, MaxAdapter.InitializationStatus initializationStatus, String str) {
boolean z;
if (initializationStatus == null || initializationStatus == MaxAdapter.InitializationStatus.INITIALIZING) {
return;
}
synchronized (this.h) {
try {
z = !b(peVar);
if (z) {
this.g.put(peVar.b(), Integer.valueOf(initializationStatus.getCode()));
JSONObject jSONObject = new JSONObject();
JsonUtils.putString(jSONObject, "class", peVar.b());
JsonUtils.putString(jSONObject, "init_status", String.valueOf(initializationStatus.getCode()));
JsonUtils.putLong(jSONObject, "init_time_ms", j);
JsonUtils.putString(jSONObject, "error_message", JSONObject.quote(str));
this.f.put(jSONObject);
}
} catch (Throwable th) {
throw th;
}
}
if (z) {
this.a.a(peVar);
this.a.Q().processAdapterInitializationPostback(peVar, j, initializationStatus, str);
this.a.p().a(initializationStatus, peVar.b());
}
}
private void c(pe peVar) {
String b = peVar.b();
synchronized (this.e) {
try {
if (this.d.contains(b)) {
return;
}
this.d.add(b);
this.a.E().a(la.m, ma.a(peVar));
} catch (Throwable th) {
throw th;
}
}
}
public boolean c() {
return this.c.get();
}
public boolean b(pe peVar) {
boolean containsKey;
synchronized (this.h) {
containsKey = this.g.containsKey(peVar.b());
}
return containsKey;
}
public JSONArray b() {
JSONArray shallowCopy;
synchronized (this.h) {
shallowCopy = JsonUtils.shallowCopy(this.f);
}
return shallowCopy;
}
private pe a(pe peVar) {
List<pe> list;
if (((Boolean) this.a.a(ve.X7)).booleanValue()) {
pe peVar2 = (pe) this.i.get(peVar.b());
return peVar2 != null ? peVar2 : peVar;
}
if (!this.a.l0().c() || (list = this.l) == null) {
return peVar;
}
for (pe peVar3 : list) {
if (peVar3.b().equals(peVar.b())) {
return peVar3;
}
}
return null;
}
public fi a(pe peVar, Activity activity) {
pe a = a(peVar);
if (a == null) {
return fi.c(MaxAdapter.InitializationStatus.DOES_NOT_APPLY);
}
String b = peVar.b();
synchronized (this.k) {
try {
fi fiVar = (fi) this.j.get(b);
if (fiVar == null || (fiVar.d() && a.q())) {
final fi fiVar2 = new fi();
this.j.put(b, fiVar2);
g a2 = this.a.M().a(a);
if (a2 == null) {
fiVar2.a("Adapter implementation not found");
return fiVar2;
}
if (n.a()) {
this.b.d("MediationAdapterInitializationManager", "Initializing adapter " + a);
}
c(a);
a2.a(MaxAdapterParametersImpl.a(a), activity, new MaxAdapter.OnCompletionListener() { // from class: com.applovin.impl.mediation.e$$ExternalSyntheticLambda0
@Override // com.applovin.mediation.adapter.MaxAdapter.OnCompletionListener
public final void onCompletion(MaxAdapter.InitializationStatus initializationStatus, String str) {
e.a(fi.this, initializationStatus, str);
}
});
an.a(a.m(), fiVar2, "The adapter (" + peVar.c() + ") timed out initializing", "MediationAdapterInitializationManager", this.a);
return fiVar2;
}
return fiVar;
} finally {
}
}
}
/* JADX INFO: Access modifiers changed from: private */
public static /* synthetic */ void a(fi fiVar, MaxAdapter.InitializationStatus initializationStatus, String str) {
if (initializationStatus != null && initializationStatus != MaxAdapter.InitializationStatus.INITIALIZING) {
if (initializationStatus == MaxAdapter.InitializationStatus.INITIALIZED_FAILURE) {
fiVar.a(str);
return;
} else {
fiVar.b(initializationStatus);
return;
}
}
q6.a("Adapters should never report a null or INITIALIZING status.", new Object[0]);
fiVar.a("Adapter reported INITIALIZING");
}
public void a(Activity activity) {
if (this.c.compareAndSet(false, true)) {
String str = (String) this.a.a(uj.F);
if (StringUtils.isValidString(str)) {
try {
JSONObject jSONObject = new JSONObject(str);
List<pe> a = a(JsonUtils.getJSONArray(jSONObject, this.a.l0().c() ? "test_mode_auto_init_adapters" : "auto_init_adapters", new JSONArray()), jSONObject);
this.l = a;
for (pe peVar : a) {
this.i.put(peVar.b(), peVar);
}
long parseLong = StringUtils.parseLong(this.a.g0().getExtraParameters().get("adapter_initialization_delay_ms"), -1L);
am amVar = new am(a, activity, this.a);
if (parseLong > 0) {
this.a.j0().a(amVar, tm.b.MEDIATION, parseLong);
} else {
this.a.j0().a(amVar);
}
} catch (JSONException e) {
if (n.a()) {
this.b.a("MediationAdapterInitializationManager", "Failed to parse auto-init adapters JSON", e);
}
q6.a((Throwable) e);
}
}
}
}
public Integer a(String str) {
Integer num;
synchronized (this.h) {
num = (Integer) this.g.get(str);
}
return num;
}
public Set a() {
HashSet hashSet;
synchronized (this.h) {
hashSet = new HashSet(this.g.keySet());
}
return hashSet;
}
private List a(JSONArray jSONArray, JSONObject jSONObject) {
ArrayList arrayList = new ArrayList(jSONArray.length());
for (int i = 0; i < jSONArray.length(); i++) {
arrayList.add(new pe(Collections.EMPTY_MAP, JsonUtils.getJSONObject(jSONArray, i, (JSONObject) null), jSONObject, this.a));
}
return arrayList;
}
public void a(MaxAdapter.InitializationStatus initializationStatus) {
synchronized (this.h) {
this.g.put("com.applovin.mediation.adapters.AppLovinMediationAdapter", Integer.valueOf(initializationStatus.getCode()));
}
this.a.p().a(initializationStatus, "com.applovin.mediation.adapters.AppLovinMediationAdapter");
}
}

View File

@@ -0,0 +1,239 @@
package com.applovin.impl.mediation;
import android.text.TextUtils;
import com.applovin.impl.ge;
import com.applovin.impl.pe;
import com.applovin.impl.sdk.j;
import com.applovin.impl.sdk.n;
import com.applovin.impl.sdk.utils.JsonUtils;
import com.applovin.mediation.MaxAdFormat;
import com.applovin.mediation.adapter.MaxAdapter;
import com.applovin.mediation.adapters.MediationAdapterBase;
import com.applovin.sdk.AppLovinSdk;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public class f {
private final j b;
private final n c;
private final Map a = Collections.synchronizedMap(new HashMap(16));
private final Object d = new Object();
private final Map e = new HashMap();
private final Set f = new HashSet();
private final Object g = new Object();
private final Set h = new HashSet();
public f(j jVar) {
if (jVar == null) {
throw new IllegalArgumentException("No sdk specified");
}
this.b = jVar;
this.c = jVar.J();
}
public Collection b() {
Set unmodifiableSet;
synchronized (this.d) {
unmodifiableSet = Collections.unmodifiableSet(this.f);
}
return unmodifiableSet;
}
public Collection c() {
Set unmodifiableSet;
synchronized (this.d) {
try {
HashSet hashSet = new HashSet(this.e.size());
Iterator it = this.e.values().iterator();
while (it.hasNext()) {
hashSet.add(((Class) it.next()).getName());
}
unmodifiableSet = Collections.unmodifiableSet(hashSet);
} catch (Throwable th) {
throw th;
}
}
return unmodifiableSet;
}
public void a(String str, String str2, ge geVar) {
synchronized (this.g) {
try {
this.b.J();
if (n.a()) {
this.b.J().b("MediationAdapterManager", "Adding " + str + " to list of disabled adapters.");
}
this.h.add(new a(str, str2, geVar, this.b));
} catch (Throwable th) {
throw th;
}
}
}
public static class a {
private final String a;
private final String b;
private final MaxAdFormat c;
private final JSONObject d;
public JSONObject a() {
return this.d;
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null || getClass() != obj.getClass()) {
return false;
}
a aVar = (a) obj;
if (!this.a.equals(aVar.a) || !this.b.equals(aVar.b)) {
return false;
}
MaxAdFormat maxAdFormat = this.c;
MaxAdFormat maxAdFormat2 = aVar.c;
return maxAdFormat == null ? maxAdFormat2 == null : maxAdFormat.equals(maxAdFormat2);
}
public int hashCode() {
int hashCode = ((this.a.hashCode() * 31) + this.b.hashCode()) * 31;
MaxAdFormat maxAdFormat = this.c;
return hashCode + (maxAdFormat != null ? maxAdFormat.hashCode() : 0);
}
public String toString() {
return "DisabledAdapterInfo{className='" + this.a + "', operationTag='" + this.b + "', format=" + this.c + '}';
}
public a(String str, String str2, ge geVar, j jVar) {
this.a = str;
this.b = str2;
JSONObject jSONObject = new JSONObject();
this.d = jSONObject;
JsonUtils.putString(jSONObject, "class", str);
JsonUtils.putString(jSONObject, "operation", str2);
if (geVar == null) {
this.c = null;
} else {
this.c = geVar.getFormat();
JsonUtils.putString(jSONObject, "format", geVar.getFormat().getLabel());
}
}
}
public g a(pe peVar) {
return a(peVar, false);
}
public g a(pe peVar, boolean z) {
Class a2;
g gVar;
if (peVar != null) {
String c = peVar.c();
String b = peVar.b();
if (TextUtils.isEmpty(c)) {
if (n.a()) {
this.c.b("MediationAdapterManager", "No adapter name provided for " + b + ", not loading the adapter ");
}
return null;
}
if (TextUtils.isEmpty(b)) {
if (n.a()) {
this.c.b("MediationAdapterManager", "Unable to find default className for '" + c + "'");
}
return null;
}
if (z && (gVar = (g) this.a.get(b)) != null) {
return gVar;
}
synchronized (this.d) {
try {
if (!this.f.contains(b)) {
if (this.e.containsKey(b)) {
a2 = (Class) this.e.get(b);
} else {
a2 = a(b);
if (a2 == null) {
if (n.a()) {
this.c.k("MediationAdapterManager", "Adapter " + c + " could not be loaded, class " + b + " not found");
}
this.f.add(b);
return null;
}
}
g a3 = a(peVar, a2, z);
if (a3 != null) {
if (n.a()) {
this.c.a("MediationAdapterManager", "Loaded " + c);
}
this.e.put(b, a2);
if (z) {
this.a.put(peVar.b(), a3);
}
return a3;
}
if (n.a()) {
this.c.b("MediationAdapterManager", "Failed to load " + c);
}
this.f.add(b);
return null;
}
if (n.a()) {
this.c.a("MediationAdapterManager", "Not attempting to load " + c + " due to prior errors");
}
return null;
} catch (Throwable th) {
throw th;
}
}
}
throw new IllegalArgumentException("No adapter spec specified");
}
private g a(pe peVar, Class cls, boolean z) {
try {
return new g(peVar, (MediationAdapterBase) cls.getConstructor(AppLovinSdk.class).newInstance(this.b.s0()), z, this.b);
} catch (Throwable th) {
n.c("MediationAdapterManager", "Failed to load adapter: " + peVar, th);
return null;
}
}
public Collection a() {
ArrayList arrayList;
synchronized (this.g) {
try {
arrayList = new ArrayList(this.h.size());
Iterator it = this.h.iterator();
while (it.hasNext()) {
arrayList.add(((a) it.next()).a());
}
} catch (Throwable th) {
throw th;
}
}
return arrayList;
}
private Class a(String str) {
try {
Class<?> cls = Class.forName(str);
if (MaxAdapter.class.isAssignableFrom(cls)) {
return cls.asSubclass(MaxAdapter.class);
}
n.h("MediationAdapterManager", str + " error: not an instance of '" + MaxAdapter.class.getName() + "'.");
return null;
} catch (Throwable unused) {
return null;
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,30 @@
package com.applovin.impl.mediation.nativeAds;
import android.view.View;
import androidx.annotation.Nullable;
import com.applovin.impl.mediation.ads.b;
import java.util.List;
/* loaded from: classes2.dex */
public class MaxNativeAdImpl {
private b adViewTracker;
private List<View> clickableViews;
@Nullable
public b getAdViewTracker() {
return this.adViewTracker;
}
@Nullable
public List<View> getClickableViews() {
return this.clickableViews;
}
public void setAdViewTracker(b bVar) {
this.adViewTracker = bVar;
}
public void setClickableViews(List<View> list) {
this.clickableViews = list;
}
}