导航菜单

页面标题

页面副标题

Handling Master v2 - a.java 源代码

正在查看: Handling Master v2 应用的 a.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.applovin.impl.adview;

import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.net.Uri;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.TypedValue;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebView;
import android.widget.RelativeLayout;
import androidx.browser.customtabs.CustomTabsSession;
import androidx.media3.common.C;
import com.applovin.adview.AppLovinAdView;
import com.applovin.adview.AppLovinAdViewDisplayErrorCode;
import com.applovin.adview.AppLovinAdViewEventListener;
import com.applovin.communicator.AppLovinCommunicator;
import com.applovin.communicator.AppLovinCommunicatorMessage;
import com.applovin.communicator.AppLovinCommunicatorSubscriber;
import com.applovin.impl.a8;
import com.applovin.impl.adview.k;
import com.applovin.impl.f2;
import com.applovin.impl.f6;
import com.applovin.impl.g1;
import com.applovin.impl.h4;
import com.applovin.impl.l2;
import com.applovin.impl.l4;
import com.applovin.impl.n2;
import com.applovin.impl.n4;
import com.applovin.impl.q;
import com.applovin.impl.q7;
import com.applovin.impl.r5;
import com.applovin.impl.s3;
import com.applovin.impl.sdk.AppLovinAdServiceImpl;
import com.applovin.impl.sdk.ad.b;
import com.applovin.impl.sdk.utils.CollectionUtils;
import com.applovin.impl.sdk.utils.JsonUtils;
import com.applovin.impl.sdk.utils.StringUtils;
import com.applovin.impl.u3;
import com.applovin.impl.v1;
import com.applovin.impl.x1;
import com.applovin.impl.y1;
import com.applovin.impl.z6;
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.s.d.oivI;
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 org.json.JSONObject;

public class a implements AppLovinCommunicatorSubscriber {
    private volatile AppLovinAdLoadListener A;
    private volatile AppLovinAdDisplayListener B;
    private volatile AppLovinAdViewEventListener C;
    private volatile AppLovinAdClickListener D;
    private Context a;
    private ViewGroup b;
    private com.applovin.impl.sdk.j c;
    private AppLovinAdServiceImpl d;
    private com.applovin.impl.sdk.n e;
    private AppLovinCommunicator f;
    private b g;
    private AppLovinAdSize i;
    private String j;
    private CustomTabsSession k;
    private com.applovin.impl.adview.c l;
    private e m;
    private com.applovin.impl.adview.b n;
    private WebView o;
    private k p;
    private Runnable q;
    private Runnable r;
    private final Map h = Collections.synchronizedMap(new HashMap());
    private volatile com.applovin.impl.sdk.ad.b s = null;
    private volatile AppLovinAd t = null;
    private f u = null;
    private f v = null;
    private final AtomicReference w = new AtomicReference();
    private final AtomicBoolean x = new AtomicBoolean();
    private volatile boolean y = false;
    private volatile boolean z = false;

    public static class C0012a {
    }

    public interface b {
        void a(a aVar);
    }

    public class c implements Runnable {
        private c() {
        }

        @Override
        public void run() {
            if (a.this.n != null) {
                a.this.n.setVisibility(8);
            }
        }

        public c(a aVar, C0012a c0012a) {
            this();
        }
    }

    public class d implements Runnable {

        public class C0013a implements k.a {
            public C0013a() {
            }

            @Override
            public void a() {
                a.this.n.addView(a.this.p, new ViewGroup.LayoutParams(-1, -1));
            }

            @Override
            public void onFailure() {
                com.applovin.impl.sdk.n unused = a.this.e;
                if (com.applovin.impl.sdk.n.a()) {
                    a.this.e.b("AppLovinAdView", "Watermark failed to render.");
                }
            }
        }

        private d() {
        }

