光速虚拟机 v3.8.2版本的 MD5 值为:e0eecbee2ded4bfb58a5ca72845ca90b
以下内容为反编译后的 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.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.adview.v;
import com.applovin.impl.sdk.AppLovinAdServiceImpl;
import com.applovin.impl.sdk.ad.e;
import com.applovin.impl.sdk.e.ac;
import com.applovin.impl.sdk.e.r;
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.iab.omid.library.applovin.adsession.FriendlyObstructionPurpose;
import com.safedk.android.internal.partials.AppLovinNetworkBridge;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
import net.lingala.zip4j.util.InternalZipConstants;
public class b implements AppLovinCommunicatorSubscriber {
private volatile AppLovinAdDisplayListener A;
private volatile AppLovinAdViewEventListener B;
private volatile AppLovinAdClickListener C;
private Context a;
private ViewGroup b;
private com.applovin.impl.sdk.o c;
private AppLovinAdServiceImpl d;
private com.applovin.impl.sdk.y e;
private AppLovinCommunicator f;
private AppLovinAdSize h;
private String i;
private com.applovin.impl.sdk.d.d j;
private e k;
private c l;
private d m;
private v n;
private Runnable o;
private Runnable p;
private volatile AppLovinAdLoadListener z;
private final Map<String, Object> g = Collections.synchronizedMap(new HashMap());
private volatile com.applovin.impl.sdk.ad.e q = null;
private volatile AppLovinAd r = null;
private m s = null;
private m t = null;
private final AtomicReference<AppLovinAd> u = new AtomicReference<>();
private final AtomicBoolean v = new AtomicBoolean();
private volatile boolean w = false;
private volatile boolean x = false;
private volatile boolean y = false;
private volatile g D = null;
public class a implements Runnable {
private a() {
}
@Override
public void run() {
if (b.this.m != null) {
b.this.m.setVisibility(8);
}
}
}
public class RunnableC0047b implements Runnable {
private RunnableC0047b() {
}
@Override
public void run() {
if (b.this.q != null) {
if (b.this.m == null) {
com.applovin.impl.sdk.y.j("AppLovinAdView", "Unable to render advertisement for ad #" + b.this.q.getAdIdNumber() + ". Please make sure you are not calling AppLovinAdView.destroy() prematurely.");
com.applovin.impl.sdk.utils.o.a(b.this.B, b.this.q, (AppLovinAdView) null, AppLovinAdViewDisplayErrorCode.WEBVIEW_NOT_FOUND);
return;
}
b.this.x();
com.applovin.impl.sdk.y unused = b.this.e;
if (com.applovin.impl.sdk.y.a()) {
com.applovin.impl.sdk.y yVar = b.this.e;
yVar.b("AppLovinAdView", "Rendering advertisement ad for #" + b.this.q.getAdIdNumber() + "...");
}
b.b(b.this.m, b.this.q.getSize());
if (b.this.n != null) {
com.applovin.impl.sdk.utils.x.a(b.this.n);
b.this.n = null;
}
if (((Boolean) b.this.c.a(com.applovin.impl.sdk.c.b.ay)).booleanValue()) {
p pVar = new p(b.this.g, b.this.c);
if (pVar.c()) {
b.this.n = new v(pVar, b.this.a);
b.this.n.a(new v.a() {
@Override
public void a() {
b.this.m.addView(b.this.n, new ViewGroup.LayoutParams(-1, -1));
}
@Override
public void b() {
com.applovin.impl.sdk.y unused2 = b.this.e;
if (com.applovin.impl.sdk.y.a()) {
b.this.e.e("AppLovinAdView", "Watermark failed to render.");
}
}
});
}
}
b.this.m.a(b.this.q);
if (b.this.q.getSize() != AppLovinAdSize.INTERSTITIAL && !b.this.x) {
b bVar = b.this;
bVar.j = new com.applovin.impl.sdk.d.d(bVar.q, b.this.c);
b.this.j.a();
b.this.m.setStatsManagerHelper(b.this.j);
b.this.q.setHasShown(true);
}
if (b.this.m.getStatsManagerHelper() != null) {
b.this.m.getStatsManagerHelper().a(b.this.q.A() ? 0L : 1L);
}
}
}
}
public static class c implements AppLovinAdLoadListener {
private final b a;
c(b bVar, com.applovin.impl.sdk.o oVar) {
if (bVar == null) {
throw new IllegalArgumentException("No view specified");
}
if (oVar == 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.y.j("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.o oVar, AppLovinAdSize appLovinAdSize, String str, Context context) {
if (appLovinAdView == null) {
throw new IllegalArgumentException("No parent view specified");
}
if (oVar == null) {
throw new IllegalArgumentException("No sdk specified");
}
if (appLovinAdSize == null) {
throw new IllegalArgumentException("No ad size specified");
}
this.c = oVar;
this.d = oVar.v();
this.e = oVar.F();
this.f = AppLovinCommunicator.getInstance(context);
this.h = appLovinAdSize;
this.i = str;
if (!(context instanceof AppLovinFullscreenActivity)) {
context = context.getApplicationContext();
}
this.a = context;
this.b = appLovinAdView;
this.k = new e(this, oVar);
this.p = new a();
this.o = new RunnableC0047b();
this.l = new c(this, oVar);
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.y.a() && com.applovin.impl.sdk.y.a()) {
this.e.b("AppLovinAdView", "Destroying...");
}
com.applovin.impl.sdk.utils.z.a(this.m);
this.m = null;
this.z = null;
this.A = null;
this.C = null;
this.B = null;
this.x = true;
}
private void u() {
a(new Runnable() {
@Override
public void run() {
if (b.this.s != null) {
com.applovin.impl.sdk.y unused = b.this.e;
if (com.applovin.impl.sdk.y.a()) {
com.applovin.impl.sdk.y yVar = b.this.e;
yVar.b("AppLovinAdView", "Detaching expanded ad: " + b.this.s.a());
}
b bVar = b.this;
bVar.t = bVar.s;
b.this.s = null;
b bVar2 = b.this;
bVar2.a(bVar2.h);
}
}
});
}
public void v() {
a(new Runnable() {
@Override
public void run() {
com.applovin.impl.sdk.ad.a a2;
if (b.this.t == null && b.this.s == null) {
return;
}
if (b.this.t != null) {
a2 = b.this.t.a();
b.this.t.dismiss();
b.this.t = null;
} else {
a2 = b.this.s.a();
b.this.s.dismiss();
b.this.s = null;
}
com.applovin.impl.sdk.utils.o.b(b.this.B, a2, (AppLovinAdView) b.this.b);
}
});
}
private void w() {
com.applovin.impl.sdk.d.d dVar = this.j;
if (dVar != null) {
dVar.c();
this.j = null;
}
}
public void x() {
com.applovin.impl.sdk.ad.e eVar = this.q;
com.applovin.impl.sdk.utils.p pVar = new com.applovin.impl.sdk.utils.p();
pVar.a().a(eVar).a(r());
if (!com.applovin.impl.sdk.utils.w.a(eVar.getSize())) {
pVar.a().a("Fullscreen Ad Properties").b(eVar);
}
pVar.a(this.c);
pVar.a();
if (com.applovin.impl.sdk.y.a()) {
this.e.b("AppLovinAdView", pVar.toString());
}
}
public void a() {
if (this.c == null || this.l == null || this.a == null || !this.w) {
com.applovin.impl.sdk.y.g("AppLovinAdView", "Unable to load next ad: AppLovinAdView is not initialized.");
} else {
this.d.loadNextAd(this.i, this.h, this.l);
}
}
void a(final int i) {
if (!this.x) {
a(this.p);
}
a(new Runnable() {
@Override
public void run() {
try {
if (b.this.z != null) {
b.this.z.failedToReceiveAd(i);
}
} catch (Throwable th) {
com.applovin.impl.sdk.y.c("AppLovinAdView", "Exception while running app load callback", th);
if (b.this.c != null) {
b.this.c.ag().a("AppLovinAdView", "notifyAdLoadFailed", th);
}
}
}
});
}
public void a(final PointF pointF) {
a(new Runnable() {
@Override
public void run() {
if (b.this.s == null && (b.this.q instanceof com.applovin.impl.sdk.ad.a) && b.this.m != null) {
com.applovin.impl.sdk.ad.a aVar = (com.applovin.impl.sdk.ad.a) b.this.q;
Activity a2 = b.this.a instanceof Activity ? (Activity) b.this.a : com.applovin.impl.sdk.utils.w.a((View) b.this.m, b.this.c);
if (a2 == null || a2.isFinishing()) {
com.applovin.impl.sdk.y.j("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.y, false);
if (b.this.j != null) {
b.this.j.b();
}
}
b.this.m.a("javascript:al_onFailedExpand();");
return;
}
if (b.this.b != null) {
b.this.b.removeView(b.this.m);
}
b.this.s = new m(aVar, b.this.m, a2, b.this.c);
b.this.s.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialogInterface) {
b.this.k();
}
});
b.this.s.show();
com.applovin.impl.sdk.utils.o.a(b.this.B, b.this.q, (AppLovinAdView) b.this.b);
if (b.this.j != null) {
b.this.j.d();
}
if (b.this.q.isOpenMeasurementEnabled()) {
b.this.q.o().a((View) b.this.s.b());
}
}
}
});
}
public void a(final WebView webView) {
if (this.q == null) {
return;
}
a(new Runnable() {
@Override
public void run() {
webView.setVisibility(0);
}
});
try {
if (this.q != this.r) {
this.r = this.q;
if (this.A != null) {
this.c.ac().a(this.q);
com.applovin.impl.sdk.utils.o.a(this.A, this.q);
this.m.a("javascript:al_onAdViewRendered();");
}
if (com.applovin.impl.sdk.utils.w.a(this.h) && this.q.isOpenMeasurementEnabled()) {
this.c.G().a(new ac(this.c, "StartOMSDK", new Runnable() {
@Override
public void run() {
b.this.q.o().b(webView);
if (b.this.n == null || !b.this.n.b()) {
b.this.q.o().a((View) webView);
} else {
b.this.q.o().a(webView, Collections.singletonList(new com.applovin.impl.sdk.a.d(b.this.n, FriendlyObstructionPurpose.NOT_VISIBLE, b.this.n.getIdentifier())));
}
b.this.q.o().c();
b.this.q.o().d();
}
}), r.b.MAIN, 500L);
}
}
} catch (Throwable th) {
com.applovin.impl.sdk.y.c("AppLovinAdView", "Exception while notifying ad display listener", th);
com.applovin.impl.sdk.o oVar = this.c;
if (oVar != null) {
oVar.ag().a("AppLovinAdView", "onAdHtmlLoaded", 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.y.j("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.a(), appLovinAdSize2, str, context);
if (com.applovin.impl.sdk.utils.c.b(attributeSet)) {
a();
}
}
}
public void a(AppLovinAdViewEventListener appLovinAdViewEventListener) {
this.B = appLovinAdViewEventListener;
}
public void a(g gVar) {
this.D = gVar;
}
public void a(com.applovin.impl.sdk.ad.e eVar, AppLovinAdView appLovinAdView, Uri uri, PointF pointF, boolean z) {
if (appLovinAdView != null) {
this.d.trackAndLaunchClick(eVar, appLovinAdView, this, uri, pointF, this.y, z);
} else if (com.applovin.impl.sdk.y.a()) {
this.e.e("AppLovinAdView", "Unable to process ad click - AppLovinAdView destroyed prematurely");
}
com.applovin.impl.sdk.utils.o.a(this.C, eVar);
}
public void a(com.applovin.impl.sdk.d.d dVar) {
d dVar2 = this.m;
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");
}
com.applovin.impl.sdk.utils.w.b(appLovinAd, this.c);
if (!this.w) {
com.applovin.impl.sdk.y.g("AppLovinAdView", "Unable to render ad: AppLovinAdView is not initialized.");
return;
}
com.applovin.impl.sdk.ad.e eVar = (com.applovin.impl.sdk.ad.e) com.applovin.impl.sdk.utils.w.a(appLovinAd, this.c);
if (eVar == null) {
com.applovin.impl.sdk.y.j("AppLovinAdView", "Unable to retrieve the loaded ad: " + appLovinAd);
com.applovin.impl.sdk.utils.o.a(this.A, "Unable to retrieve the loaded ad");
} else if (eVar == this.q) {
com.applovin.impl.sdk.y.j("AppLovinAdView", "Attempting to show ad again: " + eVar);
if (((Boolean) this.c.a(com.applovin.impl.sdk.c.b.cr)).booleanValue()) {
if (!(this.A instanceof com.applovin.impl.sdk.ad.h)) {
throw new IllegalStateException("Attempting to show ad again");
}
com.applovin.impl.sdk.utils.o.a(this.A, "Attempting to show ad again");
}
} else {
if (com.applovin.impl.sdk.y.a()) {
com.applovin.impl.sdk.y yVar = this.e;
yVar.b("AppLovinAdView", "Rendering ad #" + eVar.getAdIdNumber() + " (" + eVar.getSize() + ")");
}
com.applovin.impl.sdk.utils.o.b(this.A, this.q);
if (eVar.getSize() != AppLovinAdSize.INTERSTITIAL) {
w();
}
if (this.q != null && this.q.isOpenMeasurementEnabled()) {
this.q.o().e();
}
this.u.set(null);
this.r = null;
this.q = eVar;
if (!this.x && com.applovin.impl.sdk.utils.w.a(this.h)) {
this.c.v().trackImpression(eVar);
}
if (this.s != null) {
u();
}
a(this.o);
}
}
public void a(AppLovinAdClickListener appLovinAdClickListener) {
this.C = appLovinAdClickListener;
}
public void a(AppLovinAdDisplayListener appLovinAdDisplayListener) {
this.A = appLovinAdDisplayListener;
}
public void a(AppLovinAdLoadListener appLovinAdLoadListener) {
this.z = appLovinAdLoadListener;
}
public void a(AppLovinAdSize appLovinAdSize) {
try {
d dVar = new d(this.k, this.c, this.a);
this.m = dVar;
dVar.setBackgroundColor(0);
this.m.setWillNotCacheDrawing(false);
this.b.setBackgroundColor(0);
this.b.addView(this.m);
b(this.m, appLovinAdSize);
if (!this.w) {
a(this.p);
}
a(new Runnable() {
@Override
public void run() {
AppLovinNetworkBridge.webviewLoadDataWithBaseURL(b.this.m, InternalZipConstants.ZIP_FILE_SEPARATOR, "<html></html>", "text/html", null, "");
}
});
this.w = true;
} catch (Throwable th) {
com.applovin.impl.sdk.y.c("AppLovinAdView", "Failed to initialize AdWebView", th);
this.c.ag().a("AppLovinAdView", "initAdWebView", th);
this.v.set(true);
}
}
public void a(String str, Object obj) {
this.g.put(str, obj);
}
public AppLovinAdSize b() {
return this.h;
}
void b(final AppLovinAd appLovinAd) {
if (appLovinAd == null) {
if (com.applovin.impl.sdk.y.a()) {
this.e.e("AppLovinAdView", "No provided when to the view controller");
}
a(-1);
return;
}
if (this.x) {
this.u.set(appLovinAd);
if (com.applovin.impl.sdk.y.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.v.compareAndSet(true, false)) {
b bVar = b.this;
bVar.a(bVar.h);
}
try {
if (b.this.z != null) {
b.this.z.adReceived(appLovinAd);
}
} catch (Throwable th) {
com.applovin.impl.sdk.y.j("AppLovinAdView", "Exception while running ad load callback: " + th.getMessage());
if (b.this.c != null) {
b.this.c.ag().a("AppLovinAdView", "notifyAdLoaded", th);
}
}
}
});
}
public String c() {
return this.i;
}
public void d() {
if (!this.w || this.x) {
return;
}
this.x = true;
}
public void e() {
if (this.w) {
AppLovinAd andSet = this.u.getAndSet(null);
if (andSet != null) {
a(andSet);
}
this.x = false;
}
}
public void f() {
if (this.m != null && this.s != null) {
k();
}
t();
}
public AppLovinAdViewEventListener g() {
return this.B;
}
@Override
public String getCommunicatorId() {
return "b";
}
public g h() {
return this.D;
}
public void i() {
if (com.applovin.impl.sdk.utils.c.a(this.m)) {
this.c.J().a(com.applovin.impl.sdk.d.f.o);
}
}
public void j() {
if (this.w) {
com.applovin.impl.sdk.utils.o.b(this.A, this.q);
if (this.q != null && this.q.isOpenMeasurementEnabled() && com.applovin.impl.sdk.utils.w.a(this.q.getSize())) {
this.q.o().e();
}
if (this.m == null || this.s == null) {
if (com.applovin.impl.sdk.y.a()) {
this.e.b("AppLovinAdView", "onDetachedFromWindowCalled without an expanded ad present");
return;
}
return;
}
if (com.applovin.impl.sdk.y.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.m == null || b.this.m.getParent() != null) {
return;
}
b.this.b.addView(b.this.m);
b.b(b.this.m, b.this.q.getSize());
if (b.this.q.isOpenMeasurementEnabled()) {
b.this.q.o().a((View) b.this.m);
}
}
});
}
public void l() {
if (this.s != null || this.t != null) {
k();
return;
}
if (com.applovin.impl.sdk.y.a()) {
com.applovin.impl.sdk.y yVar = this.e;
yVar.b("AppLovinAdView", "Ad: " + this.q + " closed.");
}
a(this.p);
com.applovin.impl.sdk.utils.o.b(this.A, this.q);
this.q = null;
}
public void m() {
this.y = true;
}
public void n() {
this.y = false;
}
public void o() {
if (!(this.a instanceof l) || this.q == null) {
return;
}
if (this.q.J() == e.a.DISMISS) {
((l) 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.q;
}
public com.applovin.impl.sdk.o q() {
return this.c;
}
public AppLovinAdView r() {
return (AppLovinAdView) this.b;
}
public d s() {
return this.m;
}
}