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

应用版本信息
应用名称:Shopping List
版本号:2.74
包名称:com.icedblueberry.shoppinglisteasy

MD5 校验值:8005b9444b02324a81f85f1ef7e26f28

反编译源代码说明

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


package m5;

import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Canvas;
import android.net.Uri;
import android.os.Build;
import android.util.DisplayMetrics;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewTreeObserver;
import android.view.Window;
import android.view.WindowManager;
import android.webkit.DownloadListener;
import android.webkit.ValueCallback;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import com.adadapted.android.sdk.core.event.AppEventClient;
import com.google.android.gms.ads.internal.overlay.AdOverlayInfoParcel;
import com.yalantis.ucrop.BuildConfig;
import com.yalantis.ucrop.view.CropImageView;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
import org.json.JSONException;
import org.json.JSONObject;

public final class hd0 extends WebView implements DownloadListener, ViewTreeObserver.OnGlobalLayoutListener, uc0 {

    public static final int f12025s0 = 0;
    public ri1 A;
    public ui1 B;
    public boolean C;
    public boolean D;
    public zc0 E;
    public h4.m F;
    public k5.a G;
    public yd0 H;
    public final String I;
    public boolean J;
    public boolean K;
    public boolean L;
    public boolean M;
    public Boolean N;
    public boolean O;
    public final String P;
    public jd0 Q;
    public boolean R;
    public boolean S;
    public ns T;
    public ls U;
    public ul V;
    public int W;

    public int f12026a0;

    public oq f12027b0;

    public final oq f12028c0;

    public oq f12029d0;

    public final pq f12030e0;

    public int f12031f0;

    public int f12032g0;

    public int f12033h0;
    public h4.m i0;

    public boolean f12034j0;

    public final i4.z0 f12035k0;

    public int f12036l0;

    public int f12037m0;

    public int f12038n0;

    public int f12039o0;

    public HashMap f12040p0;

    public final WindowManager f12041q0;

    public final bn f12042r0;

    public final xd0 f12043s;

    public final va f12044t;

    public final zq f12045u;
    public final s80 v;

    public f4.k f12046w;

    public final f4.a f12047x;

    public final DisplayMetrics f12048y;

    public final float f12049z;

    public hd0(xd0 xd0Var, yd0 yd0Var, String str, boolean z10, va vaVar, zq zqVar, s80 s80Var, f4.k kVar, f4.a aVar, bn bnVar, ri1 ri1Var, ui1 ui1Var) {
        super(xd0Var);
        ui1 ui1Var2;
        String str2;
        hq hqVar;
        this.C = false;
        this.D = false;
        this.O = true;
        this.P = BuildConfig.FLAVOR;
        this.f12036l0 = -1;
        this.f12037m0 = -1;
        this.f12038n0 = -1;
        this.f12039o0 = -1;
        this.f12043s = xd0Var;
        this.H = yd0Var;
        this.I = str;
        this.L = z10;
        this.f12044t = vaVar;
        this.f12045u = zqVar;
        this.v = s80Var;
        this.f12046w = kVar;
        this.f12047x = aVar;
        WindowManager windowManager = (WindowManager) getContext().getSystemService("window");
        this.f12041q0 = windowManager;
        i4.j1 j1Var = f4.r.A.f4914c;
        DisplayMetrics D = i4.j1.D(windowManager);
        this.f12048y = D;
        this.f12049z = D.density;
        this.f12042r0 = bnVar;
        this.A = ri1Var;
        this.B = ui1Var;
        this.f12035k0 = new i4.z0(xd0Var.f18011a, this, this);
        setBackgroundColor(0);
        WebSettings settings = getSettings();
        settings.setAllowFileAccess(false);
        try {
            settings.setJavaScriptEnabled(true);
        } catch (NullPointerException unused) {
            o80.g(6);
        }
        settings.setSavePassword(false);
        settings.setSupportMultipleWindows(true);
        settings.setJavaScriptCanOpenWindowsAutomatically(true);
        sp spVar = dq.P8;
        g4.r rVar = g4.r.f5440d;
        if (((Boolean) rVar.f5443c.a(spVar)).booleanValue()) {
            settings.setMixedContentMode(1);
        } else {
            settings.setMixedContentMode(2);
        }
        f4.r rVar2 = f4.r.A;
        settings.setUserAgentString(rVar2.f4914c.t(xd0Var, s80Var.f16238s));
        Context context = getContext();
        i4.r0.a(context, new i4.t0(settings, context));
        settings.setAllowFileAccessFromFileURLs(false);
        settings.setAllowUniversalAccessFromFileURLs(false);
        settings.setMediaPlaybackRequiresUserGesture(false);
        setDownloadListener(this);
        V0();
        addJavascriptInterface(new ld0(this, new gg0(8, this)), "googleAdsJsInterface");
        removeJavascriptInterface("accessibility");
        removeJavascriptInterface("accessibilityTraversal");
        pq pqVar = this.f12030e0;
        if (pqVar != null) {
            rq rqVar = (rq) pqVar.f15338u;
            c80 c80Var = rVar2.f4918g;
            synchronized (c80Var.f9922a) {
                hqVar = c80Var.f9929h;
            }
            if (hqVar != null) {
                hqVar.f12202a.offer(rqVar);
            }
        }
        rq rqVar2 = new rq(this.I);
        pq pqVar2 = new pq(rqVar2);
        this.f12030e0 = pqVar2;
        synchronized (rqVar2.f16084c) {
        }
        if (((Boolean) rVar.f5443c.a(dq.f10761x1)).booleanValue() && (ui1Var2 = this.B) != null && (str2 = ui1Var2.f17044b) != null) {
            rqVar2.b("gqi", str2);
        }
        oq d10 = rq.d();
        this.f12028c0 = d10;
        ((Map) pqVar2.f15337t).put("native:view_create", d10);
        Context context2 = null;
        this.f12029d0 = null;
        this.f12027b0 = null;
        if (i4.u0.f6362b == null) {
            i4.u0.f6362b = new i4.u0();
        }
        i4.u0 u0Var = i4.u0.f6362b;
        u0Var.getClass();
        i4.a1.h("Updating user agent.");
        String defaultUserAgent = WebSettings.getDefaultUserAgent(xd0Var);
        if (!defaultUserAgent.equals(u0Var.f6363a)) {
            AtomicBoolean atomicBoolean = com.google.android.gms.common.a.f3330a;
            try {
                context2 = xd0Var.createPackageContext("com.google.android.gms", 3);
            } catch (PackageManager.NameNotFoundException unused2) {
            }
            if (context2 == null) {
                xd0Var.getSharedPreferences("admob_user_agent", 0).edit().putString("user_agent", WebSettings.getDefaultUserAgent(xd0Var)).apply();
            }
            u0Var.f6363a = defaultUserAgent;
        }
        i4.a1.h("User agent is updated.");
        rVar2.f4918g.j.incrementAndGet();
    }