        @Override
        public void run() {
            if (a.this.s != null) {
                if (a.this.n == null) {
                    com.applovin.impl.sdk.n.h("AppLovinAdView", "Unable to render advertisement for ad #" + a.this.s.getAdIdNumber() + ". Please make sure you are not calling AppLovinAdView.destroy() prematurely.");
                    l2.a(a.this.C, a.this.s, (AppLovinAdView) null, AppLovinAdViewDisplayErrorCode.WEBVIEW_NOT_FOUND);
                    return;
                }
                a.this.t();
                com.applovin.impl.sdk.n unused = a.this.e;
                if (com.applovin.impl.sdk.n.a()) {
                    a.this.e.a("AppLovinAdView", "Rendering advertisement ad for #" + a.this.s.getAdIdNumber() + "...");
                }
                a.b(a.this.n, a.this.s.getSize(), a.this.s.v0());
                if (a.this.p != null) {
                    q7.c(a.this.p);
                    a.this.p = null;
                }
                x1 x1Var = new x1(a.this.h, a.this.c);
                if (x1Var.c()) {
                    a.this.p = new k(x1Var, a.this.a);
                    a.this.p.a(new C0013a());
                }
                a.this.n.setAdHtmlLoaded(false);
                a.this.n.a(a.this.s);
                if (a.this.s.getSize() == AppLovinAdSize.INTERSTITIAL || a.this.z) {
                    return;
                }
                a.this.s.setHasShown(true);
            }
        }

        public d(a aVar, C0012a c0012a) {
            this();
        }
    }

    public static class e implements AppLovinAdLoadListener {
        private final a a;

        public e(a aVar, com.applovin.impl.sdk.j jVar) {
            if (aVar == null) {
                throw new IllegalArgumentException("No view specified");
            }
            if (jVar == null) {
                throw new IllegalArgumentException("No sdk specified");
            }
            this.a = aVar;
        }

        private a a() {
            return this.a;
        }

        @Override
        public void adReceived(AppLovinAd appLovinAd) {
            a a = a();
            if (a != null) {
                a.b(appLovinAd);
            } else {
                com.applovin.impl.sdk.n.h("AppLovinAdView", "Ad view has been garbage collected by the time an ad was received");
            }
        }

        @Override
        public void failedToReceiveAd(int i) {
            a a = a();
            if (a != null) {
                a.b(i);
            }
        }
    }

    private void B() {
        if (this.e != null && com.applovin.impl.sdk.n.a() && com.applovin.impl.sdk.n.a()) {
            this.e.a("AppLovinAdView", "Destroying...");
        }
        a8.b(this.n);
        this.n = null;
        a8.b(this.o);
        this.o = null;
        this.k = null;
        this.A = null;
        this.B = null;
        this.D = null;
        this.C = null;
        this.z = true;
    }

    public void m() {
        this.n.loadDataWithBaseURL("/", "<html></html>", "text/html", null, "");
    }

    public void n() {
        com.applovin.impl.adview.b bVar;
        d();
        if (this.b == null || (bVar = this.n) == null || bVar.getParent() != null) {
            return;
        }
        this.b.addView(this.n);
        b(this.n, this.s.getSize(), this.s.v0());
        if (this.s.isOpenMeasurementEnabled()) {
            this.s.getAdEventTracker().a(this.n);
        }
    }

    public void o() {
        if (this.n != null && this.u != null) {
            a();
        }
        B();
    }

    public void p() {
        if (this.u != null) {
            if (com.applovin.impl.sdk.n.a()) {
                this.e.a("AppLovinAdView", "Detaching expanded ad: " + this.u.b());
            }
            this.v = this.u;
            this.u = null;
            a(this.i);
        }
    }

    public void q() {
        com.applovin.impl.sdk.ad.a b2;
        f fVar = this.v;
        if (fVar == null && this.u == null) {
            return;
        }
        if (fVar != null) {
            b2 = fVar.b();
            this.v.dismiss();
            this.v = null;
        } else {
            b2 = this.u.b();
            this.u.dismiss();
            this.u = null;
        }
        l2.a(this.C, (AppLovinAd) b2, (AppLovinAdView) this.b);
    }

