MD5 校验值:c9acc583577d8b1a394e7959c947bec3
b.java 文件包含反编译后的源代码,请注意,该内容仅供学习和参考使用,不得用于非法用途。
package com.applovin.impl.adview; import android.app.Activity; import android.content.Context; import android.content.DialogInterface; import android.graphics.PointF; import android.net.Uri; import android.util.AttributeSet; import android.util.DisplayMetrics; import android.util.TypedValue; import android.view.View; import android.view.ViewGroup; import android.view.ViewParent; import android.webkit.WebView; import android.widget.RelativeLayout; import com.applovin.adview.AppLovinAdView; import com.applovin.adview.AppLovinAdViewDisplayErrorCode; import com.applovin.adview.AppLovinAdViewEventListener; import com.applovin.adview.AppLovinFullscreenActivity; import com.applovin.communicator.AppLovinCommunicator; import com.applovin.communicator.AppLovinCommunicatorMessage; import com.applovin.communicator.AppLovinCommunicatorSubscriber; import com.applovin.impl.sdk.AppLovinAdServiceImpl; import com.applovin.impl.sdk.ad.e; import com.applovin.impl.sdk.e.o; import com.applovin.impl.sdk.e.z; import com.applovin.impl.sdk.utils.Utils; import com.applovin.sdk.AppLovinAd; import com.applovin.sdk.AppLovinAdClickListener; import com.applovin.sdk.AppLovinAdDisplayListener; import com.applovin.sdk.AppLovinAdLoadListener; import com.applovin.sdk.AppLovinAdSize; import com.applovin.sdk.AppLovinSdk; import com.applovin.sdk.AppLovinSdkUtils; import com.safedk.android.internal.partials.AppLovinNetworkBridge; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicReference; public class b implements AppLovinCommunicatorSubscriber { private volatile AppLovinAdClickListener A; private Context a; private ViewGroup b; private com.applovin.impl.sdk.n c; private AppLovinAdServiceImpl d; private com.applovin.impl.sdk.v e; private AppLovinCommunicator f; private AppLovinAdSize g; private String h; private com.applovin.impl.sdk.d.d i; private e j; private c k; private d l; private Runnable m; private Runnable n; private volatile AppLovinAdLoadListener x; private volatile AppLovinAdDisplayListener y; private volatile AppLovinAdViewEventListener z; private volatile com.applovin.impl.sdk.ad.e o = null; private volatile AppLovinAd p = null; private l q = null; private l r = null; private final AtomicReference<AppLovinAd> s = new AtomicReference<>(); private final AtomicBoolean t = new AtomicBoolean(); private volatile boolean u = false; private volatile boolean v = false; private volatile boolean w = false; private volatile g B = null; public class a implements Runnable { private a() { } @Override public void run() { if (b.this.l != null) { b.this.l.setVisibility(8); } } } public class RunnableC0045b implements Runnable { private RunnableC0045b() { } @Override public void run() { if (b.this.o != null) { if (b.this.l == null) { com.applovin.impl.sdk.v.i("AppLovinAdView", "Unable to render advertisement for ad #" + b.this.o.getAdIdNumber() + ". Please make sure you are not calling AppLovinAdView.destroy() prematurely."); com.applovin.impl.sdk.utils.k.a(b.this.z, b.this.o, (AppLovinAdView) null, AppLovinAdViewDisplayErrorCode.WEBVIEW_NOT_FOUND); return; } b.this.x(); com.applovin.impl.sdk.v unused = b.this.e; if (com.applovin.impl.sdk.v.a()) { b.this.e.b("AppLovinAdView", "Rendering advertisement ad for #" + b.this.o.getAdIdNumber() + "..."); } b.b(b.this.l, b.this.o.getSize()); b.this.l.a(b.this.o); if (b.this.o.getSize() != AppLovinAdSize.INTERSTITIAL && !b.this.v) { b.this.i = new com.applovin.impl.sdk.d.d(b.this.o, b.this.c); b.this.i.a(); b.this.l.setStatsManagerHelper(b.this.i); b.this.o.setHasShown(true); } if (b.this.l.getStatsManagerHelper() != null) { b.this.l.getStatsManagerHelper().a(b.this.o.A() ? 0L : 1L); } } } } public static class c implements AppLovinAdLoadListener { private final b a; c(b bVar, com.applovin.impl.sdk.n nVar) { if (bVar == null) { throw new IllegalArgumentException("No view specified"); } if (nVar == null) { throw new IllegalArgumentException("No sdk specified"); } this.a = bVar; } private b a() { return this.a; } @Override public void adReceived(AppLovinAd appLovinAd) { b a = a(); if (a != null) { a.b(appLovinAd); } else { com.applovin.impl.sdk.v.i("AppLovinAdView", "Ad view has been garbage collected by the time an ad was received"); } } @Override public void failedToReceiveAd(int i) { b a = a(); if (a != null) { a.a(i); } } } private void a(AppLovinAdView appLovinAdView, com.applovin.impl.sdk.n nVar, AppLovinAdSize appLovinAdSize, String str, Context context) { if (appLovinAdView == null) { throw new IllegalArgumentException("No parent view specified"); } if (nVar == null) { throw new IllegalArgumentException("No sdk specified"); } if (appLovinAdSize == null) { throw new IllegalArgumentException("No ad size specified"); } this.c = nVar; this.d = nVar.v(); this.e = nVar.D(); this.f = AppLovinCommunicator.getInstance(context); this.g = appLovinAdSize; this.h = str; if (!(context instanceof AppLovinFullscreenActivity)) { context = context.getApplicationContext(); } this.a = context; this.b = appLovinAdView; this.j = new e(this, nVar); this.n = new a(); this.m = new RunnableC0045b(); this.k = new c(this, nVar); a(appLovinAdSize); } private void a(Runnable runnable) { AppLovinSdkUtils.runOnUiThread(runnable); } public static void b(View view, AppLovinAdSize appLovinAdSize) { if (view == null) { return; } DisplayMetrics displayMetrics = view.getResources().getDisplayMetrics(); int applyDimension = appLovinAdSize.getLabel().equals(AppLovinAdSize.INTERSTITIAL.getLabel()) ? -1 : appLovinAdSize.getWidth() == -1 ? displayMetrics.widthPixels : (int) TypedValue.applyDimension(1, appLovinAdSize.getWidth(), displayMetrics); int applyDimension2 = appLovinAdSize.getLabel().equals(AppLovinAdSize.INTERSTITIAL.getLabel()) ? -1 : appLovinAdSize.getHeight() == -1 ? displayMetrics.heightPixels : (int) TypedValue.applyDimension(1, appLovinAdSize.getHeight(), displayMetrics); ViewGroup.LayoutParams layoutParams = view.getLayoutParams(); if (layoutParams == null) { layoutParams = new RelativeLayout.LayoutParams(-2, -2); } layoutParams.width = applyDimension; layoutParams.height = applyDimension2; if (layoutParams instanceof RelativeLayout.LayoutParams) { ((RelativeLayout.LayoutParams) layoutParams).addRule(13); } view.setLayoutParams(layoutParams); } private void t() { if (this.e != null && com.applovin.impl.sdk.v.a() && com.applovin.impl.sdk.v.a()) { this.e.b("AppLovinAdView", "Destroying..."); } d dVar = this.l; if (dVar != null) { ViewParent parent = dVar.getParent(); if (parent instanceof ViewGroup) { ((ViewGroup) parent).removeView(this.l); } this.l.removeAllViews(); AppLovinNetworkBridge.webviewLoadUrl(this.l, "about:blank"); this.l.onPause(); this.l.destroyDrawingCache(); this.l.destroy(); this.l = null; } this.x = null; this.y = null; this.A = null; this.z = null; this.v = true; } private void u() { a(new Runnable() { @Override public void run() { if (b.this.q != null) { com.applovin.impl.sdk.v unused = b.this.e; if (com.applovin.impl.sdk.v.a()) { b.this.e.b("AppLovinAdView", "Detaching expanded ad: " + b.this.q.a()); } b bVar = b.this; bVar.r = bVar.q; b.this.q = null; b bVar2 = b.this; bVar2.a(bVar2.g); } } }); } public void v() { a(new Runnable() { @Override public void run() { com.applovin.impl.sdk.ad.a a2; if (b.this.r == null && b.this.q == null) { return; } if (b.this.r != null) { a2 = b.this.r.a(); b.this.r.dismiss(); b.this.r = null; } else { a2 = b.this.q.a(); b.this.q.dismiss(); b.this.q = null; } com.applovin.impl.sdk.utils.k.b(b.this.z, a2, (AppLovinAdView) b.this.b); } }); } private void w() { com.applovin.impl.sdk.d.d dVar = this.i; if (dVar != null) { dVar.c(); this.i = null; } } public void x() { com.applovin.impl.sdk.ad.e eVar = this.o; com.applovin.impl.sdk.utils.l lVar = new com.applovin.impl.sdk.utils.l(); lVar.a().a(eVar).a(r()); if (!Utils.isBML(eVar.getSize())) { lVar.a().a("Fullscreen Ad Properties").b(eVar); } lVar.a(this.c); lVar.a(); if (com.applovin.impl.sdk.v.a()) { this.e.b("AppLovinAdView", lVar.toString()); } } public void a() { if (this.c == null || this.k == null || this.a == null || !this.u) { com.applovin.impl.sdk.v.g("AppLovinAdView", "Unable to load next ad: AppLovinAdView is not initialized."); } else { this.d.loadNextAd(this.h, this.g, this.k); } } void a(final int i) { if (!this.v) { a(this.n); } a(new Runnable() { @Override public void run() { try { if (b.this.x != null) { b.this.x.failedToReceiveAd(i); } } catch (Throwable th) { com.applovin.impl.sdk.v.c("AppLovinAdView", "Exception while running app load callback", th); } } }); } public void a(final PointF pointF) { a(new Runnable() { @Override public void run() { if (b.this.q == null && (b.this.o instanceof com.applovin.impl.sdk.ad.a) && b.this.l != null) { com.applovin.impl.sdk.ad.a aVar = (com.applovin.impl.sdk.ad.a) b.this.o; Activity retrieveParentActivity = b.this.a instanceof Activity ? (Activity) b.this.a : Utils.retrieveParentActivity(b.this.l, b.this.c); if (retrieveParentActivity == null || retrieveParentActivity.isFinishing()) { com.applovin.impl.sdk.v.i("AppLovinAdView", "Unable to expand ad. No Activity found."); Uri j = aVar.j(); if (j != null) { AppLovinAdServiceImpl appLovinAdServiceImpl = b.this.d; AppLovinAdView r = b.this.r(); b bVar = b.this; appLovinAdServiceImpl.trackAndLaunchClick(aVar, r, bVar, j, pointF, bVar.w); if (b.this.i != null) { b.this.i.b(); } } b.this.l.a("javascript:al_onFailedExpand();"); return; } if (b.this.b != null) { b.this.b.removeView(b.this.l); } b.this.q = new l(aVar, b.this.l, retrieveParentActivity, b.this.c); b.this.q.setOnDismissListener(new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface dialogInterface) { b.this.k(); } }); b.this.q.show(); com.applovin.impl.sdk.utils.k.a(b.this.z, b.this.o, (AppLovinAdView) b.this.b); if (b.this.i != null) { b.this.i.d(); } if (b.this.o.isOpenMeasurementEnabled()) { b.this.o.o().a((View) b.this.q.b()); } } } }); } public void a(final WebView webView) { a(new Runnable() { @Override public void run() { webView.setVisibility(0); } }); try { if (this.o != this.p) { this.p = this.o; if (this.y != null) { this.c.an().a(this.o); com.applovin.impl.sdk.utils.k.a(this.y, this.o); this.l.a("javascript:al_onAdViewRendered();"); } if ((this.o instanceof com.applovin.impl.sdk.ad.a) && this.o.isOpenMeasurementEnabled()) { this.c.V().a(new z(this.c, new Runnable() { @Override public void run() { b.this.o.o().b(webView); b.this.o.o().a((View) webView); b.this.o.o().c(); b.this.o.o().d(); } }), o.a.MAIN, 500L); } } } catch (Throwable th) { com.applovin.impl.sdk.v.c("AppLovinAdView", "Exception while notifying ad display listener", th); } } public void a(AppLovinAdView appLovinAdView, Context context, AppLovinAdSize appLovinAdSize, String str, AppLovinSdk appLovinSdk, AttributeSet attributeSet) { if (appLovinAdView == null) { throw new IllegalArgumentException("No parent view specified"); } if (context == null) { com.applovin.impl.sdk.v.i("AppLovinAdView", "Unable to build AppLovinAdView: no context provided. Please use a different constructor for this view."); return; } if (appLovinAdSize == null && (appLovinAdSize = com.applovin.impl.sdk.utils.c.a(attributeSet)) == null) { appLovinAdSize = AppLovinAdSize.BANNER; } AppLovinAdSize appLovinAdSize2 = appLovinAdSize; if (appLovinSdk == null) { appLovinSdk = AppLovinSdk.getInstance(context); } if (appLovinSdk != null) { a(appLovinAdView, appLovinSdk.coreSdk, appLovinAdSize2, str, context); if (com.applovin.impl.sdk.utils.c.b(attributeSet)) { a(); } } } public void a(AppLovinAdViewEventListener appLovinAdViewEventListener) { this.z = appLovinAdViewEventListener; } public void a(g gVar) { this.B = gVar; } public void a(com.applovin.impl.sdk.ad.e eVar, AppLovinAdView appLovinAdView, Uri uri, PointF pointF) { if (appLovinAdView != null) { this.d.trackAndLaunchClick(eVar, appLovinAdView, this, uri, pointF, this.w); } else if (com.applovin.impl.sdk.v.a()) { this.e.e("AppLovinAdView", "Unable to process ad click - AppLovinAdView destroyed prematurely"); } com.applovin.impl.sdk.utils.k.a(this.A, eVar); } public void a(com.applovin.impl.sdk.d.d dVar) { d dVar2 = this.l; if (dVar2 != null) { dVar2.setStatsManagerHelper(dVar); } } public void a(AppLovinAd appLovinAd) { a(appLovinAd, (String) null); } public void a(AppLovinAd appLovinAd, String str) { if (appLovinAd == null) { throw new IllegalArgumentException("No ad specified"); } Utils.validateAdSdkKey(appLovinAd, this.c); if (!this.u) { com.applovin.impl.sdk.v.g("AppLovinAdView", "Unable to render ad: AppLovinAdView is not initialized."); return; } com.applovin.impl.sdk.ad.e eVar = (com.applovin.impl.sdk.ad.e) Utils.maybeRetrieveNonDummyAd(appLovinAd, this.c); if (eVar == null || eVar == this.o) { if (eVar == null) { if (com.applovin.impl.sdk.v.a()) { this.e.d("AppLovinAdView", "Unable to render ad. Ad is null. Internal inconsistency error."); return; } return; } if (com.applovin.impl.sdk.v.a()) { this.e.d("AppLovinAdView", "Ad #" + eVar.getAdIdNumber() + " is already showing, ignoring"); } if (((Boolean) this.c.a(com.applovin.impl.sdk.c.b.cn)).booleanValue()) { throw new IllegalStateException("Failed to display ad - ad can only be displayed once. Load the next ad."); } return; } if (com.applovin.impl.sdk.v.a()) { this.e.b("AppLovinAdView", "Rendering ad #" + eVar.getAdIdNumber() + " (" + eVar.getSize() + ")"); } com.applovin.impl.sdk.utils.k.b(this.y, this.o); if (eVar.getSize() != AppLovinAdSize.INTERSTITIAL) { w(); } if (this.o != null && this.o.isOpenMeasurementEnabled()) { this.o.o().e(); } this.s.set(null); this.p = null; this.o = eVar; if (!this.v && Utils.isBML(this.g)) { this.c.v().trackImpression(eVar); } if (this.q != null) { u(); } a(this.m); } public void a(AppLovinAdClickListener appLovinAdClickListener) { this.A = appLovinAdClickListener; } public void a(AppLovinAdDisplayListener appLovinAdDisplayListener) { this.y = appLovinAdDisplayListener; } public void a(AppLovinAdLoadListener appLovinAdLoadListener) { this.x = appLovinAdLoadListener; } public void a(AppLovinAdSize appLovinAdSize) { try { d dVar = new d(this.j, this.c, this.a); this.l = dVar; dVar.setBackgroundColor(0); this.l.setWillNotCacheDrawing(false); this.b.setBackgroundColor(0); this.b.addView(this.l); b(this.l, appLovinAdSize); if (!this.u) { a(this.n); } a(new Runnable() { @Override public void run() { AppLovinNetworkBridge.webviewLoadDataWithBaseURL(b.this.l, "/", "<html></html>", "text/html", null, ""); } }); this.u = true; } catch (Throwable th) { com.applovin.impl.sdk.v.c("AppLovinAdView", "Failed to initialize AdWebView", th); this.t.set(true); } } public AppLovinAdSize b() { return this.g; } void b(final AppLovinAd appLovinAd) { if (appLovinAd == null) { if (com.applovin.impl.sdk.v.a()) { this.e.e("AppLovinAdView", "No provided when to the view controller"); } a(-1); } else { if (this.v) { this.s.set(appLovinAd); if (com.applovin.impl.sdk.v.a()) { this.e.b("AppLovinAdView", "Ad view has paused when an ad was received, ad saved for later"); } } else { a(appLovinAd); } a(new Runnable() { @Override public void run() { if (b.this.t.compareAndSet(true, false)) { b bVar = b.this; bVar.a(bVar.g); } try { if (b.this.x != null) { b.this.x.adReceived(appLovinAd); } } catch (Throwable th) { com.applovin.impl.sdk.v.i("AppLovinAdView", "Exception while running ad load callback: " + th.getMessage()); } } }); } } public String c() { return this.h; } public void d() { if (!this.u || this.v) { return; } this.v = true; } public void e() { if (this.u) { AppLovinAd andSet = this.s.getAndSet(null); if (andSet != null) { a(andSet); } this.v = false; } } public void f() { if (this.l != null && this.q != null) { k(); } t(); } public AppLovinAdViewEventListener g() { return this.z; } @Override public String getCommunicatorId() { return b.class.getSimpleName(); } public g h() { return this.B; } public void i() { if (com.applovin.impl.sdk.utils.c.a(this.l)) { this.c.W().a(com.applovin.impl.sdk.d.f.o); } } public void j() { if (this.u) { com.applovin.impl.sdk.utils.k.b(this.y, this.o); if (this.o != null && this.o.isOpenMeasurementEnabled() && Utils.isBML(this.o.getSize())) { this.o.o().e(); } if (this.l == null || this.q == null) { if (com.applovin.impl.sdk.v.a()) { this.e.b("AppLovinAdView", "onDetachedFromWindowCalled without an expanded ad present"); } } else { if (com.applovin.impl.sdk.v.a()) { this.e.b("AppLovinAdView", "onDetachedFromWindowCalled with expanded ad present"); } u(); } } } public void k() { a(new Runnable() { @Override public void run() { b.this.v(); if (b.this.b == null || b.this.l == null || b.this.l.getParent() != null) { return; } b.this.b.addView(b.this.l); b.b(b.this.l, b.this.o.getSize()); if (b.this.o.isOpenMeasurementEnabled()) { b.this.o.o().a((View) b.this.l); } } }); } public void l() { if (this.q != null || this.r != null) { k(); return; } if (com.applovin.impl.sdk.v.a()) { this.e.b("AppLovinAdView", "Ad: " + this.o + " closed."); } a(this.n); com.applovin.impl.sdk.utils.k.b(this.y, this.o); this.o = null; } public void m() { this.w = true; } public void n() { this.w = false; } public void o() { if (!(this.a instanceof k) || this.o == null) { return; } if (this.o.G() == e.a.DISMISS) { ((k) this.a).dismiss(); } } @Override public void onMessageReceived(AppLovinCommunicatorMessage appLovinCommunicatorMessage) { if ("crash_applovin_ad_webview".equals(appLovinCommunicatorMessage.getTopic())) { a(new Runnable() { @Override public void run() { AppLovinNetworkBridge.webviewLoadUrl(b.this.s(), "chrome://crash"); } }); } } public com.applovin.impl.sdk.ad.e p() { return this.o; } public com.applovin.impl.sdk.n q() { return this.c; } public AppLovinAdView r() { return (AppLovinAdView) this.b; } public d s() { return this.l; } }