package com.tencent.smtt.sdk; import a.f; import android.annotation.SuppressLint; import android.annotation.TargetApi; import android.app.Dialog; import android.content.BroadcastReceiver; import android.content.ComponentCallbacks; import android.content.Context; import android.content.pm.ApplicationInfo; import android.content.pm.PackageInfo; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.Picture; import android.graphics.Rect; 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.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.webkit.DownloadListener; import android.webkit.ValueCallback; import android.webkit.WebSettings; import android.webkit.WebView; import android.widget.FrameLayout; import androidx.core.view.MotionEventCompat; import androidx.core.view.ViewCompat; import androidx.core.view.accessibility.AccessibilityEventCompat; import com.tencent.mtt.MttTraceEvent; import com.tencent.smtt.export.external.extension.interfaces.IX5WebChromeClientExtension; import com.tencent.smtt.export.external.extension.interfaces.IX5WebSettingsExtension; import com.tencent.smtt.export.external.extension.interfaces.IX5WebViewClientExtension; import com.tencent.smtt.export.external.extension.interfaces.IX5WebViewExtension; import com.tencent.smtt.export.external.interfaces.IX5WebViewBase; import com.tencent.smtt.utils.TbsLog; import com.tencent.smtt.utils.b; import com.tencent.smtt.utils.c; import com.tencent.smtt.utils.d; import java.io.BufferedWriter; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.nio.channels.FileLock; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Properties; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; import o5.i; import org.json.JSONException; import org.json.JSONObject; /* compiled from: TbsSdkJava */ public class WebView extends FrameLayout implements View.OnLongClickListener { public static int NIGHT_MODE_ALPHA = 153; /* renamed from: c reason: collision with root package name */ private static final Lock f29567c = new ReentrantLock(); private static OutputStream d = null; private static Context j = null; public static boolean mSysWebviewCreated = false; public static boolean mWebViewCreated = false; private static BroadcastReceiver n = null; private static d o = null; private static Method p = null; private static String s = null; private static Paint y = null; private static boolean z = true; private Object A; private View.OnLongClickListener B; /* renamed from: a reason: collision with root package name */ public int f29568a; private final String b; private boolean e; private IX5WebViewBase f; /* renamed from: g reason: collision with root package name */ private a f29569g; /* renamed from: h reason: collision with root package name */ private WebSettings f29570h; private Context i; private boolean k; private i l; private boolean m; public WebViewCallbackClient mWebViewCallbackClient; /* renamed from: q reason: collision with root package name */ private WebViewClient f29571q; private WebChromeClient r; private final int t; /* renamed from: u reason: collision with root package name */ private final int f29572u; /* renamed from: v reason: collision with root package name */ private final int f29573v; private final String w; private final String x; /* compiled from: TbsSdkJava */ public static class HitTestResult { @Deprecated public static final int ANCHOR_TYPE = 1; @Deprecated public static final int IMAGE_ANCHOR_TYPE = 6; /* renamed from: a reason: collision with root package name */ private IX5WebViewBase.HitTestResult f29579a; private WebView.HitTestResult b; public HitTestResult() { } public String getExtra() { IX5WebViewBase.HitTestResult hitTestResult = this.f29579a; if (hitTestResult != null) { return hitTestResult.getExtra(); } WebView.HitTestResult hitTestResult2 = this.b; return hitTestResult2 != null ? hitTestResult2.getExtra() : ""; } public int getType() { IX5WebViewBase.HitTestResult hitTestResult = this.f29579a; if (hitTestResult != null) { return hitTestResult.getType(); } WebView.HitTestResult hitTestResult2 = this.b; if (hitTestResult2 != null) { return hitTestResult2.getType(); } return 0; } public HitTestResult(IX5WebViewBase.HitTestResult hitTestResult) { this.f29579a = hitTestResult; } public HitTestResult(WebView.HitTestResult hitTestResult) { this.b = hitTestResult; } } /* compiled from: TbsSdkJava */ public interface PictureListener { void onNewPicture(WebView webView, Picture picture); } /* compiled from: TbsSdkJava */ public class WebViewTransport { private WebView b; public WebViewTransport() { } public synchronized WebView getWebView() { return this.b; } public synchronized void setWebView(WebView webView) { this.b = webView; } } /* compiled from: TbsSdkJava */ public class a extends android.webkit.WebView { public a(Context context, AttributeSet attributeSet) { super(context, attributeSet); if (!QbSdk.getIsSysWebViewForcedByOuter() || !TbsShareManager.isThirdPartyApp(context)) { CookieSyncManager.createInstance(WebView.this.i).startSync(); 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 d()); WebView.mSysWebviewCreated = true; } catch (Exception unused) { } } } public void a(int i, int i3, int i12, int i13) { super.onScrollChanged(i, i3, i12, i13); } public boolean b(MotionEvent motionEvent) { return super.dispatchTouchEvent(motionEvent); } public boolean c(MotionEvent motionEvent) { return super.onInterceptTouchEvent(motionEvent); } public void computeScroll() { WebViewCallbackClient webViewCallbackClient = WebView.this.mWebViewCallbackClient; if (webViewCallbackClient != null) { webViewCallbackClient.computeScroll(this); } else { super.computeScroll(); } } public void dispatchDraw(Canvas canvas) { try { super.dispatchDraw(canvas); if (!WebView.z && WebView.y != null) { canvas.save(); canvas.drawPaint(WebView.y); canvas.restore(); } } catch (Throwable th2) { th2.printStackTrace(); } } public boolean dispatchTouchEvent(MotionEvent motionEvent) { WebViewCallbackClient webViewCallbackClient = WebView.this.mWebViewCallbackClient; if (webViewCallbackClient != null) { return webViewCallbackClient.dispatchTouchEvent(motionEvent, this); } return super.dispatchTouchEvent(motionEvent); } public WebSettings getSettings() { try { return super.getSettings(); } catch (Exception e) { e.printStackTrace(); return null; } } public void invalidate() { super.invalidate(); WebViewCallbackClient webViewCallbackClient = WebView.this.mWebViewCallbackClient; if (webViewCallbackClient != null) { webViewCallbackClient.invalidate(); } } public boolean onInterceptTouchEvent(MotionEvent motionEvent) { WebViewCallbackClient webViewCallbackClient = WebView.this.mWebViewCallbackClient; if (webViewCallbackClient != null) { return webViewCallbackClient.onInterceptTouchEvent(motionEvent, this); } return super.onInterceptTouchEvent(motionEvent); } @TargetApi(9) public void onOverScrolled(int i, int i3, boolean z, boolean z4) { WebViewCallbackClient webViewCallbackClient = WebView.this.mWebViewCallbackClient; if (webViewCallbackClient != null) { webViewCallbackClient.onOverScrolled(i, i3, z, z4, this); } else { super.onOverScrolled(i, i3, z, z4); } } public void onScrollChanged(int i, int i3, int i12, int i13) { WebViewCallbackClient webViewCallbackClient = WebView.this.mWebViewCallbackClient; if (webViewCallbackClient != null) { webViewCallbackClient.onScrollChanged(i, i3, i12, i13, this); return; } super.onScrollChanged(i, i3, i12, i13); WebView.this.onScrollChanged(i, i3, i12, i13); } @SuppressLint({"ClickableViewAccessibility"}) public boolean onTouchEvent(MotionEvent motionEvent) { if (!hasFocus()) { requestFocus(); } Objects.toString(motionEvent); WebViewCallbackClient webViewCallbackClient = WebView.this.mWebViewCallbackClient; if (webViewCallbackClient != null) { return webViewCallbackClient.onTouchEvent(motionEvent, this); } try { return super.onTouchEvent(motionEvent); } catch (Exception e) { e.printStackTrace(); return false; } } @TargetApi(9) public boolean overScrollBy(int i, int i3, int i12, int i13, int i14, int i15, int i16, int i17, boolean z) { WebViewCallbackClient webViewCallbackClient = WebView.this.mWebViewCallbackClient; if (webViewCallbackClient != null) { return webViewCallbackClient.overScrollBy(i, i3, i12, i13, i14, i15, i16, i17, z, this); } return super.overScrollBy(i, i3, i12, i13, i14, i15, i16, i17, z); } public void setOverScrollMode(int i) { try { super.setOverScrollMode(i); } catch (Exception unused) { } } public void a() { super.computeScroll(); } public boolean a(MotionEvent motionEvent) { return super.onTouchEvent(motionEvent); } @TargetApi(9) public boolean a(int i, int i3, int i12, int i13, int i14, int i15, int i16, int i17, boolean z) { return super.overScrollBy(i, i3, i12, i13, i14, i15, i16, i17, z); } @TargetApi(9) public void a(int i, int i3, boolean z, boolean z4) { super.onOverScrolled(i, i3, z, z4); } } public WebView(Context context, boolean z4) { super(context); this.b = "WebView"; this.t = 1; this.f29572u = 2; this.f29573v = 3; this.w = "javascript:document.getElementsByTagName('HEAD').item(0).removeChild(document.getElementById('QQBrowserSDKNightMode'));"; this.x = "javascript:var style = document.createElement('style');style.type='text/css';style.id='QQBrowserSDKNightMode';style.innerHTML='html,body{background:none !important;background-color: #1d1e2a !important;}html *{background-color: #1d1e2a !important; color:#888888 !important;border-color:#3e4f61 !important;text-shadow:none !important;box-shadow:none !important;}a,a *{border-color:#4c5b99 !important; color:#2d69b3 !important;text-decoration:none !important;}a:visited,a:visited *{color:#a600a6 !important;}a:active,a:active *{color:#5588AA !important;}input,select,textarea,option,button{background-image:none !important;color:#AAAAAA !important;border-color:#4c5b99 !important;}form,div,button,span{background-color:#1d1e2a !important; border-color:#4c5b99 !important;}img{opacity:0.5}';document.getElementsByTagName('HEAD').item(0).appendChild(style);"; } private boolean b(Context context) { try { if (context.getPackageName().indexOf("com.tencent.mobileqq") >= 0) { return true; } return false; } catch (Throwable th2) { th2.printStackTrace(); return false; } } /* JADX WARNING: Removed duplicated region for block: B:35:0x00c8 A[SYNTHETIC, Splitter:B:35:0x00c8] */ /* JADX WARNING: Removed duplicated region for block: B:45:0x00ef A[SYNTHETIC, Splitter:B:45:0x00ef] */ private int c(Context context) { FileLock a5; Throwable th2; IOException e6; StringBuilder sb2; Exception e12; FileOutputStream b2 = b.b(context, true, "tbslock.txt"); if (b2 == null || (a5 = b.a(context, b2)) == null) { return -1; } Lock lock = f29567c; if (lock.tryLock()) { FileInputStream fileInputStream = null; try { File tbsFolderDir = QbSdk.getTbsFolderDir(context); File file = new File(tbsFolderDir + File.separator + "core_private", "pv.db"); if (!file.exists()) { lock.unlock(); b.a(a5, b2); return -1; } Properties properties = new Properties(); FileInputStream fileInputStream2 = new FileInputStream(file); try { properties.load(fileInputStream2); fileInputStream2.close(); String property = properties.getProperty("PV"); if (property == null) { try { fileInputStream2.close(); } catch (IOException e13) { e6 = e13; sb2 = new StringBuilder(); } f29567c.unlock(); b.a(a5, b2); return -1; } int parseInt = Integer.parseInt(property); TbsLog.d("getTbsCorePV", "mpv =" + parseInt); try { fileInputStream2.close(); } catch (IOException e14) { StringBuilder h12 = f.h("TbsInstaller--getTbsCorePV IOException="); h12.append(e14.toString()); TbsLog.e("getTbsCorePV", h12.toString()); } f29567c.unlock(); b.a(a5, b2); return parseInt; } catch (Exception e15) { e12 = e15; fileInputStream = fileInputStream2; try { TbsLog.e("getTbsCorePV", "TbsInstaller--getTbsCorePV Exception=" + e12.toString()); if (fileInputStream != null) { } f29567c.unlock(); b.a(a5, b2); return -1; } catch (Throwable th3) { th2 = th3; fileInputStream2 = fileInputStream; if (fileInputStream2 != null) { try { fileInputStream2.close(); } catch (IOException e16) { StringBuilder h13 = f.h("TbsInstaller--getTbsCorePV IOException="); h13.append(e16.toString()); TbsLog.e("getTbsCorePV", h13.toString()); } } f29567c.unlock(); b.a(a5, b2); throw th2; } } catch (Throwable th4) { th2 = th4; if (fileInputStream2 != null) { } f29567c.unlock(); b.a(a5, b2); throw th2; } } catch (Exception e17) { e12 = e17; TbsLog.e("getTbsCorePV", "TbsInstaller--getTbsCorePV Exception=" + e12.toString()); if (fileInputStream != null) { try { fileInputStream.close(); } catch (IOException e18) { e6 = e18; sb2 = new StringBuilder(); } } f29567c.unlock(); b.a(a5, b2); return -1; } } else { b.a(a5, b2); return -1; } sb2.append("TbsInstaller--getTbsCorePV IOException="); sb2.append(e6.toString()); TbsLog.e("getTbsCorePV", sb2.toString()); f29567c.unlock(); b.a(a5, b2); return -1; } @Deprecated public static void disablePlatformNotifications() { r.a(); if (!r.b()) { c.a("android.webkit.WebView", "disablePlatformNotifications"); } } @Deprecated public static void enablePlatformNotifications() { r.a(); if (!r.b()) { c.a("android.webkit.WebView", "enablePlatformNotifications"); } } public static String findAddress(String str) { r.a(); if (!r.b()) { return android.webkit.WebView.findAddress(str); } return null; } public static String getCrashExtraMessage(Context context) { Map<String, Object> map; if (context == null) { return ""; } StringBuilder h12 = f.h("tbs_core_version:"); h12.append(QbSdk.getTbsVersionForCrash(context)); h12.append(";tbs_sdk_version:"); h12.append(43799); h12.append(";"); String sb2 = h12.toString(); boolean z4 = false; if ("com.tencent.mm".equals(context.getApplicationInfo().packageName)) { try { Class.forName("de.robv.android.xposed.XposedBridge"); z4 = true; } catch (ClassNotFoundException unused) { } catch (Throwable th2) { th2.printStackTrace(); } } if (z4) { return a40.f.g(sb2, "isXposed=true;"); } StringBuilder sb3 = new StringBuilder(); sb3.append(c.a(true).d()); sb3.append("\n"); sb3.append(sb2); if (!TbsShareManager.isThirdPartyApp(context) && (map = QbSdk.l) != null && map.containsKey("weapp_id") && QbSdk.l.containsKey("weapp_name")) { StringBuilder h13 = f.h("weapp_id:"); h13.append(QbSdk.l.get("weapp_id")); h13.append(";"); h13.append("weapp_name"); h13.append(":"); h13.append(QbSdk.l.get("weapp_name")); h13.append(";"); String sb4 = h13.toString(); sb3.append("\n"); sb3.append(sb4); } if (sb3.length() > 8192) { return sb3.substring(sb3.length() - AccessibilityEventCompat.TYPE_VIEW_TEXT_SELECTION_CHANGED); } return sb3.toString(); } public static PackageInfo getCurrentWebViewPackage() { r.a(); if (r.b() || Build.VERSION.SDK_INT < 26) { return null; } try { return (PackageInfo) c.a("android.webkit.WebView", "getCurrentWebViewPackage"); } catch (Exception e6) { e6.printStackTrace(); return null; } } @Deprecated public static synchronized Object getPluginList() { synchronized (WebView.class) { r.a(); if (r.b()) { return null; } return c.a("android.webkit.WebView", "getPluginList"); } } public static int getTbsCoreVersion(Context context) { return QbSdk.getTbsVersion(context); } public static boolean getTbsNeedReboot() { c(); boolean e6 = c.a(true).e(); TbsLog.d("TbsNeedReboot", "WebView.getTbsNeedReboot--ret = " + e6); return e6; } public static int getTbsSDKVersion(Context context) { return 43799; } public static synchronized void setSysDayOrNight(boolean z4) { synchronized (WebView.class) { if (z4 != z) { z = z4; if (y == null) { Paint paint = new Paint(); y = paint; paint.setColor(ViewCompat.MEASURED_STATE_MASK); } if (!z4) { int alpha = y.getAlpha(); int i3 = NIGHT_MODE_ALPHA; if (alpha != i3) { y.setAlpha(i3); } } else if (y.getAlpha() != 255) { y.setAlpha(MotionEventCompat.ACTION_MASK); } } } } public static void setWebContentsDebuggingEnabled(boolean z4) { r a5 = r.a(); if (a5 == null || !r.b()) { try { Method declaredMethod = Class.forName("android.webkit.WebView").getDeclaredMethod("setWebContentsDebuggingEnabled", Boolean.TYPE); p = declaredMethod; if (declaredMethod != null) { declaredMethod.setAccessible(true); p.invoke(null, Boolean.valueOf(z4)); } } catch (Exception e6) { StringBuilder h12 = f.h("Exception:"); h12.append(e6.getStackTrace()); TbsLog.e("QbSdk", h12.toString()); e6.printStackTrace(); } } else { a5.c().a(z4); } } public void a(android.webkit.WebView webView) { } public void addJavascriptInterface(Object obj, String str) { if (!this.e) { this.f29569g.addJavascriptInterface(obj, str); } else { this.f.addJavascriptInterface(obj, str); } } public void addView(View view) { if (!this.e) { this.f29569g.addView(view); return; } View view2 = this.f.getView(); try { Method a5 = c.a(view2, "addView", View.class); a5.setAccessible(true); a5.invoke(view2, view); } catch (Throwable unused) { } } public boolean canGoBack() { if (!this.e) { return this.f29569g.canGoBack(); } return this.f.canGoBack(); } public boolean canGoBackOrForward(int i3) { if (!this.e) { return this.f29569g.canGoBackOrForward(i3); } return this.f.canGoBackOrForward(i3); } public boolean canGoForward() { if (!this.e) { return this.f29569g.canGoForward(); } return this.f.canGoForward(); } @Deprecated public boolean canZoomIn() { if (this.e) { return this.f.canZoomIn(); } Object a5 = c.a(this.f29569g, "canZoomIn"); if (a5 == null) { return false; } return ((Boolean) a5).booleanValue(); } @Deprecated public boolean canZoomOut() { if (this.e) { return this.f.canZoomOut(); } Object a5 = c.a(this.f29569g, "canZoomOut"); if (a5 == null) { return false; } return ((Boolean) a5).booleanValue(); } @Deprecated public Picture capturePicture() { if (this.e) { return this.f.capturePicture(); } Object a5 = c.a(this.f29569g, "capturePicture"); if (a5 == null) { return null; } return (Picture) a5; } public void clearCache(boolean z4) { if (!this.e) { this.f29569g.clearCache(z4); } else { this.f.clearCache(z4); } } public void clearFormData() { if (!this.e) { this.f29569g.clearFormData(); } else { this.f.clearFormData(); } } public void clearHistory() { if (!this.e) { this.f29569g.clearHistory(); } else { this.f.clearHistory(); } } @TargetApi(3) public void clearMatches() { if (!this.e) { this.f29569g.clearMatches(); } else { this.f.clearMatches(); } } public void clearSslPreferences() { if (!this.e) { this.f29569g.clearSslPreferences(); } else { this.f.clearSslPreferences(); } } @Deprecated public void clearView() { if (!this.e) { c.a(this.f29569g, "clearView"); } else { this.f.clearView(); } } public int computeHorizontalScrollExtent() { try { if (this.e) { Method a5 = c.a(this.f.getView(), "computeHorizontalScrollExtent", new Class[0]); a5.setAccessible(true); return ((Integer) a5.invoke(this.f.getView(), new Object[0])).intValue(); } Method a12 = c.a(this.f29569g, "computeHorizontalScrollExtent", new Class[0]); a12.setAccessible(true); return ((Integer) a12.invoke(this.f29569g, new Object[0])).intValue(); } catch (Exception e6) { e6.printStackTrace(); return -1; } } public int computeHorizontalScrollOffset() { try { if (this.e) { Method a5 = c.a(this.f.getView(), "computeHorizontalScrollOffset", new Class[0]); a5.setAccessible(true); return ((Integer) a5.invoke(this.f.getView(), new Object[0])).intValue(); } Method a12 = c.a(this.f29569g, "computeHorizontalScrollOffset", new Class[0]); a12.setAccessible(true); return ((Integer) a12.invoke(this.f29569g, new Object[0])).intValue(); } catch (Exception e6) { e6.printStackTrace(); return -1; } } public int computeHorizontalScrollRange() { try { if (this.e) { return ((Integer) c.a(this.f.getView(), "computeHorizontalScrollRange", new Class[0], new Object[0])).intValue(); } Method a5 = c.a(this.f29569g, "computeHorizontalScrollRange", new Class[0]); a5.setAccessible(true); return ((Integer) a5.invoke(this.f29569g, new Object[0])).intValue(); } catch (Exception e6) { e6.printStackTrace(); return -1; } } public void computeScroll() { if (!this.e) { this.f29569g.computeScroll(); } else { this.f.computeScroll(); } } public int computeVerticalScrollExtent() { try { if (this.e) { Method a5 = c.a(this.f.getView(), "computeVerticalScrollExtent", new Class[0]); a5.setAccessible(true); return ((Integer) a5.invoke(this.f.getView(), new Object[0])).intValue(); } Method a12 = c.a(this.f29569g, "computeVerticalScrollExtent", new Class[0]); a12.setAccessible(true); return ((Integer) a12.invoke(this.f29569g, new Object[0])).intValue(); } catch (Exception e6) { e6.printStackTrace(); return -1; } } public int computeVerticalScrollOffset() { try { if (this.e) { Method a5 = c.a(this.f.getView(), "computeVerticalScrollOffset", new Class[0]); a5.setAccessible(true); return ((Integer) a5.invoke(this.f.getView(), new Object[0])).intValue(); } Method a12 = c.a(this.f29569g, "computeVerticalScrollOffset", new Class[0]); a12.setAccessible(true); return ((Integer) a12.invoke(this.f29569g, new Object[0])).intValue(); } catch (Exception e6) { e6.printStackTrace(); return -1; } } public int computeVerticalScrollRange() { try { if (this.e) { return ((Integer) c.a(this.f.getView(), "computeVerticalScrollRange", new Class[0], new Object[0])).intValue(); } Method a5 = c.a(this.f29569g, "computeVerticalScrollRange", new Class[0]); a5.setAccessible(true); return ((Integer) a5.invoke(this.f29569g, new Object[0])).intValue(); } catch (Exception e6) { e6.printStackTrace(); return -1; } } public WebBackForwardList copyBackForwardList() { if (this.e) { return WebBackForwardList.a(this.f.copyBackForwardList()); } return WebBackForwardList.a(this.f29569g.copyBackForwardList()); } public Object createPrintDocumentAdapter(String str) { if (this.e) { try { return this.f.createPrintDocumentAdapter(str); } catch (Throwable th2) { th2.printStackTrace(); return null; } } else { return c.a(this.f29569g, "createPrintDocumentAdapter", new Class[]{String.class}, str); } } public void customDiskCachePathEnabled(boolean z4, String str) { if (this.e && getX5WebViewExtension() != null) { Bundle bundle = new Bundle(); bundle.putBoolean("enabled", z4); bundle.putString("path", str); getX5WebViewExtension().invokeMiscMethod("customDiskCachePathEnabled", bundle); } } public void destroy() { try { if ("com.xunmeng.pinduoduo".equals(this.i.getApplicationInfo().packageName)) { AnonymousClass1 r12 = new Thread("WebviewDestroy") { /* class com.tencent.smtt.sdk.WebView.AnonymousClass1 */ public void run() { WebView.this.tbsWebviewDestroy(false); } }; int i3 = p4.f.b; r12.setName(p4.f.a(r12.getName(), "com.tencent.smtt.sdk.WebView")); r12.start(); if (this.e) { this.f.destroy(); } else { this.f29569g.destroy(); } } else { tbsWebviewDestroy(true); } } catch (Throwable unused) { tbsWebviewDestroy(true); } } public void documentHasImages(Message message) { if (!this.e) { this.f29569g.documentHasImages(message); } else { this.f.documentHasImages(message); } } public void dumpViewHierarchyWithProperties(BufferedWriter bufferedWriter, int i3) { if (!this.e) { c.a(this.f29569g, "dumpViewHierarchyWithProperties", new Class[]{BufferedWriter.class, Integer.TYPE}, bufferedWriter, Integer.valueOf(i3)); return; } this.f.dumpViewHierarchyWithProperties(bufferedWriter, i3); } public void evaluateJavascript(String str, ValueCallback<String> valueCallback) { if (this.e) { try { Method a5 = c.a(this.f.getView(), "evaluateJavascript", String.class, ValueCallback.class); a5.setAccessible(true); a5.invoke(this.f.getView(), str, valueCallback); } catch (Exception e6) { e6.printStackTrace(); loadUrl(str); } } else { try { Method declaredMethod = Class.forName("android.webkit.WebView").getDeclaredMethod("evaluateJavascript", String.class, ValueCallback.class); declaredMethod.setAccessible(true); declaredMethod.invoke(this.f29569g, str, valueCallback); } catch (Exception e12) { e12.printStackTrace(); } } } @Deprecated public int findAll(String str) { if (this.e) { return this.f.findAll(str); } Object a5 = c.a(this.f29569g, "findAll", new Class[]{String.class}, str); if (a5 == null) { return 0; } return ((Integer) a5).intValue(); } @TargetApi(16) public void findAllAsync(String str) { if (!this.e) { c.a(this.f29569g, "findAllAsync", new Class[]{String.class}, str); return; } this.f.findAllAsync(str); } public View findHierarchyView(String str, int i3) { if (this.e) { return this.f.findHierarchyView(str, i3); } return (View) c.a(this.f29569g, "findHierarchyView", new Class[]{String.class, Integer.TYPE}, str, Integer.valueOf(i3)); } @TargetApi(3) public void findNext(boolean z4) { if (!this.e) { this.f29569g.findNext(z4); } else { this.f.findNext(z4); } } public void flingScroll(int i3, int i12) { if (!this.e) { this.f29569g.flingScroll(i3, i12); } else { this.f.flingScroll(i3, i12); } } @Deprecated public void freeMemory() { if (!this.e) { c.a(this.f29569g, "freeMemory"); } else { this.f.freeMemory(); } } public SslCertificate getCertificate() { if (!this.e) { return this.f29569g.getCertificate(); } return this.f.getCertificate(); } public int getContentHeight() { if (!this.e) { return this.f29569g.getContentHeight(); } return this.f.getContentHeight(); } public int getContentWidth() { if (this.e) { return this.f.getContentWidth(); } Object a5 = c.a(this.f29569g, "getContentWidth"); if (a5 == null) { return 0; } return ((Integer) a5).intValue(); } public Bitmap getFavicon() { if (!this.e) { return this.f29569g.getFavicon(); } return this.f.getFavicon(); } public HitTestResult getHitTestResult() { if (!this.e) { return new HitTestResult(this.f29569g.getHitTestResult()); } return new HitTestResult(this.f.getHitTestResult()); } public String[] getHttpAuthUsernamePassword(String str, String str2) { if (!this.e) { return this.f29569g.getHttpAuthUsernamePassword(str, str2); } return this.f.getHttpAuthUsernamePassword(str, str2); } @TargetApi(3) public String getOriginalUrl() { if (!this.e) { return this.f29569g.getOriginalUrl(); } return this.f.getOriginalUrl(); } public int getProgress() { if (!this.e) { return this.f29569g.getProgress(); } return this.f.getProgress(); } public boolean getRendererPriorityWaivedWhenNotVisible() { try { if (this.e || Build.VERSION.SDK_INT < 26) { return false; } Object a5 = c.a(this.f29569g, "getRendererPriorityWaivedWhenNotVisible"); if (a5 == null) { return false; } return ((Boolean) a5).booleanValue(); } catch (Exception e6) { e6.printStackTrace(); return false; } } public int getRendererRequestedPriority() { try { if (this.e || Build.VERSION.SDK_INT < 26) { return 0; } Object a5 = c.a(this.f29569g, "getRendererRequestedPriority"); if (a5 == null) { return 0; } return ((Integer) a5).intValue(); } catch (Exception e6) { e6.printStackTrace(); return 0; } } @Deprecated public float getScale() { if (this.e) { return this.f.getScale(); } Object a5 = c.a(this.f29569g, "getScale"); if (a5 == null) { return i.f36333a; } return ((Float) a5).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 WebSettings getSettings() { WebSettings webSettings = this.f29570h; if (webSettings != null) { return webSettings; } if (this.e) { WebSettings webSettings2 = new WebSettings(this.f.getSettings()); this.f29570h = webSettings2; return webSettings2; } WebSettings webSettings3 = new WebSettings(this.f29569g.getSettings()); this.f29570h = webSettings3; return webSettings3; } public IX5WebSettingsExtension getSettingsExtension() { if (!this.e) { return null; } return this.f.getX5WebViewExtension().getSettingsExtension(); } public int getSysNightModeAlpha() { return NIGHT_MODE_ALPHA; } public String getTitle() { if (!this.e) { return this.f29569g.getTitle(); } return this.f.getTitle(); } public String getUrl() { if (!this.e) { return this.f29569g.getUrl(); } return this.f.getUrl(); } public View getView() { if (!this.e) { return this.f29569g; } return this.f.getView(); } public int getVisibleTitleHeight() { if (this.e) { return this.f.getVisibleTitleHeight(); } Object a5 = c.a(this.f29569g, "getVisibleTitleHeight"); if (a5 == null) { return 0; } return ((Integer) a5).intValue(); } public WebChromeClient getWebChromeClient() { return this.r; } public IX5WebChromeClientExtension getWebChromeClientExtension() { if (!this.e) { return null; } return this.f.getX5WebViewExtension().getWebChromeClientExtension(); } public int getWebScrollX() { if (this.e) { return this.f.getView().getScrollX(); } return this.f29569g.getScrollX(); } public int getWebScrollY() { if (this.e) { return this.f.getView().getScrollY(); } return this.f29569g.getScrollY(); } public WebViewClient getWebViewClient() { return this.f29571q; } public IX5WebViewClientExtension getWebViewClientExtension() { if (!this.e) { return null; } return this.f.getX5WebViewExtension().getWebViewClientExtension(); } public IX5WebViewBase.HitTestResult getX5HitTestResult() { if (!this.e) { return null; } return this.f.getHitTestResult(); } public IX5WebViewExtension getX5WebViewExtension() { if (!this.e) { return null; } return this.f.getX5WebViewExtension(); } @Deprecated public View getZoomControls() { if (!this.e) { return (View) c.a(this.f29569g, "getZoomControls"); } return this.f.getZoomControls(); } public void goBack() { if (!this.e) { this.f29569g.goBack(); } else { this.f.goBack(); } } public void goBackOrForward(int i3) { if (!this.e) { this.f29569g.goBackOrForward(i3); } else { this.f.goBackOrForward(i3); } } public void goForward() { if (!this.e) { this.f29569g.goForward(); } else { this.f.goForward(); } } public void invokeZoomPicker() { if (!this.e) { this.f29569g.invokeZoomPicker(); } else { this.f.invokeZoomPicker(); } } public boolean isDayMode() { return z; } public boolean isPrivateBrowsingEnabled() { if (this.e) { return this.f.isPrivateBrowsingEnable(); } Object a5 = c.a(this.f29569g, "isPrivateBrowsingEnabled"); if (a5 == null) { return false; } return ((Boolean) a5).booleanValue(); } public void loadData(String str, String str2, String str3) { if (!this.e) { this.f29569g.loadData(str, str2, str3); } else { this.f.loadData(str, str2, str3); } } public void loadDataWithBaseURL(String str, String str2, String str3, String str4, String str5) { if (!this.e) { this.f29569g.loadDataWithBaseURL(str, str2, str3, str4, str5); } else { this.f.loadDataWithBaseURL(str, str2, str3, str4, str5); } } @TargetApi(8) public void loadUrl(String str, Map<String, String> map) { if (str != null && !showDebugView(str)) { if (!this.e) { this.f29569g.loadUrl(str, map); } else { this.f.loadUrl(str, map); } } } public boolean onLongClick(View view) { View.OnLongClickListener onLongClickListener = this.B; if (onLongClickListener == null) { return a(view); } if (!onLongClickListener.onLongClick(view)) { return a(view); } return true; } public void onPause() { if (!this.e) { c.a(this.f29569g, "onPause"); } else { this.f.onPause(); } } public void onResume() { if (!this.e) { c.a(this.f29569g, "onResume"); } else { this.f.onResume(); } } @TargetApi(11) public void onSizeChanged(int i3, int i12, int i13, int i14) { super.onSizeChanged(i3, i12, i13, i14); if (b(this.i) && isHardwareAccelerated() && i3 > 0 && i12 > 0) { getLayerType(); } } public boolean overlayHorizontalScrollbar() { if (!this.e) { return this.f29569g.overlayHorizontalScrollbar(); } return this.f.overlayHorizontalScrollbar(); } public boolean overlayVerticalScrollbar() { if (this.e) { return this.f.overlayVerticalScrollbar(); } return this.f29569g.overlayVerticalScrollbar(); } public boolean pageDown(boolean z4) { if (!this.e) { return this.f29569g.pageDown(z4); } return this.f.pageDown(z4, -1); } public boolean pageUp(boolean z4) { if (!this.e) { return this.f29569g.pageUp(z4); } return this.f.pageUp(z4, -1); } public void pauseTimers() { if (!this.e) { this.f29569g.pauseTimers(); } else { this.f.pauseTimers(); } } @TargetApi(5) public void postUrl(String str, byte[] bArr) { if (!this.e) { this.f29569g.postUrl(str, bArr); } else { this.f.postUrl(str, bArr); } } @Deprecated public void refreshPlugins(boolean z4) { if (!this.e) { c.a(this.f29569g, "refreshPlugins", new Class[]{Boolean.TYPE}, Boolean.valueOf(z4)); return; } this.f.refreshPlugins(z4); } public void reload() { if (!this.e) { this.f29569g.reload(); } else { this.f.reload(); } } @TargetApi(11) public void removeJavascriptInterface(String str) { if (!this.e) { c.a(this.f29569g, "removeJavascriptInterface", new Class[]{String.class}, str); } } public void removeView(View view) { if (!this.e) { this.f29569g.removeView(view); return; } View view2 = this.f.getView(); try { Method a5 = c.a(view2, "removeView", View.class); a5.setAccessible(true); a5.invoke(view2, view); } catch (Throwable unused) { } } public JSONObject reportInitPerformance(long j12, int i3, long j13, long j14) { i iVar; JSONObject jSONObject = new JSONObject(); try { jSONObject.put("IS_X5", this.e); } catch (JSONException e6) { e6.printStackTrace(); } StringBuilder g3 = a0.b.g("reportInitPerformance initType is ", j12, " isX5Core is "); g3.append(this.e); g3.append(" isPerformanceDataRecorded"); g3.append(this.m); TbsLog.i("sdkreport", g3.toString()); if (this.e && (iVar = this.l) != null && !this.m) { iVar.a("init_type", j12); this.l.a("time_oncreate", j13); this.l.a("webview_type", (long) i3); this.l.a("time_webaccelerator", j14); if (this.l.a(this.f.hashCode(), getUrl())) { this.m = true; } try { jSONObject.put("DETAIL", this.l.a()); } catch (JSONException e12) { e12.printStackTrace(); } } return jSONObject; } public boolean requestChildRectangleOnScreen(View view, Rect rect, boolean z4) { if (this.e) { View view2 = this.f.getView(); if (!(view2 instanceof ViewGroup)) { return false; } ViewGroup viewGroup = (ViewGroup) view2; if (view == this) { view = view2; } return viewGroup.requestChildRectangleOnScreen(view, rect, z4); } a aVar = this.f29569g; if (view == this) { view = aVar; } return aVar.requestChildRectangleOnScreen(view, rect, z4); } public void requestFocusNodeHref(Message message) { if (!this.e) { this.f29569g.requestFocusNodeHref(message); } else { this.f.requestFocusNodeHref(message); } } public void requestImageRef(Message message) { if (!this.e) { this.f29569g.requestImageRef(message); } else { this.f.requestImageRef(message); } } @Deprecated public boolean restorePicture(Bundle bundle, File file) { if (this.e) { return this.f.restorePicture(bundle, file); } Object a5 = c.a(this.f29569g, "restorePicture", new Class[]{Bundle.class, File.class}, bundle, file); if (a5 == null) { return false; } return ((Boolean) a5).booleanValue(); } public WebBackForwardList restoreState(Bundle bundle) { if (!this.e) { return WebBackForwardList.a(this.f29569g.restoreState(bundle)); } return WebBackForwardList.a(this.f.restoreState(bundle)); } public void resumeTimers() { if (!this.e) { this.f29569g.resumeTimers(); } else { this.f.resumeTimers(); } } @Deprecated public void savePassword(String str, String str2, String str3) { if (!this.e) { c.a(this.f29569g, "savePassword", new Class[]{String.class, String.class, String.class}, str, str2, str3); return; } this.f.savePassword(str, str2, str3); } @Deprecated public boolean savePicture(Bundle bundle, File file) { if (this.e) { return this.f.savePicture(bundle, file); } Object a5 = c.a(this.f29569g, "savePicture", new Class[]{Bundle.class, File.class}, bundle, file); if (a5 == null) { return false; } return ((Boolean) a5).booleanValue(); } public WebBackForwardList saveState(Bundle bundle) { if (!this.e) { return WebBackForwardList.a(this.f29569g.saveState(bundle)); } return WebBackForwardList.a(this.f.saveState(bundle)); } @TargetApi(11) public void saveWebArchive(String str) { if (!this.e) { c.a(this.f29569g, "saveWebArchive", new Class[]{String.class}, str); return; } this.f.saveWebArchive(str); } public void setARModeEnable(boolean z4) { try { if (this.e) { getSettingsExtension().setARModeEnable(z4); } } catch (Throwable th2) { th2.printStackTrace(); } } public void setBackgroundColor(int i3) { if (!this.e) { this.f29569g.setBackgroundColor(i3); } else { this.f.setBackgroundColor(i3); } super.setBackgroundColor(i3); } @Deprecated public void setCertificate(SslCertificate sslCertificate) { if (!this.e) { this.f29569g.setCertificate(sslCertificate); } else { this.f.setCertificate(sslCertificate); } } public void setDayOrNight(boolean z4) { try { if (this.e) { getSettingsExtension().setDayOrNight(z4); } setSysDayOrNight(z4); getView().postInvalidate(); } catch (Throwable th2) { th2.printStackTrace(); } } public void setDownloadListener(final DownloadListener downloadListener) { boolean z4 = this.e; if (!z4) { this.f29569g.setDownloadListener(new DownloadListener() { /* class com.tencent.smtt.sdk.WebView.AnonymousClass3 */ public void onDownloadStart(String str, String str2, String str3, String str4, long j) { DownloadListener downloadListener = downloadListener; if (downloadListener == null) { ApplicationInfo applicationInfo = WebView.this.i == null ? null : WebView.this.i.getApplicationInfo(); if (applicationInfo == null || !"com.tencent.mm".equals(applicationInfo.packageName)) { com.tencent.smtt.sdk.a.a.a(WebView.this.i, str, null, null); return; } return; } downloadListener.onDownloadStart(str, str2, str3, str4, j); } }); } else { this.f.setDownloadListener(new a(this, downloadListener, z4)); } } @TargetApi(16) public void setFindListener(final IX5WebViewBase.FindListener findListener) { if (!this.e) { this.f29569g.setFindListener(new WebView.FindListener() { /* class com.tencent.smtt.sdk.WebView.AnonymousClass2 */ public void onFindResultReceived(int i, int i3, boolean z) { findListener.onFindResultReceived(i, i3, z); } }); } else { this.f.setFindListener(findListener); } } public void setHorizontalScrollbarOverlay(boolean z4) { if (!this.e) { this.f29569g.setHorizontalScrollbarOverlay(z4); } else { this.f.setHorizontalScrollbarOverlay(z4); } } public void setHttpAuthUsernamePassword(String str, String str2, String str3, String str4) { if (!this.e) { this.f29569g.setHttpAuthUsernamePassword(str, str2, str3, str4); } else { this.f.setHttpAuthUsernamePassword(str, str2, str3, str4); } } public void setInitialScale(int i3) { if (!this.e) { this.f29569g.setInitialScale(i3); } else { this.f.setInitialScale(i3); } } @Deprecated public void setMapTrackballToArrowKeys(boolean z4) { if (!this.e) { c.a(this.f29569g, "setMapTrackballToArrowKeys", new Class[]{Boolean.TYPE}, Boolean.valueOf(z4)); return; } this.f.setMapTrackballToArrowKeys(z4); } public void setNetworkAvailable(boolean z4) { if (!this.e) { this.f29569g.setNetworkAvailable(z4); } else { this.f.setNetworkAvailable(z4); } } public void setOnLongClickListener(View.OnLongClickListener onLongClickListener) { if (!this.e) { this.f29569g.setOnLongClickListener(onLongClickListener); return; } View view = this.f.getView(); try { if (this.A == null) { Method a5 = c.a(view, "getListenerInfo", new Class[0]); a5.setAccessible(true); Object invoke = a5.invoke(view, null); Field declaredField = invoke.getClass().getDeclaredField("mOnLongClickListener"); declaredField.setAccessible(true); this.A = declaredField.get(invoke); } this.B = onLongClickListener; getView().setOnLongClickListener(this); } catch (Throwable unused) { } } public void setOnTouchListener(View.OnTouchListener onTouchListener) { getView().setOnTouchListener(onTouchListener); } public void setPictureListener(final PictureListener pictureListener) { if (!this.e) { if (pictureListener == null) { this.f29569g.setPictureListener(null); } else { this.f29569g.setPictureListener(new WebView.PictureListener() { /* class com.tencent.smtt.sdk.WebView.AnonymousClass4 */ public void onNewPicture(android.webkit.WebView webView, Picture picture) { WebView.this.a(webView); pictureListener.onNewPicture(WebView.this, picture); } }); } } else if (pictureListener == null) { this.f.setPictureListener(null); } else { this.f.setPictureListener(new IX5WebViewBase.PictureListener() { /* class com.tencent.smtt.sdk.WebView.AnonymousClass5 */ @Override // com.tencent.smtt.export.external.interfaces.IX5WebViewBase.PictureListener public void onNewPicture(IX5WebViewBase iX5WebViewBase, Picture picture, boolean z) { WebView.this.a(iX5WebViewBase); pictureListener.onNewPicture(WebView.this, picture); } @Override // com.tencent.smtt.export.external.interfaces.IX5WebViewBase.PictureListener public void onNewPictureIfHaveContent(IX5WebViewBase iX5WebViewBase, Picture picture) { } }); } } public void setRendererPriorityPolicy(int i3, boolean z4) { try { if (!this.e && Build.VERSION.SDK_INT >= 26) { c.a(this.f29569g, "setRendererPriorityPolicy", new Class[]{Integer.TYPE, Boolean.TYPE}, Integer.valueOf(i3), Boolean.valueOf(z4)); } } catch (Exception e6) { e6.printStackTrace(); } } public void setScrollBarStyle(int i3) { if (this.e) { this.f.getView().setScrollBarStyle(i3); } else { this.f29569g.setScrollBarStyle(i3); } } public void setSysNightModeAlpha(int i3) { NIGHT_MODE_ALPHA = i3; } public void setVerticalScrollbarOverlay(boolean z4) { if (!this.e) { this.f29569g.setVerticalScrollbarOverlay(z4); } else { this.f.setVerticalScrollbarOverlay(z4); } } public boolean setVideoFullScreen(Context context, boolean z4) { if (!context.getApplicationInfo().processName.contains("com.tencent.android.qqdownloader") || this.f == null) { return false; } Bundle bundle = new Bundle(); if (z4) { bundle.putInt("DefaultVideoScreen", 2); } else { bundle.putInt("DefaultVideoScreen", 1); } this.f.getX5WebViewExtension().invokeMiscMethod("setVideoParams", bundle); return true; } public void setVisibility(int i3) { super.setVisibility(i3); if (getView() != null) { getView().setVisibility(i3); } } public void setWebChromeClient(WebChromeClient webChromeClient) { SystemWebChromeClient systemWebChromeClient = null; e eVar = null; if (this.e) { IX5WebViewBase iX5WebViewBase = this.f; if (webChromeClient != null) { eVar = new e(r.a().a(true).g(), this, webChromeClient); } iX5WebViewBase.setWebChromeClient(eVar); } else { a aVar = this.f29569g; if (webChromeClient != null) { systemWebChromeClient = new SystemWebChromeClient(this, webChromeClient); } aVar.setWebChromeClient(systemWebChromeClient); } this.r = webChromeClient; } public void setWebChromeClientExtension(IX5WebChromeClientExtension iX5WebChromeClientExtension) { if (this.e) { this.f.getX5WebViewExtension().setWebChromeClientExtension(iX5WebChromeClientExtension); } } public void setWebViewCallbackClient(WebViewCallbackClient webViewCallbackClient) { this.mWebViewCallbackClient = webViewCallbackClient; if (this.e && getX5WebViewExtension() != null) { Bundle bundle = new Bundle(); bundle.putBoolean("flag", true); getX5WebViewExtension().invokeMiscMethod("setWebViewCallbackClientFlag", bundle); } } public void setWebViewClient(WebViewClient webViewClient) { SystemWebViewClient systemWebViewClient = null; f fVar = null; if (this.e) { IX5WebViewBase iX5WebViewBase = this.f; if (webViewClient != null) { fVar = new f(r.a().a(true).h(), this, webViewClient); } iX5WebViewBase.setWebViewClient(fVar); } else { a aVar = this.f29569g; if (webViewClient != null) { systemWebViewClient = new SystemWebViewClient(this, webViewClient); } aVar.setWebViewClient(systemWebViewClient); } this.f29571q = webViewClient; } public void setWebViewClientExtension(IX5WebViewClientExtension iX5WebViewClientExtension) { if (this.e) { this.f.getX5WebViewExtension().setWebViewClientExtension(iX5WebViewClientExtension); } } @SuppressLint({"NewApi"}) public boolean showDebugView(String str) { String lowerCase = str.toLowerCase(); if (lowerCase.startsWith("http://debugtbs.qq.com")) { getView().setVisibility(4); return true; } else if (!lowerCase.startsWith("http://debugx5.qq.com") || this.e) { return false; } else { loadDataWithBaseURL(null, "<!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=\"http://debugtbs.qq.com?10000\">进入DebugTbs安装或打开X5内核</a></body></html>", "text/html", "utf-8", null); return true; } } public boolean showFindDialog(String str, boolean z4) { return false; } public void stopLoading() { if (!this.e) { this.f29569g.stopLoading(); } else { this.f.stopLoading(); } } public void super_computeScroll() { if (!this.e) { this.f29569g.a(); return; } try { c.a(this.f.getView(), "super_computeScroll"); } catch (Throwable th2) { th2.printStackTrace(); } } public boolean super_dispatchTouchEvent(MotionEvent motionEvent) { if (!this.e) { return this.f29569g.b(motionEvent); } try { Object a5 = c.a(this.f.getView(), "super_dispatchTouchEvent", new Class[]{MotionEvent.class}, motionEvent); if (a5 == null) { return false; } return ((Boolean) a5).booleanValue(); } catch (Throwable unused) { return false; } } public boolean super_onInterceptTouchEvent(MotionEvent motionEvent) { if (!this.e) { return this.f29569g.c(motionEvent); } try { Object a5 = c.a(this.f.getView(), "super_onInterceptTouchEvent", new Class[]{MotionEvent.class}, motionEvent); if (a5 == null) { return false; } return ((Boolean) a5).booleanValue(); } catch (Throwable unused) { return false; } } public void super_onOverScrolled(int i3, int i12, boolean z4, boolean z5) { if (!this.e) { this.f29569g.a(i3, i12, z4, z5); return; } View view = this.f.getView(); try { Class cls = Integer.TYPE; Class cls2 = Boolean.TYPE; c.a(view, "super_onOverScrolled", new Class[]{cls, cls, cls2, cls2}, Integer.valueOf(i3), Integer.valueOf(i12), Boolean.valueOf(z4), Boolean.valueOf(z5)); } catch (Throwable th2) { th2.printStackTrace(); } } public void super_onScrollChanged(int i3, int i12, int i13, int i14) { if (!this.e) { this.f29569g.a(i3, i12, i13, i14); return; } View view = this.f.getView(); try { Class cls = Integer.TYPE; c.a(view, "super_onScrollChanged", new Class[]{cls, cls, cls, cls}, Integer.valueOf(i3), Integer.valueOf(i12), Integer.valueOf(i13), Integer.valueOf(i14)); } catch (Throwable th2) { th2.printStackTrace(); } } public boolean super_onTouchEvent(MotionEvent motionEvent) { if (!this.e) { return this.f29569g.a(motionEvent); } try { Object a5 = c.a(this.f.getView(), "super_onTouchEvent", new Class[]{MotionEvent.class}, motionEvent); if (a5 == null) { return false; } return ((Boolean) a5).booleanValue(); } catch (Throwable unused) { return false; } } public boolean super_overScrollBy(int i3, int i12, int i13, int i14, int i15, int i16, int i17, int i18, boolean z4) { if (!this.e) { return this.f29569g.a(i3, i12, i13, i14, i15, i16, i17, i18, z4); } View view = this.f.getView(); try { Class cls = Integer.TYPE; Object a5 = c.a(view, "super_overScrollBy", new Class[]{cls, cls, cls, cls, cls, cls, cls, cls, Boolean.TYPE}, Integer.valueOf(i3), Integer.valueOf(i12), Integer.valueOf(i13), Integer.valueOf(i14), Integer.valueOf(i15), Integer.valueOf(i16), Integer.valueOf(i17), Integer.valueOf(i18), Boolean.valueOf(z4)); if (a5 == null) { return false; } return ((Boolean) a5).booleanValue(); } catch (Throwable unused) { return false; } } public void switchNightMode(boolean z4) { if (z4 != z) { z = z4; if (z4) { TbsLog.e("QB_SDK", "deleteNightMode"); loadUrl("javascript:document.getElementsByTagName('HEAD').item(0).removeChild(document.getElementById('QQBrowserSDKNightMode'));"); return; } TbsLog.e("QB_SDK", "nightMode"); loadUrl("javascript:var style = document.createElement('style');style.type='text/css';style.id='QQBrowserSDKNightMode';style.innerHTML='html,body{background:none !important;background-color: #1d1e2a !important;}html *{background-color: #1d1e2a !important; color:#888888 !important;border-color:#3e4f61 !important;text-shadow:none !important;box-shadow:none !important;}a,a *{border-color:#4c5b99 !important; color:#2d69b3 !important;text-decoration:none !important;}a:visited,a:visited *{color:#a600a6 !important;}a:active,a:active *{color:#5588AA !important;}input,select,textarea,option,button{background-image:none !important;color:#AAAAAA !important;border-color:#4c5b99 !important;}form,div,button,span{background-color:#1d1e2a !important; border-color:#4c5b99 !important;}img{opacity:0.5}';document.getElementsByTagName('HEAD').item(0).appendChild(style);"); } } public void switchToNightMode() { TbsLog.e("QB_SDK", "switchToNightMode 01"); if (!z) { TbsLog.e("QB_SDK", "switchToNightMode"); loadUrl("javascript:var style = document.createElement('style');style.type='text/css';style.id='QQBrowserSDKNightMode';style.innerHTML='html,body{background:none !important;background-color: #1d1e2a !important;}html *{background-color: #1d1e2a !important; color:#888888 !important;border-color:#3e4f61 !important;text-shadow:none !important;box-shadow:none !important;}a,a *{border-color:#4c5b99 !important; color:#2d69b3 !important;text-decoration:none !important;}a:visited,a:visited *{color:#a600a6 !important;}a:active,a:active *{color:#5588AA !important;}input,select,textarea,option,button{background-image:none !important;color:#AAAAAA !important;border-color:#4c5b99 !important;}form,div,button,span{background-color:#1d1e2a !important; border-color:#4c5b99 !important;}img{opacity:0.5}';document.getElementsByTagName('HEAD').item(0).appendChild(style);"); } } public void tbsWebviewDestroy(boolean z4) { if (!this.e) { try { Class<?> cls = Class.forName("android.webkit.WebViewClassic"); Method method = cls.getMethod("fromWebView", android.webkit.WebView.class); method.setAccessible(true); Object invoke = method.invoke(null, this.f29569g); 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("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 (z4) { this.f29569g.destroy(); } try { 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); } } } } catch (Exception unused2) { } } else if (z4) { this.f.destroy(); } StringBuilder h12 = f.h("X5 GUID = "); h12.append(QbSdk.b()); TbsLog.i("WebView", h12.toString()); } public boolean zoomIn() { if (!this.e) { return this.f29569g.zoomIn(); } return this.f.zoomIn(); } public boolean zoomOut() { if (!this.e) { return this.f29569g.zoomOut(); } return this.f.zoomOut(); } public android.webkit.WebView a() { if (!this.e) { return this.f29569g; } return null; } public IX5WebViewBase b() { return this.f; } @TargetApi(11) public void saveWebArchive(String str, boolean z4, ValueCallback<String> valueCallback) { if (!this.e) { c.a(this.f29569g, "saveWebArchive", new Class[]{String.class, Boolean.TYPE, ValueCallback.class}, str, Boolean.valueOf(z4), valueCallback); return; } this.f.saveWebArchive(str, z4, valueCallback); } public void a(IX5WebViewBase iX5WebViewBase) { this.f = iX5WebViewBase; } public void loadUrl(String str) { if (str != null && !showDebugView(str)) { MttTraceEvent.begin(AccessibilityEventCompat.TYPE_VIEW_HOVER_EXIT, "WebView.loadUrl"); if (!this.e) { this.f29569g.loadUrl(str); } else { this.f.loadUrl(str); } MttTraceEvent.end(AccessibilityEventCompat.TYPE_VIEW_HOVER_EXIT, "WebView.loadUrl"); } } public void a(Context context) { String str; int c5 = c(context); if (c5 != -1) { StringBuilder h12 = f.h("PV="); h12.append(String.valueOf(c5 + 1)); str = h12.toString(); } else { str = "PV=1"; } File tbsFolderDir = QbSdk.getTbsFolderDir(context); StringBuilder sb2 = new StringBuilder(); sb2.append(tbsFolderDir); File file = new File(f.g(sb2, File.separator, "core_private"), "pv.db"); try { file.getParentFile().mkdirs(); if (!file.isFile() || !file.exists()) { file.createNewFile(); } FileOutputStream fileOutputStream = new FileOutputStream(file, false); d = fileOutputStream; fileOutputStream.write(str.getBytes()); TbsLog.d("writetbscorepvfile", "writepvfile finish "); OutputStream outputStream = d; if (outputStream != null) { outputStream.flush(); } } catch (Throwable th2) { StringBuilder h13 = f.h("file.getAbsolutePath="); h13.append(file.getAbsolutePath()); h13.append(" Throwable="); h13.append(th2); TbsLog.d("writetbscorepvfile", h13.toString()); } } public WebView(Context context) { this(context, (AttributeSet) null); } public WebView(Context context, AttributeSet attributeSet) { this(context, attributeSet, 0); } public WebView(Context context, AttributeSet attributeSet, int i3) { this(context, attributeSet, i3, false); } public WebView(Context context, AttributeSet attributeSet, int i3, boolean z4) { this(context, attributeSet, i3, null, z4); } @TargetApi(11) public WebView(Context context, AttributeSet attributeSet, int i3, Map<String, Object> map, boolean z4) { super(context, attributeSet, i3); this.b = "WebView"; this.t = 1; this.f29572u = 2; this.f29573v = 3; this.w = "javascript:document.getElementsByTagName('HEAD').item(0).removeChild(document.getElementById('QQBrowserSDKNightMode'));"; this.x = "javascript:var style = document.createElement('style');style.type='text/css';style.id='QQBrowserSDKNightMode';style.innerHTML='html,body{background:none !important;background-color: #1d1e2a !important;}html *{background-color: #1d1e2a !important; color:#888888 !important;border-color:#3e4f61 !important;text-shadow:none !important;box-shadow:none !important;}a,a *{border-color:#4c5b99 !important; color:#2d69b3 !important;text-decoration:none !important;}a:visited,a:visited *{color:#a600a6 !important;}a:active,a:active *{color:#5588AA !important;}input,select,textarea,option,button{background-image:none !important;color:#AAAAAA !important;border-color:#4c5b99 !important;}form,div,button,span{background-color:#1d1e2a !important; border-color:#4c5b99 !important;}img{opacity:0.5}';document.getElementsByTagName('HEAD').item(0).appendChild(style);"; mWebViewCreated = true; i iVar = new i(); this.l = iVar; iVar.a("init_all", (byte) 1); this.i = context; this.f = null; this.e = false; QbSdk.a(context, "failed to createTBSWebview!"); this.f29569g = new a(context, attributeSet); CookieManager.getInstance().a(context, true, false); CookieSyncManager.createInstance(this.i).startSync(); 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 d()); mSysWebviewCreated = true; } catch (Exception unused) { } CookieManager.getInstance().a(); this.f29569g.setFocusableInTouchMode(true); addView(this.f29569g, new FrameLayout.LayoutParams(-1, -1)); TbsLog.i("WebView", "SystemWebView Created Success! #3"); TbsLog.e("WebView", "sys WebView: IsSysWebViewForcedByOuter = true", true); TbsCoreLoadStat.getInstance().a(context, 402, new Throwable()); b.a(context, this); MttTraceEvent.end(AccessibilityEventCompat.TYPE_VIEW_HOVER_EXIT, "WebView.constructor"); } private boolean a(View view) { Object a5; Context context = this.i; if ((context == null || getTbsCoreVersion(context) <= 36200) && (a5 = c.a(this.A, "onLongClick", new Class[]{View.class}, view)) != null) { return ((Boolean) a5).booleanValue(); } return false; } public static void c() { try { p4.f fVar = new p4.f(new Runnable() { /* class com.tencent.smtt.sdk.WebView.AnonymousClass6 */ public void run() { if (WebView.j == null) { TbsLog.d("TbsNeedReboot", "WebView.updateNeeeRebootStatus--mAppContext == null"); return; } c a5 = c.a(true); if (c.b) { TbsLog.d("TbsNeedReboot", "WebView.updateNeeeRebootStatus--needReboot = true"); return; } h a12 = h.a(WebView.j); int c5 = a12.c(); TbsLog.d("TbsNeedReboot", "WebView.updateNeeeRebootStatus--installStatus = " + c5); if (c5 == 2) { TbsLog.d("TbsNeedReboot", "WebView.updateNeeeRebootStatus--install setTbsNeedReboot true"); a5.a(String.valueOf(a12.b())); a5.b(true); return; } int a13 = a12.a("copy_status"); TbsLog.d("TbsNeedReboot", "WebView.updateNeeeRebootStatus--copyStatus = " + a13); if (a13 == 1) { TbsLog.d("TbsNeedReboot", "WebView.updateNeeeRebootStatus--copy setTbsNeedReboot true"); a5.a(String.valueOf(a12.b("copy_core_ver"))); a5.b(true); return; } r.a(); if (r.b()) { return; } if (c5 == 3 || a13 == 3) { TbsLog.d("TbsNeedReboot", "WebView.updateNeeeRebootStatus--setTbsNeedReboot true"); a5.a(String.valueOf(c.c())); a5.b(true); } } }, "com.tencent.smtt.sdk.WebView"); fVar.setName(p4.f.a(fVar.getName(), "com.tencent.smtt.sdk.WebView")); fVar.start(); } catch (Throwable th2) { TbsLog.e("webview", "updateRebootStatus excpetion: " + th2); } } }