    public void r() {
        f().loadUrl("chrome://crash");
    }

    public void t() {
        com.applovin.impl.sdk.ad.b bVar = this.s;
        n2 n2Var = new n2();
        n2Var.a().a(bVar).a(i());
        if (!z6.a(bVar.getSize())) {
            n2Var.a().a("Fullscreen Ad Properties").b(bVar);
        }
        n2Var.a(this.c);
        n2Var.a();
        if (com.applovin.impl.sdk.n.a()) {
            this.e.a("AppLovinAdView", n2Var.toString());
        }
    }

    private void v() {
        if (this.s.T0()) {
            int a = this.c.p().a();
            if (com.applovin.impl.sdk.h.a(a)) {
                this.n.a("javascript:al_muteSwitchOn();");
            } else if (a == 2) {
                this.n.a("javascript:al_muteSwitchOff();");
            }
        }
    }

    public void A() {
        if (!this.y || this.z) {
            return;
        }
        this.z = true;
    }

    public void C() {
        if (this.y) {
            AppLovinAd appLovinAd = (AppLovinAd) this.w.getAndSet(null);
            if (appLovinAd != null) {
                c(appLovinAd);
            }
            this.z = false;
        }
    }

    @Override
    public String getCommunicatorId() {
        return a.class.getSimpleName();
    }

    public AppLovinAdSize k() {
        return this.i;
    }

    public String l() {
        return this.j;
    }

    @Override
    public void onMessageReceived(AppLovinCommunicatorMessage appLovinCommunicatorMessage) {
        if ("crash_applovin_ad_webview".equals(appLovinCommunicatorMessage.getTopic())) {
            a(new Runnable() {
                @Override
                public final void run() {
                    a.this.r();
                }
            });
        }
    }

    public void s() {
        if (this.c == null || this.m == null || this.a == null || !this.y) {
            com.applovin.impl.sdk.n.i("AppLovinAdView", "Unable to load next ad: AppLovinAdView is not initialized.");
        } else {
            this.d.loadNextAd(this.j, this.i, this.m);
        }
    }

    public void u() {
        if ((this.a instanceof g1) && this.s != null && this.s.P() == b.b.b) {
            ((g1) this.a).dismiss();
        }
    }

    public void w() {
        if (this.u != null || this.v != null) {
            a();
            return;
        }
        if (com.applovin.impl.sdk.n.a()) {
            this.e.a("AppLovinAdView", "Ad: " + this.s + " closed.");
        }
        a(this.r);
        l2.b(this.B, this.s);
        this.s = null;
    }

    public void x() {
        if (com.applovin.impl.sdk.n.a()) {
            this.e.a("AppLovinAdView", "AdView fully watched...");
        }
        b bVar = this.g;
        if (bVar != null) {
            bVar.a(this);
        }
    }

    public void y() {
        if (this.s != null && this.s.u0()) {
            com.applovin.impl.g.a(this.n, this.c);
        } else if (q.a(this.n)) {
            this.c.E().c(v1.r);
        }
    }

    public void z() {
        if (this.y) {
            l2.b(this.B, this.s);
            if (this.s != null && this.s.isOpenMeasurementEnabled() && z6.a(this.s.getSize())) {
                this.s.getAdEventTracker().f();
            }
            if (this.n == null || this.u == null) {
                if (com.applovin.impl.sdk.n.a()) {
                    this.e.a("AppLovinAdView", "onDetachedFromWindowCalled without an expanded ad present");
                }
            } else {
                if (com.applovin.impl.sdk.n.a()) {
                    this.e.a("AppLovinAdView", "onDetachedFromWindowCalled with expanded ad present");
                }
                c();
            }
        }
    }

