APK反编译源代码展示 - 南明离火平台提供

应用版本信息
应用名称:Նվագարկիչ
版本号:9.9.9
包名称:com.iptv.player

MD5 校验值:d7f913ab91d7343430e85d5ce2e5aff0

反编译源代码说明

v0.java 文件包含反编译后的源代码,请注意,该内容仅供学习和参考使用,不得用于非法用途。


package com.adcolony.sdk;

import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Rect;
import android.graphics.drawable.GradientDrawable;
import android.net.Uri;
import android.os.Build;
import android.view.MotionEvent;
import android.webkit.ConsoleMessage;
import android.webkit.JavascriptInterface;
import android.webkit.JsResult;
import android.webkit.RenderProcessGoneDetail;
import android.webkit.WebChromeClient;
import android.webkit.WebMessage;
import android.webkit.WebMessagePort;
import android.webkit.WebResourceResponse;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.AbsoluteLayout;
import android.widget.FrameLayout;
import android.widget.ImageView;
import com.adcolony.sdk.e;
import com.ottplay.ottplay.epg.EpgSource;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Objects;
import java.util.regex.Matcher;
import k4.k2;
import k4.m2;
import org.json.JSONException;

@SuppressLint({"SetJavaScriptEnabled"})
public class v0 extends WebView implements k4.p0 {

    public static boolean f14661m0;
    public boolean A;
    public boolean B;
    public boolean C;
    public boolean W;

    public String f14662a;

    public boolean f14663a0;

    public String f14664b;

    public boolean f14665b0;

    public String f14666c;

    public boolean f14667c0;

    public String f14668d;

    public boolean f14669d0;

    public String f14670e;

    public f.s f14671e0;

    public String f14672f;

    public m2 f14673f0;

    public String f14674g;

    public m2 f14675g0;

    public String f14676h;

    public com.adcolony.sdk.i f14677h0;

    public String f14678i;

    public o f14679i0;

    public String f14680j;

    public ImageView f14681j0;

    public String f14682k;

    public k f14683k0;

    public int f14684l;

    public final Object f14685l0;

    public int f14686m;

    public int f14687n;

    public int f14688o;

    public int f14689p;

    public int f14690q;

    public int f14691r;

    public int f14692s;

    public int f14693t;

    public int f14694u;

    public int f14695v;

    public int f14696w;

    public int f14697x;

    public boolean f14698y;

    public boolean f14699z;

    public class a implements Runnable {

        public final String f14700a;

        public a(String str) {
            this.f14700a = str;
        }

        @Override
        public void run() {
            v0 v0Var = v0.this;
            if (v0Var.f14698y) {
                StringBuilder a10 = android.support.v4.media.b.a("NativeLayer.dispatch_messages(ADC3_update(");
                a10.append(this.f14700a);
                a10.append("), '");
                a10.append(v0.this.f14682k);
                a10.append("');");
                v0Var.p(a10.toString());
            }
        }
    }

    public class b implements k4.o0 {

        public class a implements Runnable {

            public final o f14703a;

            public a(o oVar) {
                this.f14703a = oVar;
            }

            @Override
            public void run() {
                v0 v0Var = v0.this;
                o oVar = this.f14703a;
                Objects.requireNonNull(v0Var);
                if (y0.m(oVar.f14508b, "visible")) {
                    v0Var.setVisibility(0);
                } else {
                    v0Var.setVisibility(4);
                }
                if (v0Var.f14699z) {
                    m2 m2Var = new m2();
                    y0.o(m2Var, "success", true);
                    y0.n(m2Var, "id", v0Var.f14694u);
                    oVar.a(m2Var).b();
                }
            }
        }

        public b() {
        }

        @Override
        public void a(o oVar) {
            if (v0.this.r(oVar)) {
                p0.s(new a(oVar));
            }
        }
    }

    public class c implements k4.o0 {

        public class a implements Runnable {

            public final o f14706a;

            public a(o oVar) {
                this.f14706a = oVar;
            }

            @Override
            public void run() {
                v0.this.h(this.f14706a);
            }
        }

        public c() {
        }

        @Override
        public void a(o oVar) {
            if (v0.this.r(oVar)) {
                p0.s(new a(oVar));
            }
        }
    }

    public class d implements k4.o0 {

        public class a implements Runnable {

            public final o f14709a;

            public a(o oVar) {
                this.f14709a = oVar;
            }

            @Override
            public void run() {
                v0.this.p(this.f14709a.f14508b.p("custom_js"));
            }
        }