    @Override
    public final View A() {
        return this;
    }

    @Override
    public final synchronized void A0(boolean z10) {
        String str;
        boolean z11 = this.L;
        this.L = z10;
        V0();
        if (z10 != z11) {
            if (!((Boolean) g4.r.f5440d.f5443c.a(dq.L)).booleanValue() || !this.H.b()) {
                if (true != z10) {
                    str = "default";
                } else {
                    str = "expanded";
                }
                try {
                    d(new JSONObject().put("state", str), "onStateChanged");
                } catch (JSONException unused) {
                    o80.g(6);
                }
            }
        }
    }

    @Override
    public final synchronized String B() {
        ui1 ui1Var = this.B;
        if (ui1Var == null) {
            return null;
        }
        return ui1Var.f17044b;
    }

    @Override
    public final void B0(int i10, boolean z10, boolean z11) {
        boolean z12;
        g4.a aVar;
        vq0 vq0Var;
        zc0 zc0Var = this.E;
        boolean g10 = zc0.g(zc0Var.f18693s.e0(), zc0Var.f18693s);
        if (!g10 && z11) {
            z12 = false;
        } else {
            z12 = true;
        }
        if (g10) {
            aVar = null;
        } else {
            aVar = zc0Var.f18696w;
        }
        h4.o oVar = zc0Var.f18697x;
        h4.x xVar = zc0Var.I;
        uc0 uc0Var = zc0Var.f18693s;
        s80 l10 = uc0Var.l();
        if (z12) {
            vq0Var = null;
        } else {
            vq0Var = zc0Var.C;
        }
        zc0Var.q(new AdOverlayInfoParcel(aVar, oVar, xVar, uc0Var, z10, i10, l10, vq0Var));
    }

    @Override
    public final ri1 C() {
        return this.A;
    }

    @Override
    public final synchronized k5.a C0() {
        return this.G;
    }

    @Override
    public final void D(String str, String str2) {
        T0(str + "(" + str2 + ");");
    }

    @Override
    public final t90 D0() {
        return null;
    }

    @Override
    public final void E(boolean z10) {
        this.E.D = false;
    }

    @Override
    public final void E0(boolean z10, long j) {
        String str;
        HashMap hashMap = new HashMap(2);
        if (true != z10) {
            str = "0";
        } else {
            str = "1";
        }
        hashMap.put("success", str);
        hashMap.put("duration", Long.toString(j));
        p("onCacheAccessComplete", hashMap);
    }

    @Override
    public final Context F() {
        return this.f12043s.f18013c;
    }

    @Override
    public final synchronized boolean F0() {
        return this.K;
    }

    @Override
    public final synchronized void G(int i10) {
        this.f12031f0 = i10;
    }

    @Override
    public final void G0(int i10) {
        if (i10 == 0) {
            jq.h((rq) this.f12030e0.f15338u, this.f12028c0, "aebb2");
        }
        jq.h((rq) this.f12030e0.f15338u, this.f12028c0, "aeh2");
        this.f12030e0.getClass();
        ((rq) this.f12030e0.f15338u).b("close_type", String.valueOf(i10));
        HashMap hashMap = new HashMap(2);
        hashMap.put("closetype", String.valueOf(i10));
        hashMap.put("version", this.v.f16238s);
        p("onhide", hashMap);
    }

    @Override
    public final synchronized void H(boolean z10) {
        int i10;
        h4.m mVar;
        int i11 = this.W;
        if (true != z10) {
            i10 = -1;
        } else {
            i10 = 1;
        }
        int i12 = i11 + i10;
        this.W = i12;
        if (i12 <= 0 && (mVar = this.F) != null) {
            synchronized (mVar.F) {
                mVar.H = true;
                j2.n nVar = mVar.G;
                if (nVar != null) {
                    i4.b1 b1Var = i4.j1.f6298i;
                    b1Var.removeCallbacks(nVar);
                    b1Var.post(mVar.G);
                }
            }
        }
    }

    @Override
    public final void H0(i4.j0 j0Var, q41 q41Var, yx0 yx0Var, kl1 kl1Var, String str, String str2) {
        zc0 zc0Var = this.E;
        uc0 uc0Var = zc0Var.f18693s;
        zc0Var.q(new AdOverlayInfoParcel(uc0Var, uc0Var.l(), j0Var, q41Var, yx0Var, kl1Var, str, str2));
    }

    @Override
    public final synchronized ul I() {
        return this.V;
    }

    @Override
    public final boolean I0(final int i10, final boolean z10) {
        destroy();
        this.f12042r0.a(new an() {
            @Override
            public final void j(eo eoVar) {
                boolean z11 = z10;
                int i11 = i10;
                int i12 = hd0.f12025s0;
                op y10 = pp.y();
                if (((pp) y10.f11329t).C() != z11) {
                    y10.i();
                    pp.A((pp) y10.f11329t, z11);
                }
                y10.i();
                pp.B((pp) y10.f11329t, i11);
                pp ppVar = (pp) y10.g();
                eoVar.i();
                fo.J((fo) eoVar.f11329t, ppVar);
            }
        });
        this.f12042r0.b(10003);
        return true;
    }