    public static void b(View view, AppLovinAdSize appLovinAdSize, boolean z) {
        if (view == null) {
            return;
        }
        DisplayMetrics displayMetrics = view.getResources().getDisplayMetrics();
        String label = appLovinAdSize.getLabel();
        AppLovinAdSize appLovinAdSize2 = AppLovinAdSize.INTERSTITIAL;
        int i = -1;
        int applyDimension = (label.equals(appLovinAdSize2.getLabel()) || z) ? -1 : appLovinAdSize.getWidth() == -1 ? displayMetrics.widthPixels : (int) TypedValue.applyDimension(1, appLovinAdSize.getWidth(), displayMetrics);
        if (!appLovinAdSize.getLabel().equals(appLovinAdSize2.getLabel()) && !z) {
            i = 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 = i;
        if (layoutParams instanceof RelativeLayout.LayoutParams) {
            ((RelativeLayout.LayoutParams) layoutParams).addRule(13);
        }
        view.setLayoutParams(layoutParams);
    }

    private void c() {
        a(new Runnable() {
            @Override
            public final void run() {
                a.this.p();
            }
        });
    }

    private void d() {
        a(new Runnable() {
            @Override
            public final void run() {
                a.this.q();
            }
        });
    }

    public AppLovinAdViewEventListener e() {
        return this.C;
    }

    public com.applovin.impl.adview.b f() {
        return this.n;
    }

    public com.applovin.impl.sdk.ad.b g() {
        return this.s;
    }

    public CustomTabsSession h() {
        return this.k;
    }

    public AppLovinAdView i() {
        return (AppLovinAdView) this.b;
    }

    public com.applovin.impl.sdk.j j() {
        return this.c;
    }

    public void c(AppLovinAd appLovinAd) {
        a(appLovinAd, (String) null);
    }

    public void c(WebView webView) {
        a(webView, (String) null);
    }

    public void a(AppLovinAdLoadListener appLovinAdLoadListener) {
        this.A = appLovinAdLoadListener;
    }

    public void a(AppLovinAdDisplayListener appLovinAdDisplayListener) {
        this.B = appLovinAdDisplayListener;
    }

    public void a(AppLovinAdViewEventListener appLovinAdViewEventListener) {
        this.C = appLovinAdViewEventListener;
    }

    public void a(AppLovinAdClickListener appLovinAdClickListener) {
        this.D = appLovinAdClickListener;
    }

    private void a(AppLovinAdView appLovinAdView, com.applovin.impl.sdk.j jVar, AppLovinAdSize appLovinAdSize, String str, Context context) {
        if (appLovinAdView == null) {
            throw new IllegalArgumentException("No parent view specified");
        }
        if (jVar == null) {
            throw new IllegalArgumentException("No sdk specified");
        }
        if (appLovinAdSize != null) {
            this.c = jVar;
            this.d = jVar.k();
            this.e = jVar.I();
            this.f = AppLovinCommunicator.getInstance(context);
            this.i = appLovinAdSize;
            this.j = str;
            if (!(context instanceof oivI)) {
                context = context.getApplicationContext();
            }
            this.a = context;
            this.b = appLovinAdView;
            this.l = new com.applovin.impl.adview.c(this, jVar);
            C0012a c0012a = null;
            this.r = new c(this, c0012a);
            this.q = new d(this, c0012a);
            this.m = new e(this, jVar);
            a(appLovinAdSize);
            return;
        }
        throw new IllegalArgumentException("No ad size specified");
    }

    public void b() {
        a(new Runnable() {
            @Override
            public final void run() {
                a.this.o();
            }
        });
    }

    public void b(WebView webView) {
        this.s.getAdEventTracker().c(webView);
        k kVar = this.p;
        if (kVar != null && kVar.a()) {
            s3 adEventTracker = this.s.getAdEventTracker();
            k kVar2 = this.p;
            adEventTracker.b(webView, Collections.singletonList(new u3(kVar2, FriendlyObstructionPurpose.NOT_VISIBLE, kVar2.getIdentifier())));
        } else {
            this.s.getAdEventTracker().a(webView);
        }
        this.s.getAdEventTracker().h();
        this.s.getAdEventTracker().g();
    }

    public void a(AppLovinAdSize appLovinAdSize) {
        try {
            com.applovin.impl.adview.b bVar = new com.applovin.impl.adview.b(this.l, this.c, this.a);
            this.n = bVar;
            bVar.setBackgroundColor(0);
            this.n.setWillNotCacheDrawing(false);
            this.b.setBackgroundColor(0);
            this.b.addView(this.n);
            a(this.n, appLovinAdSize);
            if (!this.y) {
                a(this.r);
            }
            a(new Runnable() {
                @Override
                public final void run() {
                    a.this.m();
                }
            });
            this.y = true;
        } catch (Throwable th) {
            com.applovin.impl.sdk.n.c("AppLovinAdView", "Failed to initialize AdWebView", th);
            this.c.A().a("AppLovinAdView", "initAdWebView", th);
            this.x.set(true);
        }
    }

    public void b(MotionEvent motionEvent) {
        if (this.u == null && (this.s instanceof com.applovin.impl.sdk.ad.a) && this.n != null) {
            com.applovin.impl.sdk.ad.a aVar = this.s;
            Context context = this.a;
            Activity b2 = context instanceof Activity ? (Activity) context : q7.b(this.n, this.c);
            if (b2 != null && !b2.isFinishing()) {
                ViewGroup viewGroup = this.b;
                if (viewGroup != null) {
                    viewGroup.removeView(this.n);
                }
                f fVar = new f(aVar, this.n, b2, this.c);
                this.u = fVar;
                fVar.setOnDismissListener(new DialogInterface.OnDismissListener() {
                    @Override
                    public final void onDismiss(DialogInterface dialogInterface) {
                        a.this.a(dialogInterface);
                    }
                });
                this.u.show();
                l2.c(this.C, this.s, (AppLovinAdView) this.b);
                if (this.s.isOpenMeasurementEnabled()) {
                    this.s.getAdEventTracker().a(this.u.c());
                    return;
                }
                return;
            }
            com.applovin.impl.sdk.n.h("AppLovinAdView", "Unable to expand ad. No Activity found.");
            Uri j = aVar.j();
            if (j != null) {
                this.d.trackAndLaunchClick(aVar, i(), this, j, motionEvent, (Bundle) null);
            }
            this.n.a("javascript:al_onFailedExpand();");
        }
    }

    private static void a(View view, AppLovinAdSize appLovinAdSize) {
        b(view, appLovinAdSize, false);
    }

    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.n.h("AppLovinAdView", "Unable to build AppLovinAdView: no context provided. Please use a different constructor for this view.");
            return;
        }
        if (appLovinAdSize == null && (appLovinAdSize = q.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 (q.b(attributeSet)) {
                s();
            }
        }
    }