        public d() {
        }

        @Override
        public void a(o oVar) {
            if (v0.this.r(oVar)) {
                p0.s(new a(oVar));
            }
        }
    }

    public class e implements k4.o0 {

        public class a implements Runnable {

            public final o f14712a;

            public a(o oVar) {
                this.f14712a = oVar;
            }

            @Override
            public void run() {
                v0 v0Var = v0.this;
                boolean m10 = y0.m(this.f14712a.f14508b, "transparent");
                boolean z10 = v0.f14661m0;
                v0Var.setBackgroundColor(m10 ? 0 : -1);
            }
        }

        public e() {
        }

        @Override
        public void a(o oVar) {
            if (v0.this.r(oVar)) {
                p0.s(new a(oVar));
            }
        }
    }

    public class f implements Runnable {
        public f() {
        }

        @Override
        public void run() {
            v0.this.clearCache(true);
            v0 v0Var = v0.this;
            v0Var.C = true;
            v0Var.destroy();
        }
    }

    public class g {
        public g(w0 w0Var) {
        }

        @JavascriptInterface
        public void dispatch_messages(String str, String str2) {
            if (str2.equals(v0.this.f14682k)) {
                v0.o(v0.this, str);
            }
        }

        @JavascriptInterface
        public void enable_reverse_messaging(String str) {
            if (str.equals(v0.this.f14682k)) {
                v0.this.W = true;
            }
        }

        @JavascriptInterface
        public String pull_messages(String str) {
            String str2;
            if (!str.equals(v0.this.f14682k)) {
                return "[]";
            }
            str2 = "[]";
            synchronized (v0.this.f14685l0) {
                if (v0.this.f14671e0.O() > 0) {
                    v0 v0Var = v0.this;
                    str2 = v0Var.f14698y ? v0Var.f14671e0.toString() : "[]";
                    v0.this.f14671e0 = y0.c();
                }
            }
            return str2;
        }

        @JavascriptInterface
        public void push_messages(String str, String str2) {
            if (str2.equals(v0.this.f14682k)) {
                v0.o(v0.this, str);
            }
        }
    }

    public class h extends g {
        public h(w0 w0Var) {
            super(null);
        }

        @JavascriptInterface
        public void enable_event_messaging(String str) {
            if (str.equals(v0.this.f14682k)) {
                v0.this.f14663a0 = true;
            }
        }
    }

    public class i extends WebChromeClient {
        public i(w0 w0Var) {
        }

        @Override
        public boolean onConsoleMessage(ConsoleMessage consoleMessage) {
            ConsoleMessage.MessageLevel messageLevel = consoleMessage.messageLevel();
            String message = consoleMessage.message();
            boolean z10 = message.contains("Viewport target-densitydpi is not supported.") || message.contains("Viewport argument key \"shrink-to-fit\" not recognized and ignored");
            boolean z11 = messageLevel == ConsoleMessage.MessageLevel.ERROR;
            boolean z12 = messageLevel == ConsoleMessage.MessageLevel.WARNING;
            if (message.contains("ADC3_update is not defined") || message.contains("NativeLayer.dispatch_messages is not a function")) {
                v0 v0Var = v0.this;
                v0.k(v0Var, v0Var.f14679i0.f14508b, "Unable to communicate with AdColony. Please ensure that you have added an exception for our Javascript interface in your ProGuard configuration and that you do not have a faulty proxy enabled on your device.");
            }
            if (!z10 && (z12 || z11)) {
                StringBuilder sb2 = new StringBuilder();
                StringBuilder a10 = androidx.activity.result.c.a("onConsoleMessage: ", message, " with ad id: ");
                a10.append(v0.this.u());
                sb2.append(a10.toString());
                com.adcolony.sdk.h hVar = z11 ? com.adcolony.sdk.h.f14390f : com.adcolony.sdk.h.f14388d;
                com.adcolony.sdk.g.d().p().e(0, hVar.f14391a, sb2.toString(), hVar.f14392b);
            }
            return true;
        }

        @Override
        public boolean onJsAlert(WebView webView, String str, String str2, JsResult jsResult) {
            jsResult.confirm();
            return true;
        }
    }

    public class j extends WebViewClient {
        public j(w0 w0Var) {
        }