    @Override
    public final synchronized void J(h4.m mVar) {
        this.i0 = mVar;
    }

    @Override
    public final void J0(h4.g gVar, boolean z10) {
        this.E.p(gVar, z10);
    }

    @Override
    public final synchronized void K() {
        i4.a1.h("Destroying WebView!");
        synchronized (this) {
            if (!this.f12034j0) {
                this.f12034j0 = true;
                f4.r.A.f4918g.j.decrementAndGet();
            }
        }
        i4.j1.f6298i.post(new cx(3, this));
    }

    @Override
    public final void K0(Context context) {
        this.f12043s.setBaseContext(context);
        this.f12035k0.f6385b = this.f12043s.f18011a;
    }

    @Override
    public final void L(int i10) {
    }

    @Override
    public final void L0() {
        throw null;
    }

    @Override
    public final synchronized void M(k5.a aVar) {
        this.G = aVar;
    }

    @Override
    public final synchronized void M0(boolean z10) {
        boolean z11;
        h4.m mVar = this.F;
        if (mVar != null) {
            zc0 zc0Var = this.E;
            synchronized (zc0Var.v) {
                z11 = zc0Var.F;
            }
            mVar.H4(z11, z10);
            return;
        }
        this.J = z10;
    }

    @Override
    public final synchronized boolean N() {
        return this.O;
    }

    @Override
    public final synchronized void N0(yd0 yd0Var) {
        this.H = yd0Var;
        requestLayout();
    }

    @Override
    public final void O() {
        throw null;
    }

    @Override
    public final synchronized void O0() {
        f4.k kVar = this.f12046w;
        if (kVar != null) {
            kVar.O0();
        }
    }

    @Override
    public final void P() {
        h4.m X = X();
        if (X != null) {
            X.D.f5935t = true;
        }
    }

    @Override
    public final void P0(String str, pl0 pl0Var) {
        boolean z10;
        zc0 zc0Var = this.E;
        if (zc0Var != null) {
            synchronized (zc0Var.v) {
                List<yv> list = (List) zc0Var.f18695u.get(str);
                if (list != null) {
                    ArrayList arrayList = new ArrayList();
                    for (yv yvVar : list) {
                        yv yvVar2 = (yv) pl0Var.f15298t;
                        if ((yvVar instanceof fy) && ((fy) yvVar).f11536s.equals(yvVar2)) {
                            z10 = true;
                        } else {
                            z10 = false;
                        }
                        if (z10) {
                            arrayList.add(yvVar);
                        }
                    }
                    list.removeAll(arrayList);
                }
            }
        }
    }

    @Override
    public final synchronized ns Q() {
        return this.T;
    }

    @Override
    public final synchronized void Q0(ns nsVar) {
        this.T = nsVar;
    }

    @Override
    public final synchronized ob0 R(String str) {
        HashMap hashMap = this.f12040p0;
        if (hashMap == null) {
            return null;
        }
        return (ob0) hashMap.get(str);
    }

    @Override
    public final void R0(ri1 ri1Var, ui1 ui1Var) {
        this.A = ri1Var;
        this.B = ui1Var;
    }

    @Override
    public final va S() {
        return this.f12044t;
    }

    @Override
    public final synchronized void T(boolean z10) {
        if (z10) {
            setBackgroundColor(0);
        }
        h4.m mVar = this.F;
        if (mVar != null) {
            if (z10) {
                mVar.D.setBackgroundColor(0);
            } else {
                mVar.D.setBackgroundColor(-16777216);
            }
        }
    }

    public final void T0(String str) {
        Boolean bool;
        Boolean bool2;
        Boolean bool3;
        synchronized (this) {
            bool = this.N;
        }
        if (bool == null) {
            synchronized (this) {
                f4.r rVar = f4.r.A;
                c80 c80Var = rVar.f4918g;
                synchronized (c80Var.f9922a) {
                    bool3 = c80Var.f9930i;
                }
                this.N = bool3;
                if (bool3 == null) {
                    try {
                        evaluateJavascript("(function(){})()", null);
                        Boolean bool4 = Boolean.TRUE;
                        synchronized (this) {
                            this.N = bool4;
                            c80 c80Var2 = rVar.f4918g;
                            synchronized (c80Var2.f9922a) {
                                c80Var2.f9930i = bool4;
                            }
                        }
                    } catch (IllegalStateException unused) {
                        Boolean bool5 = Boolean.FALSE;
                        synchronized (this) {
                            this.N = bool5;
                            c80 c80Var3 = f4.r.A.f4918g;
                            synchronized (c80Var3.f9922a) {
                                c80Var3.f9930i = bool5;
                            }
                        }
                    }
                }
            }
            if (!bool2.booleanValue()) {
                synchronized (this) {
                    if (!F0()) {
                        evaluateJavascript(str, null);
                        return;
                    } else {
                        o80.e("#004 The webview is destroyed. Ignoring action.");
                        return;
                    }
                }
            }
            String concat = "javascript:".concat(str);
            synchronized (this) {
                if (!F0()) {
                    loadUrl(concat);
                    return;
                } else {
                    o80.e("#004 The webview is destroyed. Ignoring action.");
                    return;
                }
            }
        }
        synchronized (this) {
            bool2 = this.N;
            if (!bool2.booleanValue()) {
            }
        }
    }

    @Override
    public final zc0 U() {
        return this.E;
    }