    public void b(final AppLovinAd appLovinAd) {
        if (appLovinAd != null) {
            if (!this.z) {
                c(appLovinAd);
            } else {
                this.w.set(appLovinAd);
                if (com.applovin.impl.sdk.n.a()) {
                    this.e.a("AppLovinAdView", "Ad view has paused when an ad was received, ad saved for later");
                }
            }
            a(new Runnable() {
                @Override
                public final void run() {
                    a.this.a(appLovinAd);
                }
            });
            return;
        }
        if (com.applovin.impl.sdk.n.a()) {
            this.e.b("AppLovinAdView", "No provided when to the view controller");
        }
        b(-1);
    }

    public void a(String str, Object obj) {
        this.h.put(str, obj);
    }

    public void a(AppLovinAd appLovinAd, String str) {
        if (appLovinAd != null) {
            z6.b(appLovinAd, this.c);
            if (this.y) {
                com.applovin.impl.sdk.ad.b bVar = (com.applovin.impl.sdk.ad.b) z6.a(appLovinAd, this.c);
                if (bVar == null) {
                    com.applovin.impl.sdk.n.h("AppLovinAdView", "Unable to retrieve the loaded ad: " + appLovinAd);
                    l2.a(this.B, "Unable to retrieve the loaded ad");
                    return;
                }
                if (bVar == this.s) {
                    com.applovin.impl.sdk.n.h("AppLovinAdView", "Attempting to show ad again: " + bVar);
                    if (((Boolean) this.c.a(l4.z1)).booleanValue()) {
                        if (this.B instanceof f2) {
                            l2.a(this.B, "Attempting to show ad again");
                            return;
                        } else {
                            if (!z6.c(this.c)) {
                                this.c.g().a(y1.o0, bVar, CollectionUtils.hashMap("source", "attemptingAdReRender"));
                                return;
                            }
                            throw new IllegalStateException("Attempting to show ad again");
                        }
                    }
                    return;
                }
                if (com.applovin.impl.sdk.n.a()) {
                    this.e.a("AppLovinAdView", "Rendering ad #" + bVar.getAdIdNumber() + " (" + bVar.getSize() + ")");
                }
                l2.b(this.B, this.s);
                if (this.s != null && this.s.isOpenMeasurementEnabled()) {
                    this.s.getAdEventTracker().f();
                }
                this.w.set(null);
                this.t = null;
                this.s = bVar;
                if (this.s.z0()) {
                    this.k = this.c.x().a(this);
                    this.c.x().b(this.s.A(), this.k);
                }
                if (!this.z && z6.a(this.i)) {
                    this.c.k().trackImpression(bVar);
                }
                if (this.u != null) {
                    c();
                }
                a(this.q);
                return;
            }
            com.applovin.impl.sdk.n.i("AppLovinAdView", "Unable to render ad: AppLovinAdView is not initialized.");
            return;
        }
        throw new IllegalArgumentException("No ad specified");
    }