        @Override
        public void onPageFinished(WebView webView, String str) {
            m2 m2Var = new m2();
            y0.n(m2Var, "id", v0.this.f14684l);
            y0.i(m2Var, EpgSource.EPG_URL, str);
            v0 v0Var = v0.this;
            if (v0Var.f14677h0 == null) {
                new o("WebView.on_load", v0Var.f14694u, m2Var).b();
            } else {
                y0.i(m2Var, "ad_session_id", v0Var.f14670e);
                y0.n(m2Var, "container_id", v0.this.f14677h0.f14404j);
                new o("WebView.on_load", v0.this.f14677h0.f14405k, m2Var).b();
            }
            v0 v0Var2 = v0.this;
            if ((v0Var2.f14698y || v0Var2.f14699z) && !v0Var2.B) {
                int i10 = v0Var2.f14695v;
                int i11 = i10 > 0 ? i10 : v0Var2.f14694u;
                if (i10 > 0) {
                    float a10 = k4.g.a();
                    y0.n(v0.this.f14673f0, "app_orientation", p0.x(p0.C()));
                    v0 v0Var3 = v0.this;
                    y0.n(v0Var3.f14673f0, "x", p0.b(v0Var3));
                    v0 v0Var4 = v0.this;
                    y0.n(v0Var4.f14673f0, "y", p0.n(v0Var4));
                    y0.n(v0.this.f14673f0, "width", (int) (r2.f14690q / a10));
                    y0.n(v0.this.f14673f0, "height", (int) (r2.f14692s / a10));
                    v0 v0Var5 = v0.this;
                    y0.i(v0Var5.f14673f0, "ad_session_id", v0Var5.f14670e);
                }
                if (v0.this.f14694u == 1) {
                    com.adcolony.sdk.j l10 = com.adcolony.sdk.g.d().l();
                    f.s sVar = new f.s(7);
                    Objects.requireNonNull(l10);
                    ArrayList arrayList = new ArrayList();
                    for (com.adcolony.sdk.e eVar : l10.f14424c.values()) {
                        e.c cVar = eVar.f14327l;
                        if (!(cVar == e.c.EXPIRED || cVar == e.c.SHOWN || cVar == e.c.CLOSED)) {
                            arrayList.add(eVar);
                        }
                    }
                    Iterator it = arrayList.iterator();
                    while (it.hasNext()) {
                        com.adcolony.sdk.e eVar2 = (com.adcolony.sdk.e) it.next();
                        m2 m2Var2 = new m2();
                        y0.i(m2Var2, "ad_session_id", eVar2.f14322g);
                        String str2 = eVar2.f14323h;
                        if (str2 == null) {
                            str2 = "";
                        }
                        y0.i(m2Var2, "ad_id", str2);
                        y0.i(m2Var2, "zone_id", eVar2.f14324i);
                        y0.i(m2Var2, "ad_request_id", eVar2.f14326k);
                        sVar.L(m2Var2);
                    }
                    y0.h(v0.this.f14673f0, "ads_to_restore", sVar);
                }
                v0.this.f14682k = p0.d();
                m2 f10 = y0.f(new m2(), v0.this.f14673f0);
                y0.i(f10, "message_key", v0.this.f14682k);
                v0 v0Var6 = v0.this;
                StringBuilder a11 = androidx.appcompat.widget.w0.a("ADC3_init(", i11, ",");
                a11.append(f10.toString());
                a11.append(");");
                v0Var6.p(a11.toString());
                v0.this.B = true;
            }
            v0 v0Var7 = v0.this;
            if (v0Var7.f14699z) {
                if (v0Var7.f14694u != 1 || v0Var7.f14695v > 0) {
                    m2 m2Var3 = new m2();
                    y0.o(m2Var3, "success", true);
                    y0.n(m2Var3, "id", v0.this.f14694u);
                    v0.this.f14679i0.a(m2Var3).b();
                }
            }
        }

        @Override
        public void onPageStarted(WebView webView, String str, Bitmap bitmap) {
            v0.this.B = false;
        }

        @Override
        public void onReceivedError(WebView webView, int i10, String str, String str2) {
            if (Build.VERSION.SDK_INT >= 23) {
                return;
            }
            v0.j(v0.this, i10, str, str2);
        }

        @Override
        public boolean onRenderProcessGone(WebView webView, RenderProcessGoneDetail renderProcessGoneDetail) {
            if (Build.VERSION.SDK_INT < 26) {
                return super.onRenderProcessGone(webView, renderProcessGoneDetail);
            }
            if (!renderProcessGoneDetail.didCrash()) {
                return true;
            }
            v0.k(v0.this, new m2(), "An error occurred while rendering the ad. Ad closing.");
            return true;
        }

