导航菜单

页面标题

页面副标题

FileWipe Pro v3.0.0 - a.java 源代码

正在查看: FileWipe Pro v3.0.0 应用的 a.java JAVA 源代码文件

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


package com.applovin.impl.adview;

import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
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 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.a2;
import com.applovin.impl.a7;
import com.applovin.impl.adview.k;
import com.applovin.impl.b8;
import com.applovin.impl.e8;
import com.applovin.impl.f2;
import com.applovin.impl.f6;
import com.applovin.impl.h4;
import com.applovin.impl.i1;
import com.applovin.impl.l2;
import com.applovin.impl.l4;
import com.applovin.impl.n2;
import com.applovin.impl.n4;
import com.applovin.impl.r5;
import com.applovin.impl.r7;
import com.applovin.impl.s3;
import com.applovin.impl.sdk.AppLovinAdServiceImpl;
import com.applovin.impl.sdk.AppLovinBroadcastManager;
import com.applovin.impl.sdk.SessionTracker;
import com.applovin.impl.sdk.ad.AppLovinAdImpl;
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.x1;
import com.applovin.impl.y1;
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.mbridge.msdk.playercommon.exoplayer2.C;
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, AppLovinBroadcastManager.Receiver {
    private volatile AppLovinAdLoadListener A;
    private volatile AppLovinAdDisplayListener B;
    private volatile AppLovinAdViewEventListener C;
    private volatile AppLovinAdClickListener D;

    private Context f2108a;

    private ViewGroup f2109b;

    private com.applovin.impl.sdk.k f2110c;

    private AppLovinAdServiceImpl f2111d;

    private com.applovin.impl.sdk.o f2112e;

    private AppLovinCommunicator f2113f;

    private b f2114g;

    private AppLovinAdSize f2116i;

    private String f2117j;

    private t.i f2118k;
    private com.applovin.impl.adview.c l;
    private e m;

    private com.applovin.impl.adview.b f2119n;

    private WebView f2120o;

    private k f2121p;

    private Runnable f2122q;

    private Runnable f2123r;

    private final Map f2115h = Collections.synchronizedMap(new HashMap());

    private volatile com.applovin.impl.sdk.ad.b f2124s = null;

    private volatile AppLovinAd f2125t = null;

    private f f2126u = null;

    private f f2127v = null;

    private final AtomicReference f2128w = new AtomicReference();

    private final AtomicBoolean f2129x = new AtomicBoolean();

    private volatile boolean f2130y = false;

    private volatile boolean f2131z = false;

    public class C0000a extends h4 {
        public C0000a() {
        }

        @Override
        public Map a() {
            return CollectionUtils.hashMap("name", "AdViewController:GAWebView");
        }
    }

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

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

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

        public c(a aVar, C0000a c0000a) {
            this();
        }
    }

    public class d implements Runnable {

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

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

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

        private d() {
        }

        @Override
        public void run() {
            if (a.this.f2124s != null) {
                if (a.this.f2119n == null) {
                    com.applovin.impl.sdk.o.h("AppLovinAdView", "Unable to render advertisement for ad #" + a.this.f2124s.getAdIdNumber() + ". Please make sure you are not calling AppLovinAdView.destroy() prematurely.");
                    l2.a(a.this.C, a.this.f2124s, (AppLovinAdView) null, AppLovinAdViewDisplayErrorCode.WEBVIEW_NOT_FOUND);
                    HashMap<String, String> hashMap = CollectionUtils.hashMap("source", "renderTask");
                    CollectionUtils.putStringIfValid("error_message", "Ad view failed to render due to null adView", hashMap);
                    a.this.f2110c.g().a(y1.f4711s, a.this.f2124s, hashMap);
                    return;
                }
                a.this.v();
                com.applovin.impl.sdk.o unused = a.this.f2112e;
                if (com.applovin.impl.sdk.o.a()) {
                    a.this.f2112e.a("AppLovinAdView", "Rendering advertisement ad for #" + a.this.f2124s.getAdIdNumber() + "...");
                }
                a.b(a.this.f2119n, a.this.f2124s.getSize(), a.this.f2124s.D0());
                if (a.this.f2121p != null) {
                    r7.c(a.this.f2121p);
                    a.this.f2121p = null;
                }
                x1 x1Var = new x1(a.this.f2115h, a.this.f2110c);
                if (x1Var.c()) {
                    a.this.f2121p = new k(x1Var, a.this.f2108a);
                    a.this.f2121p.a(new C0001a());
                }
                a.this.f2119n.setAdHtmlLoaded(false);
                a.this.f2119n.a(a.this.f2124s);
                if (a.this.f2124s.getSize() == AppLovinAdSize.INTERSTITIAL || a.this.f2131z) {
                    return;
                }
                a.this.f2124s.setHasShown(true);
            }
        }

        public d(a aVar, C0000a c0000a) {
            this();
        }
    }

    public static class e implements AppLovinAdLoadListener {

        private final a f2136a;

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

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

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

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

    private void E() {
        if (this.f2112e != null && com.applovin.impl.sdk.o.a() && com.applovin.impl.sdk.o.a()) {
            this.f2112e.a("AppLovinAdView", "Destroying...");
        }
        b8.b(this.f2119n);
        this.f2119n = null;
        b8.b(this.f2120o);
        this.f2120o = null;
        this.f2118k = null;
        this.A = null;
        this.B = null;
        this.D = null;
        this.C = null;
        AppLovinBroadcastManager.unregisterReceiver(this);
        this.f2131z = true;
    }

    public void v() {
        com.applovin.impl.sdk.ad.b bVar = this.f2124s;
        n2 n2Var = new n2();
        n2Var.a().a(bVar).a(i());
        if (!a7.a(bVar.getSize())) {
            n2Var.a().a("Fullscreen Ad Properties").b(bVar);
        }
        n2Var.a(this.f2110c);
        n2Var.a();
        if (com.applovin.impl.sdk.o.a()) {
            this.f2112e.a("AppLovinAdView", n2Var.toString());
        }
    }

    private void x() {
        if (this.f2124s.b1()) {
            int c4 = this.f2110c.q().c();
            if (com.applovin.impl.sdk.i.a(c4)) {
                this.f2119n.a("javascript:al_muteSwitchOn();");
            } else if (c4 == 2) {
                this.f2119n.a("javascript:al_muteSwitchOff();");
            }
        }
    }

    private void y() {
        if (a7.a(this.f2116i)) {
            if (((Boolean) this.f2110c.a(l4.C1)).booleanValue()) {
                AppLovinBroadcastManager.registerReceiver(this, new IntentFilter(SessionTracker.ACTION_APPLICATION_PAUSED));
                AppLovinBroadcastManager.registerReceiver(this, new IntentFilter(SessionTracker.ACTION_APPLICATION_RESUMED));
            }
            if (((Boolean) this.f2110c.a(l4.D1)).booleanValue()) {
                AppLovinBroadcastManager.registerReceiver(this, new IntentFilter("com.applovin.custom_tabs_shown"));
                AppLovinBroadcastManager.registerReceiver(this, new IntentFilter("com.applovin.custom_tabs_hidden"));
                AppLovinBroadcastManager.registerReceiver(this, new IntentFilter("com.applovin.custom_tabs_failure"));
            }
            AppLovinBroadcastManager.registerReceiver(this, new IntentFilter("com.applovin.custom_intent_launch_success"));
            AppLovinBroadcastManager.registerReceiver(this, new IntentFilter("com.applovin.custom_intent_launch_failure"));
            if (((Boolean) this.f2110c.a(l4.E1)).booleanValue()) {
                AppLovinBroadcastManager.registerReceiver(this, new IntentFilter("com.applovin.external_redirect_success"));
                AppLovinBroadcastManager.registerReceiver(this, new IntentFilter("com.applovin.external_redirect_failure"));
            }
            if (((Boolean) this.f2110c.a(l4.F1)).booleanValue()) {
                AppLovinBroadcastManager.registerReceiver(this, new IntentFilter("com.applovin.preload_success"));
                AppLovinBroadcastManager.registerReceiver(this, new IntentFilter("com.applovin.preload_failure"));
            }
        }
    }

    public void A() {
        if (com.applovin.impl.sdk.o.a()) {
            this.f2112e.a("AppLovinAdView", "AdView fully watched...");
        }
        b bVar = this.f2114g;
        if (bVar != null) {
            bVar.a(this);
        }
    }

    public void B() {
        y();
        if (this.f2124s != null && this.f2124s.C0()) {
            com.applovin.impl.g.a(this.f2119n, this.f2110c);
        }
        b("javascript:al_onAttachedToWindow();");
    }

    public void C() {
        if (this.f2130y) {
            if (this.f2124s == null || !this.f2124s.i1()) {
                l2.b(this.B, this.f2124s);
            }
            if (this.f2124s != null && this.f2124s.isOpenMeasurementEnabled() && a7.a(this.f2124s.getSize())) {
                this.f2124s.getAdEventTracker().f();
            }
            if (this.f2119n != null && this.f2126u != null) {
                if (com.applovin.impl.sdk.o.a()) {
                    this.f2112e.a("AppLovinAdView", "onDetachedFromWindowCalled with expanded ad present");
                }
                c();
            } else if (com.applovin.impl.sdk.o.a()) {
                this.f2112e.a("AppLovinAdView", "onDetachedFromWindowCalled without an expanded ad present");
            }
            b("javascript:al_onDetachedFromWindow();");
        }
    }

    public void D() {
        if (!this.f2130y || this.f2131z) {
            return;
        }
        this.f2131z = true;
    }

    public void F() {
        if (this.f2130y) {
            AppLovinAd appLovinAd = (AppLovinAd) this.f2128w.getAndSet(null);
            if (appLovinAd != null) {
                c(appLovinAd);
            }
            this.f2131z = false;
        }
    }

    @Override
    public String getCommunicatorId() {
        return "a";
    }

    @Override
    public void onMessageReceived(AppLovinCommunicatorMessage appLovinCommunicatorMessage) {
        if ("crash_applovin_ad_webview".equals(appLovinCommunicatorMessage.getTopic())) {
            a(new o(this, 4));
        }
    }

    @Override
    public void onReceive(Intent intent, Map map) {
        String action = intent.getAction();
        if (action == null) {
            return;
        }
        switch (action) {
            case "com.applovin.custom_intent_launch_failure":
            case "com.applovin.custom_intent_launch_success":
                a(action, map);
                break;
            case "com.applovin.external_redirect_success":
            case "com.applovin.external_redirect_failure":
                c(action, map);
                break;
            case "com.applovin.custom_tabs_failure":
            case "com.applovin.custom_tabs_hidden":
            case "com.applovin.custom_tabs_shown":
                b(action, map);
                break;
            case "com.applovin.application_paused":
                m();
                break;
            case "com.applovin.application_resumed":
                n();
                break;
            case "com.applovin.preload_success":
            case "com.applovin.preload_failure":
                d(action, map);
                break;
        }
    }

    public void w() {
        if ((this.f2108a instanceof i1) && this.f2124s != null && this.f2124s.U() == b.EnumC0013b.DISMISS) {
            ((i1) this.f2108a).dismiss("postitial_click");
        }
    }

    public void z() {
        if (this.f2126u != null || this.f2127v != null) {
            a();
            return;
        }
        if (com.applovin.impl.sdk.o.a()) {
            this.f2112e.a("AppLovinAdView", "Ad: " + this.f2124s + " closed.");
        }
        a(this.f2123r);
        l2.b(this.B, this.f2124s);
        this.f2124s = null;
    }

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

    private void c() {
        a(new o(this, 2));
    }

    private void m() {
        if (com.applovin.impl.sdk.o.a()) {
            this.f2112e.a("AppLovinAdView", "handleApplicationPaused()");
        }
        b("javascript:al_onAppPaused();");
    }

    private void n() {
        if (com.applovin.impl.sdk.o.a()) {
            this.f2112e.a("AppLovinAdView", "handleApplicationResumed()");
        }
        b("javascript:al_onAppResumed();");
    }

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

    public void p() {
        com.applovin.impl.adview.b bVar;
        d();
        if (this.f2109b == null || (bVar = this.f2119n) == null || bVar.getParent() != null) {
            return;
        }
        this.f2109b.addView(this.f2119n);
        b(this.f2119n, this.f2124s.getSize(), this.f2124s.D0());
        if (this.f2124s.isOpenMeasurementEnabled()) {
            this.f2124s.getAdEventTracker().a((View) this.f2119n);
        }
    }

    public void q() {
        if (this.f2119n != null && this.f2126u != null) {
            a();
        }
        E();
    }

    public void r() {
        if (this.f2126u != null) {
            if (com.applovin.impl.sdk.o.a()) {
                this.f2112e.a("AppLovinAdView", "Detaching expanded ad: " + this.f2126u.b());
            }
            this.f2127v = this.f2126u;
            this.f2126u = null;
            a(this.f2116i);
        }
    }

    public void s() {
        com.applovin.impl.sdk.ad.a b10;
        f fVar = this.f2127v;
        if (fVar == null && this.f2126u == null) {
            return;
        }
        if (fVar != null) {
            b10 = fVar.b();
            this.f2127v.dismiss();
            this.f2127v = null;
        } else {
            b10 = this.f2126u.b();
            this.f2126u.dismiss();
            this.f2126u = null;
        }
        l2.a(this.C, b10, (AppLovinAdView) this.f2109b);
    }

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

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

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

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

    public t.i h() {
        return this.f2118k;
    }

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

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

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

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

    public void u() {
        if (this.f2110c == null || this.m == null || this.f2108a == null || !this.f2130y) {
            com.applovin.impl.sdk.o.i("AppLovinAdView", "Unable to load next ad: AppLovinAdView is not initialized.");
        } else {
            this.f2111d.loadNextAd(this.f2117j, this.f2116i, this.m);
        }
    }

    private void d() {
        a(new o(this, 0));
    }

    public void c(int i10) {
        String a10 = r7.a(i10);
        if (com.applovin.impl.sdk.o.a()) {
            this.f2112e.a("AppLovinAdView", "onWindowVisibilityChanged( " + a10 + " )");
        }
        b(j0.a.g("javascript:al_onWindowVisibilityChanged( ", a10, " );"));
    }

    private void d(String str, Map map) {
        a(b8.d(str, map));
    }

    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.k kVar, AppLovinAdSize appLovinAdSize, String str, Context context) {
        if (appLovinAdView == null) {
            throw new IllegalArgumentException("No parent view specified");
        }
        if (kVar == null) {
            throw new IllegalArgumentException("No sdk specified");
        }
        if (appLovinAdSize != null) {
            this.f2110c = kVar;
            this.f2111d = kVar.k();
            this.f2112e = kVar.O();
            this.f2113f = AppLovinCommunicator.getInstance(context);
            this.f2116i = appLovinAdSize;
            this.f2117j = str;
            if (!(context instanceof AppLovinFullscreenActivity)) {
                context = context.getApplicationContext();
            }
            this.f2108a = context;
            this.f2109b = appLovinAdView;
            this.l = new com.applovin.impl.adview.c(this, kVar);
            C0000a c0000a = null;
            this.f2123r = new c(this, c0000a);
            this.f2122q = new d(this, c0000a);
            this.m = new e(this, kVar);
            a(appLovinAdSize);
            return;
        }
        throw new IllegalArgumentException("No ad size specified");
    }

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

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

    private void c(String str, Map map) {
        a(b8.c(str, map));
    }

    public void b() {
        a(new o(this, 3));
    }

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

    public void a(AppLovinAdSize appLovinAdSize) {
        try {
            com.applovin.impl.adview.b bVar = new com.applovin.impl.adview.b(this.l, this.f2110c, this.f2108a);
            this.f2119n = bVar;
            bVar.setBackgroundColor(0);
            this.f2119n.setWillNotCacheDrawing(false);
            this.f2109b.setBackgroundColor(0);
            this.f2109b.addView(this.f2119n);
            a(this.f2119n, appLovinAdSize);
            if (!this.f2130y) {
                a(this.f2123r);
            }
            a(new o(this, 5));
            this.f2130y = true;
        } catch (Throwable th) {
            com.applovin.impl.sdk.o.c("AppLovinAdView", "Failed to initialize AdWebView", th);
            this.f2110c.E().a("AppLovinAdView", "initAdWebView", th);
            this.f2129x.set(true);
        }
    }

    public void b(MotionEvent motionEvent) {
        a aVar;
        if (this.f2126u == null && (this.f2124s instanceof com.applovin.impl.sdk.ad.a) && this.f2119n != null) {
            com.applovin.impl.sdk.ad.a aVar2 = (com.applovin.impl.sdk.ad.a) this.f2124s;
            Context context = this.f2108a;
            Activity b10 = context instanceof Activity ? (Activity) context : r7.b(this.f2119n, this.f2110c);
            if (b10 != null && !b10.isFinishing()) {
                ViewGroup viewGroup = this.f2109b;
                if (viewGroup != null) {
                    viewGroup.removeView(this.f2119n);
                }
                f fVar = new f(aVar2, this.f2119n, b10, this.f2110c);
                this.f2126u = fVar;
                fVar.setOnDismissListener(new DialogInterface.OnDismissListener() {
                    @Override
                    public final void onDismiss(DialogInterface dialogInterface) {
                        a.this.a(dialogInterface);
                    }
                });
                this.f2126u.show();
                l2.c(this.C, this.f2124s, (AppLovinAdView) this.f2109b);
                if (this.f2124s.isOpenMeasurementEnabled()) {
                    this.f2124s.getAdEventTracker().a((View) this.f2126u.c());
                    return;
                }
                return;
            }
            com.applovin.impl.sdk.o.h("AppLovinAdView", "Unable to expand ad. No Activity found.");
            Uri m = aVar2.m();
            if (m != null) {
                aVar = this;
                this.f2111d.trackAndLaunchClick(aVar2, i(), aVar, m, motionEvent, null);
            } else {
                aVar = this;
            }
            aVar.f2119n.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.o.h("AppLovinAdView", "Unable to build AppLovinAdView: no context provided. Please use a different constructor for this view.");
            return;
        }
        if (appLovinAdSize == null && (appLovinAdSize = com.applovin.impl.r.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.r.b(attributeSet)) {
                u();
            }
        }
    }

    public void b(AppLovinAd appLovinAd) {
        if (appLovinAd != null) {
            if (!this.f2131z) {
                c(appLovinAd);
            } else {
                this.f2128w.set(appLovinAd);
                if (com.applovin.impl.sdk.o.a()) {
                    this.f2112e.a("AppLovinAdView", "Ad view has paused when an ad was received, ad saved for later");
                }
            }
            a((Runnable) new bd.b(6, this, appLovinAd));
            return;
        }
        if (com.applovin.impl.sdk.o.a()) {
            this.f2112e.b("AppLovinAdView", "No provided when to the view controller");
        }
        b(-1);
    }

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

    public void a(boolean z3) {
        if (com.applovin.impl.sdk.o.a()) {
            this.f2112e.a("AppLovinAdView", "onWindowFocusChanged( " + z3 + " )");
        }
        b("javascript:al_onWindowFocusChanged( " + z3 + " );");
    }

    public void a(AppLovinAd appLovinAd, String str) {
        if (appLovinAd != null) {
            a7.b(appLovinAd, this.f2110c);
            if (this.f2130y) {
                if (appLovinAd.getSize() != AppLovinAdSize.INTERSTITIAL) {
                    Map a10 = a2.a((AppLovinAdImpl) appLovinAd);
                    CollectionUtils.putStringIfValid("source", "renderAd", a10);
                    this.f2110c.g().d(y1.f4706p, a10);
                }
                com.applovin.impl.sdk.ad.b bVar = (com.applovin.impl.sdk.ad.b) a7.a(appLovinAd, this.f2110c);
                if (bVar == null) {
                    com.applovin.impl.sdk.o.h("AppLovinAdView", "Unable to retrieve the loaded ad: " + appLovinAd);
                    l2.a(this.B, "Unable to retrieve the loaded ad");
                    Map a11 = a2.a((AppLovinAdImpl) appLovinAd);
                    CollectionUtils.putStringIfValid("source", "noAdToRender", a11);
                    CollectionUtils.putStringIfValid("error_message", "Unable to retrieve the loaded ad", a11);
                    this.f2110c.g().d(y1.f4711s, a11);
                    return;
                }
                if (bVar == this.f2124s) {
                    com.applovin.impl.sdk.o.h("AppLovinAdView", "Attempting to show ad again: " + bVar);
                    if (((Boolean) this.f2110c.a(l4.G1)).booleanValue()) {
                        if (this.B instanceof f2) {
                            l2.a(this.B, "Attempting to show ad again");
                        } else if (!a7.c(this.f2110c)) {
                            this.f2110c.g().a(y1.f4720w0, bVar, CollectionUtils.hashMap("source", "attemptingAdReRender"));
                        } else {
                            throw new IllegalStateException("Attempting to show ad again");
                        }
                    }
                    HashMap<String, String> hashMap = CollectionUtils.hashMap("source", "attemptingAdReRender");
                    CollectionUtils.putStringIfValid("error_message", "Attempting to show ad again", hashMap);
                    this.f2110c.g().a(y1.f4711s, bVar, hashMap);
                    return;
                }
                if (com.applovin.impl.sdk.o.a()) {
                    this.f2112e.a("AppLovinAdView", "Rendering ad #" + bVar.getAdIdNumber() + " (" + bVar.getSize() + ")");
                }
                l2.b(this.B, this.f2124s);
                if (this.f2124s != null && this.f2124s.isOpenMeasurementEnabled()) {
                    this.f2124s.getAdEventTracker().f();
                }
                this.f2128w.set(null);
                this.f2125t = null;
                this.f2124s = bVar;
                if (this.f2124s.I0()) {
                    this.f2118k = this.f2110c.A().a(this);
                    this.f2110c.A().b(this.f2124s.D(), this.f2118k);
                }
                if (!this.f2131z && a7.a(this.f2116i)) {
                    this.f2110c.k().trackImpression(bVar);
                }
                if (this.f2126u != null) {
                    c();
                }
                a(this.f2122q);
                return;
            }
            com.applovin.impl.sdk.o.i("AppLovinAdView", "Unable to render ad: AppLovinAdView is not initialized.");
            return;
        }
        throw new IllegalArgumentException("No ad specified");
    }

    public void b(int i10) {
        if (!this.f2131z) {
            a(this.f2123r);
        }
        a(new p(i10, 0, this));
    }

    private void b(String str) {
        if (((Boolean) this.f2110c.a(l4.C1)).booleanValue()) {
            a(str);
        }
    }

    private void b(String str, Map map) {
        a(b8.b(str, map));
    }

    public void b(Uri uri) {
        if (this.f2124s != null && this.f2124s.K0() && this.f2120o == null) {
            String queryParameter = uri.getQueryParameter("tracking_id");
            if (TextUtils.isEmpty(queryParameter)) {
                this.f2110c.O();
                if (com.applovin.impl.sdk.o.a()) {
                    this.f2110c.O().b("AppLovinAdView", "Invalid tracking id. Cannot initialize GA");
                    return;
                }
                return;
            }
            WebView webView = new WebView(this.f2108a);
            this.f2120o = webView;
            webView.setWebViewClient(new C0000a());
            this.f2120o.getSettings().setJavaScriptEnabled(true);
            this.f2120o.loadDataWithBaseURL((String) this.f2110c.a(l4.F6), "<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(WebView webView, String str) {
        if (this.f2124s == null) {
            return;
        }
        a(new u(webView, 2));
        if (!((Boolean) this.f2110c.a(l4.U5)).booleanValue() || (str != null && str.startsWith(this.f2124s.k()))) {
            try {
                if (this.f2124s != this.f2125t) {
                    this.f2125t = this.f2124s;
                    x();
                    this.f2119n.setAdHtmlLoaded(true);
                    if (this.B != null) {
                        this.f2110c.z().d(this.f2124s);
                        if (this.f2124s.E0()) {
                            this.f2110c.g().a(y1.f4709r, this.f2124s, CollectionUtils.hashMap("details", a2.b(this.f2124s)));
                        } else {
                            this.f2110c.g().a(y1.f4707q, this.f2124s);
                            l2.a(this.B, this.f2124s);
                        }
                        if (this.f2124s.c1()) {
                            String str2 = (String) this.f2110c.p0().a(n4.N, "");
                            JSONObject jSONObject = new JSONObject();
                            JsonUtils.putString(jSONObject, "template_browser_package_name", str2);
                            this.f2119n.a("javascript:al_onAdViewRendered(" + jSONObject + ");");
                        } else {
                            this.f2119n.a("javascript:al_onAdViewRendered();");
                        }
                        if (this.f2124s.E0()) {
                            this.f2119n.a("javascript:al_onAdRestored( '" + this.f2124s.h0() + "' );");
                        }
                    }
                    if ((this.f2124s instanceof com.applovin.impl.sdk.ad.a) && this.f2124s.isOpenMeasurementEnabled()) {
                        this.f2110c.q0().a(new f6(this.f2110c, "StartOMSDK", new bd.b(5, this, webView)), r5.b.OTHER, 500L);
                    }
                }
            } catch (Throwable th) {
                com.applovin.impl.sdk.o.c("AppLovinAdView", "Exception while notifying ad display listener", th);
                com.applovin.impl.sdk.k kVar = this.f2110c;
                if (kVar != null) {
                    kVar.E().a("AppLovinAdView", "onAdHtmlLoaded", th);
                }
            }
        }
    }

    public void a(MotionEvent motionEvent) {
        a((Runnable) new bd.b(4, this, motionEvent));
    }

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

    public void a() {
        a(new o(this, 1));
    }

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

    public void a(AppLovinAd appLovinAd) {
        if (this.f2129x.compareAndSet(true, false)) {
            a(this.f2116i);
        }
        try {
            if (this.A != null) {
                this.A.adReceived(appLovinAd);
            }
        } catch (Throwable th) {
            com.applovin.impl.sdk.o.h("AppLovinAdView", "Exception while running ad load callback: " + th.getMessage());
            com.applovin.impl.sdk.k kVar = this.f2110c;
            if (kVar != null) {
                kVar.E().a("AppLovinAdView", "notifyAdLoadedCallback", th);
            }
        }
    }

    public void a(int i10) {
        try {
            if (this.A != null) {
                this.A.failedToReceiveAd(i10);
            }
        } catch (Throwable th) {
            com.applovin.impl.sdk.o.c("AppLovinAdView", "Exception while running app load callback", th);
            com.applovin.impl.sdk.k kVar = this.f2110c;
            if (kVar != null) {
                kVar.E().a("AppLovinAdView", "notifyAdLoadFailedCallback", th);
            }
        }
    }

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

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

    private void a(String str, Map map) {
        a(b8.a(str, map));
    }

    private void a(String str) {
        if (this.f2124s == null || this.f2119n == null || !a7.a(this.f2124s.getSize()) || !StringUtils.isValidString(str)) {
            return;
        }
        this.f2119n.a(str);
    }

    public void a(Uri uri) {
        if (this.f2124s == null || !this.f2124s.K0()) {
            return;
        }
        if (this.f2120o == null) {
            this.f2110c.O();
            if (com.applovin.impl.sdk.o.a()) {
                this.f2110c.O().a("AppLovinAdView", "GA is not initialized. Cannot fire GA event");
                return;
            }
            return;
        }
        String queryParameter = uri.getQueryParameter("event_name");
        String queryParameter2 = uri.getQueryParameter("event_params_json");
        if (TextUtils.isEmpty(queryParameter)) {
            this.f2110c.O();
            if (com.applovin.impl.sdk.o.a()) {
                this.f2110c.O().a("AppLovinAdView", "Invalid GA event name. Cannot fire GA event");
                return;
            }
            return;
        }
        a(new e8(this, queryParameter2, queryParameter, 2));
    }

    public void a(String str, String str2) {
        String g5;
        if (StringUtils.isValidString(str)) {
            g5 = j0.a.i("gtag('event', '", str2, "', ", str, ");");
        } else {
            g5 = j0.a.g("gtag('event', '", str2, "')");
        }
        b8.a(this.f2120o, g5);
    }
}