    public void b(final int i) {
        if (!this.z) {
            a(this.r);
        }
        a(new Runnable() {
            @Override
            public final void run() {
                a.this.a(i);
            }
        });
    }

    public void b(Uri uri) {
        if (this.s != null && this.s.B0() && this.o == null) {
            String queryParameter = uri.getQueryParameter("tracking_id");
            if (TextUtils.isEmpty(queryParameter)) {
                this.c.I();
                if (com.applovin.impl.sdk.n.a()) {
                    this.c.I().b("AppLovinAdView", "Invalid tracking id. Cannot initialize GA");
                    return;
                }
                return;
            }
            WebView webView = new WebView(this.a);
            this.o = webView;
            webView.setWebViewClient(new h4());
            this.o.getSettings().setJavaScriptEnabled(true);
            this.o.loadDataWithBaseURL((String) this.c.a(l4.q6), "<html><head><link rel=\"icon\" href=\"data:,\"><G-SCRIPT_TAG></head><body></body></html>".replace("<G-SCRIPT_TAG>", "<script src='https://www.googletagmanager.com/gtag/js?id=<G-TRACKING_ID>'></script><script>window.dataLayer = window.dataLayer || [];function gtag(){dataLayer.push(arguments);}gtag('js', new Date());gtag('config', '<G-TRACKING_ID>')</script>".replace("<G-TRACKING_ID>", queryParameter)), "text/html", C.UTF8_NAME, null);
        }
    }

    public void a(final WebView webView, String str) {
        if (this.s == null) {
            return;
        }
        a(new Runnable() {
            @Override
            public final void run() {
                webView.setVisibility(0);
            }
        });
        if (!((Boolean) this.c.a(l4.M5)).booleanValue() || (str != null && str.startsWith(this.s.h()))) {
            try {
                if (this.s != this.t) {
                    this.t = this.s;
                    v();
                    this.n.setAdHtmlLoaded(true);
                    if (this.B != null) {
                        this.c.w().d(this.s);
                        this.c.g().a(y1.n, this.s);
                        l2.a(this.B, this.s);
                        if (this.s.U0()) {
                            String str2 = (String) this.c.i0().a(n4.L, "");
                            JSONObject jSONObject = new JSONObject();
                            JsonUtils.putString(jSONObject, "template_browser_package_name", str2);
                            this.n.a("javascript:al_onAdViewRendered(" + jSONObject + ");");
                        } else {
                            this.n.a("javascript:al_onAdViewRendered();");
                        }
                    }
                    if ((this.s instanceof com.applovin.impl.sdk.ad.a) && this.s.isOpenMeasurementEnabled()) {
                        this.c.j0().a(new f6(this.c, "StartOMSDK", new Runnable() {
                            @Override
                            public final void run() {
                                a.this.b(webView);
                            }
                        }), r5.b.e, 500L);
                    }
                }
            } catch (Throwable th) {
                com.applovin.impl.sdk.n.c("AppLovinAdView", "Exception while notifying ad display listener", th);
                com.applovin.impl.sdk.j jVar = this.c;
                if (jVar != null) {
                    jVar.A().a("AppLovinAdView", "onAdHtmlLoaded", th);
                }
            }
        }
    }