        @Override
        @TargetApi(11)
        public WebResourceResponse shouldInterceptRequest(WebView webView, String str) {
            return null;
        }

        @Override
        public boolean shouldOverrideUrlLoading(WebView webView, String str) {
            v0 v0Var = v0.this;
            if (!v0Var.B) {
                return false;
            }
            String w10 = v0Var.w();
            if (w10 != null) {
                str = w10;
            }
            if (str != null) {
                p0.g(new Intent("android.intent.action.VIEW", Uri.parse(str)));
                n0 c10 = com.adcolony.sdk.g.d().c();
                c10.b(v0.this.f14670e);
                c10.d(v0.this.f14670e);
                m2 m2Var = new m2();
                y0.i(m2Var, EpgSource.EPG_URL, str);
                y0.i(m2Var, "ad_session_id", v0.this.f14670e);
                new o("WebView.redirect_detected", v0.this.f14677h0.f14405k, m2Var).b();
            } else {
                StringBuilder sb2 = new StringBuilder();
                StringBuilder a10 = android.support.v4.media.b.a("shouldOverrideUrlLoading called with null url, with ad id: ");
                a10.append(v0.this.u());
                sb2.append(a10.toString());
                k4.c.a(0, 0, sb2.toString(), true);
            }
            return true;
        }
    }

    public static class k {

        public Object[] f14719a;

        public k(WebMessagePort[] webMessagePortArr) {
            this.f14719a = webMessagePortArr;
        }
    }

    public v0(Context context, int i10, boolean z10) {
        super(context);
        this.f14666c = "";
        this.f14668d = "";
        this.f14672f = "";
        this.f14674g = "";
        this.f14676h = "";
        this.f14678i = "";
        this.f14680j = "";
        this.f14682k = "";
        this.f14671e0 = y0.c();
        this.f14673f0 = new m2();
        this.f14675g0 = new m2();
        this.f14685l0 = new Object();
        this.f14694u = i10;
        this.A = z10;
    }

    public v0(Context context, o oVar, int i10, int i11, com.adcolony.sdk.i iVar) {
        super(context);
        this.f14666c = "";
        this.f14668d = "";
        this.f14672f = "";
        this.f14674g = "";
        this.f14676h = "";
        this.f14678i = "";
        this.f14680j = "";
        this.f14682k = "";
        this.f14671e0 = y0.c();
        this.f14673f0 = new m2();
        this.f14675g0 = new m2();
        this.f14685l0 = new Object();
        this.f14679i0 = oVar;
        i(oVar, i10, i11, iVar);
        l(false, null);
    }

    public static void j(v0 v0Var, int i10, String str, String str2) {
        if (v0Var.f14677h0 != null) {
            m2 m2Var = new m2();
            y0.n(m2Var, "id", v0Var.f14684l);
            y0.i(m2Var, "ad_session_id", v0Var.f14670e);
            y0.n(m2Var, "container_id", v0Var.f14677h0.f14404j);
            y0.n(m2Var, "code", i10);
            y0.i(m2Var, "error", str);
            y0.i(m2Var, EpgSource.EPG_URL, str2);
            new o("WebView.on_error", v0Var.f14677h0.f14405k, m2Var).b();
        }
        k4.c.a(0, 0, i.c.a("onReceivedError: ", str), true);
    }

    public static void k(v0 v0Var, m2 m2Var, String str) {
        Objects.requireNonNull(v0Var);
        Context context = com.adcolony.sdk.g.f14378a;
        if (context != null && (context instanceof k4.u)) {
            com.adcolony.sdk.g.d().l().a(context, m2Var, str);
            return;
        }
        if (v0Var.f14694u == 1) {
            com.adcolony.sdk.g.d().p().e(0, 0, "Unable to communicate with controller, disabling AdColony.", false);
            com.adcolony.sdk.a.i();
        } else if (v0Var.f14695v > 0) {
            v0Var.f14698y = false;
        }
    }

    public static void o(v0 v0Var, String str) {
        f.s sVar;
        Objects.requireNonNull(v0Var);
        try {
            sVar = new f.s(str);
        } catch (JSONException e10) {
            com.adcolony.sdk.g.d().p().e(0, 0, e10.toString(), true);
            sVar = new f.s(7);
        }
        for (int i10 = 0; i10 < sVar.O(); i10++) {
            com.adcolony.sdk.g.d().q().f(sVar.Q(i10));
        }
    }

