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,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 + ")");
}
}
}