    public void a(final MotionEvent motionEvent) {
        a(new Runnable() {
            @Override
            public final void run() {
                a.this.b(motionEvent);
            }
        });
    }

    public void a(DialogInterface dialogInterface) {
        a();
    }

    public void a() {
        a(new Runnable() {
            @Override
            public final void run() {
                a.this.n();
            }
        });
    }

    public void a(com.applovin.impl.sdk.ad.b bVar, AppLovinAdView appLovinAdView, Uri uri, MotionEvent motionEvent, Bundle bundle) {
        if (appLovinAdView != null) {
            this.d.trackAndLaunchClick(bVar, appLovinAdView, this, uri, motionEvent, bundle);
        } else if (com.applovin.impl.sdk.n.a()) {
            this.e.b("AppLovinAdView", "Unable to process ad click - AppLovinAdView destroyed prematurely");
        }
        l2.a(this.D, bVar);
    }

    public void a(AppLovinAd appLovinAd) {
        if (this.x.compareAndSet(true, false)) {
            a(this.i);
        }
        try {
            if (this.A != null) {
                this.A.adReceived(appLovinAd);
            }
        } catch (Throwable th) {
            com.applovin.impl.sdk.n.h("AppLovinAdView", "Exception while running ad load callback: " + th.getMessage());
            com.applovin.impl.sdk.j jVar = this.c;
            if (jVar != null) {
                jVar.A().a("AppLovinAdView", "notifyAdLoadedCallback", th);
            }
        }
    }

    public void a(int i) {
        try {
            if (this.A != null) {
                this.A.failedToReceiveAd(i);
            }
        } catch (Throwable th) {
            com.applovin.impl.sdk.n.c("AppLovinAdView", "Exception while running app load callback", th);
            com.applovin.impl.sdk.j jVar = this.c;
            if (jVar != null) {
                jVar.A().a("AppLovinAdView", "notifyAdLoadFailedCallback", th);
            }
        }
    }

    private void a(Runnable runnable) {
        AppLovinSdkUtils.runOnUiThread(runnable);
    }

    public void a(b bVar) {
        this.g = bVar;
    }

    public void a(Uri uri) {
        if (this.s == null || !this.s.B0()) {
            return;
        }
        if (this.o == null) {
            this.c.I();
            if (com.applovin.impl.sdk.n.a()) {
                this.c.I().a("AppLovinAdView", "GA is not initialized. Cannot fire GA event");
                return;
            }
            return;
        }
        final String queryParameter = uri.getQueryParameter("event_name");
        final String queryParameter2 = uri.getQueryParameter("event_params_json");
        if (TextUtils.isEmpty(queryParameter)) {
            this.c.I();
            if (com.applovin.impl.sdk.n.a()) {
                this.c.I().a("AppLovinAdView", "Invalid GA event name. Cannot fire GA event");
                return;
            }
            return;
        }
        a(new Runnable() {
            @Override
            public final void run() {
                a.this.a(queryParameter2, queryParameter);
            }
        });
    }

    public void a(String str, String str2) {
        String str3;
        if (StringUtils.isValidString(str)) {
            str3 = "gtag('event', '" + str2 + "', " + str + ");";
        } else {
            str3 = "gtag('event', '" + str2 + "')";
        }
        a8.a(this.o, str3);
    }
}