    @Override
    public void a(m2 m2Var) {
        synchronized (this.f14685l0) {
            if (this.f14663a0) {
                q(m2Var);
            } else {
                this.f14671e0.L(m2Var);
            }
        }
    }

    @Override
    public boolean a() {
        return (this.W || this.f14663a0) ? false : true;
    }

    @Override
    public void b() {
        if (!com.adcolony.sdk.g.e() || !this.B || this.W || this.f14663a0) {
            return;
        }
        f();
    }

    @Override
    public void c() {
        if (this.A) {
            return;
        }
        p0.s(new f());
    }

    @Override
    public int d() {
        return this.f14694u;
    }

    public void e() {
        if (this.f14681j0 != null) {
            Rect g10 = com.adcolony.sdk.g.d().m().g();
            int width = this.f14669d0 ? this.f14686m + this.f14690q : g10.width();
            int height = this.f14669d0 ? this.f14688o + this.f14692s : g10.height();
            float a10 = k4.g.a();
            int i10 = (int) (this.f14696w * a10);
            int i11 = (int) (this.f14697x * a10);
            this.f14681j0.setLayoutParams(new AbsoluteLayout.LayoutParams(i10, i11, width - i10, height - i11));
        }
    }

    public void f() {
        String str;
        str = "";
        synchronized (this.f14685l0) {
            if (this.f14671e0.O() > 0) {
                str = this.f14698y ? this.f14671e0.toString() : "";
                this.f14671e0 = y0.c();
            }
        }
        p0.s(new a(str));
    }

    public final String g(String str, String str2) {
        com.adcolony.sdk.j l10 = com.adcolony.sdk.g.d().l();
        com.adcolony.sdk.e x10 = x();
        k4.k kVar = l10.f14425d.get(this.f14670e);
        if (x10 != null && this.f14675g0.f() > 0 && !this.f14675g0.p("ad_type").equals("video")) {
            m2 m2Var = this.f14675g0;
            if (m2Var.f() > 0) {
                x10.f14320e = new z(m2Var, x10.f14322g);
            }
        } else if (kVar != null && this.f14675g0.f() > 0) {
            kVar.f33903c = new z(this.f14675g0, this.f14670e);
        }
        z zVar = x10 == null ? null : x10.f14320e;
        if (zVar == null && kVar != null) {
            zVar = kVar.f33903c;
        }
        if (zVar != null && zVar.f14757e == 2) {
            this.f14665b0 = true;
            if (!str2.equals("")) {
                try {
                    return androidx.lifecycle.e.l(com.adcolony.sdk.g.d().o().a(str2, false).toString(), str);
                } catch (IOException e10) {
                    m(e10);
                }
            }
        }
        return str;
    }