    public final boolean U0() {
        boolean z10;
        int i10;
        int i11;
        boolean z11;
        zc0 zc0Var = this.E;
        synchronized (zc0Var.v) {
            z10 = zc0Var.F;
        }
        boolean z12 = false;
        if (!z10) {
            zc0 zc0Var2 = this.E;
            synchronized (zc0Var2.v) {
                z11 = zc0Var2.G;
            }
            if (!z11) {
                return false;
            }
        }
        k80 k80Var = g4.p.f5423f.f5424a;
        int round = Math.round(r0.widthPixels / this.f12048y.density);
        int round2 = Math.round(r2.heightPixels / this.f12048y.density);
        Activity activity = this.f12043s.f18011a;
        if (activity != null && activity.getWindow() != null) {
            i4.j1 j1Var = f4.r.A.f4914c;
            int[] k10 = i4.j1.k(activity);
            i10 = Math.round(k10[0] / this.f12048y.density);
            i11 = Math.round(k10[1] / this.f12048y.density);
        } else {
            i10 = round;
            i11 = round2;
        }
        int i12 = this.f12037m0;
        if (i12 == round && this.f12036l0 == round2 && this.f12038n0 == i10 && this.f12039o0 == i11) {
            return false;
        }
        if (i12 != round || this.f12036l0 != round2) {
            z12 = true;
        }
        this.f12037m0 = round;
        this.f12036l0 = round2;
        this.f12038n0 = i10;
        this.f12039o0 = i11;
        try {
            d(new JSONObject().put("width", round).put("height", round2).put("maxSizeWidth", i10).put("maxSizeHeight", i11).put("density", this.f12048y.density).put("rotation", this.f12041q0.getDefaultDisplay().getRotation()), "onScreenInfoChanged");
        } catch (JSONException unused) {
            o80.g(6);
        }
        return z12;
    }

    @Override
    public final synchronized yd0 V() {
        return this.H;
    }

    public final synchronized void V0() {
        ri1 ri1Var = this.A;
        if (ri1Var != null && ri1Var.f16019n0) {
            o80.b("Disabling hardware acceleration on an overlay.");
            synchronized (this) {
                if (!this.M) {
                    setLayerType(1, null);
                }
                this.M = true;
            }
            return;
        }
        if (!this.L && !this.H.b()) {
            o80.b("Enabling hardware acceleration on an AdView.");
            synchronized (this) {
                if (this.M) {
                    setLayerType(0, null);
                }
                this.M = false;
            }
            return;
        }
        o80.b("Enabling hardware acceleration on an overlay.");
        synchronized (this) {
            if (this.M) {
                setLayerType(0, null);
            }
            this.M = false;
        }
    }

    @Override
    public final ui1 W() {
        return this.B;
    }

    public final void W0(boolean z10) {
        String str;
        HashMap hashMap = new HashMap();
        if (true != z10) {
            str = "0";
        } else {
            str = "1";
        }
        hashMap.put("isVisible", str);
        p("onAdVisibilityChanged", hashMap);
    }

    @Override
    public final synchronized h4.m X() {
        return this.F;
    }

    public final synchronized void X0() {
        HashMap hashMap = this.f12040p0;
        if (hashMap != null) {
            Iterator it = hashMap.values().iterator();
            while (it.hasNext()) {
                ((ob0) it.next()).a();
            }
        }
        this.f12040p0 = null;
    }

    @Override
    public final void Y(JSONObject jSONObject, String str) {
        D(str, jSONObject.toString());
    }

    @Override
    public final synchronized void Z(ul ulVar) {
        this.V = ulVar;
    }

    @Override
    public final synchronized void a0(int i10) {
        h4.m mVar = this.F;
        if (mVar != null) {
            mVar.I4(i10);
        }
    }

    @Override
    public final void b0(int i10) {
        this.f12032g0 = i10;
    }

    @Override
    public final synchronized boolean c() {
        return this.J;
    }

    @Override
    public final synchronized h4.m c0() {
        return this.i0;
    }

    @Override
    public final void d(JSONObject jSONObject, String str) {
        if (jSONObject == null) {
            jSONObject = new JSONObject();
        }
        StringBuilder b10 = j2.g.b("(window.AFMA_ReceiveMessage || function() {})('", str, "',", jSONObject.toString(), ");");
        o80.b("Dispatching AFMA event: ".concat(b10.toString()));
        T0(b10.toString());
    }

    @Override
    public final void d0() {
        jq.h((rq) this.f12030e0.f15338u, this.f12028c0, "aeh2");
        HashMap hashMap = new HashMap(1);
        hashMap.put("version", this.v.f16238s);
        p("onhide", hashMap);
    }

    @Override
    public final synchronized void destroy() {
        hq hqVar;
        View decorView;
        ViewTreeObserver viewTreeObserver;
        pq pqVar = this.f12030e0;
        if (pqVar != null) {
            rq rqVar = (rq) pqVar.f15338u;
            c80 c80Var = f4.r.A.f4918g;
            synchronized (c80Var.f9922a) {
                hqVar = c80Var.f9929h;
            }
            if (hqVar != null) {
                hqVar.f12202a.offer(rqVar);
            }
        }
        i4.z0 z0Var = this.f12035k0;
        z0Var.f6388e = false;
        Activity activity = z0Var.f6385b;
        if (activity != null && z0Var.f6386c) {
            ViewTreeObserver.OnGlobalLayoutListener onGlobalLayoutListener = z0Var.f6389f;
            Window window = activity.getWindow();
            if (window != null && (decorView = window.getDecorView()) != null) {
                viewTreeObserver = decorView.getViewTreeObserver();
                if (viewTreeObserver != null) {
                    viewTreeObserver.removeOnGlobalLayoutListener(onGlobalLayoutListener);
                }
                z0Var.f6386c = false;
            }
            viewTreeObserver = null;
            if (viewTreeObserver != null) {
            }
            z0Var.f6386c = false;
        }
        h4.m mVar = this.F;
        if (mVar != null) {
            mVar.b();
            this.F.o();
            this.F = null;
        }
        this.G = null;
        this.E.z();
        this.V = null;
        this.f12046w = null;
        setOnClickListener(null);
        setOnTouchListener(null);
        if (this.K) {
            return;
        }
        f4.r.A.f4934y.e(this);
        X0();
        this.K = true;
        if (((Boolean) g4.r.f5440d.f5443c.a(dq.f10649l8)).booleanValue()) {
            i4.a1.h("Initiating WebView self destruct sequence in 3...");
            i4.a1.h("Loading blank page in WebView, 2...");
            synchronized (this) {
                try {
                    super.loadUrl("about:blank");
                } catch (Throwable th) {
                    f4.r.A.f4918g.f("AdWebViewImpl.loadUrlUnsafe", th);
                    o80.g(5);
                }
                return;
            }
        }
        i4.a1.h("Destroying the WebView immediately...");
        K();
    }

