APKPure.apk(点击下载) / w.java


package e.w.h.b;

import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.Dialog;
import android.content.ComponentCallbacks;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Picture;
import android.graphics.Rect;
import android.net.Uri;
import android.net.http.SslCertificate;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.DownloadListener;
import android.webkit.ValueCallback;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.widget.FrameLayout;
import com.android.volley.toolbox.JsonRequest;
import com.apkpure.aegon.download.DownloadTask;
import com.yalantis.ucrop.view.CropImageView;
import e.g.a.x.z4;
import e.w.c.e.b.l;
import e.w.e.a.a.g.i;
import e.w.h.a.a.g.b;
import e.w.h.a.a.g.d;
import e.w.h.c.o;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Properties;

public class w extends FrameLayout implements View.OnLongClickListener {

    /* renamed from: o  reason: collision with root package name */
    public static Context f12696o = null;

    /* renamed from: p  reason: collision with root package name */
    public static boolean f12697p = false;

    /* renamed from: q  reason: collision with root package name */
    public static Method f12698q = null;

    /* renamed from: r  reason: collision with root package name */
    public static String f12699r = null;

    /* renamed from: s  reason: collision with root package name */
    public static boolean f12700s = false;

    /* renamed from: t  reason: collision with root package name */
    public static Paint f12701t = null;
    public static boolean u = true;
    public static int v = 153;
    public boolean b = false;
    public e.w.h.a.a.g.d c;
    public j d;

    /* renamed from: e  reason: collision with root package name */
    public t f12702e = null;

    /* renamed from: f  reason: collision with root package name */
    public Context f12703f = null;

    /* renamed from: g  reason: collision with root package name */
    public q f12704g = new q();

    /* renamed from: h  reason: collision with root package name */
    public volatile int f12705h = 0;

    /* renamed from: i  reason: collision with root package name */
    public volatile boolean f12706i = false;

    /* renamed from: j  reason: collision with root package name */
    public x f12707j;

    /* renamed from: k  reason: collision with root package name */
    public boolean f12708k = false;

    /* renamed from: l  reason: collision with root package name */
    public s f12709l = null;

    /* renamed from: m  reason: collision with root package name */
    public Object f12710m = null;

    /* renamed from: n  reason: collision with root package name */
    public View.OnLongClickListener f12711n = null;

    public class a implements WebView.FindListener {

        /* renamed from: a  reason: collision with root package name */
        public final /* synthetic */ d.a f12712a;

        public a(w wVar, d.a aVar) {
            this.f12712a = aVar;
        }

        public void onFindResultReceived(int i2, int i3, boolean z) {
            this.f12712a.onFindResultReceived(i2, i3, z);
        }
    }

    public class b implements DownloadListener {

        /* renamed from: a  reason: collision with root package name */
        public final /* synthetic */ c f12713a;

        public b(c cVar) {
            this.f12713a = cVar;
        }

        /* JADX WARNING: Code restructure failed: missing block: B:109:0x014f, code lost:
            if (android.text.TextUtils.isEmpty(r13.f12637a) == false) goto L_0x0199;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:127:0x0183, code lost:
            if (android.text.TextUtils.isEmpty(r13.f12637a) == false) goto L_0x0199;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:131:0x0197, code lost:
            if (android.text.TextUtils.isEmpty(r13.f12637a) == false) goto L_0x0199;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:56:?, code lost:
            r15 = r1.getPackageInfo("com.tencent.mtt", 0);
         */
        /* JADX WARNING: Code restructure failed: missing block: B:57:0x00cd, code lost:
            r13 = r0;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:62:?, code lost:
            r15 = r1.getPackageInfo("com.tencent.mtt.x86", 0);
         */
        /* JADX WARNING: Code restructure failed: missing block: B:63:0x00d5, code lost:
            r5 = r15;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:67:?, code lost:
            r7 = e.w.c.e.b.l.j(r11, android.net.Uri.parse("https://mdc.html5.qq.com/mh?channel_id=50079&u="));
         */
        /* JADX WARNING: Code restructure failed: missing block: B:71:0x00eb, code lost:
            r15 = r1.getPackageInfo(r7.b, 0);
         */
        /* JADX WARNING: Code restructure failed: missing block: B:72:0x00f2, code lost:
            r15 = 2;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:73:0x00f4, code lost:
            r15 = r0;
         */
        /* JADX WARNING: Failed to process nested try/catch */
        /* JADX WARNING: Missing exception handler attribute for start block: B:52:0x00c2 */
        /* JADX WARNING: Missing exception handler attribute for start block: B:55:0x00c8 */
        /* JADX WARNING: Removed duplicated region for block: B:135:0x01b3  */
        /* JADX WARNING: Removed duplicated region for block: B:136:0x01b6  */
        /* JADX WARNING: Removed duplicated region for block: B:154:? A[RETURN, SYNTHETIC] */
        /* JADX WARNING: Removed duplicated region for block: B:155:? A[RETURN, SYNTHETIC] */
        /* JADX WARNING: Removed duplicated region for block: B:23:0x005b  */
        /* JADX WARNING: Removed duplicated region for block: B:27:0x0069  */
        /* JADX WARNING: Removed duplicated region for block: B:58:? A[ExcHandler: Exception (unused java.lang.Exception), SYNTHETIC, Splitter:B:50:0x00bd] */
        /* JADX WARNING: Removed duplicated region for block: B:89:0x010e  */
        public void onDownloadStart(String str, String str2, String str3, String str4, long j2) {
            ApplicationInfo applicationInfo;
            Context context;
            char c;
            boolean z;
            Uri parse;
            char c2;
            int i2;
            e.w.h.b.k0.b bVar;
            String str5;
            String str6;
            PackageInfo packageInfo;
            char c3;
            c cVar = this.f12713a;
            if (cVar == null) {
                Context context2 = w.this.f12703f;
                if (context2 == null) {
                    applicationInfo = null;
                } else {
                    applicationInfo = context2.getApplicationInfo();
                }
                if ((applicationInfo == null || !"com.tencent.mm".equals(applicationInfo.packageName)) && (context = w.this.f12703f) != null) {
                    c = 0;
                    if (!(str == null || str.length() == 0)) {
                        String trim = str.trim();
                        int indexOf = trim.toLowerCase().indexOf("://");
                        int indexOf2 = trim.toLowerCase().indexOf(46);
                        if (indexOf <= 0 || indexOf2 <= 0 || indexOf <= indexOf2) {
                            z = trim.toLowerCase().contains("://");
                            if (!z) {
                                str = e.d.a.a.a.H("http://", str);
                            }
                            parse = Uri.parse(str);
                            if (parse == null) {
                                if (!context.getApplicationContext().getSharedPreferences("x5_proxy_setting", 0).getBoolean("qb_install_status", false)) {
                                    try {
                                        PackageManager packageManager = context.getPackageManager();
                                        try {
                                            packageInfo = packageManager.getPackageInfo("com.tencent.mtt", 0);
                                            if (packageInfo != null) {
                                                try {
                                                    i2 = packageInfo.versionCode;
                                                    if (i2 > 420000) {
                                                        try {
                                                            String str7 = "ADRQB_" + packageInfo.versionName.replaceAll("\\.", "");
                                                            packageInfo.versionName.replaceAll("\\.", "");
                                                        } catch (PackageManager.NameNotFoundException unused) {
                                                        } catch (Exception unused2) {
                                                        }
                                                        c2 = 2;
                                                        if (c2 != 65535) {
                                                            if (c2 != 2 || i2 >= 33) {
                                                                Intent intent = new Intent("android.intent.action.VIEW");
                                                                if (c2 == 2) {
                                                                    if (i2 >= 33 && i2 <= 39) {
                                                                        str6 = "com.tencent.mtt.MainActivity";
                                                                    } else if (i2 < 40 || i2 > 45) {
                                                                        if (i2 >= 46) {
                                                                            intent = new Intent("com.tencent.QQBrowser.action.VIEW");
                                                                            bVar = l.j(context, parse);
                                                                            if (bVar != null) {
                                                                            }
                                                                        }
                                                                        intent.setData(parse);
                                                                        String str8 = context.getApplicationInfo().processName;
                                                                        intent.putExtra("loginType", !str8.equals("com.tencent.mobileqq") ? 13 : str8.equals("com.qzone") ? 14 : str8.equals("com.tencent.WBlog") ? 15 : str8.equals("com.tencent.mm") ? 24 : 26);
                                                                        intent.addFlags(268435456);
                                                                        context.startActivity(intent);
                                                                        return;
                                                                    } else {
                                                                        str6 = "com.tencent.mtt.SplashActivity";
                                                                    }
                                                                    intent.setClassName("com.tencent.mtt", str6);
                                                                    intent.setData(parse);
                                                                    String str82 = context.getApplicationInfo().processName;
                                                                    intent.putExtra("loginType", !str82.equals("com.tencent.mobileqq") ? 13 : str82.equals("com.qzone") ? 14 : str82.equals("com.tencent.WBlog") ? 15 : str82.equals("com.tencent.mm") ? 24 : 26);
                                                                    intent.addFlags(268435456);
                                                                    context.startActivity(intent);
                                                                    return;
                                                                }
                                                                if (c2 == 1) {
                                                                    if (i2 == 1) {
                                                                        str5 = "com.tencent.qbx5.MainActivity";
                                                                    } else if (i2 == 2) {
                                                                        str5 = "com.tencent.qbx5.SplashActivity";
                                                                    }
                                                                    intent.setClassName("com.tencent.qbx5", str5);
                                                                } else if (c2 != 0) {
                                                                    intent = new Intent("com.tencent.QQBrowser.action.VIEW");
                                                                    bVar = l.j(context, parse);
                                                                    if (bVar != null) {
                                                                    }
                                                                } else if (i2 >= 4 && i2 <= 6) {
                                                                    intent.setClassName("com.tencent.qbx", "com.tencent.qbx.SplashActivity");
                                                                } else if (i2 > 6) {
                                                                    intent = new Intent("com.tencent.QQBrowser.action.VIEW");
                                                                    bVar = l.j(context, parse);
                                                                    if (bVar != null) {
                                                                    }
                                                                }
                                                                intent.setData(parse);
                                                                String str822 = context.getApplicationInfo().processName;
                                                                intent.putExtra("loginType", !str822.equals("com.tencent.mobileqq") ? 13 : str822.equals("com.qzone") ? 14 : str822.equals("com.tencent.WBlog") ? 15 : str822.equals("com.tencent.mm") ? 24 : 26);
                                                                intent.addFlags(268435456);
                                                                context.startActivity(intent);
                                                                return;
                                                                intent.setClassName(bVar.b, bVar.f12637a);
                                                                intent.setData(parse);
                                                                String str8222 = context.getApplicationInfo().processName;
                                                                intent.putExtra("loginType", !str8222.equals("com.tencent.mobileqq") ? 13 : str8222.equals("com.qzone") ? 14 : str8222.equals("com.tencent.WBlog") ? 15 : str8222.equals("com.tencent.mm") ? 24 : 26);
                                                                intent.addFlags(268435456);
                                                                context.startActivity(intent);
                                                                return;
                                                            }
                                                            return;
                                                        }
                                                        return;
                                                    }
                                                } catch (PackageManager.NameNotFoundException unused3) {
                                                } catch (Exception unused4) {
                                                    c2 = 2;
                                                }
                                            }
                                            i2 = -1;
                                            c3 = 2;
                                        } catch (PackageManager.NameNotFoundException unused5) {
                                            c3 = 65535;
                                            packageInfo = null;
                                            i2 = -1;
                                        }
                                        try {
                                            packageInfo = packageManager.getPackageInfo("com.tencent.qbx", 0);
                                        } catch (PackageManager.NameNotFoundException unknown) {
                                            packageInfo = packageManager.getPackageInfo("com.tencent.qbx5", 0);
                                            c = 1;
                                        } catch (Exception unused6) {
                                        }
                                        packageInfo = packageManager.getPackageInfo("com.tencent.qbx5", 0);
                                        c = 1;
                                        if (packageInfo != null) {
                                            try {
                                                int i3 = packageInfo.versionCode;
                                                try {
                                                    packageInfo.versionName.replaceAll("\\.", "");
                                                    packageInfo.versionName.replaceAll("\\.", "");
                                                } catch (Exception unused7) {
                                                }
                                                i2 = i3;
                                            } catch (Exception unused8) {
                                            }
                                        }
                                        c2 = c;
                                    } catch (Exception unused9) {
                                    }
                                    if (c2 != 65535) {
                                    }
                                }
                                c2 = 65535;
                                i2 = -1;
                                if (c2 != 65535) {
                                }
                            } else {
                                return;
                            }
                        }
                    }
                    z = false;
                    if (!z) {
                    }
                    try {
                        parse = Uri.parse(str);
                        if (parse == null) {
                        }
                    } catch (Exception unused10) {
                    }
                }
            } else {
                ((z4) cVar).a(str, str2, str3, str4, j2);
            }
        }
    }

