导航菜单

页面标题

页面副标题

All File Recovery v1.0.2 - C0479a.java 源代码

正在查看: All File Recovery v1.0.2 应用的 C0479a.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 androidx.fragment.app.L;
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.AbstractC0473a2;
import com.applovin.impl.AbstractC0532g;
import com.applovin.impl.AbstractC0545h4;
import com.applovin.impl.AbstractC0575l2;
import com.applovin.impl.AbstractC0656s3;
import com.applovin.impl.AbstractC0742z6;
import com.applovin.impl.C0531f6;
import com.applovin.impl.C0577l4;
import com.applovin.impl.C0616n2;
import com.applovin.impl.C0618n4;
import com.applovin.impl.C0650r5;
import com.applovin.impl.C0699u3;
import com.applovin.impl.C0721x1;
import com.applovin.impl.C0729y1;
import com.applovin.impl.InterfaceC0527f2;
import com.applovin.impl.InterfaceC0550i1;
import com.applovin.impl.a8;
import com.applovin.impl.adview.k;
import com.applovin.impl.q7;
import com.applovin.impl.sdk.AppLovinAdServiceImpl;
import com.applovin.impl.sdk.AppLovinBroadcastManager;
import com.applovin.impl.sdk.C0670i;
import com.applovin.impl.sdk.C0672k;
import com.applovin.impl.sdk.C0676o;
import com.applovin.impl.sdk.SessionTracker;
import com.applovin.impl.sdk.ad.AbstractC0662b;
import com.applovin.impl.sdk.ad.AppLovinAdImpl;
import com.applovin.impl.sdk.ad.C0661a;
import com.applovin.impl.sdk.utils.CollectionUtils;
import com.applovin.impl.sdk.utils.JsonUtils;
import com.applovin.impl.sdk.utils.StringUtils;
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.facebook.internal.C0752a;
import com.facebook.internal.C0755d;
import com.iab.omid.library.applovin.adsession.FriendlyObstructionPurpose;
import i4.C0888c;
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 C0479a implements AppLovinCommunicatorSubscriber, AppLovinBroadcastManager.Receiver {
    private volatile AppLovinAdLoadListener A;
    private volatile AppLovinAdDisplayListener B;
    private volatile AppLovinAdViewEventListener C;
    private volatile AppLovinAdClickListener D;
    private Context a;
    private ViewGroup b;
    private C0672k c;
    private AppLovinAdServiceImpl d;
    private C0676o e;
    private AppLovinCommunicator f;
    private b g;
    private AppLovinAdSize i;
    private String j;
    private E.m k;
    private C0481c l;
    private e m;
    private C0480b n;
    private WebView o;
    private k p;
    private Runnable q;
    private Runnable r;
    private final Map h = L.a();
    private volatile AbstractC0662b s = null;
    private volatile AppLovinAd t = null;
    private DialogC0484f u = null;
    private DialogC0484f 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 class C0091a extends AbstractC0545h4 {
        public C0091a() {
        }

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

    public interface b {
        void a(C0479a c0479a);
    }

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

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

        public c(C0479a c0479a, C0091a c0091a) {
            this();
        }
    }

    public class d implements Runnable {

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

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

            @Override
            public void onFailure() {
                C0676o unused = C0479a.this.e;
                if (C0676o.a()) {
                    C0479a.this.e.b("AppLovinAdView", "Watermark failed to render.");
                }
            }
        }

        private d() {
        }

        @Override
        public void run() {
            if (C0479a.this.s != null) {
                if (C0479a.this.n == null) {
                    C0676o.h("AppLovinAdView", "Unable to render advertisement for ad #" + C0479a.this.s.getAdIdNumber() + ". Please make sure you are not calling AppLovinAdView.destroy() prematurely.");
                    AbstractC0575l2.a(C0479a.this.C, C0479a.this.s, (AppLovinAdView) null, AppLovinAdViewDisplayErrorCode.WEBVIEW_NOT_FOUND);
                    HashMap<String, String> hashMap = CollectionUtils.hashMap("source", "renderTask");
                    CollectionUtils.putStringIfValid(C0752a.Y, "Ad view failed to render due to null adView", hashMap);
                    C0479a.this.c.g().a(C0729y1.s, C0479a.this.s, hashMap);
                    return;
                }
                C0479a.this.v();
                C0676o unused = C0479a.this.e;
                if (C0676o.a()) {
                    C0479a.this.e.a("AppLovinAdView", "Rendering advertisement ad for #" + C0479a.this.s.getAdIdNumber() + "...");
                }
                C0479a.b(C0479a.this.n, C0479a.this.s.getSize(), C0479a.this.s.D0());
                if (C0479a.this.p != null) {
                    q7.c(C0479a.this.p);
                    C0479a.this.p = null;
                }
                C0721x1 c0721x1 = new C0721x1(C0479a.this.h, C0479a.this.c);
                if (c0721x1.c()) {
                    C0479a.this.p = new k(c0721x1, C0479a.this.a);
                    C0479a.this.p.a(new C0092a());
                }
                C0479a.this.n.setAdHtmlLoaded(false);
                C0479a.this.n.a(C0479a.this.s);
                if (C0479a.this.s.getSize() == AppLovinAdSize.INTERSTITIAL || C0479a.this.z) {
                    return;
                }
                C0479a.this.s.setHasShown(true);
            }
        }

        public d(C0479a c0479a, C0091a c0091a) {
            this();
        }
    }

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

        public e(C0479a c0479a, C0672k c0672k) {
            if (c0479a == null) {
                throw new IllegalArgumentException("No view specified");
            }
            if (c0672k == null) {
                throw new IllegalArgumentException("No sdk specified");
            }
            this.a = c0479a;
        }

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

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

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

    private void E() {
        if (this.e != null && C0676o.a() && C0676o.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;
        AppLovinBroadcastManager.unregisterReceiver(this);
        this.z = true;
    }

    public void v() {
        AbstractC0662b abstractC0662b = this.s;
        C0616n2 c0616n2 = new C0616n2();
        c0616n2.a().a(abstractC0662b).a(i());
        if (!AbstractC0742z6.a(abstractC0662b.getSize())) {
            c0616n2.a().a("Fullscreen Ad Properties").b(abstractC0662b);
        }
        c0616n2.a(this.c);
        c0616n2.a();
        if (C0676o.a()) {
            this.e.a("AppLovinAdView", c0616n2.toString());
        }
    }

    private void x() {
        if (this.s.b1()) {
            int c2 = this.c.q().c();
            if (C0670i.a(c2)) {
                this.n.a("javascript:al_muteSwitchOn();");
            } else if (c2 == 2) {
                this.n.a("javascript:al_muteSwitchOff();");
            }
        }
    }

    private void y() {
        if (AbstractC0742z6.a(this.i)) {
            if (((Boolean) this.c.a(C0577l4.C1)).booleanValue()) {
                AppLovinBroadcastManager.registerReceiver(this, new IntentFilter(SessionTracker.ACTION_APPLICATION_PAUSED));
                AppLovinBroadcastManager.registerReceiver(this, new IntentFilter(SessionTracker.ACTION_APPLICATION_RESUMED));
            }
            if (((Boolean) this.c.a(C0577l4.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"));
            }
            if (((Boolean) this.c.a(C0577l4.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.c.a(C0577l4.F1)).booleanValue()) {
                AppLovinBroadcastManager.registerReceiver(this, new IntentFilter("com.applovin.preload_success"));
                AppLovinBroadcastManager.registerReceiver(this, new IntentFilter("com.applovin.preload_failure"));
            }
        }
    }

    public void A() {
        if (C0676o.a()) {
            this.e.a("AppLovinAdView", "AdView fully watched...");
        }
        b bVar = this.g;
        if (bVar != null) {
            bVar.a(this);
        }
    }

    public void B() {
        y();
        if (this.s != null && this.s.C0()) {
            AbstractC0532g.a(this.n, this.c);
        }
        b("javascript:al_onAttachedToWindow();");
    }

    public void C() {
        if (this.y) {
            if (this.s == null || !this.s.i1()) {
                AbstractC0575l2.b(this.B, this.s);
            }
            if (this.s != null && this.s.isOpenMeasurementEnabled() && AbstractC0742z6.a(this.s.getSize())) {
                this.s.getAdEventTracker().f();
            }
            if (this.n != null && this.u != null) {
                if (C0676o.a()) {
                    this.e.a("AppLovinAdView", "onDetachedFromWindowCalled with expanded ad present");
                }
                c();
            } else if (C0676o.a()) {
                this.e.a("AppLovinAdView", "onDetachedFromWindowCalled without an expanded ad present");
            }
            b("javascript:al_onDetachedFromWindow();");
        }
    }

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

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

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

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

    @Override
    public void onReceive(Intent intent, Map map) {
        String action = intent.getAction();
        if (action == null) {
            return;
        }
        switch (action) {
            case "com.applovin.external_redirect_success":
            case "com.applovin.external_redirect_failure":
                b(action, map);
                break;
            case "com.applovin.custom_tabs_failure":
            case "com.applovin.custom_tabs_hidden":
            case "com.applovin.custom_tabs_shown":
                a(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":
                c(action, map);
                break;
        }
    }

    public void w() {
        if ((this.a instanceof InterfaceC0550i1) && this.s != null && this.s.U() == AbstractC0662b.EnumC0104b.DISMISS) {
            ((InterfaceC0550i1) this.a).dismiss("postitial_click");
        }
    }

    public void z() {
        if (this.u != null || this.v != null) {
            a();
            return;
        }
        if (C0676o.a()) {
            this.e.a("AppLovinAdView", "Ad: " + this.s + " closed.");
        }
        a(this.r);
        AbstractC0575l2.b(this.B, this.s);
        this.s = null;
    }

    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() {
                C0479a.this.r();
            }
        });
    }

    private void m() {
        if (C0676o.a()) {
            this.e.a("AppLovinAdView", "handleApplicationPaused()");
        }
        b("javascript:al_onAppPaused();");
    }

    private void n() {
        if (C0676o.a()) {
            this.e.a("AppLovinAdView", "handleApplicationResumed()");
        }
        b("javascript:al_onAppResumed();");
    }

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

    public void p() {
        C0480b c0480b;
        d();
        if (this.b == null || (c0480b = this.n) == null || c0480b.getParent() != null) {
            return;
        }
        this.b.addView(this.n);
        b(this.n, this.s.getSize(), this.s.D0());
        if (this.s.isOpenMeasurementEnabled()) {
            this.s.getAdEventTracker().a((View) this.n);
        }
    }

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

    public void r() {
        if (this.u != null) {
            if (C0676o.a()) {
                this.e.a("AppLovinAdView", "Detaching expanded ad: " + this.u.b());
            }
            this.v = this.u;
            this.u = null;
            a(this.i);
        }
    }

    public void s() {
        C0661a b2;
        DialogC0484f dialogC0484f = this.v;
        if (dialogC0484f == null && this.u == null) {
            return;
        }
        if (dialogC0484f != null) {
            b2 = dialogC0484f.b();
            this.v.dismiss();
            this.v = null;
        } else {
            b2 = this.u.b();
            this.u.dismiss();
            this.u = null;
        }
        AbstractC0575l2.a(this.C, b2, (AppLovinAdView) this.b);
    }

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

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

    public C0480b f() {
        return this.n;
    }

    public AbstractC0662b g() {
        return this.s;
    }

    public E.m h() {
        return this.k;
    }

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

    public C0672k j() {
        return this.c;
    }

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

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

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

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

    public void c(int i) {
        String a = q7.a(i);
        if (C0676o.a()) {
            this.e.a("AppLovinAdView", "onWindowVisibilityChanged( " + a + " )");
        }
        b(android.support.v4.media.f.a("javascript:al_onWindowVisibilityChanged( ", a, " );"));
    }

    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, C0672k c0672k, AppLovinAdSize appLovinAdSize, String str, Context context) {
        if (appLovinAdView == null) {
            throw new IllegalArgumentException("No parent view specified");
        }
        if (c0672k == null) {
            throw new IllegalArgumentException("No sdk specified");
        }
        if (appLovinAdSize != null) {
            this.c = c0672k;
            this.d = c0672k.k();
            this.e = c0672k.O();
            this.f = AppLovinCommunicator.getInstance(context);
            this.i = appLovinAdSize;
            this.j = str;
            if (!(context instanceof AppLovinFullscreenActivity)) {
                context = context.getApplicationContext();
            }
            this.a = context;
            this.b = appLovinAdView;
            this.l = new C0481c(this, c0672k);
            C0091a c0091a = null;
            this.r = new c(this, c0091a);
            this.q = new d(this, c0091a);
            this.m = new e(this, c0672k);
            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(a8.c(str, map));
    }

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

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

    public void a(AppLovinAdSize appLovinAdSize) {
        try {
            C0480b c0480b = new C0480b(this.l, this.c, this.a);
            this.n = c0480b;
            c0480b.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() {
                    C0479a.this.o();
                }
            });
            this.y = true;
        } catch (Throwable th) {
            C0676o.c("AppLovinAdView", "Failed to initialize AdWebView", th);
            this.c.E().a("AppLovinAdView", "initAdWebView", th);
            this.x.set(true);
        }
    }

    public void b(MotionEvent motionEvent) {
        C0479a c0479a;
        if (this.u == null && (this.s instanceof C0661a) && this.n != null) {
            C0661a c0661a = (C0661a) 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);
                }
                DialogC0484f dialogC0484f = new DialogC0484f(c0661a, this.n, b2, this.c);
                this.u = dialogC0484f;
                dialogC0484f.setOnDismissListener(new DialogInterface.OnDismissListener() {
                    @Override
                    public final void onDismiss(DialogInterface dialogInterface) {
                        C0479a.this.a(dialogInterface);
                    }
                });
                this.u.show();
                AbstractC0575l2.c(this.C, this.s, (AppLovinAdView) this.b);
                if (this.s.isOpenMeasurementEnabled()) {
                    this.s.getAdEventTracker().a((View) this.u.c());
                    return;
                }
                return;
            }
            C0676o.h("AppLovinAdView", "Unable to expand ad. No Activity found.");
            Uri m = c0661a.m();
            if (m != null) {
                c0479a = this;
                this.d.trackAndLaunchClick(c0661a, i(), c0479a, m, motionEvent, null);
            } else {
                c0479a = this;
            }
            c0479a.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) {
            C0676o.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(final AppLovinAd appLovinAd) {
        if (appLovinAd != null) {
            if (!this.z) {
                c(appLovinAd);
            } else {
                this.w.set(appLovinAd);
                if (C0676o.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() {
                    C0479a.this.a(appLovinAd);
                }
            });
            return;
        }
        if (C0676o.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(boolean z) {
        if (C0676o.a()) {
            this.e.a("AppLovinAdView", "onWindowFocusChanged( " + z + " )");
        }
        b("javascript:al_onWindowFocusChanged( " + z + " );");
    }

    public void a(AppLovinAd appLovinAd, String str) {
        if (appLovinAd != null) {
            AbstractC0742z6.b(appLovinAd, this.c);
            if (this.y) {
                if (appLovinAd.getSize() != AppLovinAdSize.INTERSTITIAL) {
                    Map a = AbstractC0473a2.a((AppLovinAdImpl) appLovinAd);
                    CollectionUtils.putStringIfValid("source", "renderAd", a);
                    this.c.g().d(C0729y1.p, a);
                }
                AbstractC0662b abstractC0662b = (AbstractC0662b) AbstractC0742z6.a(appLovinAd, this.c);
                if (abstractC0662b == null) {
                    C0676o.h("AppLovinAdView", "Unable to retrieve the loaded ad: " + appLovinAd);
                    AbstractC0575l2.a(this.B, "Unable to retrieve the loaded ad");
                    Map a2 = AbstractC0473a2.a((AppLovinAdImpl) appLovinAd);
                    CollectionUtils.putStringIfValid("source", "noAdToRender", a2);
                    CollectionUtils.putStringIfValid(C0752a.Y, "Unable to retrieve the loaded ad", a2);
                    this.c.g().d(C0729y1.s, a2);
                    return;
                }
                if (abstractC0662b == this.s) {
                    C0676o.h("AppLovinAdView", "Attempting to show ad again: " + abstractC0662b);
                    if (((Boolean) this.c.a(C0577l4.G1)).booleanValue()) {
                        if (this.B instanceof InterfaceC0527f2) {
                            AbstractC0575l2.a(this.B, "Attempting to show ad again");
                        } else if (!AbstractC0742z6.c(this.c)) {
                            this.c.g().a(C0729y1.u0, abstractC0662b, CollectionUtils.hashMap("source", "attemptingAdReRender"));
                        } else {
                            throw new IllegalStateException("Attempting to show ad again");
                        }
                    }
                    HashMap<String, String> hashMap = CollectionUtils.hashMap("source", "attemptingAdReRender");
                    CollectionUtils.putStringIfValid(C0752a.Y, "Attempting to show ad again", hashMap);
                    this.c.g().a(C0729y1.s, abstractC0662b, hashMap);
                    return;
                }
                if (C0676o.a()) {
                    this.e.a("AppLovinAdView", "Rendering ad #" + abstractC0662b.getAdIdNumber() + " (" + abstractC0662b.getSize() + ")");
                }
                AbstractC0575l2.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 = abstractC0662b;
                if (this.s.I0()) {
                    this.k = this.c.A().a(this);
                    this.c.A().b(this.s.D(), this.k);
                }
                if (!this.z && AbstractC0742z6.a(this.i)) {
                    this.c.k().trackImpression(abstractC0662b);
                }
                if (this.u != null) {
                    c();
                }
                a(this.q);
                return;
            }
            C0676o.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() {
                C0479a.this.a(i);
            }
        });
    }

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

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

    public void b(Uri uri) {
        if (this.s != null && this.s.K0() && this.o == null) {
            String queryParameter = uri.getQueryParameter("tracking_id");
            if (TextUtils.isEmpty(queryParameter)) {
                this.c.O();
                if (C0676o.a()) {
                    this.c.O().b("AppLovinAdView", "Invalid tracking id. Cannot initialize GA");
                    return;
                }
                return;
            }
            WebView webView = new WebView(this.a);
            this.o = webView;
            webView.setWebViewClient(new C0091a());
            this.o.getSettings().setJavaScriptEnabled(true);
            this.o.loadDataWithBaseURL((String) this.c.a(C0577l4.E6), "<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", "UTF-8", 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(C0577l4.T5)).booleanValue() || (str != null && str.startsWith(this.s.k()))) {
            try {
                if (this.s != this.t) {
                    this.t = this.s;
                    x();
                    this.n.setAdHtmlLoaded(true);
                    if (this.B != null) {
                        this.c.z().d(this.s);
                        if (this.s.E0()) {
                            this.c.g().a(C0729y1.r, this.s, CollectionUtils.hashMap("details", AbstractC0473a2.b(this.s)));
                        } else {
                            this.c.g().a(C0729y1.q, this.s);
                            AbstractC0575l2.a(this.B, this.s);
                        }
                        if (this.s.c1()) {
                            String str2 = (String) this.c.p0().a(C0618n4.N, "");
                            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.E0()) {
                            this.n.a("javascript:al_onAdRestored( '" + this.s.h0() + "' );");
                        }
                    }
                    if ((this.s instanceof C0661a) && this.s.isOpenMeasurementEnabled()) {
                        this.c.q0().a(new C0531f6(this.c, "StartOMSDK", new Runnable() {
                            @Override
                            public final void run() {
                                C0479a.this.b(webView);
                            }
                        }), C0650r5.b.OTHER, 500L);
                    }
                }
            } catch (Throwable th) {
                C0676o.c("AppLovinAdView", "Exception while notifying ad display listener", th);
                C0672k c0672k = this.c;
                if (c0672k != null) {
                    c0672k.E().a("AppLovinAdView", "onAdHtmlLoaded", th);
                }
            }
        }
    }

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

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

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

    public void a(AbstractC0662b abstractC0662b, AppLovinAdView appLovinAdView, Uri uri, MotionEvent motionEvent, Bundle bundle) {
        C0479a c0479a;
        AbstractC0662b abstractC0662b2;
        if (appLovinAdView != null) {
            c0479a = this;
            abstractC0662b2 = abstractC0662b;
            this.d.trackAndLaunchClick(abstractC0662b2, appLovinAdView, c0479a, uri, motionEvent, bundle);
        } else {
            c0479a = this;
            abstractC0662b2 = abstractC0662b;
            if (C0676o.a()) {
                c0479a.e.b("AppLovinAdView", "Unable to process ad click - AppLovinAdView destroyed prematurely");
            }
        }
        AbstractC0575l2.a(c0479a.D, abstractC0662b2);
    }

    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) {
            C0676o.h("AppLovinAdView", "Exception while running ad load callback: " + th.getMessage());
            C0672k c0672k = this.c;
            if (c0672k != null) {
                c0672k.E().a("AppLovinAdView", "notifyAdLoadedCallback", th);
            }
        }
    }

    public void a(int i) {
        try {
            if (this.A != null) {
                this.A.failedToReceiveAd(i);
            }
        } catch (Throwable th) {
            C0676o.c("AppLovinAdView", "Exception while running app load callback", th);
            C0672k c0672k = this.c;
            if (c0672k != null) {
                c0672k.E().a("AppLovinAdView", "notifyAdLoadFailedCallback", th);
            }
        }
    }

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

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

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

    private void a(String str) {
        if (this.s == null || this.n == null || !AbstractC0742z6.a(this.s.getSize()) || !StringUtils.isValidString(str)) {
            return;
        }
        this.n.a(str);
    }

    public void a(Uri uri) {
        if (this.s == null || !this.s.K0()) {
            return;
        }
        if (this.o == null) {
            this.c.O();
            if (C0676o.a()) {
                this.c.O().a("AppLovinAdView", "GA is not initialized. Cannot fire GA event");
                return;
            }
            return;
        }
        final String queryParameter = uri.getQueryParameter(C0755d.e);
        final String queryParameter2 = uri.getQueryParameter("event_params_json");
        if (TextUtils.isEmpty(queryParameter)) {
            this.c.O();
            if (C0676o.a()) {
                this.c.O().a("AppLovinAdView", "Invalid GA event name. Cannot fire GA event");
                return;
            }
            return;
        }
        a(new Runnable() {
            @Override
            public final void run() {
                C0479a.this.a(queryParameter2, queryParameter);
            }
        });
    }

    public void a(String str, String str2) {
        String a;
        if (StringUtils.isValidString(str)) {
            a = b0.s.a("gtag('event', '", str2, "', ", str, ");");
        } else {
            a = android.support.v4.media.f.a("gtag('event', '", str2, "')");
        }
        a8.a(this.o, a);
    }
}