    public void h(o oVar) {
        m2 m2Var = oVar.f14508b;
        this.f14686m = y0.s(m2Var, "x");
        this.f14688o = y0.s(m2Var, "y");
        this.f14690q = y0.s(m2Var, "width");
        this.f14692s = y0.s(m2Var, "height");
        FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) getLayoutParams();
        layoutParams.setMargins(this.f14686m, this.f14688o, 0, 0);
        layoutParams.width = this.f14690q;
        layoutParams.height = this.f14692s;
        setLayoutParams(layoutParams);
        if (this.f14699z) {
            m2 m2Var2 = new m2();
            y0.o(m2Var2, "success", true);
            y0.n(m2Var2, "id", this.f14694u);
            oVar.a(m2Var2).b();
        }
        e();
    }

    public void i(o oVar, int i10, int i11, com.adcolony.sdk.i iVar) {
        m2 m2Var = oVar.f14508b;
        String p10 = m2Var.p(EpgSource.EPG_URL);
        this.f14662a = p10;
        if (p10.equals("")) {
            this.f14662a = m2Var.p("data");
        }
        this.f14668d = m2Var.p("base_url");
        this.f14666c = m2Var.p("custom_js");
        this.f14670e = m2Var.p("ad_session_id");
        this.f14673f0 = m2Var.m("info");
        this.f14674g = m2Var.p("mraid_filepath");
        this.f14695v = y0.m(m2Var, "use_mraid_module") ? com.adcolony.sdk.g.d().q().g() : this.f14695v;
        this.f14676h = m2Var.p("ad_choices_filepath");
        this.f14678i = m2Var.p("ad_choices_url");
        this.f14667c0 = y0.m(m2Var, "disable_ad_choices");
        this.f14669d0 = y0.m(m2Var, "ad_choices_snap_to_webview");
        this.f14696w = y0.s(m2Var, "ad_choices_width");
        this.f14697x = y0.s(m2Var, "ad_choices_height");
        if (this.f14675g0.f() == 0) {
            this.f14675g0 = m2Var.m("iab");
        }
        if (!this.A && !this.f14674g.equals("")) {
            if (this.f14695v > 0) {
                this.f14662a = g(this.f14662a.replaceFirst("script\\s*src\\s*=\\s*\"mraid.js\"", w.a.a(android.support.v4.media.b.a("script src=\"file://"), this.f14674g, "\"")), this.f14673f0.m("device_info").p("iab_filepath"));
            } else {
                try {
                    this.f14672f = com.adcolony.sdk.g.d().o().a(this.f14674g, false).toString();
                    this.f14672f = this.f14672f.replaceFirst("bridge.os_name\\s*=\\s*\"\"\\s*;", "bridge.os_name = \"\";\nvar ADC_DEVICE_INFO = " + this.f14673f0.toString() + ";\n");
                } catch (IOException e10) {
                    n(e10);
                } catch (IllegalArgumentException e11) {
                    n(e11);
                } catch (IndexOutOfBoundsException e12) {
                    n(e12);
                }
            }
        }
        this.f14684l = i10;
        this.f14677h0 = iVar;
        if (i11 >= 0) {
            this.f14694u = i11;
        } else {
            s();
        }
        this.f14690q = y0.s(m2Var, "width");
        this.f14692s = y0.s(m2Var, "height");
        this.f14686m = y0.s(m2Var, "x");
        int s4 = y0.s(m2Var, "y");
        this.f14688o = s4;
        this.f14691r = this.f14690q;
        this.f14693t = this.f14692s;
        this.f14689p = s4;
        this.f14687n = this.f14686m;
        this.f14698y = y0.m(m2Var, "enable_messages") || this.f14699z;
        t();
    }

    @SuppressLint({"AddJavascriptInterface"})
    public void l(boolean z10, o oVar) {
        String replaceFirst;
        String str;
        this.f14699z = z10;
        o oVar2 = this.f14679i0;
        if (oVar2 != null) {
            oVar = oVar2;
        }
        this.f14679i0 = oVar;
        m2 m2Var = oVar.f14508b;
        this.A = y0.m(m2Var, "is_display_module");
        setFocusable(true);
        setHorizontalScrollBarEnabled(false);
        setVerticalScrollBarEnabled(false);
        int i10 = Build.VERSION.SDK_INT;
        WebView.setWebContentsDebuggingEnabled(false);
        if (z10) {
            this.f14698y = true;
            String p10 = m2Var.p("filepath");
            this.f14680j = m2Var.p("interstitial_html");
            this.f14674g = m2Var.p("mraid_filepath");
            this.f14668d = m2Var.p("base_url");
            this.f14675g0 = m2Var.m("iab");
            this.f14673f0 = m2Var.m("info");
            this.f14670e = m2Var.p("ad_session_id");
            this.f14664b = p10;
            if (f14661m0 && this.f14694u == 1) {
                this.f14664b = "android_asset/ADCController.js";
            }
            if (this.f14680j.equals("")) {
                StringBuilder a10 = android.support.v4.media.b.a("file:///");
                a10.append(this.f14664b);
                str = a10.toString();
            } else {
                str = "";
            }
            this.f14662a = str;
        }
        setWebChromeClient(new i(null));
        WebSettings settings = getSettings();
        settings.setJavaScriptEnabled(true);
        settings.setBuiltInZoomControls(true);
        settings.setDisplayZoomControls(false);
        settings.setGeolocationEnabled(true);
        settings.setUseWideViewPort(true);
        settings.setMediaPlaybackRequiresUserGesture(false);
        settings.setAllowFileAccessFromFileURLs(true);
        settings.setAllowUniversalAccessFromFileURLs(true);
        settings.setAllowFileAccess(true);
        if (i10 >= 23) {
            addJavascriptInterface(new h(null), "NativeLayer");
        } else {
            addJavascriptInterface(new g(null), "NativeLayer");
        }
        setWebViewClient(i10 >= 23 ? new w0(this) : new x0(this));
        if (this.A) {
            try {
                if (this.f14680j.equals("")) {
                    FileInputStream fileInputStream = new FileInputStream(this.f14664b);
                    try {
                        StringBuilder sb2 = new StringBuilder(fileInputStream.available());
                        byte[] bArr = new byte[1024];
                        while (true) {
                            int read = fileInputStream.read(bArr, 0, 1024);
                            if (read < 0) {
                                break;
                            } else {
                                sb2.append(new String(bArr, 0, read));
                            }
                        }
                        if (this.f14664b.contains(".html")) {
                            replaceFirst = sb2.toString();
                        } else {
                            replaceFirst = "<html><script>" + sb2.toString() + "</script></html>";
                        }
                        fileInputStream.close();
                    } catch (Throwable th2) {
                        try {
                            fileInputStream.close();
                        } catch (Throwable th3) {
                            th2.addSuppressed(th3);
                        }
                        throw th2;
                    }
                } else {
                    replaceFirst = this.f14680j.replaceFirst("script\\s*src\\s*=\\s*\"mraid.js\"", "script src=\"file://" + this.f14674g + "\"");
                }
                String p11 = this.f14679i0.f14508b.m("info").p("metadata");
                loadDataWithBaseURL(this.f14662a.equals("") ? this.f14668d : this.f14662a, g(replaceFirst, y0.l(p11).p("iab_filepath")).replaceFirst("var\\s*ADC_DEVICE_INFO\\s*=\\s*null\\s*;", Matcher.quoteReplacement("var ADC_DEVICE_INFO = " + p11 + ";")), "text/html", null, null);
            } catch (IOException e10) {
                m(e10);
            } catch (IllegalArgumentException e11) {
                m(e11);
            } catch (IndexOutOfBoundsException e12) {
                m(e12);
            }
        } else if (!this.f14662a.startsWith("http") && !this.f14662a.startsWith("file")) {
            loadDataWithBaseURL(this.f14668d, this.f14662a, "text/html", null, null);
        } else if (this.f14662a.contains(".html") || !this.f14662a.startsWith("file")) {
            loadUrl(this.f14662a);
        } else {
            loadDataWithBaseURL(this.f14662a, w.a.a(android.support.v4.media.b.a("<html><script src=\""), this.f14662a, "\"></script></html>"), "text/html", null, null);
        }
        if (!z10) {
            s();
            y();
        }
        if (z10 || this.f14698y) {
            p q10 = com.adcolony.sdk.g.d().q();
            synchronized (q10.f14538a) {
                int i11 = this.f14695v;
                if (i11 <= 0) {
                    i11 = this.f14694u;
                }
                q10.f14538a.add(this);
                q10.f14539b.put(Integer.valueOf(i11), this);
                q10.i();
            }
        }
        if (this.f14666c.equals("")) {
            return;
        }
        p(this.f14666c);
    }

    public final boolean m(Exception exc) {
        com.adcolony.sdk.g.d().p().e(0, 0, exc.getClass().toString() + " during metadata injection w/ metadata = " + this.f14673f0.p("metadata"), true);
        com.adcolony.sdk.e remove = com.adcolony.sdk.g.d().l().f14424c.remove(this.f14673f0.p("ad_session_id"));
        if (remove == null) {
            return false;
        }
        return remove.c();
    }

    public final void n(Exception exc) {
        com.adcolony.sdk.g.d().p().e(0, 0, exc.getClass().toString() + " during metadata injection w/ metadata = " + this.f14673f0.p("metadata"), true);
        m2 m2Var = new m2();
        y0.i(m2Var, "id", this.f14670e);
        new o("AdSession.on_error", this.f14677h0.f14405k, m2Var).b();
    }

    @Override
    public boolean onTouchEvent(MotionEvent motionEvent) {
        if (motionEvent.getAction() == 1) {
            com.adcolony.sdk.c v10 = v();
            if (v10 != null && !v10.f14282n) {
                m2 m2Var = new m2();
                y0.i(m2Var, "ad_session_id", this.f14670e);
                new o("WebView.on_first_click", 1, m2Var).b();
                v10.setUserInteraction(true);
            }
            com.adcolony.sdk.e x10 = x();
            if (x10 != null) {
                x10.f14328m = true;
            }
        }
        return super.onTouchEvent(motionEvent);
    }

    public void p(String str) {
        if (this.C) {
            k4.c.a(0, 3, k4.b.a("Ignoring call to execute_js as WebView has been destroyed."), true);
            return;
        }
        try {
            evaluateJavascript(str, null);
        } catch (IllegalStateException unused) {
            com.adcolony.sdk.g.d().p().e(0, 0, i.c.a("Device reporting incorrect OS version, evaluateJavascript ", "is not available. Disabling AdColony."), false);
            com.adcolony.sdk.a.i();
        }
    }

    public final void q(m2 m2Var) {
        if (this.f14698y) {
            if (this.f14683k0 == null) {
                k4.c.a(0, 1, "Sending message before event messaging is initialized", true);
                return;
            }
            f.s c10 = y0.c();
            c10.L(m2Var);
            ((WebMessagePort) this.f14683k0.f14719a[0]).postMessage(new WebMessage(c10.toString()));
        }
    }

    public boolean r(o oVar) {
        m2 m2Var = oVar.f14508b;
        return y0.s(m2Var, "id") == this.f14684l && y0.s(m2Var, "container_id") == this.f14677h0.f14404j && m2Var.p("ad_session_id").equals(this.f14677h0.f14406l);
    }

    public void s() {
        ArrayList<k4.o0> arrayList = this.f14677h0.f14413s;
        b bVar = new b();
        com.adcolony.sdk.g.a("WebView.set_visible", bVar);
        arrayList.add(bVar);
        ArrayList<k4.o0> arrayList2 = this.f14677h0.f14413s;
        c cVar = new c();
        com.adcolony.sdk.g.a("WebView.set_bounds", cVar);
        arrayList2.add(cVar);
        ArrayList<k4.o0> arrayList3 = this.f14677h0.f14413s;
        d dVar = new d();
        com.adcolony.sdk.g.a("WebView.execute_js", dVar);
        arrayList3.add(dVar);
        ArrayList<k4.o0> arrayList4 = this.f14677h0.f14413s;
        e eVar = new e();
        com.adcolony.sdk.g.a("WebView.set_transparent", eVar);
        arrayList4.add(eVar);
        this.f14677h0.f14414t.add("WebView.set_visible");
        this.f14677h0.f14414t.add("WebView.set_bounds");
        this.f14677h0.f14414t.add("WebView.execute_js");
        this.f14677h0.f14414t.add("WebView.set_transparent");
    }

    public void t() {
        com.adcolony.sdk.j l10 = com.adcolony.sdk.g.d().l();
        String str = this.f14670e;
        com.adcolony.sdk.i iVar = this.f14677h0;
        Objects.requireNonNull(l10);
        p0.s(new n(l10, str, this, iVar));
    }

    public String u() {
        com.adcolony.sdk.j l10 = com.adcolony.sdk.g.d().l();
        String str = this.f14670e;
        com.adcolony.sdk.e eVar = str == null ? null : l10.f14424c.get(str);
        if (eVar == null) {
            return "unknown";
        }
        StringBuilder sb2 = new StringBuilder();
        String str2 = eVar.f14323h;
        if (str2 == null) {
            str2 = "";
        }
        sb2.append(str2);
        sb2.append(" : ");
        sb2.append(eVar.f14324i);
        return sb2.toString();
    }

    public final com.adcolony.sdk.c v() {
        if (this.f14670e == null) {
            return null;
        }
        return com.adcolony.sdk.g.d().l().f14427f.get(this.f14670e);
    }

    public String w() {
        String str = (!(x() != null) || x() == null) ? null : x().f14325j;
        if (str == null || str.equals(null)) {
            return (!(v() != null) || v() == null) ? str : v().getClickOverride();
        }
        return str;
    }

    public final com.adcolony.sdk.e x() {
        if (this.f14670e == null) {
            return null;
        }
        return com.adcolony.sdk.g.d().l().f14424c.get(this.f14670e);
    }

    public void y() {
        Context context;
        setVisibility(4);
        FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(this.f14690q, this.f14692s);
        layoutParams.setMargins(this.f14686m, this.f14688o, 0, 0);
        layoutParams.gravity = 0;
        this.f14677h0.addView(this, layoutParams);
        if (this.f14676h.equals("") || this.f14678i.equals("") || (context = com.adcolony.sdk.g.f14378a) == null || this.f14677h0 == null || this.f14667c0) {
            return;
        }
        GradientDrawable gradientDrawable = new GradientDrawable();
        gradientDrawable.setColor(-1);
        gradientDrawable.setShape(1);
        ImageView imageView = new ImageView(context);
        this.f14681j0 = imageView;
        imageView.setImageURI(Uri.fromFile(new File(this.f14676h)));
        this.f14681j0.setBackground(gradientDrawable);
        this.f14681j0.setOnClickListener(new k2(this));
        e();
        addView(this.f14681j0);
    }
}