    @Override
    public final int e() {
        return this.f12033h0;
    }

    @Override
    public final synchronized boolean e0() {
        return this.L;
    }

    @Override
    public final synchronized void evaluateJavascript(String str, ValueCallback valueCallback) {
        if (F0()) {
            o80.f("#004 The webview is destroyed. Ignoring action.", null);
            if (valueCallback != null) {
                valueCallback.onReceiveValue(null);
                return;
            }
            return;
        }
        super.evaluateJavascript(str, valueCallback);
    }

    @Override
    public final synchronized int f() {
        return this.f12031f0;
    }

    @Override
    public final void f0() {
        if (this.f12029d0 == null) {
            this.f12030e0.getClass();
            oq d10 = rq.d();
            this.f12029d0 = d10;
            ((Map) this.f12030e0.f15337t).put("native:view_load", d10);
        }
    }

    public final void finalize() throws Throwable {
        try {
            synchronized (this) {
                try {
                    if (!this.K) {
                        this.E.z();
                        f4.r rVar = f4.r.A;
                        rVar.f4934y.e(this);
                        X0();
                        synchronized (this) {
                            if (!this.f12034j0) {
                                this.f12034j0 = true;
                                rVar.f4918g.j.decrementAndGet();
                            }
                        }
                    }
                } catch (Throwable th) {
                    throw th;
                }
            }
        } finally {
            super.finalize();
        }
    }

    @Override
    public final int g() {
        return getMeasuredHeight();
    }

    @Override
    public final synchronized void g0() {
        ls lsVar = this.U;
        if (lsVar != null) {
            i4.j1.f6298i.post(new oe(6, (ov0) lsVar));
        }
    }

    @Override
    public final int h() {
        return this.f12032g0;
    }

    @Override
    public final void h0() {
        zc0 zc0Var = this.E;
        if (zc0Var != null) {
            zc0Var.h0();
        }
    }

    @Override
    public final synchronized boolean i() {
        return this.W > 0;
    }

    @Override
    public final synchronized void i0(String str, String str2) {
        String str3;
        if (!F0()) {
            String[] strArr = new String[1];
            String str4 = (String) g4.r.f5440d.f5443c.a(dq.K);
            JSONObject jSONObject = new JSONObject();
            try {
                jSONObject.put("version", str4);
                jSONObject.put(AppEventClient.Types.SDK, "Google Mobile Ads");
                jSONObject.put("sdkVersion", "12.4.51-000");
                str3 = "<script>Object.defineProperty(window,'MRAID_ENV',{get:function(){return " + jSONObject.toString() + "}});</script>";
            } catch (JSONException unused) {
                o80.g(5);
                str3 = null;
            }
            strArr[0] = str3;
            super.loadDataWithBaseURL(str, qd0.a(str2, strArr), "text/html", "UTF-8", null);
            return;
        }
        o80.e("#004 The webview is destroyed. Ignoring action.");
    }

    @Override
    public final int j() {
        return getMeasuredWidth();
    }

    @Override
    public final synchronized String j0() {
        return this.I;
    }

    @Override
    public final Activity k() {
        return this.f12043s.f18011a;
    }

    @Override
    public final void k0(tk tkVar) {
        boolean z10;
        synchronized (this) {
            z10 = tkVar.j;
            this.R = z10;
        }
        W0(z10);
    }

    @Override
    public final s80 l() {
        return this.v;
    }

    @Override
    public final synchronized void l0() {
        f4.k kVar = this.f12046w;
        if (kVar != null) {
            kVar.l0();
        }
    }

    @Override
    public final synchronized void loadData(String str, String str2, String str3) {
        if (!F0()) {
            super.loadData(str, str2, str3);
        } else {
            o80.e("#004 The webview is destroyed. Ignoring action.");
        }
    }

    @Override
    public final synchronized void loadDataWithBaseURL(String str, String str2, String str3, String str4, String str5) {
        if (!F0()) {
            super.loadDataWithBaseURL(str, str2, str3, str4, str5);
        } else {
            o80.e("#004 The webview is destroyed. Ignoring action.");
        }
    }

    @Override
    public final synchronized void loadUrl(String str) {
        if (!F0()) {
            try {
                super.loadUrl(str);
                return;
            } catch (Throwable th) {
                f4.r.A.f4918g.f("AdWebViewImpl.loadUrl", th);
                o80.g(5);
                return;
            }
        }
        o80.e("#004 The webview is destroyed. Ignoring action.");
    }

    @Override
    public final synchronized void m0(ls lsVar) {
        this.U = lsVar;
    }

    @Override
    public final pq n() {
        return this.f12030e0;
    }

    @Override
    public final synchronized void n0(boolean z10) {
        this.O = z10;
    }

    @Override
    public final void o(boolean z10, int i10, String str, boolean z11) {
        boolean z12;
        g4.a aVar;
        yc0 yc0Var;
        vq0 vq0Var;
        zc0 zc0Var = this.E;
        boolean e02 = zc0Var.f18693s.e0();
        boolean g10 = zc0.g(e02, zc0Var.f18693s);
        if (!g10 && z11) {
            z12 = false;
        } else {
            z12 = true;
        }
        if (g10) {
            aVar = null;
        } else {
            aVar = zc0Var.f18696w;
        }
        if (e02) {
            yc0Var = null;
        } else {
            yc0Var = new yc0(zc0Var.f18693s, zc0Var.f18697x);
        }
        xu xuVar = zc0Var.A;
        zu zuVar = zc0Var.B;
        h4.x xVar = zc0Var.I;
        uc0 uc0Var = zc0Var.f18693s;
        s80 l10 = uc0Var.l();
        if (z12) {
            vq0Var = null;
        } else {
            vq0Var = zc0Var.C;
        }
        zc0Var.q(new AdOverlayInfoParcel(aVar, yc0Var, xuVar, zuVar, xVar, uc0Var, z10, i10, str, l10, vq0Var));
    }