    public class c implements WebView.PictureListener {

        /* renamed from: a  reason: collision with root package name */
        public final /* synthetic */ h f12714a;

        public c(h hVar) {
            this.f12714a = hVar;
        }

        public void onNewPicture(WebView webView, Picture picture) {
            w.this.a();
            this.f12714a.a(w.this, picture);
        }
    }

    public class d implements d.c {
        public d(w wVar, h hVar) {
        }
    }

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

        public void run() {
            boolean z;
            Bundle a2;
            if (!w.this.f12706i && w.this.f12705h != 0) {
                synchronized (w.this) {
                    if (!w.this.f12706i) {
                        if (w.this.f12705h != 0) {
                            w.this.f12706i = true;
                            String str = "";
                            String str2 = "";
                            String str3 = "";
                            w wVar = w.this;
                            if (wVar.b && (a2 = wVar.c.C().a()) != null) {
                                str = a2.getString("guid");
                                str2 = a2.getString("qua2");
                                str3 = a2.getString("lc");
                            }
                            try {
                                z = w.this.c.C().h();
                            } catch (Throwable th) {
                                e.w.h.c.e.i("onVisibilityChanged", "", "exception: " + th);
                                z = false;
                            }
                            w wVar2 = w.this;
                            Context context = wVar2.f12703f;
                            int i2 = wVar2.f12705h;
                            boolean z2 = w.this.b;
                            synchronized (d.f12602k) {
                                boolean z3 = d.f12595a;
                                d.f12601j = System.currentTimeMillis();
                            }
                            e.w.h.b.k0.d.f(context, str, str2, str3, i2, z2, 0, z);
                            w.this.f12705h = 0;
                            w.this.f12706i = false;
                        }
                    }
                }
            }
        }
    }

    public static class f implements Runnable {
        public void run() {
            int i2;
            if (w.f12696o != null) {
                d0 a2 = d0.a(true);
                if (!d0.f12610g) {
                    h0 a3 = h0.a(w.f12696o);
                    int h2 = a3.h();
                    if (h2 == 2) {
                        i2 = a3.f();
                    } else {
                        int g2 = a3.g("copy_status");
                        if (g2 == 1) {
                            i2 = a3.i("copy_core_ver");
                        } else if (l0.a().d()) {
                            return;
                        } else {
                            if (h2 == 3 || g2 == 3) {
                                String valueOf = String.valueOf(d0.f12608e);
                                Objects.requireNonNull(a2);
                                d0.f12611h = valueOf;
                                d0.f12610g = true;
                                return;
                            }
                            return;
                        }
                    }
                    String valueOf2 = String.valueOf(i2);
                    Objects.requireNonNull(a2);
                    d0.f12611h = valueOf2;
                    d0.f12610g = true;
                }
            }
        }
    }

    public static class g {
        public g() {
        }

        public g(WebView.HitTestResult hitTestResult) {
        }
    }

    @Deprecated
    public interface h {
        @Deprecated
        void a(w wVar, Picture picture);
    }

    public class i {
        public i(w wVar) {
        }
    }

    public class j extends e.w.e.a.b.t.d.a.a {
        /* JADX WARNING: Illegal instructions before constructor call */
        public j(Context context, AttributeSet attributeSet) {
            super(context, attributeSet);
            Context context2 = w.f12696o;
            Objects.requireNonNull(w.this);
            int i2 = Build.VERSION.SDK_INT;
            if (i2 >= 21 && i2 <= 22) {
                context = context.createConfigurationContext(new Configuration());
            }
            w.f12700s = true;
            boolean z = d.f12595a;
            b.a(w.this.f12703f).b();
            try {
                Method declaredMethod = Class.forName("android.webkit.WebViewWorker").getDeclaredMethod("getHandler", new Class[0]);
                declaredMethod.setAccessible(true);
                ((Handler) declaredMethod.invoke(null, new Object[0])).getLooper().getThread().setUncaughtExceptionHandler(new e0());
            } catch (Exception unused) {
            }
        }

        public void computeScroll() {
            x xVar = w.this.f12707j;
            if (xVar != null) {
                e.w.e.a.a.g.a a2 = e.w.e.a.a.g.i.a(e.w.e.a.a.g.i.this);
                if (a2 != null) {
                    a2.o();
                    return;
                }
                return;
            }
            super.computeScroll();
        }

        public void dispatchDraw(Canvas canvas) {
            try {
                super.dispatchDraw(canvas);
                if (!w.u && w.f12701t != null) {
                    canvas.save();
                    canvas.drawPaint(w.f12701t);
                    canvas.restore();
                }
            } catch (Throwable th) {
                th.printStackTrace();
            }
        }

        public boolean dispatchTouchEvent(MotionEvent motionEvent) {
            x xVar = w.this.f12707j;
            if (xVar == null) {
                return super.dispatchTouchEvent(motionEvent);
            }
            e.w.e.a.a.g.a a2 = e.w.e.a.a.g.i.a(e.w.e.a.a.g.i.this);
            if (a2 == null) {
                return false;
            }
            return a2.p(motionEvent);
        }

        public WebSettings getSettings() {
            try {
                return super.getSettings();
            } catch (Exception e2) {
                e2.printStackTrace();
                return null;
            }
        }

        public void invalidate() {
            super.invalidate();
            x xVar = w.this.f12707j;
            if (xVar != null) {
                Objects.requireNonNull((i.a) xVar);
            }
        }

        public boolean onInterceptTouchEvent(MotionEvent motionEvent) {
            x xVar = w.this.f12707j;
            if (xVar == null) {
                return super.onInterceptTouchEvent(motionEvent);
            }
            e.w.e.a.a.g.a a2 = e.w.e.a.a.g.i.a(e.w.e.a.a.g.i.this);
            if (a2 == null) {
                return false;
            }
            return a2.q(motionEvent);
        }

        @TargetApi(9)
        public void onOverScrolled(int i2, int i3, boolean z, boolean z2) {
            x xVar = w.this.f12707j;
            if (xVar != null) {
                e.w.e.a.a.g.a a2 = e.w.e.a.a.g.i.a(e.w.e.a.a.g.i.this);
                if (a2 != null) {
                    a2.r(i2, i3, z, z2);
                    return;
                }
                return;
            }
            super.onOverScrolled(i2, i3, z, z2);
        }

        public void onScrollChanged(int i2, int i3, int i4, int i5) {
            x xVar = w.this.f12707j;
            if (xVar != null) {
                e.w.e.a.a.g.a a2 = e.w.e.a.a.g.i.a(e.w.e.a.a.g.i.this);
                if (a2 != null) {
                    a2.s(i2, i3, i4, i5);
                    return;
                }
                return;
            }
            super.onScrollChanged(i2, i3, i4, i5);
            w.this.onScrollChanged(i2, i3, i4, i5);
        }

        @SuppressLint({"ClickableViewAccessibility"})
        public boolean onTouchEvent(MotionEvent motionEvent) {
            if (!hasFocus()) {
                requestFocus();
            }
            x xVar = w.this.f12707j;
            if (xVar != null) {
                e.w.e.a.a.g.a a2 = e.w.e.a.a.g.i.a(e.w.e.a.a.g.i.this);
                if (a2 == null) {
                    return false;
                }
                return a2.t(motionEvent);
            }
            try {
                return super.onTouchEvent(motionEvent);
            } catch (Throwable th) {
                th.printStackTrace();
                return false;
            }
        }

        @TargetApi(9)
        public boolean overScrollBy(int i2, int i3, int i4, int i5, int i6, int i7, int i8, int i9, boolean z) {
            x xVar = w.this.f12707j;
            if (xVar == null) {
                return super.overScrollBy(i2, i3, i4, i5, i6, i7, i8, i9, z);
            }
            e.w.e.a.a.g.a a2 = e.w.e.a.a.g.i.a(e.w.e.a.a.g.i.this);
            if (a2 == null) {
                return false;
            }
            return a2.u(i2, i3, i4, i5, i6, i7, i8, i9, z);
        }

        public void p() {
            super.computeScroll();
        }

        public void q(int i2, int i3, int i4, int i5) {
            super.onScrollChanged(i2, i3, i4, i5);
        }

        @TargetApi(9)
        public void r(int i2, int i3, boolean z, boolean z2) {
            super.onOverScrolled(i2, i3, z, z2);
        }

        @TargetApi(9)
        public boolean s(int i2, int i3, int i4, int i5, int i6, int i7, int i8, int i9, boolean z) {
            return super.overScrollBy(i2, i3, i4, i5, i6, i7, i8, i9, z);
        }

        public void setOverScrollMode(int i2) {
            try {
                super.setOverScrollMode(i2);
            } catch (Exception unused) {
            }
        }

        public boolean t(MotionEvent motionEvent) {
            return super.onTouchEvent(motionEvent);
        }

        public boolean u(MotionEvent motionEvent) {
            return super.dispatchTouchEvent(motionEvent);
        }

        public boolean v(MotionEvent motionEvent) {
            return super.onInterceptTouchEvent(motionEvent);
        }
    }

    /* JADX INFO: super call moved to the top of the method (can break code semantics) */
    /* JADX WARNING: Removed duplicated region for block: B:34:0x00f3  */
    /* JADX WARNING: Removed duplicated region for block: B:37:0x00f8  */
    /* JADX WARNING: Removed duplicated region for block: B:46:0x016e  */
    /* JADX WARNING: Removed duplicated region for block: B:47:0x0174  */
    public w(Context context) {
        super(context, null, 0);
        j jVar;
        e.w.h.a.a.g.d dVar;
        j jVar2;
        Exception e2;
        e.w.h.a.a.g.d dVar2;
        boolean z = false;
        System.currentTimeMillis();
        f12697p = true;
        boolean z2 = d.f12595a;
        if (p.a(context)) {
            StringBuilder Z = e.d.a.a.a.Z("new WebView, thread is ");
            Z.append(Thread.currentThread());
            Z.append("stack: ");
            Z.append(Log.getStackTraceString(new Throwable("new WebView Detect")));
            e.w.h.c.e.e("webview", "", Z.toString());
        }
        e.w.h.c.e.h(context);
        if (context != null) {
            e(context);
            this.f12703f = context;
            f12696o = context.getApplicationContext();
            if (!this.b || d.f12597f) {
                this.c = null;
                if (p.a(this.f12703f)) {
                    jVar = new j(context, null);
                } else {
                    jVar = new j(context, null);
                }
                this.d = jVar;
                e.w.h.c.e.e("WebView", "", "SystemWebView Created Success! #2");
                a.b().a();
                this.d.setFocusableInTouchMode(true);
                addView(this.d, new FrameLayout.LayoutParams(-1, -1));
                setDownloadListener(null);
                e.w.h.c.e.j();
                i0.d(context);
            } else {
                m0 b2 = l0.a().b(true);
                Object c2 = b2.f12671a.c("com.tencent.tbs.tbsshell.WebCoreProxy", "createSDKWebview", new Class[]{Context.class}, context);
                if (c2 == null) {
                    try {
                        Object c3 = b2.f12671a.c("com.tencent.tbs.tbsshell.TBSShell", "getLoadFailureDetails", new Class[0], new Object[0]);
                        if (c3 != null && (c3 instanceof Throwable)) {
                            h.b().a(context, 325, (Throwable) c3);
                        }
                        if (c3 != null && (c3 instanceof String)) {
                            h.b().a(context, 325, new Throwable((String) c3));
                        }
                        dVar2 = null;
                    } catch (Exception e3) {
                        e2 = e3;
                        dVar = null;
                        e2.printStackTrace();
                        if (c2 == null) {
                        }
                        this.c = dVar;
                        if (dVar != null) {
                        }
                        e.w.h.c.e.c("WebView", "sys WebView: failed to createTBSWebview", true);
                        this.c = null;
                        this.b = false;
                        d.c(context, "failed to createTBSWebview!");
                        e(context);
                        if (!p.a(this.f12703f)) {
                        }
                        this.d = jVar2;
                        e.w.h.c.e.e("WebView", "", "SystemWebView Created Success! #1");
                        a.b().a();
                        this.d.setFocusableInTouchMode(true);
                        addView(this.d, new FrameLayout.LayoutParams(-1, -1));
                        l("searchBoxJavaBridge_");
                        l("accessibility");
                        l("accessibilityTraversal");
                        e.w.h.c.e.j();
                        i0.d(context);
                        q qVar = this.f12704g;
                        System.currentTimeMillis();
                        Objects.requireNonNull(qVar);
                        return;
                    }
                } else {
                    dVar = (e.w.h.a.a.g.d) c2;
                    try {
                        if (dVar.A() == null) {
                            h.b().a(context, 325, new Throwable("x5webview.getView is null!"));
                            dVar2 = dVar;
                        }
                    } catch (Exception e4) {
                        e2 = e4;
                        e2.printStackTrace();
                        if (c2 == null) {
                        }
                        this.c = dVar;
                        if (dVar != null) {
                        }
                        e.w.h.c.e.c("WebView", "sys WebView: failed to createTBSWebview", true);
                        this.c = null;
                        this.b = false;
                        d.c(context, "failed to createTBSWebview!");
                        e(context);
                        if (!p.a(this.f12703f)) {
                        }
                        this.d = jVar2;
                        e.w.h.c.e.e("WebView", "", "SystemWebView Created Success! #1");
                        a.b().a();
                        this.d.setFocusableInTouchMode(true);
                        addView(this.d, new FrameLayout.LayoutParams(-1, -1));
                        l("searchBoxJavaBridge_");
                        l("accessibility");
                        l("accessibilityTraversal");
                        e.w.h.c.e.j();
                        i0.d(context);
                        q qVar2 = this.f12704g;
                        System.currentTimeMillis();
                        Objects.requireNonNull(qVar2);
                        return;
                    }
                    dVar = c2 == null ? null : dVar;
                    this.c = dVar;
                    if (dVar != null || dVar.A() == null) {
                        e.w.h.c.e.c("WebView", "sys WebView: failed to createTBSWebview", true);
                        this.c = null;
                        this.b = false;
                        d.c(context, "failed to createTBSWebview!");
                        e(context);
                        if (!p.a(this.f12703f)) {
                            jVar2 = new j(context, null);
                        } else {
                            jVar2 = new j(context, null);
                        }
                        this.d = jVar2;
                        e.w.h.c.e.e("WebView", "", "SystemWebView Created Success! #1");
                        a.b().a();
                        this.d.setFocusableInTouchMode(true);
                        addView(this.d, new FrameLayout.LayoutParams(-1, -1));
                        l("searchBoxJavaBridge_");
                        l("accessibility");
                        l("accessibilityTraversal");
                        e.w.h.c.e.j();
                        i0.d(context);
                        q qVar22 = this.f12704g;
                        System.currentTimeMillis();
                        Objects.requireNonNull(qVar22);
                        return;
                    }
                    e.w.h.c.e.e("WebView", "", "X5 WebView Created Success!!");
                    this.c.A().setFocusableInTouchMode(true);
                    addView(this.c.A(), new FrameLayout.LayoutParams(-1, -1));
                    this.c.J(new a0(this, null));
                    e.w.h.a.a.f.a.d C = this.c.C();
                    Object c4 = l0.a().b(true).f12671a.c("com.tencent.tbs.tbsshell.WebCoreProxy", "createDefaultX5WebChromeClientExtension", new Class[0], new Object[0]);
                    C.b(new u(this, c4 == null ? null : (e.w.h.a.a.f.a.c) c4));
                }
                c2 = null;
                dVar = dVar2;
                if (c2 == null) {
                }
                this.c = dVar;
                if (dVar != null) {
                }
                e.w.h.c.e.c("WebView", "sys WebView: failed to createTBSWebview", true);
                this.c = null;
                this.b = false;
                d.c(context, "failed to createTBSWebview!");
                e(context);
                if (!p.a(this.f12703f)) {
                }
                this.d = jVar2;
                e.w.h.c.e.e("WebView", "", "SystemWebView Created Success! #1");
                a.b().a();
                this.d.setFocusableInTouchMode(true);
                addView(this.d, new FrameLayout.LayoutParams(-1, -1));
                try {
                    l("searchBoxJavaBridge_");
                    l("accessibility");
                    l("accessibilityTraversal");
                } catch (Throwable th) {
                    th.printStackTrace();
                }
                e.w.h.c.e.j();
                i0.d(context);
                q qVar222 = this.f12704g;
                System.currentTimeMillis();
                Objects.requireNonNull(qVar222);
                return;
            }
            try {
                l("searchBoxJavaBridge_");
                l("accessibility");
                l("accessibilityTraversal");
            } catch (Throwable th2) {
                th2.printStackTrace();
            }
            if ("com.tencent.mobileqq".equals(this.f12703f.getApplicationInfo().packageName) || "com.tencent.mm".equals(this.f12703f.getApplicationInfo().packageName)) {
                Objects.requireNonNull(d0.a(true));
                Object obj = d.f12596e;
                if (obj != null) {
                    Object m2 = l.m(obj, "useSoftWare", new Class[0], new Object[0]);
                    m2 = m2 == null ? l.m(d.f12596e, "useSoftWare", new Class[]{Integer.TYPE}, Integer.valueOf(z.a())) : m2;
                    if (m2 != null) {
                        z = ((Boolean) m2).booleanValue();
                    }
                }
                if (z) {
                    setLayerType(1, null);
                }
            }
            if (this.c != null) {
                e.w.h.c.e.j();
            }
            q qVar2222 = this.f12704g;
            System.currentTimeMillis();
            Objects.requireNonNull(qVar2222);
            return;
        }
        throw new IllegalArgumentException("Invalid context argument");
    }

    public static void g() {
        try {
            new Thread(new f()).start();
        } catch (Throwable th) {
            e.w.h.c.e.b("webview", "", "updateRebootStatus excpetion: " + th);
        }
    }

    public static PackageInfo getCurrentWebViewPackage() {
        if (l0.a().d() || Build.VERSION.SDK_INT < 26) {
            return null;
        }
        try {
            return (PackageInfo) l.n("android.webkit.WebView", "getCurrentWebViewPackage");
        } catch (Exception e2) {
            e2.printStackTrace();
            return null;
        }
    }

    @Deprecated
    public static synchronized Object getPluginList() {
        synchronized (w.class) {
            if (l0.a().d()) {
                return null;
            }
            return l.n("android.webkit.WebView", "getPluginList");
        }
    }

    /* JADX WARNING: Removed duplicated region for block: B:23:0x005f A[SYNTHETIC, Splitter:B:23:0x005f] */
    /* JADX WARNING: Removed duplicated region for block: B:29:0x006a  */
    /* JADX WARNING: Removed duplicated region for block: B:30:0x006e  */
    /* JADX WARNING: Removed duplicated region for block: B:36:0x007a A[SYNTHETIC, Splitter:B:36:0x007a] */
    public static boolean getTbsNeedReboot() {
        Throwable th;
        int i2;
        BufferedInputStream bufferedInputStream;
        Exception e2;
        g();
        d0 a2 = d0.a(true);
        Objects.requireNonNull(a2);
        if (d0.f12610g) {
            if (d0.f12611h == null) {
                return false;
            }
            BufferedInputStream bufferedInputStream2 = null;
            try {
                File file = new File(a2.c, "count.prop");
                if (!file.exists()) {
                    i2 = 0;
                    if (i2 != 0) {
                        a2.c(1);
                    } else {
                        int i3 = i2 + 1;
                        if (i3 > 3) {
                            return false;
                        }
                        a2.c(i3);
                    }
                } else {
                    bufferedInputStream = new BufferedInputStream(new FileInputStream(file));
                    try {
                        Properties properties = new Properties();
                        properties.load(bufferedInputStream);
                        i2 = Integer.valueOf(properties.getProperty(d0.f12611h, "1")).intValue();
                        try {
                            bufferedInputStream.close();
                        } catch (IOException e3) {
                            e3.printStackTrace();
                        }
                    } catch (Exception e4) {
                        e2 = e4;
                        try {
                            e2.printStackTrace();
                            if (bufferedInputStream != null) {
                                try {
                                    bufferedInputStream.close();
                                } catch (IOException e5) {
                                    e5.printStackTrace();
                                }
                            }
                            i2 = 0;
                            if (i2 != 0) {
                            }
                            return d0.f12610g;
                        } catch (Throwable th2) {
                            th = th2;
                            bufferedInputStream2 = bufferedInputStream;
                            if (bufferedInputStream2 != null) {
                                try {
                                    bufferedInputStream2.close();
                                } catch (IOException e6) {
                                    e6.printStackTrace();
                                }
                            }
                            throw th;
                        }
                    }
                    if (i2 != 0) {
                    }
                }
            } catch (Exception e7) {
                bufferedInputStream = null;
                e2 = e7;
                e2.printStackTrace();
                if (bufferedInputStream != null) {
                }
                i2 = 0;
                if (i2 != 0) {
                }
                return d0.f12610g;
            } catch (Throwable th3) {
                th = th3;
                if (bufferedInputStream2 != null) {
                }
                throw th;
            }
        }
        return d0.f12610g;
    }

    public static void setDataDirectorySuffix(String str) {
        if (Build.VERSION.SDK_INT >= 28) {
            try {
                l.k(Class.forName("android.webkit.WebView"), "setDataDirectorySuffix", new Class[]{String.class}, str);
            } catch (Exception e2) {
                e2.printStackTrace();
            }
        }
        HashMap i0 = e.d.a.a.a.i0("data_directory_suffix", str);
        Map<String, Object> map = d.f12607p;
        if (map == null) {
            d.f12607p = i0;
            return;
        }
        try {
            map.putAll(i0);
        } catch (Exception e3) {
            e3.printStackTrace();
        }
    }

    public static synchronized void setSysDayOrNight(boolean z) {
        int i2;
        Paint paint;
        synchronized (w.class) {
            if (z != u) {
                u = z;
                if (f12701t == null) {
                    Paint paint2 = new Paint();
                    f12701t = paint2;
                    paint2.setColor(-16777216);
                }
                if (!z) {
                    int alpha = f12701t.getAlpha();
                    i2 = v;
                    if (alpha != i2) {
                        paint = f12701t;
                    }
                }
                i2 = 255;
                if (f12701t.getAlpha() != 255) {
                    paint = f12701t;
                }
                paint.setAlpha(i2);
            }
        }
    }

    public static void setWebContentsDebuggingEnabled(boolean z) {
        Class<?> cls = Boolean.TYPE;
        l0 a2 = l0.a();
        if (a2 == null || !a2.d()) {
            try {
                Method declaredMethod = Class.forName("android.webkit.WebView").getDeclaredMethod("setWebContentsDebuggingEnabled", cls);
                f12698q = declaredMethod;
                if (declaredMethod != null) {
                    declaredMethod.setAccessible(true);
                    f12698q.invoke(null, Boolean.valueOf(z));
                }
            } catch (Exception e2) {
                StringBuilder Z = e.d.a.a.a.Z("Exception:");
                Z.append(e2.getStackTrace());
                e.w.h.c.e.b("QbSdk", "", Z.toString());
                e2.printStackTrace();
            }
        } else {
            a2.e().f12671a.c("com.tencent.tbs.tbsshell.WebCoreProxy", "webview_setWebContentsDebuggingEnabled", new Class[]{cls}, Boolean.valueOf(z));
        }
    }

    public void a() {
    }

    public void addView(View view) {
        if (!this.b) {
            this.d.addView(view);
            return;
        }
        View A = this.c.A();
        try {
            Method s2 = l.s(A, "addView", View.class);
            s2.setAccessible(true);
            s2.invoke(A, view);
        } catch (Throwable unused) {
        }
    }

    public final void b(boolean z) {
        Object c2;
        if (!this.f12706i && this.f12705h != 0) {
            i();
        }
        String str = null;
        if (!this.b) {
            try {
                Class<?> cls = Class.forName("android.webkit.WebViewClassic");
                Method method = cls.getMethod("fromWebView", WebView.class);
                method.setAccessible(true);
                Object invoke = method.invoke(null, this.d);
                if (invoke != null) {
                    Field declaredField = cls.getDeclaredField("mListBoxDialog");
                    declaredField.setAccessible(true);
                    Object obj = declaredField.get(invoke);
                    if (obj != null) {
                        Dialog dialog = (Dialog) obj;
                        dialog.setOnCancelListener(null);
                        Class<?> cls2 = Class.forName("android.app.Dialog");
                        Field declaredField2 = cls2.getDeclaredField(DownloadTask.DOWNLOAD_STATUS_CANCEL);
                        declaredField2.setAccessible(true);
                        int intValue = ((Integer) declaredField2.get(dialog)).intValue();
                        Field declaredField3 = cls2.getDeclaredField("mListenersHandler");
                        declaredField3.setAccessible(true);
                        ((Handler) declaredField3.get(dialog)).removeMessages(intValue);
                    }
                }
            } catch (Exception unused) {
            }
            if (z) {
                this.d.destroy();
            }
            try {
                e.w.h.c.e.e("sdkreport", "", "webview.tbsWebviewDestroy mQQMusicCrashFix is " + this.f12708k);
                if (!this.f12708k) {
                    Field declaredField4 = Class.forName("android.webkit.BrowserFrame").getDeclaredField("sConfigCallback");
                    declaredField4.setAccessible(true);
                    ComponentCallbacks componentCallbacks = (ComponentCallbacks) declaredField4.get(null);
                    if (componentCallbacks != null) {
                        declaredField4.set(null, null);
                        Field declaredField5 = Class.forName("android.view.ViewRoot").getDeclaredField("sConfigCallbacks");
                        declaredField5.setAccessible(true);
                        Object obj2 = declaredField5.get(null);
                        if (obj2 != null) {
                            List list = (List) obj2;
                            synchronized (list) {
                                list.remove(componentCallbacks);
                            }
                        }
                    }
                } else {
                    return;
                }
            } catch (Exception unused2) {
            }
        } else if (z) {
            this.c.destroy();
        }
        StringBuilder Z = e.d.a.a.a.Z("X5 GUID = ");
        boolean z2 = d.f12595a;
        l0 a2 = l0.a();
        if (a2 != null && a2.d() && (c2 = a2.e().f12671a.c("com.tencent.tbs.tbsshell.WebCoreProxy", "getGUID", new Class[0], new Object[0])) != null && (c2 instanceof String)) {
            str = (String) c2;
        }
        Z.append(str);
        e.w.h.c.e.e("WebView", "", Z.toString());
    }

    public final boolean c(View view) {
        Object m2;
        Context context = this.f12703f;
        if ((context == null || d.k(context) <= 36200) && (m2 = l.m(this.f12710m, "onLongClick", new Class[]{View.class}, view)) != null) {
            return ((Boolean) m2).booleanValue();
        }
        return false;
    }

    public int computeHorizontalScrollExtent() {
        try {
            if (this.b) {
                Method s2 = l.s(this.c.A(), "computeHorizontalScrollExtent", new Class[0]);
                s2.setAccessible(true);
                return ((Integer) s2.invoke(this.c.A(), new Object[0])).intValue();
            }
            Method s3 = l.s(this.d, "computeHorizontalScrollExtent", new Class[0]);
            s3.setAccessible(true);
            return ((Integer) s3.invoke(this.d, new Object[0])).intValue();
        } catch (Exception e2) {
            e2.printStackTrace();
            return -1;
        }
    }

    public int computeHorizontalScrollOffset() {
        try {
            if (this.b) {
                Method s2 = l.s(this.c.A(), "computeHorizontalScrollOffset", new Class[0]);
                s2.setAccessible(true);
                return ((Integer) s2.invoke(this.c.A(), new Object[0])).intValue();
            }
            Method s3 = l.s(this.d, "computeHorizontalScrollOffset", new Class[0]);
            s3.setAccessible(true);
            return ((Integer) s3.invoke(this.d, new Object[0])).intValue();
        } catch (Exception e2) {
            e2.printStackTrace();
            return -1;
        }
    }

    public int computeHorizontalScrollRange() {
        try {
            if (this.b) {
                return ((Integer) l.m(this.c.A(), "computeHorizontalScrollRange", new Class[0], new Object[0])).intValue();
            }
            Method s2 = l.s(this.d, "computeHorizontalScrollRange", new Class[0]);
            s2.setAccessible(true);
            return ((Integer) s2.invoke(this.d, new Object[0])).intValue();
        } catch (Exception e2) {
            e2.printStackTrace();
            return -1;
        }
    }

    public void computeScroll() {
        if (!this.b) {
            this.d.computeScroll();
        } else {
            this.c.u();
        }
    }

    public int computeVerticalScrollExtent() {
        try {
            if (this.b) {
                Method s2 = l.s(this.c.A(), "computeVerticalScrollExtent", new Class[0]);
                s2.setAccessible(true);
                return ((Integer) s2.invoke(this.c.A(), new Object[0])).intValue();
            }
            Method s3 = l.s(this.d, "computeVerticalScrollExtent", new Class[0]);
            s3.setAccessible(true);
            return ((Integer) s3.invoke(this.d, new Object[0])).intValue();
        } catch (Exception e2) {
            e2.printStackTrace();
            return -1;
        }
    }

    public int computeVerticalScrollOffset() {
        try {
            if (this.b) {
                Method s2 = l.s(this.c.A(), "computeVerticalScrollOffset", new Class[0]);
                s2.setAccessible(true);
                return ((Integer) s2.invoke(this.c.A(), new Object[0])).intValue();
            }
            Method s3 = l.s(this.d, "computeVerticalScrollOffset", new Class[0]);
            s3.setAccessible(true);
            return ((Integer) s3.invoke(this.d, new Object[0])).intValue();
        } catch (Exception e2) {
            e2.printStackTrace();
            return -1;
        }
    }

    public int computeVerticalScrollRange() {
        try {
            if (this.b) {
                return ((Integer) l.m(this.c.A(), "computeVerticalScrollRange", new Class[0], new Object[0])).intValue();
            }
            Method s2 = l.s(this.d, "computeVerticalScrollRange", new Class[0]);
            s2.setAccessible(true);
            return ((Integer) s2.invoke(this.d, new Object[0])).intValue();
        } catch (Exception e2) {
            e2.printStackTrace();
            return -1;
        }
    }

    public void d(Object obj, String str) {
        if (!this.b) {
            this.d.addJavascriptInterface(obj, str);
        } else {
            this.c.b(obj, str);
        }
    }

    /* JADX WARNING: Removed duplicated region for block: B:32:0x00d4  */
    /* JADX WARNING: Removed duplicated region for block: B:58:0x01fb  */
    public final void e(Context context) {
        Throwable th;
        String str;
        String str2;
        StringBuilder sb;
        String sb2;
        System.currentTimeMillis();
        l0 a2 = l0.a();
        synchronized (a2) {
            if (a2.c) {
                boolean z = d.f12595a;
                e.w.h.c.e.i("X5CoreEngine", "", "coreEngine has init, mCanUseX5=" + a2.b);
            } else {
                e.w.h.c.e.e("X5CoreEngine", "init", "#1# Start init");
                d0 a3 = d0.a(true);
                a3.b(context, false, false);
                e.w.h.c.e.e("X5CoreEngine", "init", "#2# SDKEngine init finish");
                StringBuilder sb3 = new StringBuilder();
                boolean z2 = a3.b;
                Object obj = null;
                j0 j0Var = z2 ? a3.f12612a : null;
                if (!z2 || j0Var == null) {
                    a2.b = false;
                    e.w.h.c.e.b("X5CoreEngine", "init", "SDKEngine tbs not available!");
                    sb3.append("SDKEngine tbs not available_");
                } else if (!a2.d) {
                    e.w.h.c.e.e("X5CoreEngine", "init", "#3-1# X5CoreWizard start to load dex and so");
                    m0 m0Var = new m0(j0Var.f12634e);
                    a2.f12646a = m0Var;
                    try {
                        boolean a4 = m0Var.a();
                        a2.b = a4;
                        if (!a4) {
                            sb3.append("can not use X5 by x5corewizard return false");
                        }
                    } catch (NoSuchMethodException unused) {
                        a2.b = true;
                        sb3.append("NoSuchMethodException");
                    } catch (Throwable th2) {
                        th = th2;
                        a2.b = false;
                        sb3.append("can not use x5 by x5corewizard throwable ");
                        sb3.append(Log.getStackTraceString(th));
                    }
                    th = null;
                    sb3.append("mCanUseX5 is ");
                    sb3.append(a2.b);
                    if (a2.b) {
                        a.b().a();
                    }
                    a2.d = true;
                    e.w.h.c.e.e("X5CoreEngine", "", "init  mCanUseX5 is " + a2.b);
                    if (a2.b) {
                        e.w.h.c.e.b("X5CoreEngine", "", "mCanUseX5 is false --> report");
                        boolean z3 = a3.b;
                        if (z3 && j0Var != null && th == null) {
                            try {
                                e.w.h.a.a.e eVar = j0Var.f12634e;
                                if (eVar != null) {
                                    obj = eVar.c("com.tencent.tbs.tbsshell.TBSShell", "getLoadFailureDetails", new Class[0], new Object[0]);
                                }
                                if (obj instanceof Throwable) {
                                    Throwable th3 = (Throwable) obj;
                                    sb3.append("#");
                                    sb3.append(th3.getMessage());
                                    sb3.append("; cause: ");
                                    sb3.append(th3.getCause());
                                    sb3.append("; th: ");
                                    sb3.append(th3);
                                }
                                if (obj instanceof String) {
                                    sb3.append("failure detail: ");
                                    sb3.append(obj);
                                }
                            } catch (Throwable th4) {
                                e.w.h.c.e.b("X5CoreEngine", "init", Log.getStackTraceString(th4));
                            }
                            if (sb3.toString().contains("isPreloadX5Disabled:-10000")) {
                                h.b().a(context, 408, new Throwable("Core Crash, details: " + sb3.toString()));
                                str = "X5CoreEngine";
                                sb = new StringBuilder();
                                sb.append("[LoadError] Core Crash, details: ");
                                sb2 = sb3.toString();
                            } else {
                                h.b().a(context, 407, new Throwable("Failed in Core, details: " + sb3.toString()));
                                str = "X5CoreEngine";
                                sb = new StringBuilder();
                                sb.append("[LoadError] Failed in Core, details: ");
                                sb2 = sb3.toString();
                            }
                        } else if (z3) {
                            h.b().a(context, 409, new Throwable("mCanUseX5=false, available true, reason: " + sb3.toString()));
                            str = "X5CoreEngine";
                            sb = new StringBuilder();
                            sb.append("[LoadError] details: ");
                            sb2 = sb3.toString();
                        } else {
                            h.b().a(context, 410, new Throwable());
                            str = "X5CoreEngine";
                            str2 = "[LoadError] mCanUseX5=false, available=false";
                            e.w.h.c.e.b(str, "init", str2);
                        }
                        sb.append(sb2);
                        str2 = sb.toString();
                        e.w.h.c.e.b(str, "init", str2);
                    } else {
                        e.w.h.c.e.e("X5CoreEngine", "init", "#5# sTbsCoreLoadFileLock is " + l0.f12645f);
                        if (l0.f12645f == null) {
                            a2.c(context);
                        }
                    }
                    a2.c = true;
                }
                th = null;
                e.w.h.c.e.e("X5CoreEngine", "", "init  mCanUseX5 is " + a2.b);
                if (a2.b) {
                }
                a2.c = true;
            }
        }
        q qVar = this.f12704g;
        System.currentTimeMillis();
        Objects.requireNonNull(qVar);
        this.b = a2.d();
    }

    public SslCertificate getCertificate() {
        return !this.b ? this.d.getCertificate() : this.c.F();
    }

    public int getContentHeight() {
        return !this.b ? this.d.getContentHeight() : this.c.G();
    }

    public int getContentWidth() {
        if (this.b) {
            return this.c.v();
        }
        Object l2 = l.l(this.d, "getContentWidth");
        if (l2 == null) {
            return 0;
        }
        return ((Integer) l2).intValue();
    }

    public Bitmap getFavicon() {
        return !this.b ? this.d.getFavicon() : this.c.y();
    }

    public g getHitTestResult() {
        if (!this.b) {
            return new g(this.d.getHitTestResult());
        }
        this.c.e();
        return new g();
    }

    public boolean getIsX5Core() {
        return this.b;
    }

    @TargetApi(3)
    public String getOriginalUrl() {
        return !this.b ? this.d.getOriginalUrl() : this.c.r();
    }

    public q getPerformanceRecorder() {
        return this.f12704g;
    }

    public int getProgress() {
        return !this.b ? this.d.getProgress() : this.c.k();
    }

    public boolean getRendererPriorityWaivedWhenNotVisible() {
        try {
            if (this.b || Build.VERSION.SDK_INT < 26) {
                return false;
            }
            Object l2 = l.l(this.d, "getRendererPriorityWaivedWhenNotVisible");
            if (l2 == null) {
                return false;
            }
            return ((Boolean) l2).booleanValue();
        } catch (Exception e2) {
            e2.printStackTrace();
            return false;
        }
    }

    public int getRendererRequestedPriority() {
        try {
            if (this.b || Build.VERSION.SDK_INT < 26) {
                return 0;
            }
            Object l2 = l.l(this.d, "getRendererRequestedPriority");
            if (l2 == null) {
                return 0;
            }
            return ((Integer) l2).intValue();
        } catch (Exception e2) {
            e2.printStackTrace();
            return 0;
        }
    }

    @Deprecated
    public float getScale() {
        if (this.b) {
            return this.c.s();
        }
        Object l2 = l.l(this.d, "getScale");
        return l2 == null ? CropImageView.DEFAULT_ASPECT_RATIO : ((Float) l2).floatValue();
    }

    public int getScrollBarDefaultDelayBeforeFade() {
        if (getView() == null) {
            return 0;
        }
        return getView().getScrollBarDefaultDelayBeforeFade();
    }

    public int getScrollBarFadeDuration() {
        if (getView() == null) {
            return 0;
        }
        return getView().getScrollBarFadeDuration();
    }

    public int getScrollBarSize() {
        if (getView() == null) {
            return 0;
        }
        return getView().getScrollBarSize();
    }

    public int getScrollBarStyle() {
        if (getView() == null) {
            return 0;
        }
        return getView().getScrollBarStyle();
    }

    public t getSettings() {
        t tVar = this.f12702e;
        if (tVar != null) {
            return tVar;
        }
        t tVar2 = this.b ? new t(this.c.g()) : new t(this.d.getSettings());
        this.f12702e = tVar2;
        return tVar2;
    }

    public e.w.h.a.a.f.a.b getSettingsExtension() {
        if (!this.b) {
            return null;
        }
        return this.c.C().f();
    }

    public int getSysNightModeAlpha() {
        return v;
    }

    public String getTitle() {
        return !this.b ? this.d.getTitle() : this.c.getTitle();
    }

    public String getUrl() {
        return !this.b ? this.d.getUrl() : this.c.f();
    }

    public View getView() {
        return !this.b ? this.d : this.c.A();
    }

    public int getVisibleTitleHeight() {
        if (this.b) {
            return this.c.I();
        }
        Object l2 = l.l(this.d, "getVisibleTitleHeight");
        if (l2 == null) {
            return 0;
        }
        return ((Integer) l2).intValue();
    }

    public s getWebChromeClient() {
        return this.f12709l;
    }

    public e.w.h.a.a.f.a.a getWebChromeClientExtension() {
        if (!this.b) {
            return null;
        }
        return this.c.C().g();
    }

    public int getWebScrollX() {
        return this.b ? this.c.A().getScrollX() : this.d.getScrollX();
    }

    public int getWebScrollY() {
        return this.b ? this.c.A().getScrollY() : this.d.getScrollY();
    }

    public y getWebViewClient() {
        return null;
    }

    public e.w.h.a.a.f.a.c getWebViewClientExtension() {
        if (!this.b) {
            return null;
        }
        return this.c.C().e();
    }

    public d.b getX5HitTestResult() {
        if (!this.b) {
            return null;
        }
        return this.c.e();
    }

    public e.w.h.a.a.f.a.d getX5WebViewExtension() {
        if (!this.b) {
            return null;
        }
        return this.c.C();
    }

    @Deprecated
    public View getZoomControls() {
        return !this.b ? (View) l.l(this.d, "getZoomControls") : this.c.E();
    }

    public void h(String str, r<String> rVar) {
        if (this.b) {
            try {
                Method s2 = l.s(this.c.A(), "evaluateJavascript", String.class, ValueCallback.class);
                s2.setAccessible(true);
                s2.invoke(this.c.A(), str, rVar);
            } catch (Exception e2) {
                e2.printStackTrace();
                k(str);
            }
        } else {
            try {
                Method declaredMethod = Class.forName("android.webkit.WebView").getDeclaredMethod("evaluateJavascript", String.class, ValueCallback.class);
                declaredMethod.setAccessible(true);
                declaredMethod.invoke(this.d, str, rVar);
            } catch (Exception e3) {
                e3.printStackTrace();
            }
        }
    }

    public final void i() {
        e eVar = new e();
        Handler handler = e.w.h.c.e.f12727a;
        if (handler != null) {
            Message obtain = Message.obtain(handler, 501);
            obtain.obj = eVar;
            obtain.sendToTarget();
            return;
        }
        Thread thread = new Thread(eVar);
        thread.setName("TbsPV");
        thread.start();
    }

    public void j(String str, String str2, String str3, String str4, String str5) {
        if (!this.b) {
            this.d.loadDataWithBaseURL(str, str2, str3, str4, str5);
        } else {
            this.c.n(str, str2, str3, str4, str5);
        }
    }

    public void k(String str) {
        long currentTimeMillis = System.currentTimeMillis();
        if (str != null && !m(str)) {
            if (!this.b) {
                this.d.loadUrl(str);
            } else {
                this.c.B(str);
            }
            q qVar = this.f12704g;
            qVar.b += System.currentTimeMillis() - currentTimeMillis;
            qVar.f12691a++;
        }
    }

    @TargetApi(11)
    public void l(String str) {
        if (!this.b) {
            l.m(this.d, "removeJavascriptInterface", new Class[]{String.class}, str);
            return;
        }
        this.c.z(str);
    }

    @SuppressLint({"NewApi"})
    public boolean m(String str) {
        String lowerCase = str.toLowerCase();
        if (lowerCase.startsWith("https://debugtbs.qq.com")) {
            getView().setVisibility(4);
            Context context = this.f12703f;
            if (o.d == null) {
                o.d = new o(context);
            }
            o.d.a(lowerCase, this, this.f12703f, k.a().getLooper());
            return true;
        } else if (!lowerCase.startsWith("https://debugx5.qq.com") || this.b) {
            return false;
        } else {
            j(null, e.d.a.a.a.V(e.d.a.a.a.g0("<!DOCTYPE html><html><body>", "<head>", "<title>无法打开debugx5</title>", "<meta name=\"viewport\" content=\"width=device-width, user-scalable=no\" />", "</head>"), "<br/><br /><h2>debugx5页面仅在使用了X5内核时有效,由于当前没有使用X5内核,无法打开debugx5!</h2><br />", "尝试<a href=\"https://debugtbs.qq.com?10000\">进入DebugTbs安装或打开X5内核</a>", "</body></html>"), "text/html", JsonRequest.PROTOCOL_CHARSET, null);
            return true;
        }
    }

    public void onDetachedFromWindow() {
        super.onDetachedFromWindow();
        if (!this.f12706i && this.f12705h != 0) {
            i();
        }
    }

    public boolean onLongClick(View view) {
        View.OnLongClickListener onLongClickListener = this.f12711n;
        if (onLongClickListener == null) {
            return c(view);
        }
        if (!onLongClickListener.onLongClick(view)) {
            return c(view);
        }
        return true;
    }

    @TargetApi(11)
    public void onSizeChanged(int i2, int i3, int i4, int i5) {
        boolean z;
        super.onSizeChanged(i2, i3, i4, i5);
        if (Build.VERSION.SDK_INT >= 21) {
            try {
                if (this.f12703f.getPackageName().indexOf("com.tencent.mobileqq") >= 0) {
                    z = true;
                    if (z && isHardwareAccelerated() && i2 > 0 && i3 > 0) {
                        getLayerType();
                        return;
                    }
                    return;
                }
            } catch (Throwable th) {
                th.printStackTrace();
            }
            z = false;
            if (z) {
            }
        }
    }

    public void onVisibilityChanged(View view, int i2) {
        Context context = this.f12703f;
        if (context == null) {
            super.onVisibilityChanged(view, i2);
            return;
        }
        if (f12699r == null) {
            f12699r = context.getApplicationInfo().packageName;
        }
        String str = f12699r;
        if (str == null || (!str.equals("com.tencent.mm") && !f12699r.equals("com.tencent.mobileqq"))) {
            if (!(i2 == 0 || this.f12706i || this.f12705h == 0)) {
                i();
            }
            super.onVisibilityChanged(view, i2);
            return;
        }
        super.onVisibilityChanged(view, i2);
    }

    public void removeView(View view) {
        if (!this.b) {
            this.d.removeView(view);
            return;
        }
        View A = this.c.A();
        try {
            Method s2 = l.s(A, "removeView", View.class);
            s2.setAccessible(true);
            s2.invoke(A, view);
        } catch (Throwable unused) {
        }
    }

    public boolean requestChildRectangleOnScreen(View view, Rect rect, boolean z) {
        if (this.b) {
            View A = this.c.A();
            if (!(A instanceof ViewGroup)) {
                return false;
            }
            ViewGroup viewGroup = (ViewGroup) A;
            if (view == this) {
                view = A;
            }
            return viewGroup.requestChildRectangleOnScreen(view, rect, z);
        }
        j jVar = this.d;
        if (view == this) {
            view = jVar;
        }
        return jVar.requestChildRectangleOnScreen(view, rect, z);
    }

    public void setARModeEnable(boolean z) {
        try {
            if (this.b) {
                getSettingsExtension().b(z);
            }
        } catch (Throwable th) {
            th.printStackTrace();
        }
    }

    public void setBackgroundColor(int i2) {
        if (!this.b) {
            this.d.setBackgroundColor(i2);
        } else {
            this.c.c(i2);
        }
        super.setBackgroundColor(i2);
    }

    @Deprecated
    public void setCertificate(SslCertificate sslCertificate) {
        if (!this.b) {
            this.d.setCertificate(sslCertificate);
        } else {
            this.c.p(sslCertificate);
        }
    }

    public void setDayOrNight(boolean z) {
        try {
            if (this.b) {
                getSettingsExtension().a(z);
            }
            setSysDayOrNight(z);
            getView().postInvalidate();
        } catch (Throwable th) {
            th.printStackTrace();
        }
    }

    public void setDownloadListener(c cVar) {
        if (!this.b) {
            this.d.setDownloadListener(new b(cVar));
        } else {
            this.c.J(new a0(this, cVar));
        }
    }

    @TargetApi(16)
    public void setFindListener(d.a aVar) {
        if (!this.b) {
            this.d.setFindListener(new a(this, aVar));
        } else {
            this.c.q(aVar);
        }
    }

    public void setHorizontalScrollbarOverlay(boolean z) {
        if (!this.b) {
            this.d.setHorizontalScrollbarOverlay(z);
        } else {
            this.c.o(z);
        }
    }

    public void setInitialScale(int i2) {
        if (!this.b) {
            this.d.setInitialScale(i2);
        } else {
            this.c.D(i2);
        }
    }

    @Deprecated
    public void setMapTrackballToArrowKeys(boolean z) {
        if (!this.b) {
            l.m(this.d, "setMapTrackballToArrowKeys", new Class[]{Boolean.TYPE}, Boolean.valueOf(z));
            return;
        }
        this.c.l(z);
    }

    public void setNetworkAvailable(boolean z) {
        if (!this.b) {
            this.d.setNetworkAvailable(z);
        } else {
            this.c.K(z);
        }
    }

    public void setOnLongClickListener(View.OnLongClickListener onLongClickListener) {
        if (!this.b) {
            this.d.setOnLongClickListener(onLongClickListener);
            return;
        }
        View A = this.c.A();
        try {
            if (this.f12710m == null) {
                Method s2 = l.s(A, "getListenerInfo", new Class[0]);
                s2.setAccessible(true);
                Object invoke = s2.invoke(A, null);
                Field declaredField = invoke.getClass().getDeclaredField("mOnLongClickListener");
                declaredField.setAccessible(true);
                this.f12710m = declaredField.get(invoke);
            }
            this.f12711n = onLongClickListener;
            getView().setOnLongClickListener(this);
        } catch (Throwable unused) {
        }
    }

    public void setOnTouchListener(View.OnTouchListener onTouchListener) {
        getView().setOnTouchListener(onTouchListener);
    }

    @Deprecated
    public void setPictureListener(h hVar) {
        if (!this.b) {
            if (hVar == null) {
                this.d.setPictureListener(null);
            } else {
                this.d.setPictureListener(new c(hVar));
            }
        } else if (hVar == null) {
            this.c.H(null);
        } else {
            this.c.H(new d(this, hVar));
        }
    }

    public void setScrollBarStyle(int i2) {
        if (this.b) {
            this.c.A().setScrollBarStyle(i2);
        } else {
            this.d.setScrollBarStyle(i2);
        }
    }

    public void setSysNightModeAlpha(int i2) {
        v = i2;
    }

    public void setVerticalScrollbarOverlay(boolean z) {
        if (!this.b) {
            this.d.setVerticalScrollbarOverlay(z);
        } else {
            this.c.t(z);
        }
    }

    public void setVisibility(int i2) {
        super.setVisibility(i2);
        if (getView() != null) {
            getView().setVisibility(i2);
        }
    }

    public void setWebChromeClient(s sVar) {
        j jVar;
        Object c2;
        boolean z = false;
        WebChromeClient webChromeClient = null;
        r3 = null;
        e.w.h.a.a.g.b bVar = null;
        f0 f0Var = null;
        if (this.b) {
            e.w.h.a.a.g.d dVar = this.c;
            if (sVar != null) {
                e.w.h.a.a.e eVar = l0.a().b(true).f12671a;
                if (!(eVar == null || (c2 = eVar.c("com.tencent.tbs.tbsshell.WebCoreProxy", "createDefaultX5WebChromeClient", new Class[0], new Object[0])) == null)) {
                    bVar = (e.w.h.a.a.g.b) c2;
                }
                f0Var = new f0(bVar, this, sVar);
            }
            dVar.w(f0Var);
        } else {
            if (sVar != null) {
                boolean z2 = false;
                boolean z3 = false;
                for (Class<?> cls = sVar.getClass(); cls != s.class && (!z2 || !z3); cls = cls.getSuperclass()) {
                    if (!z2) {
                        try {
                            cls.getDeclaredMethod("onShowCustomView", View.class, b.a.class);
                            z2 = true;
                        } catch (NoSuchMethodException unused) {
                        }
                    }
                    if (!z3) {
                        try {
                            cls.getDeclaredMethod("onHideCustomView", new Class[0]);
                            z3 = true;
                        } catch (NoSuchMethodException unused2) {
                        }
                    }
                }
                if (z2 && z3) {
                    z = true;
                }
                jVar = this.d;
                webChromeClient = z ? new b0(this, sVar) : new e(this, sVar);
            } else {
                jVar = this.d;
            }
            jVar.setWebChromeClient(webChromeClient);
        }
        this.f12709l = sVar;
    }

    public void setWebChromeClientExtension(e.w.h.a.a.f.a.a aVar) {
        if (this.b) {
            this.c.C().c(aVar);
        }
    }

    public void setWebViewCallbackClient(x xVar) {
        this.f12707j = xVar;
        if (this.b && getX5WebViewExtension() != null) {
            Bundle bundle = new Bundle();
            bundle.putBoolean("flag", true);
            getX5WebViewExtension().d("setWebViewCallbackClientFlag", bundle);
        }
    }

    public void setWebViewClient(y yVar) {
        f fVar = null;
        if (this.b) {
            e.w.h.a.a.g.d dVar = this.c;
            if (yVar == null) {
                dVar.i(null);
                return;
            }
            Object c2 = l0.a().b(true).f12671a.c("com.tencent.tbs.tbsshell.WebCoreProxy", "createDefaultX5WebViewClient", new Class[0], new Object[0]);
            if (c2 != null) {
                e.w.h.a.a.g.e eVar = (e.w.h.a.a.g.e) c2;
            }
            throw null;
        }
        j jVar = this.d;
        if (yVar != null) {
            fVar = new f(this);
        }
        jVar.setWebViewClient(fVar);
    }

    public void setWebViewClientExtension(e.w.h.a.a.f.a.c cVar) {
        if (this.b) {
            this.c.C().b(cVar);
        }
    }
}