    @Override
    public final synchronized void o0(h4.m mVar) {
        this.F = mVar;
    }

    @Override
    public final synchronized void onAttachedToWindow() {
        boolean z10;
        super.onAttachedToWindow();
        boolean z11 = true;
        if (!F0()) {
            i4.z0 z0Var = this.f12035k0;
            z0Var.f6387d = true;
            if (z0Var.f6388e) {
                z0Var.a();
            }
        }
        boolean z12 = this.R;
        zc0 zc0Var = this.E;
        if (zc0Var != null) {
            synchronized (zc0Var.v) {
                z10 = zc0Var.G;
            }
            if (z10) {
                if (!this.S) {
                    synchronized (this.E.v) {
                    }
                    synchronized (this.E.v) {
                    }
                    this.S = true;
                }
                U0();
                W0(z11);
            }
        }
        z11 = z12;
        W0(z11);
    }

    @Override
    public final void onDetachedFromWindow() {
        zc0 zc0Var;
        boolean z10;
        View decorView;
        synchronized (this) {
            try {
                if (!F0()) {
                    i4.z0 z0Var = this.f12035k0;
                    z0Var.f6387d = false;
                    Activity activity = z0Var.f6385b;
                    if (activity != null && z0Var.f6386c) {
                        ViewTreeObserver.OnGlobalLayoutListener onGlobalLayoutListener = z0Var.f6389f;
                        Window window = activity.getWindow();
                        ViewTreeObserver viewTreeObserver = null;
                        if (window != null && (decorView = window.getDecorView()) != null) {
                            viewTreeObserver = decorView.getViewTreeObserver();
                        }
                        if (viewTreeObserver != null) {
                            viewTreeObserver.removeOnGlobalLayoutListener(onGlobalLayoutListener);
                        }
                        z0Var.f6386c = false;
                    }
                }
                super.onDetachedFromWindow();
                if (this.S && (zc0Var = this.E) != null) {
                    synchronized (zc0Var.v) {
                        z10 = zc0Var.G;
                    }
                    if (z10 && getViewTreeObserver() != null && getViewTreeObserver().isAlive()) {
                        synchronized (this.E.v) {
                        }
                        synchronized (this.E.v) {
                        }
                        this.S = false;
                    }
                }
            } catch (Throwable th) {
                throw th;
            }
        }
        W0(false);
    }

    @Override
    public final void onDownloadStart(String str, String str2, String str3, String str4, long j) {
        try {
            Intent intent = new Intent("android.intent.action.VIEW");
            intent.setDataAndType(Uri.parse(str), str4);
            i4.j1 j1Var = f4.r.A.f4914c;
            i4.j1.n(getContext(), intent);
        } catch (ActivityNotFoundException unused) {
            o80.b("Couldn't find an Activity to view url/mimetype: " + str + " / " + str4);
        }
    }

    @Override
    public final void onDraw(Canvas canvas) {
        if (F0()) {
            return;
        }
        if (Build.VERSION.SDK_INT == 21 && canvas.isHardwareAccelerated() && !isAttachedToWindow()) {
            return;
        }
        super.onDraw(canvas);
    }

    @Override
    public final boolean onGenericMotionEvent(MotionEvent motionEvent) {
        float axisValue = motionEvent.getAxisValue(9);
        float axisValue2 = motionEvent.getAxisValue(10);
        if (motionEvent.getActionMasked() == 8) {
            if (axisValue <= CropImageView.DEFAULT_ASPECT_RATIO || canScrollVertically(-1)) {
                if (axisValue >= CropImageView.DEFAULT_ASPECT_RATIO || canScrollVertically(1)) {
                    if (axisValue2 <= CropImageView.DEFAULT_ASPECT_RATIO || canScrollHorizontally(-1)) {
                        if (axisValue2 < CropImageView.DEFAULT_ASPECT_RATIO && !canScrollHorizontally(1)) {
                            return false;
                        }
                    } else {
                        return false;
                    }
                } else {
                    return false;
                }
            } else {
                return false;
            }
        }
        return super.onGenericMotionEvent(motionEvent);
    }

    @Override
    public final void onGlobalLayout() {
        boolean U0 = U0();
        h4.m X = X();
        if (X != null && U0 && X.E) {
            X.E = false;
            X.a();
        }
    }

    @Override
    public final synchronized void onMeasure(int i10, int i11) {
        boolean z10;
        boolean z11;
        boolean z12;
        boolean z13;
        int i12;
        yd0 yd0Var;
        boolean z14;
        boolean z15;
        int size;
        float f10;
        int i13 = 0;
        if (F0()) {
            setMeasuredDimension(0, 0);
            return;
        }
        if (!isInEditMode() && !this.L) {
            yd0 yd0Var2 = this.H;
            int i14 = yd0Var2.f18404a;
            if (i14 == 0) {
                z10 = true;
            } else {
                z10 = false;
            }
            if (!z10) {
                if (i14 == 5) {
                    z11 = true;
                } else {
                    z11 = false;
                }
                if (z11) {
                    super.onMeasure(i10, i11);
                    return;
                }
                if (i14 == 4) {
                    z12 = true;
                } else {
                    z12 = false;
                }
                if (z12) {
                    if (((Boolean) g4.r.f5440d.f5443c.a(dq.f10537a3)).booleanValue()) {
                        super.onMeasure(i10, i11);
                        return;
                    }
                    jd0 t10 = t();
                    if (t10 != null) {
                        f10 = t10.c();
                    } else {
                        f10 = CropImageView.DEFAULT_ASPECT_RATIO;
                    }
                    if (f10 == CropImageView.DEFAULT_ASPECT_RATIO) {
                        super.onMeasure(i10, i11);
                        return;
                    }
                    int size2 = View.MeasureSpec.getSize(i10);
                    int size3 = View.MeasureSpec.getSize(i11);
                    int i15 = (int) (size3 * f10);
                    int i16 = (int) (size2 / f10);
                    if (size3 == 0) {
                        if (i16 != 0) {
                            i15 = (int) (i16 * f10);
                            i13 = size2;
                            size3 = i16;
                            setMeasuredDimension(Math.min(i15, i13), Math.min(i16, size3));
                            return;
                        }
                        size3 = 0;
                    }
                    if (size2 == 0) {
                        if (i15 != 0) {
                            i16 = (int) (i15 / f10);
                            i13 = i15;
                        }
                    } else {
                        i13 = size2;
                    }
                    setMeasuredDimension(Math.min(i15, i13), Math.min(i16, size3));
                    return;
                }
                if (i14 == 2) {
                    z13 = true;
                } else {
                    z13 = false;
                }
                if (z13) {
                    if (((Boolean) g4.r.f5440d.f5443c.a(dq.f10597g3)).booleanValue()) {
                        super.onMeasure(i10, i11);
                        return;
                    }
                    v0("/contentHeight", new wu(2, this));
                    T0("(function() {  var height = -1;  if (document.body) {    height = document.body.offsetHeight;  } else if (document.documentElement) {    height = document.documentElement.offsetHeight;  }  var url = 'gmsg://mobileads.google.com/contentHeight?';  url += 'height=' + height;  try {    window.googleAdsJsInterface.notify(url);  } catch (e) {    var frame = document.getElementById('afma-notify-fluid');    if (!frame) {      frame = document.createElement('IFRAME');      frame.id = 'afma-notify-fluid';      frame.style.display = 'none';      var body = document.body || document.documentElement;      body.appendChild(frame);    }    frame.src = url;  }})();");
                    float f11 = this.f12048y.density;
                    int size4 = View.MeasureSpec.getSize(i10);
                    int i17 = this.f12026a0;
                    if (i17 != -1) {
                        size = (int) (i17 * f11);
                    } else {
                        size = View.MeasureSpec.getSize(i11);
                    }
                    setMeasuredDimension(size4, size);
                    return;
                }
                if (yd0Var2.b()) {
                    DisplayMetrics displayMetrics = this.f12048y;
                    setMeasuredDimension(displayMetrics.widthPixels, displayMetrics.heightPixels);
                    return;
                }
                int mode = View.MeasureSpec.getMode(i10);
                int size5 = View.MeasureSpec.getSize(i10);
                int mode2 = View.MeasureSpec.getMode(i11);
                int size6 = View.MeasureSpec.getSize(i11);
                int i18 = ua.x.UNINITIALIZED_SERIALIZED_SIZE;
                if (mode != Integer.MIN_VALUE && mode != 1073741824) {
                    i12 = ua.x.UNINITIALIZED_SERIALIZED_SIZE;
                    if (mode2 != Integer.MIN_VALUE || mode2 == 1073741824) {
                        i18 = size6;
                    }
                    yd0Var = this.H;
                    if (yd0Var.f18406c <= i12 && yd0Var.f18405b <= i18) {
                        z14 = false;
                        if (((Boolean) g4.r.f5440d.f5443c.a(dq.f10665n4)).booleanValue()) {
                            int i19 = this.H.f18406c;
                            float f12 = this.f12049z;
                            if (i19 / f12 <= i12 / f12 && r5.f18405b / f12 <= i18 / f12) {
                                z15 = true;
                            } else {
                                z15 = false;
                            }
                            z14 &= z15;
                        }
                        if (!z14) {
                            yd0 yd0Var3 = this.H;
                            int i20 = yd0Var3.f18406c;
                            float f13 = this.f12049z;
                            o80.e("Not enough space to show ad. Needs " + ((int) (i20 / f13)) + "x" + ((int) (yd0Var3.f18405b / f13)) + " dp, but only has " + ((int) (size5 / f13)) + "x" + ((int) (size6 / f13)) + " dp.");
                            if (getVisibility() != 8) {
                                setVisibility(4);
                            }
                            setMeasuredDimension(0, 0);
                            if (!this.C) {
                                this.f12042r0.b(10001);
                                this.C = true;
                                return;
                            }
                            return;
                        }
                        if (getVisibility() != 8) {
                            setVisibility(0);
                        }
                        if (!this.D) {
                            this.f12042r0.b(10002);
                            this.D = true;
                        }
                        yd0 yd0Var4 = this.H;
                        setMeasuredDimension(yd0Var4.f18406c, yd0Var4.f18405b);
                        return;
                    }
                    z14 = true;
                    if (((Boolean) g4.r.f5440d.f5443c.a(dq.f10665n4)).booleanValue()) {
                    }
                    if (!z14) {
                    }
                }
                i12 = size5;
                if (mode2 != Integer.MIN_VALUE) {
                }
                i18 = size6;
                yd0Var = this.H;
                if (yd0Var.f18406c <= i12) {
                    z14 = false;
                    if (((Boolean) g4.r.f5440d.f5443c.a(dq.f10665n4)).booleanValue()) {
                    }
                    if (!z14) {
                    }
                }
                z14 = true;
                if (((Boolean) g4.r.f5440d.f5443c.a(dq.f10665n4)).booleanValue()) {
                }
                if (!z14) {
                }
            }
        }
        super.onMeasure(i10, i11);
    }

    @Override
    public final void onPause() {
        if (F0()) {
            return;
        }
        try {
            super.onPause();
        } catch (Exception unused) {
            o80.g(6);
        }
    }

    @Override
    public final void onResume() {
        if (F0()) {
            return;
        }
        try {
            super.onResume();
        } catch (Exception unused) {
            o80.g(6);
        }
    }

    @Override
    public final boolean onTouchEvent(MotionEvent motionEvent) {
        boolean z10;
        boolean z11;
        zc0 zc0Var = this.E;
        synchronized (zc0Var.v) {
            z10 = zc0Var.G;
        }
        if (z10) {
            zc0 zc0Var2 = this.E;
            synchronized (zc0Var2.v) {
                z11 = zc0Var2.H;
            }
            if (!z11) {
                synchronized (this) {
                    ns nsVar = this.T;
                    if (nsVar != null) {
                        nsVar.c(motionEvent);
                    }
                }
                if (!F0()) {
                    return false;
                }
                return super.onTouchEvent(motionEvent);
            }
        }
        va vaVar = this.f12044t;
        if (vaVar != null) {
            vaVar.f17290b.e(motionEvent);
        }
        zq zqVar = this.f12045u;
        if (zqVar != null) {
            if (motionEvent.getAction() == 1 && motionEvent.getEventTime() > zqVar.f18876a.getEventTime()) {
                zqVar.f18876a = MotionEvent.obtain(motionEvent);
            } else if (motionEvent.getAction() == 0 && motionEvent.getEventTime() > zqVar.f18877b.getEventTime()) {
                zqVar.f18877b = MotionEvent.obtain(motionEvent);
            }
        }
        if (!F0()) {
        }
    }

    @Override
    public final void p(String str, Map map) {
        try {
            d(g4.p.f5423f.f5424a.h(map), str);
        } catch (JSONException unused) {
            o80.e("Could not convert parameters to JSON.");
        }
    }

    @Override
    public final boolean p0() {
        return false;
    }

    @Override
    public final oq q() {
        return this.f12028c0;
    }

    @Override
    public final void q0(boolean z10) {
        this.E.R = z10;
    }

    @Override
    public final f4.a r() {
        return this.f12047x;
    }

    @Override
    public final void r0(int i10, String str, String str2, boolean z10, boolean z11) {
        boolean z12;
        g4.a aVar;
        yc0 yc0Var;
        vq0 vq0Var;
        zc0 zc0Var = this.E;
        boolean e02 = zc0Var.f18693s.e0();
        boolean g10 = zc0.g(e02, zc0Var.f18693s);
        if (!g10 && z11) {
            z12 = false;
        } else {
            z12 = true;
        }
        if (g10) {
            aVar = null;
        } else {
            aVar = zc0Var.f18696w;
        }
        if (e02) {
            yc0Var = null;
        } else {
            yc0Var = new yc0(zc0Var.f18693s, zc0Var.f18697x);
        }
        xu xuVar = zc0Var.A;
        zu zuVar = zc0Var.B;
        h4.x xVar = zc0Var.I;
        uc0 uc0Var = zc0Var.f18693s;
        s80 l10 = uc0Var.l();
        if (z12) {
            vq0Var = null;
        } else {
            vq0Var = zc0Var.C;
        }
        zc0Var.q(new AdOverlayInfoParcel(aVar, yc0Var, xuVar, zuVar, xVar, uc0Var, z10, i10, str, str2, l10, vq0Var));
    }

    @Override
    public final void s(String str) {
        throw null;
    }

    @Override
    public final void s0() {
        setBackgroundColor(0);
    }

    @Override
    public final void setWebViewClient(WebViewClient webViewClient) {
        super.setWebViewClient(webViewClient);
        if (webViewClient instanceof zc0) {
            this.E = (zc0) webViewClient;
        }
    }

    @Override
    public final void stopLoading() {
        if (F0()) {
            return;
        }
        try {
            super.stopLoading();
        } catch (Exception unused) {
            o80.g(6);
        }
    }

    @Override
    public final synchronized jd0 t() {
        return this.Q;
    }

    @Override
    public final mx1 t0() {
        zq zqVar = this.f12045u;
        if (zqVar == null) {
            return fx1.K(null);
        }
        return zqVar.a();
    }

    @Override
    public final synchronized void u(jd0 jd0Var) {
        if (this.Q != null) {
            o80.c("Attempt to create multiple AdWebViewVideoControllers.");
        } else {
            this.Q = jd0Var;
        }
    }

    @Override
    public final void u0() {
        zc0 zc0Var = this.E;
        if (zc0Var != null) {
            zc0Var.u0();
        }
    }

    @Override
    public final WebView v() {
        return this;
    }

    @Override
    public final void v0(String str, yv yvVar) {
        zc0 zc0Var = this.E;
        if (zc0Var != null) {
            zc0Var.s(str, yvVar);
        }
    }

    @Override
    public final WebViewClient w() {
        return this.E;
    }

    @Override
    public final void w0(String str, yv yvVar) {
        zc0 zc0Var = this.E;
        if (zc0Var != null) {
            synchronized (zc0Var.v) {
                List list = (List) zc0Var.f18695u.get(str);
                if (list != null) {
                    list.remove(yvVar);
                }
            }
        }
    }

    @Override
    public final void x() {
        zc0 zc0Var = this.E;
        if (zc0Var != null) {
            zc0Var.x();
        }
    }

    @Override
    public final void x0() {
        if (this.f12027b0 == null) {
            jq.h((rq) this.f12030e0.f15338u, this.f12028c0, "aes2");
            this.f12030e0.getClass();
            oq d10 = rq.d();
            this.f12027b0 = d10;
            ((Map) this.f12030e0.f15337t).put("native:view_show", d10);
        }
        HashMap hashMap = new HashMap(1);
        hashMap.put("version", this.v.f16238s);
        p("onshow", hashMap);
    }

    @Override
    public final synchronized void y(String str, ob0 ob0Var) {
        if (this.f12040p0 == null) {
            this.f12040p0 = new HashMap();
        }
        this.f12040p0.put(str, ob0Var);
    }

    @Override
    public final void y0(int i10) {
        this.f12033h0 = i10;
    }

    @Override
    public final synchronized String z() {
        return this.P;
    }

    @Override
    public final void z0() {
        i4.z0 z0Var = this.f12035k0;
        z0Var.f6388e = true;
        if (z0Var.f6387d) {
            z0Var.a();
        }
    }
}