package com.tencent.smtt.sdk; 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.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.WebSettings; import android.webkit.WebView; import android.widget.FrameLayout; import com.alibaba.baichuan.trade.biz.applink.adapter.AppLinkConstants; import com.alipay.sdk.util.f; import com.tencent.matrix.iocanary.config.SharePluginInfo; import com.tencent.mtt.MttTraceEvent; import com.tencent.smtt.export.external.TbsCoreSettings; 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 de.robv.android.xposed.XposedBridge; 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.Properties; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; import org.json.JSONException; import org.json.JSONObject; /* compiled from: TbsSdkJava */ public class WebView extends FrameLayout implements View.OnLongClickListener { public static final int GETPVERROR = -1; public static int NIGHT_MODE_ALPHA = 153; public static final int NIGHT_MODE_COLOR = -16777216; public static final int NORMAL_MODE_ALPHA = 255; public static final String SCHEME_GEO = "geo:0,0?q="; public static final String SCHEME_MAILTO = "mailto:"; public static final String SCHEME_TEL = "tel:"; /* renamed from: c reason: collision with root package name */ private static final Lock f34392c = new ReentrantLock(); /* renamed from: d reason: collision with root package name */ private static OutputStream f34393d = null; /* renamed from: j reason: collision with root package name */ private static Context f34394j = null; public static boolean mSysWebviewCreated = false; public static boolean mWebViewCreated = false; /* renamed from: n reason: collision with root package name */ private static BroadcastReceiver f34395n = null; /* renamed from: o reason: collision with root package name */ private static d f34396o = null; /* renamed from: p reason: collision with root package name */ private static Method f34397p = null; /* renamed from: s reason: collision with root package name */ private static String f34398s = null; /* renamed from: y reason: collision with root package name */ private static Paint f34399y = null; /* renamed from: z reason: collision with root package name */ private static boolean f34400z = true; private Object A; private View.OnLongClickListener B; /* renamed from: a reason: collision with root package name */ public int f34401a; /* renamed from: b reason: collision with root package name */ private final String f34402b; /* renamed from: e reason: collision with root package name */ private boolean f34403e; /* renamed from: f reason: collision with root package name */ private IX5WebViewBase f34404f; /* renamed from: g reason: collision with root package name */ private a f34405g; /* renamed from: h reason: collision with root package name */ private WebSettings f34406h; /* renamed from: i reason: collision with root package name */ private Context f34407i; /* renamed from: k reason: collision with root package name */ private boolean f34408k; /* renamed from: l reason: collision with root package name */ private i f34409l; /* renamed from: m reason: collision with root package name */ private boolean f34410m; public WebViewCallbackClient mWebViewCallbackClient; /* renamed from: q reason: collision with root package name */ private WebViewClient f34411q; /* renamed from: r reason: collision with root package name */ private WebChromeClient f34412r; /* renamed from: t reason: collision with root package name */ private final int f34413t; /* renamed from: u reason: collision with root package name */ private final int f34414u; /* renamed from: v reason: collision with root package name */ private final int f34415v; /* renamed from: w reason: collision with root package name */ private final String f34416w; /* renamed from: x reason: collision with root package name */ private final String f34417x; /* compiled from: TbsSdkJava */ public interface PictureListener { void onNewPicture(WebView webView, Picture picture); } /* compiled from: TbsSdkJava */ public class WebViewTransport { /* renamed from: b reason: collision with root package name */ private WebView f34430b; public WebViewTransport() { } public synchronized WebView getWebView() { return this.f34430b; } public synchronized void setWebView(WebView webView) { this.f34430b = 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.f34407i).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 i10, int i14, int i15, int i16) { super.onScrollChanged(i10, i14, i15, i16); } public boolean b(MotionEvent motionEvent) { return super.dispatchTouchEvent(motionEvent); } public boolean c(MotionEvent motionEvent) { return super.onInterceptTouchEvent(motionEvent); } public void computeScroll() { Log.d("syswebview", "SystemWebView - 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.f34400z && WebView.f34399y != null) { canvas.save(); canvas.drawPaint(WebView.f34399y); canvas.restore(); } } catch (Throwable th3) { th3.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 e14) { e14.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 i10, int i14, boolean z14, boolean z15) { WebViewCallbackClient webViewCallbackClient = WebView.this.mWebViewCallbackClient; if (webViewCallbackClient != null) { webViewCallbackClient.onOverScrolled(i10, i14, z14, z15, this); } else if (Build.VERSION.SDK_INT >= 9) { super.onOverScrolled(i10, i14, z14, z15); } } public void onScrollChanged(int i10, int i14, int i15, int i16) { Log.d("syswebview", "SystemWebView - onScrollChanged..."); WebViewCallbackClient webViewCallbackClient = WebView.this.mWebViewCallbackClient; if (webViewCallbackClient != null) { webViewCallbackClient.onScrollChanged(i10, i14, i15, i16, this); return; } super.onScrollChanged(i10, i14, i15, i16); WebView.this.onScrollChanged(i10, i14, i15, i16); } @SuppressLint({"ClickableViewAccessibility"}) public boolean onTouchEvent(MotionEvent motionEvent) { if (!hasFocus()) { requestFocus(); } Log.d("syswebview", "SystemWebView - onTouchEvent:" + motionEvent); WebViewCallbackClient webViewCallbackClient = WebView.this.mWebViewCallbackClient; if (webViewCallbackClient != null) { return webViewCallbackClient.onTouchEvent(motionEvent, this); } try { return super.onTouchEvent(motionEvent); } catch (Exception e14) { e14.printStackTrace(); return false; } } @TargetApi(9) public boolean overScrollBy(int i10, int i14, int i15, int i16, int i17, int i18, int i19, int i24, boolean z14) { WebViewCallbackClient webViewCallbackClient = WebView.this.mWebViewCallbackClient; if (webViewCallbackClient != null) { return webViewCallbackClient.overScrollBy(i10, i14, i15, i16, i17, i18, i19, i24, z14, this); } if (Build.VERSION.SDK_INT >= 9) { return super.overScrollBy(i10, i14, i15, i16, i17, i18, i19, i24, z14); } return false; } public void setOverScrollMode(int i10) { try { super.setOverScrollMode(i10); } catch (Exception unused) { } } public void a() { Log.d("syswebview", "SystemWebView - super_computeScroll..."); super.computeScroll(); } public boolean a(MotionEvent motionEvent) { Log.d("syswebview", "SystemWebView - super_onTouchEvent..."); return super.onTouchEvent(motionEvent); } @TargetApi(9) public boolean a(int i10, int i14, int i15, int i16, int i17, int i18, int i19, int i24, boolean z14) { if (Build.VERSION.SDK_INT >= 9) { return super.overScrollBy(i10, i14, i15, i16, i17, i18, i19, i24, z14); } return false; } @TargetApi(9) public void a(int i10, int i14, boolean z14, boolean z15) { if (Build.VERSION.SDK_INT >= 9) { super.onOverScrolled(i10, i14, z14, z15); } } } public WebView(Context context, boolean z14) { super(context); this.f34402b = "WebView"; this.f34403e = false; this.f34406h = null; this.f34407i = null; this.f34401a = 0; this.f34408k = false; this.f34409l = null; this.f34410m = false; this.f34411q = null; this.f34412r = null; this.f34413t = 1; this.f34414u = 2; this.f34415v = 3; this.f34416w = "javascript:document.getElementsByTagName('HEAD').item(0).removeChild(document.getElementById('QQBrowserSDKNightMode'));"; this.f34417x = "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);"; this.A = null; this.B = null; } private boolean b(Context context) { try { if (context.getPackageName().indexOf("com.tencent.mobileqq") >= 0) { return true; } return false; } catch (Throwable th3) { th3.printStackTrace(); return false; } } /* JADX WARNING: Removed duplicated region for block: B:40:0x00e4 A[SYNTHETIC, Splitter:B:40:0x00e4] */ /* JADX WARNING: Removed duplicated region for block: B:45:0x00f2 A[SYNTHETIC, Splitter:B:45:0x00f2] */ private int c(Context context) { FileLock a14; Throwable th3; Exception e14; StringBuilder sb3; FileOutputStream b14 = b.b(context, true, "tbslock.txt"); if (b14 == null || (a14 = b.a(context, b14)) == null) { return -1; } Lock lock = f34392c; 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(a14, b14); 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 e15) { e = e15; sb3 = new StringBuilder(); } f34392c.unlock(); b.a(a14, b14); return -1; } int parseInt = Integer.parseInt(property); TbsLog.d("getTbsCorePV", "mpv =" + parseInt); try { fileInputStream2.close(); } catch (IOException e16) { TbsLog.e("getTbsCorePV", "TbsInstaller--getTbsCorePV IOException=" + e16.toString()); } f34392c.unlock(); b.a(a14, b14); return parseInt; } catch (Exception e17) { e14 = e17; fileInputStream = fileInputStream2; try { TbsLog.e("getTbsCorePV", "TbsInstaller--getTbsCorePV Exception=" + e14.toString()); if (fileInputStream != null) { try { fileInputStream.close(); } catch (IOException e18) { e = e18; sb3 = new StringBuilder(); } } f34392c.unlock(); b.a(a14, b14); return -1; } catch (Throwable th4) { th3 = th4; if (fileInputStream != null) { try { fileInputStream.close(); } catch (IOException e19) { TbsLog.e("getTbsCorePV", "TbsInstaller--getTbsCorePV IOException=" + e19.toString()); } } f34392c.unlock(); b.a(a14, b14); throw th3; } } catch (Throwable th5) { th3 = th5; fileInputStream = fileInputStream2; if (fileInputStream != null) { } f34392c.unlock(); b.a(a14, b14); throw th3; } } catch (Exception e24) { e14 = e24; TbsLog.e("getTbsCorePV", "TbsInstaller--getTbsCorePV Exception=" + e14.toString()); if (fileInputStream != null) { } f34392c.unlock(); b.a(a14, b14); return -1; } } else { b.a(a14, b14); return -1; } sb3.append("TbsInstaller--getTbsCorePV IOException="); sb3.append(e.toString()); TbsLog.e("getTbsCorePV", sb3.toString()); f34392c.unlock(); b.a(a14, b14); 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 ""; } String str = "tbs_core_version:" + QbSdk.getTbsVersionForCrash(context) + ";tbs_sdk_version:" + 43799 + f.f18324b; boolean z14 = false; if ("com.tencent.mm".equals(context.getApplicationInfo().packageName)) { try { ClassLoader classLoader = XposedBridge.f67886a; z14 = true; } catch (ClassNotFoundException unused) { } catch (Throwable th3) { th3.printStackTrace(); } } if (z14) { return str + "isXposed=true;"; } StringBuilder sb3 = new StringBuilder(); sb3.append(c.a(true).d()); sb3.append("\n"); sb3.append(str); if (!TbsShareManager.isThirdPartyApp(context) && (map = QbSdk.f34221l) != null && map.containsKey(TbsCoreSettings.TBS_SETTINGS_WEAPP_ID_KEY) && QbSdk.f34221l.containsKey(TbsCoreSettings.TBS_SETTINGS_WEAPP_NAME_KEY)) { sb3.append("\n"); sb3.append("weapp_id:" + QbSdk.f34221l.get(TbsCoreSettings.TBS_SETTINGS_WEAPP_ID_KEY) + f.f18324b + TbsCoreSettings.TBS_SETTINGS_WEAPP_NAME_KEY + ":" + QbSdk.f34221l.get(TbsCoreSettings.TBS_SETTINGS_WEAPP_NAME_KEY) + f.f18324b); } if (sb3.length() > 8192) { return sb3.substring(sb3.length() - 8192); } 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 e14) { e14.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 e14 = c.a(true).e(); TbsLog.d("TbsNeedReboot", "WebView.getTbsNeedReboot--ret = " + e14); return e14; } public static int getTbsSDKVersion(Context context) { return 43799; } public static synchronized void setSysDayOrNight(boolean z14) { synchronized (WebView.class) { if (z14 != f34400z) { f34400z = z14; if (f34399y == null) { Paint paint = new Paint(); f34399y = paint; paint.setColor(NIGHT_MODE_COLOR); } if (!z14) { int alpha = f34399y.getAlpha(); int i10 = NIGHT_MODE_ALPHA; if (alpha != i10) { f34399y.setAlpha(i10); } } else if (f34399y.getAlpha() != 255) { f34399y.setAlpha(255); } } } } public static void setWebContentsDebuggingEnabled(boolean z14) { r a14 = r.a(); if (a14 != null && r.b()) { a14.c().a(z14); } else if (Build.VERSION.SDK_INT >= 19) { try { Method declaredMethod = Class.forName("android.webkit.WebView").getDeclaredMethod("setWebContentsDebuggingEnabled", Boolean.TYPE); f34397p = declaredMethod; if (declaredMethod != null) { declaredMethod.setAccessible(true); f34397p.invoke(null, Boolean.valueOf(z14)); } } catch (Exception e14) { TbsLog.e("QbSdk", "Exception:" + e14.getStackTrace()); e14.printStackTrace(); } } } public void a(android.webkit.WebView webView) { } public void addJavascriptInterface(Object obj, String str) { if (!this.f34403e) { this.f34405g.addJavascriptInterface(obj, str); } else { this.f34404f.addJavascriptInterface(obj, str); } } public void addView(View view) { if (!this.f34403e) { this.f34405g.addView(view); return; } View view2 = this.f34404f.getView(); try { Method a14 = c.a(view2, "addView", View.class); a14.setAccessible(true); a14.invoke(view2, view); } catch (Throwable unused) { } } public boolean canGoBack() { if (!this.f34403e) { return this.f34405g.canGoBack(); } return this.f34404f.canGoBack(); } public boolean canGoBackOrForward(int i10) { if (!this.f34403e) { return this.f34405g.canGoBackOrForward(i10); } return this.f34404f.canGoBackOrForward(i10); } public boolean canGoForward() { if (!this.f34403e) { return this.f34405g.canGoForward(); } return this.f34404f.canGoForward(); } @Deprecated public boolean canZoomIn() { Object a14; if (this.f34403e) { return this.f34404f.canZoomIn(); } if (Build.VERSION.SDK_INT < 11 || (a14 = c.a(this.f34405g, "canZoomIn")) == null) { return false; } return ((Boolean) a14).booleanValue(); } @Deprecated public boolean canZoomOut() { Object a14; if (this.f34403e) { return this.f34404f.canZoomOut(); } if (Build.VERSION.SDK_INT < 11 || (a14 = c.a(this.f34405g, "canZoomOut")) == null) { return false; } return ((Boolean) a14).booleanValue(); } @Deprecated public Picture capturePicture() { if (this.f34403e) { return this.f34404f.capturePicture(); } Object a14 = c.a(this.f34405g, "capturePicture"); if (a14 == null) { return null; } return (Picture) a14; } public void clearCache(boolean z14) { if (!this.f34403e) { this.f34405g.clearCache(z14); } else { this.f34404f.clearCache(z14); } } public void clearFormData() { if (!this.f34403e) { this.f34405g.clearFormData(); } else { this.f34404f.clearFormData(); } } public void clearHistory() { if (!this.f34403e) { this.f34405g.clearHistory(); } else { this.f34404f.clearHistory(); } } @TargetApi(3) public void clearMatches() { if (!this.f34403e) { this.f34405g.clearMatches(); } else { this.f34404f.clearMatches(); } } public void clearSslPreferences() { if (!this.f34403e) { this.f34405g.clearSslPreferences(); } else { this.f34404f.clearSslPreferences(); } } @Deprecated public void clearView() { if (!this.f34403e) { c.a(this.f34405g, "clearView"); } else { this.f34404f.clearView(); } } public int computeHorizontalScrollExtent() { try { if (this.f34403e) { Method a14 = c.a(this.f34404f.getView(), "computeHorizontalScrollExtent", new Class[0]); a14.setAccessible(true); return ((Integer) a14.invoke(this.f34404f.getView(), new Object[0])).intValue(); } Method a15 = c.a(this.f34405g, "computeHorizontalScrollExtent", new Class[0]); a15.setAccessible(true); return ((Integer) a15.invoke(this.f34405g, new Object[0])).intValue(); } catch (Exception e14) { e14.printStackTrace(); return -1; } } public int computeHorizontalScrollOffset() { try { if (this.f34403e) { Method a14 = c.a(this.f34404f.getView(), "computeHorizontalScrollOffset", new Class[0]); a14.setAccessible(true); return ((Integer) a14.invoke(this.f34404f.getView(), new Object[0])).intValue(); } Method a15 = c.a(this.f34405g, "computeHorizontalScrollOffset", new Class[0]); a15.setAccessible(true); return ((Integer) a15.invoke(this.f34405g, new Object[0])).intValue(); } catch (Exception e14) { e14.printStackTrace(); return -1; } } public int computeHorizontalScrollRange() { try { if (this.f34403e) { return ((Integer) c.a(this.f34404f.getView(), "computeHorizontalScrollRange", new Class[0], new Object[0])).intValue(); } Method a14 = c.a(this.f34405g, "computeHorizontalScrollRange", new Class[0]); a14.setAccessible(true); return ((Integer) a14.invoke(this.f34405g, new Object[0])).intValue(); } catch (Exception e14) { e14.printStackTrace(); return -1; } } public void computeScroll() { if (!this.f34403e) { this.f34405g.computeScroll(); } else { this.f34404f.computeScroll(); } } public int computeVerticalScrollExtent() { try { if (this.f34403e) { Method a14 = c.a(this.f34404f.getView(), "computeVerticalScrollExtent", new Class[0]); a14.setAccessible(true); return ((Integer) a14.invoke(this.f34404f.getView(), new Object[0])).intValue(); } Method a15 = c.a(this.f34405g, "computeVerticalScrollExtent", new Class[0]); a15.setAccessible(true); return ((Integer) a15.invoke(this.f34405g, new Object[0])).intValue(); } catch (Exception e14) { e14.printStackTrace(); return -1; } } public int computeVerticalScrollOffset() { try { if (this.f34403e) { Method a14 = c.a(this.f34404f.getView(), "computeVerticalScrollOffset", new Class[0]); a14.setAccessible(true); return ((Integer) a14.invoke(this.f34404f.getView(), new Object[0])).intValue(); } Method a15 = c.a(this.f34405g, "computeVerticalScrollOffset", new Class[0]); a15.setAccessible(true); return ((Integer) a15.invoke(this.f34405g, new Object[0])).intValue(); } catch (Exception e14) { e14.printStackTrace(); return -1; } } public int computeVerticalScrollRange() { try { if (this.f34403e) { return ((Integer) c.a(this.f34404f.getView(), "computeVerticalScrollRange", new Class[0], new Object[0])).intValue(); } Method a14 = c.a(this.f34405g, "computeVerticalScrollRange", new Class[0]); a14.setAccessible(true); return ((Integer) a14.invoke(this.f34405g, new Object[0])).intValue(); } catch (Exception e14) { e14.printStackTrace(); return -1; } } public WebBackForwardList copyBackForwardList() { if (this.f34403e) { return WebBackForwardList.a(this.f34404f.copyBackForwardList()); } return WebBackForwardList.a(this.f34405g.copyBackForwardList()); } public Object createPrintDocumentAdapter(String str) { if (this.f34403e) { try { return this.f34404f.createPrintDocumentAdapter(str); } catch (Throwable th3) { th3.printStackTrace(); return null; } } else if (Build.VERSION.SDK_INT < 21) { return null; } else { return c.a(this.f34405g, "createPrintDocumentAdapter", new Class[]{String.class}, str); } } public void customDiskCachePathEnabled(boolean z14, String str) { if (this.f34403e && getX5WebViewExtension() != null) { Bundle bundle = new Bundle(); bundle.putBoolean("enabled", z14); bundle.putString(SharePluginInfo.ISSUE_FILE_PATH, str); getX5WebViewExtension().invokeMiscMethod("customDiskCachePathEnabled", bundle); } } public void destroy() { try { if ("com.xunmeng.pinduoduo".equals(this.f34407i.getApplicationInfo().packageName)) { new Thread("WebviewDestroy") { /* class com.tencent.smtt.sdk.WebView.AnonymousClass1 */ public void run() { WebView.this.tbsWebviewDestroy(false); } }.start(); if (this.f34403e) { this.f34404f.destroy(); } else { this.f34405g.destroy(); } } else { tbsWebviewDestroy(true); } } catch (Throwable unused) { tbsWebviewDestroy(true); } } public void documentHasImages(Message message) { if (!this.f34403e) { this.f34405g.documentHasImages(message); } else { this.f34404f.documentHasImages(message); } } public void dumpViewHierarchyWithProperties(BufferedWriter bufferedWriter, int i10) { if (!this.f34403e) { c.a(this.f34405g, "dumpViewHierarchyWithProperties", new Class[]{BufferedWriter.class, Integer.TYPE}, bufferedWriter, Integer.valueOf(i10)); return; } this.f34404f.dumpViewHierarchyWithProperties(bufferedWriter, i10); } public void evaluateJavascript(String str, ValueCallback<String> valueCallback) { if (this.f34403e) { try { Method a14 = c.a(this.f34404f.getView(), "evaluateJavascript", String.class, ValueCallback.class); a14.setAccessible(true); a14.invoke(this.f34404f.getView(), str, valueCallback); } catch (Exception e14) { e14.printStackTrace(); loadUrl(str); } } else if (Build.VERSION.SDK_INT >= 19) { try { Method declaredMethod = Class.forName("android.webkit.WebView").getDeclaredMethod("evaluateJavascript", String.class, ValueCallback.class); declaredMethod.setAccessible(true); declaredMethod.invoke(this.f34405g, str, valueCallback); } catch (Exception e15) { e15.printStackTrace(); } } } @Deprecated public int findAll(String str) { if (this.f34403e) { return this.f34404f.findAll(str); } Object a14 = c.a(this.f34405g, "findAll", new Class[]{String.class}, str); if (a14 == null) { return 0; } return ((Integer) a14).intValue(); } @TargetApi(16) public void findAllAsync(String str) { if (this.f34403e) { this.f34404f.findAllAsync(str); } else if (Build.VERSION.SDK_INT >= 16) { c.a(this.f34405g, "findAllAsync", new Class[]{String.class}, str); } } public View findHierarchyView(String str, int i10) { if (this.f34403e) { return this.f34404f.findHierarchyView(str, i10); } return (View) c.a(this.f34405g, "findHierarchyView", new Class[]{String.class, Integer.TYPE}, str, Integer.valueOf(i10)); } @TargetApi(3) public void findNext(boolean z14) { if (!this.f34403e) { this.f34405g.findNext(z14); } else { this.f34404f.findNext(z14); } } public void flingScroll(int i10, int i14) { if (!this.f34403e) { this.f34405g.flingScroll(i10, i14); } else { this.f34404f.flingScroll(i10, i14); } } @Deprecated public void freeMemory() { if (!this.f34403e) { c.a(this.f34405g, "freeMemory"); } else { this.f34404f.freeMemory(); } } public SslCertificate getCertificate() { if (!this.f34403e) { return this.f34405g.getCertificate(); } return this.f34404f.getCertificate(); } public int getContentHeight() { if (!this.f34403e) { return this.f34405g.getContentHeight(); } return this.f34404f.getContentHeight(); } public int getContentWidth() { if (this.f34403e) { return this.f34404f.getContentWidth(); } Object a14 = c.a(this.f34405g, "getContentWidth"); if (a14 == null) { return 0; } return ((Integer) a14).intValue(); } public Bitmap getFavicon() { if (!this.f34403e) { return this.f34405g.getFavicon(); } return this.f34404f.getFavicon(); } public HitTestResult getHitTestResult() { if (!this.f34403e) { return new HitTestResult(this.f34405g.getHitTestResult()); } return new HitTestResult(this.f34404f.getHitTestResult()); } public String[] getHttpAuthUsernamePassword(String str, String str2) { if (!this.f34403e) { return this.f34405g.getHttpAuthUsernamePassword(str, str2); } return this.f34404f.getHttpAuthUsernamePassword(str, str2); } @TargetApi(3) public String getOriginalUrl() { if (!this.f34403e) { return this.f34405g.getOriginalUrl(); } return this.f34404f.getOriginalUrl(); } public int getProgress() { if (!this.f34403e) { return this.f34405g.getProgress(); } return this.f34404f.getProgress(); } public boolean getRendererPriorityWaivedWhenNotVisible() { try { if (this.f34403e || Build.VERSION.SDK_INT < 26) { return false; } Object a14 = c.a(this.f34405g, "getRendererPriorityWaivedWhenNotVisible"); if (a14 == null) { return false; } return ((Boolean) a14).booleanValue(); } catch (Exception e14) { e14.printStackTrace(); return false; } } public int getRendererRequestedPriority() { try { if (this.f34403e || Build.VERSION.SDK_INT < 26) { return 0; } Object a14 = c.a(this.f34405g, "getRendererRequestedPriority"); if (a14 == null) { return 0; } return ((Integer) a14).intValue(); } catch (Exception e14) { e14.printStackTrace(); return 0; } } @Deprecated public float getScale() { if (this.f34403e) { return this.f34404f.getScale(); } Object a14 = c.a(this.f34405g, "getScale"); if (a14 == null) { return 0.0f; } return ((Float) a14).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.f34406h; if (webSettings != null) { return webSettings; } if (this.f34403e) { WebSettings webSettings2 = new WebSettings(this.f34404f.getSettings()); this.f34406h = webSettings2; return webSettings2; } WebSettings webSettings3 = new WebSettings(this.f34405g.getSettings()); this.f34406h = webSettings3; return webSettings3; } public IX5WebSettingsExtension getSettingsExtension() { if (!this.f34403e) { return null; } return this.f34404f.getX5WebViewExtension().getSettingsExtension(); } public int getSysNightModeAlpha() { return NIGHT_MODE_ALPHA; } public String getTitle() { if (!this.f34403e) { return this.f34405g.getTitle(); } return this.f34404f.getTitle(); } public String getUrl() { if (!this.f34403e) { return this.f34405g.getUrl(); } return this.f34404f.getUrl(); } public View getView() { if (!this.f34403e) { return this.f34405g; } return this.f34404f.getView(); } public int getVisibleTitleHeight() { if (this.f34403e) { return this.f34404f.getVisibleTitleHeight(); } Object a14 = c.a(this.f34405g, "getVisibleTitleHeight"); if (a14 == null) { return 0; } return ((Integer) a14).intValue(); } public WebChromeClient getWebChromeClient() { return this.f34412r; } public IX5WebChromeClientExtension getWebChromeClientExtension() { if (!this.f34403e) { return null; } return this.f34404f.getX5WebViewExtension().getWebChromeClientExtension(); } public int getWebScrollX() { if (this.f34403e) { return this.f34404f.getView().getScrollX(); } return this.f34405g.getScrollX(); } public int getWebScrollY() { if (this.f34403e) { return this.f34404f.getView().getScrollY(); } return this.f34405g.getScrollY(); } public WebViewClient getWebViewClient() { return this.f34411q; } public IX5WebViewClientExtension getWebViewClientExtension() { if (!this.f34403e) { return null; } return this.f34404f.getX5WebViewExtension().getWebViewClientExtension(); } public IX5WebViewBase.HitTestResult getX5HitTestResult() { if (!this.f34403e) { return null; } return this.f34404f.getHitTestResult(); } public IX5WebViewExtension getX5WebViewExtension() { if (!this.f34403e) { return null; } return this.f34404f.getX5WebViewExtension(); } @Deprecated public View getZoomControls() { if (!this.f34403e) { return (View) c.a(this.f34405g, "getZoomControls"); } return this.f34404f.getZoomControls(); } public void goBack() { if (!this.f34403e) { this.f34405g.goBack(); } else { this.f34404f.goBack(); } } public void goBackOrForward(int i10) { if (!this.f34403e) { this.f34405g.goBackOrForward(i10); } else { this.f34404f.goBackOrForward(i10); } } public void goForward() { if (!this.f34403e) { this.f34405g.goForward(); } else { this.f34404f.goForward(); } } public void invokeZoomPicker() { if (!this.f34403e) { this.f34405g.invokeZoomPicker(); } else { this.f34404f.invokeZoomPicker(); } } public boolean isDayMode() { return f34400z; } public boolean isPrivateBrowsingEnabled() { Object a14; if (this.f34403e) { return this.f34404f.isPrivateBrowsingEnable(); } if (Build.VERSION.SDK_INT < 11 || (a14 = c.a(this.f34405g, "isPrivateBrowsingEnabled")) == null) { return false; } return ((Boolean) a14).booleanValue(); } public void loadData(String str, String str2, String str3) { if (!this.f34403e) { this.f34405g.loadData(str, str2, str3); } else { this.f34404f.loadData(str, str2, str3); } } public void loadDataWithBaseURL(String str, String str2, String str3, String str4, String str5) { if (!this.f34403e) { this.f34405g.loadDataWithBaseURL(str, str2, str3, str4, str5); } else { this.f34404f.loadDataWithBaseURL(str, str2, str3, str4, str5); } } @TargetApi(8) public void loadUrl(String str, Map<String, String> map) { if (str != null && !showDebugView(str)) { if (this.f34403e) { this.f34404f.loadUrl(str, map); } else if (Build.VERSION.SDK_INT >= 8) { this.f34405g.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.f34403e) { c.a(this.f34405g, "onPause"); } else { this.f34404f.onPause(); } } public void onResume() { if (!this.f34403e) { c.a(this.f34405g, "onResume"); } else { this.f34404f.onResume(); } } @TargetApi(11) public void onSizeChanged(int i10, int i14, int i15, int i16) { super.onSizeChanged(i10, i14, i15, i16); if (Build.VERSION.SDK_INT >= 21 && b(this.f34407i) && isHardwareAccelerated() && i10 > 0 && i14 > 0) { getLayerType(); } } public boolean overlayHorizontalScrollbar() { if (!this.f34403e) { return this.f34405g.overlayHorizontalScrollbar(); } return this.f34404f.overlayHorizontalScrollbar(); } public boolean overlayVerticalScrollbar() { if (this.f34403e) { return this.f34404f.overlayVerticalScrollbar(); } return this.f34405g.overlayVerticalScrollbar(); } public boolean pageDown(boolean z14) { if (!this.f34403e) { return this.f34405g.pageDown(z14); } return this.f34404f.pageDown(z14, -1); } public boolean pageUp(boolean z14) { if (!this.f34403e) { return this.f34405g.pageUp(z14); } return this.f34404f.pageUp(z14, -1); } public void pauseTimers() { if (!this.f34403e) { this.f34405g.pauseTimers(); } else { this.f34404f.pauseTimers(); } } @TargetApi(5) public void postUrl(String str, byte[] bArr) { if (!this.f34403e) { this.f34405g.postUrl(str, bArr); } else { this.f34404f.postUrl(str, bArr); } } @Deprecated public void refreshPlugins(boolean z14) { if (!this.f34403e) { c.a(this.f34405g, "refreshPlugins", new Class[]{Boolean.TYPE}, Boolean.valueOf(z14)); return; } this.f34404f.refreshPlugins(z14); } public void reload() { if (!this.f34403e) { this.f34405g.reload(); } else { this.f34404f.reload(); } } @TargetApi(11) public void removeJavascriptInterface(String str) { if (this.f34403e) { return; } if (Build.VERSION.SDK_INT >= 11) { c.a(this.f34405g, "removeJavascriptInterface", new Class[]{String.class}, str); return; } this.f34404f.removeJavascriptInterface(str); } public void removeView(View view) { if (!this.f34403e) { this.f34405g.removeView(view); return; } View view2 = this.f34404f.getView(); try { Method a14 = c.a(view2, "removeView", View.class); a14.setAccessible(true); a14.invoke(view2, view); } catch (Throwable unused) { } } public JSONObject reportInitPerformance(long j14, int i10, long j15, long j16) { i iVar; JSONObject jSONObject = new JSONObject(); try { jSONObject.put("IS_X5", this.f34403e); } catch (JSONException e14) { e14.printStackTrace(); } TbsLog.i("sdkreport", "reportInitPerformance initType is " + j14 + " isX5Core is " + this.f34403e + " isPerformanceDataRecorded" + this.f34410m); if (this.f34403e && (iVar = this.f34409l) != null && !this.f34410m) { iVar.a("init_type", j14); this.f34409l.a("time_oncreate", j15); this.f34409l.a("webview_type", (long) i10); this.f34409l.a("time_webaccelerator", j16); if (this.f34409l.a(this.f34404f.hashCode(), getUrl())) { this.f34410m = true; } try { jSONObject.put(AppLinkConstants.DETAIL, this.f34409l.a()); } catch (JSONException e15) { e15.printStackTrace(); } } return jSONObject; } public boolean requestChildRectangleOnScreen(View view, Rect rect, boolean z14) { if (this.f34403e) { View view2 = this.f34404f.getView(); if (!(view2 instanceof ViewGroup)) { return false; } ViewGroup viewGroup = (ViewGroup) view2; if (view == this) { view = view2; } return viewGroup.requestChildRectangleOnScreen(view, rect, z14); } a aVar = this.f34405g; if (view == this) { view = aVar; } return aVar.requestChildRectangleOnScreen(view, rect, z14); } public void requestFocusNodeHref(Message message) { if (!this.f34403e) { this.f34405g.requestFocusNodeHref(message); } else { this.f34404f.requestFocusNodeHref(message); } } public void requestImageRef(Message message) { if (!this.f34403e) { this.f34405g.requestImageRef(message); } else { this.f34404f.requestImageRef(message); } } @Deprecated public boolean restorePicture(Bundle bundle, File file) { if (this.f34403e) { return this.f34404f.restorePicture(bundle, file); } Object a14 = c.a(this.f34405g, "restorePicture", new Class[]{Bundle.class, File.class}, bundle, file); if (a14 == null) { return false; } return ((Boolean) a14).booleanValue(); } public WebBackForwardList restoreState(Bundle bundle) { if (!this.f34403e) { return WebBackForwardList.a(this.f34405g.restoreState(bundle)); } return WebBackForwardList.a(this.f34404f.restoreState(bundle)); } public void resumeTimers() { if (!this.f34403e) { this.f34405g.resumeTimers(); } else { this.f34404f.resumeTimers(); } } @Deprecated public void savePassword(String str, String str2, String str3) { if (!this.f34403e) { c.a(this.f34405g, "savePassword", new Class[]{String.class, String.class, String.class}, str, str2, str3); return; } this.f34404f.savePassword(str, str2, str3); } @Deprecated public boolean savePicture(Bundle bundle, File file) { if (this.f34403e) { return this.f34404f.savePicture(bundle, file); } Object a14 = c.a(this.f34405g, "savePicture", new Class[]{Bundle.class, File.class}, bundle, file); if (a14 == null) { return false; } return ((Boolean) a14).booleanValue(); } public WebBackForwardList saveState(Bundle bundle) { if (!this.f34403e) { return WebBackForwardList.a(this.f34405g.saveState(bundle)); } return WebBackForwardList.a(this.f34404f.saveState(bundle)); } @TargetApi(11) public void saveWebArchive(String str) { if (this.f34403e) { this.f34404f.saveWebArchive(str); } else if (Build.VERSION.SDK_INT >= 11) { c.a(this.f34405g, "saveWebArchive", new Class[]{String.class}, str); } } public void setARModeEnable(boolean z14) { try { if (this.f34403e) { getSettingsExtension().setARModeEnable(z14); } } catch (Throwable th3) { th3.printStackTrace(); } } public void setBackgroundColor(int i10) { if (!this.f34403e) { this.f34405g.setBackgroundColor(i10); } else { this.f34404f.setBackgroundColor(i10); } super.setBackgroundColor(i10); } @Deprecated public void setCertificate(SslCertificate sslCertificate) { if (!this.f34403e) { this.f34405g.setCertificate(sslCertificate); } else { this.f34404f.setCertificate(sslCertificate); } } public void setDayOrNight(boolean z14) { try { if (this.f34403e) { getSettingsExtension().setDayOrNight(z14); } setSysDayOrNight(z14); getView().postInvalidate(); } catch (Throwable th3) { th3.printStackTrace(); } } public void setDownloadListener(final DownloadListener downloadListener) { boolean z14 = this.f34403e; if (!z14) { this.f34405g.setDownloadListener(new DownloadListener() { /* class com.tencent.smtt.sdk.WebView.AnonymousClass3 */ public void onDownloadStart(String str, String str2, String str3, String str4, long j14) { DownloadListener downloadListener = downloadListener; if (downloadListener == null) { ApplicationInfo applicationInfo = WebView.this.f34407i == null ? null : WebView.this.f34407i.getApplicationInfo(); if (applicationInfo == null || !"com.tencent.mm".equals(applicationInfo.packageName)) { com.tencent.smtt.sdk.a.a.a(WebView.this.f34407i, str, null, null); return; } return; } downloadListener.onDownloadStart(str, str2, str3, str4, j14); } }); } else { this.f34404f.setDownloadListener(new a(this, downloadListener, z14)); } } @TargetApi(16) public void setFindListener(final IX5WebViewBase.FindListener findListener) { if (this.f34403e) { this.f34404f.setFindListener(findListener); } else if (Build.VERSION.SDK_INT >= 16) { this.f34405g.setFindListener(new WebView.FindListener() { /* class com.tencent.smtt.sdk.WebView.AnonymousClass2 */ public void onFindResultReceived(int i10, int i14, boolean z14) { findListener.onFindResultReceived(i10, i14, z14); } }); } } public void setHorizontalScrollbarOverlay(boolean z14) { if (!this.f34403e) { this.f34405g.setHorizontalScrollbarOverlay(z14); } else { this.f34404f.setHorizontalScrollbarOverlay(z14); } } public void setHttpAuthUsernamePassword(String str, String str2, String str3, String str4) { if (!this.f34403e) { this.f34405g.setHttpAuthUsernamePassword(str, str2, str3, str4); } else { this.f34404f.setHttpAuthUsernamePassword(str, str2, str3, str4); } } public void setInitialScale(int i10) { if (!this.f34403e) { this.f34405g.setInitialScale(i10); } else { this.f34404f.setInitialScale(i10); } } @Deprecated public void setMapTrackballToArrowKeys(boolean z14) { if (!this.f34403e) { c.a(this.f34405g, "setMapTrackballToArrowKeys", new Class[]{Boolean.TYPE}, Boolean.valueOf(z14)); return; } this.f34404f.setMapTrackballToArrowKeys(z14); } public void setNetworkAvailable(boolean z14) { if (this.f34403e) { this.f34404f.setNetworkAvailable(z14); } else if (Build.VERSION.SDK_INT >= 3) { this.f34405g.setNetworkAvailable(z14); } } public void setOnLongClickListener(View.OnLongClickListener onLongClickListener) { if (!this.f34403e) { this.f34405g.setOnLongClickListener(onLongClickListener); return; } View view = this.f34404f.getView(); try { if (this.A == null) { Method a14 = c.a(view, "getListenerInfo", new Class[0]); a14.setAccessible(true); Object invoke = a14.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.f34403e) { if (pictureListener == null) { this.f34405g.setPictureListener(null); } else { this.f34405g.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.f34404f.setPictureListener(null); } else { this.f34404f.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 z14) { 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 i10, boolean z14) { try { if (!this.f34403e && Build.VERSION.SDK_INT >= 26) { c.a(this.f34405g, "setRendererPriorityPolicy", new Class[]{Integer.TYPE, Boolean.TYPE}, Integer.valueOf(i10), Boolean.valueOf(z14)); } } catch (Exception e14) { e14.printStackTrace(); } } public void setScrollBarStyle(int i10) { if (this.f34403e) { this.f34404f.getView().setScrollBarStyle(i10); } else { this.f34405g.setScrollBarStyle(i10); } } public void setSysNightModeAlpha(int i10) { NIGHT_MODE_ALPHA = i10; } public void setVerticalScrollbarOverlay(boolean z14) { if (!this.f34403e) { this.f34405g.setVerticalScrollbarOverlay(z14); } else { this.f34404f.setVerticalScrollbarOverlay(z14); } } public boolean setVideoFullScreen(Context context, boolean z14) { if (!context.getApplicationInfo().processName.contains("com.tencent.android.qqdownloader") || this.f34404f == null) { return false; } Bundle bundle = new Bundle(); if (z14) { bundle.putInt("DefaultVideoScreen", 2); } else { bundle.putInt("DefaultVideoScreen", 1); } this.f34404f.getX5WebViewExtension().invokeMiscMethod("setVideoParams", bundle); return true; } public void setVisibility(int i10) { super.setVisibility(i10); if (getView() != null) { getView().setVisibility(i10); } } public void setWebChromeClient(WebChromeClient webChromeClient) { SystemWebChromeClient systemWebChromeClient = null; e eVar = null; if (this.f34403e) { IX5WebViewBase iX5WebViewBase = this.f34404f; if (webChromeClient != null) { eVar = new e(r.a().a(true).g(), this, webChromeClient); } iX5WebViewBase.setWebChromeClient(eVar); } else { a aVar = this.f34405g; if (webChromeClient != null) { systemWebChromeClient = new SystemWebChromeClient(this, webChromeClient); } aVar.setWebChromeClient(systemWebChromeClient); } this.f34412r = webChromeClient; } public void setWebChromeClientExtension(IX5WebChromeClientExtension iX5WebChromeClientExtension) { if (this.f34403e) { this.f34404f.getX5WebViewExtension().setWebChromeClientExtension(iX5WebChromeClientExtension); } } public void setWebViewCallbackClient(WebViewCallbackClient webViewCallbackClient) { this.mWebViewCallbackClient = webViewCallbackClient; if (this.f34403e && 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.f34403e) { IX5WebViewBase iX5WebViewBase = this.f34404f; if (webViewClient != null) { fVar = new f(r.a().a(true).h(), this, webViewClient); } iX5WebViewBase.setWebViewClient(fVar); } else { a aVar = this.f34405g; if (webViewClient != null) { systemWebViewClient = new SystemWebViewClient(this, webViewClient); } aVar.setWebViewClient(systemWebViewClient); } this.f34411q = webViewClient; } public void setWebViewClientExtension(IX5WebViewClientExtension iX5WebViewClientExtension) { if (this.f34403e) { this.f34404f.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.f34403e) { 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 z14) { return false; } public void stopLoading() { if (!this.f34403e) { this.f34405g.stopLoading(); } else { this.f34404f.stopLoading(); } } public void super_computeScroll() { if (!this.f34403e) { this.f34405g.a(); return; } try { c.a(this.f34404f.getView(), "super_computeScroll"); } catch (Throwable th3) { th3.printStackTrace(); } } public boolean super_dispatchTouchEvent(MotionEvent motionEvent) { if (!this.f34403e) { return this.f34405g.b(motionEvent); } try { Object a14 = c.a(this.f34404f.getView(), "super_dispatchTouchEvent", new Class[]{MotionEvent.class}, motionEvent); if (a14 == null) { return false; } return ((Boolean) a14).booleanValue(); } catch (Throwable unused) { return false; } } public boolean super_onInterceptTouchEvent(MotionEvent motionEvent) { if (!this.f34403e) { return this.f34405g.c(motionEvent); } try { Object a14 = c.a(this.f34404f.getView(), "super_onInterceptTouchEvent", new Class[]{MotionEvent.class}, motionEvent); if (a14 == null) { return false; } return ((Boolean) a14).booleanValue(); } catch (Throwable unused) { return false; } } public void super_onOverScrolled(int i10, int i14, boolean z14, boolean z15) { if (!this.f34403e) { this.f34405g.a(i10, i14, z14, z15); return; } View view = this.f34404f.getView(); try { Class cls = Integer.TYPE; Class cls2 = Boolean.TYPE; c.a(view, "super_onOverScrolled", new Class[]{cls, cls, cls2, cls2}, Integer.valueOf(i10), Integer.valueOf(i14), Boolean.valueOf(z14), Boolean.valueOf(z15)); } catch (Throwable th3) { th3.printStackTrace(); } } public void super_onScrollChanged(int i10, int i14, int i15, int i16) { if (!this.f34403e) { this.f34405g.a(i10, i14, i15, i16); return; } View view = this.f34404f.getView(); try { Class cls = Integer.TYPE; c.a(view, "super_onScrollChanged", new Class[]{cls, cls, cls, cls}, Integer.valueOf(i10), Integer.valueOf(i14), Integer.valueOf(i15), Integer.valueOf(i16)); } catch (Throwable th3) { th3.printStackTrace(); } } public boolean super_onTouchEvent(MotionEvent motionEvent) { if (!this.f34403e) { return this.f34405g.a(motionEvent); } Log.d("grass", "super_onTouchEvent"); try { Object a14 = c.a(this.f34404f.getView(), "super_onTouchEvent", new Class[]{MotionEvent.class}, motionEvent); if (a14 == null) { return false; } return ((Boolean) a14).booleanValue(); } catch (Throwable unused) { return false; } } public boolean super_overScrollBy(int i10, int i14, int i15, int i16, int i17, int i18, int i19, int i24, boolean z14) { if (!this.f34403e) { return this.f34405g.a(i10, i14, i15, i16, i17, i18, i19, i24, z14); } View view = this.f34404f.getView(); try { Class cls = Integer.TYPE; Object a14 = c.a(view, "super_overScrollBy", new Class[]{cls, cls, cls, cls, cls, cls, cls, cls, Boolean.TYPE}, Integer.valueOf(i10), Integer.valueOf(i14), Integer.valueOf(i15), Integer.valueOf(i16), Integer.valueOf(i17), Integer.valueOf(i18), Integer.valueOf(i19), Integer.valueOf(i24), Boolean.valueOf(z14)); if (a14 == null) { return false; } return ((Boolean) a14).booleanValue(); } catch (Throwable unused) { return false; } } public void switchNightMode(boolean z14) { if (z14 != f34400z) { f34400z = z14; if (z14) { 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 (!f34400z) { 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 z14) { if (!this.f34403e) { 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.f34405g); 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 (z14) { this.f34405g.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 (z14) { this.f34404f.destroy(); } TbsLog.i("WebView", "X5 GUID = " + QbSdk.b()); } public boolean zoomIn() { if (!this.f34403e) { return this.f34405g.zoomIn(); } return this.f34404f.zoomIn(); } public boolean zoomOut() { if (!this.f34403e) { return this.f34405g.zoomOut(); } return this.f34404f.zoomOut(); } public android.webkit.WebView a() { if (!this.f34403e) { return this.f34405g; } return null; } /* compiled from: TbsSdkJava */ public static class HitTestResult { @Deprecated public static final int ANCHOR_TYPE = 1; public static final int EDIT_TEXT_TYPE = 9; public static final int EMAIL_TYPE = 4; public static final int GEO_TYPE = 3; @Deprecated public static final int IMAGE_ANCHOR_TYPE = 6; public static final int IMAGE_TYPE = 5; public static final int PHONE_TYPE = 2; public static final int SRC_ANCHOR_TYPE = 7; public static final int SRC_IMAGE_ANCHOR_TYPE = 8; public static final int UNKNOWN_TYPE = 0; /* renamed from: a reason: collision with root package name */ private IX5WebViewBase.HitTestResult f34427a; /* renamed from: b reason: collision with root package name */ private WebView.HitTestResult f34428b; public HitTestResult() { this.f34428b = null; this.f34427a = null; this.f34428b = null; } public String getExtra() { IX5WebViewBase.HitTestResult hitTestResult = this.f34427a; if (hitTestResult != null) { return hitTestResult.getExtra(); } WebView.HitTestResult hitTestResult2 = this.f34428b; return hitTestResult2 != null ? hitTestResult2.getExtra() : ""; } public int getType() { IX5WebViewBase.HitTestResult hitTestResult = this.f34427a; if (hitTestResult != null) { return hitTestResult.getType(); } WebView.HitTestResult hitTestResult2 = this.f34428b; if (hitTestResult2 != null) { return hitTestResult2.getType(); } return 0; } public HitTestResult(IX5WebViewBase.HitTestResult hitTestResult) { this.f34428b = null; this.f34427a = hitTestResult; this.f34428b = null; } public HitTestResult(WebView.HitTestResult hitTestResult) { this.f34428b = null; this.f34427a = null; this.f34428b = hitTestResult; } } public IX5WebViewBase b() { return this.f34404f; } public void a(IX5WebViewBase iX5WebViewBase) { this.f34404f = iX5WebViewBase; } @TargetApi(11) public void saveWebArchive(String str, boolean z14, ValueCallback<String> valueCallback) { if (this.f34403e) { this.f34404f.saveWebArchive(str, z14, valueCallback); } else if (Build.VERSION.SDK_INT >= 11) { c.a(this.f34405g, "saveWebArchive", new Class[]{String.class, Boolean.TYPE, ValueCallback.class}, str, Boolean.valueOf(z14), valueCallback); } } public void a(Context context) { String str; int c14 = c(context); if (c14 != -1) { str = "PV=" + String.valueOf(c14 + 1); } else { str = "PV=1"; } File file = new File(QbSdk.getTbsFolderDir(context) + File.separator + "core_private", "pv.db"); try { file.getParentFile().mkdirs(); if (!file.isFile() || !file.exists()) { file.createNewFile(); } FileOutputStream fileOutputStream = new FileOutputStream(file, false); f34393d = fileOutputStream; fileOutputStream.write(str.getBytes()); TbsLog.d("writetbscorepvfile", "writepvfile finish "); OutputStream outputStream = f34393d; if (outputStream != null) { outputStream.flush(); } } catch (Throwable th3) { TbsLog.d("writetbscorepvfile", "file.getAbsolutePath=" + file.getAbsolutePath() + " Throwable=" + th3); } } public void loadUrl(String str) { if (str != null && !showDebugView(str)) { MttTraceEvent.begin(256, "WebView.loadUrl"); if (!this.f34403e) { this.f34405g.loadUrl(str); } else { this.f34404f.loadUrl(str); } MttTraceEvent.end(256, "WebView.loadUrl"); } } 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 i10) { this(context, attributeSet, i10, false); } public WebView(Context context, AttributeSet attributeSet, int i10, boolean z14) { this(context, attributeSet, i10, null, z14); } @TargetApi(11) public WebView(Context context, AttributeSet attributeSet, int i10, Map<String, Object> map, boolean z14) { super(context, attributeSet, i10); this.f34402b = "WebView"; this.f34403e = false; this.f34406h = null; this.f34407i = null; this.f34401a = 0; this.f34408k = false; this.f34409l = null; this.f34410m = false; this.f34411q = null; this.f34412r = null; this.f34413t = 1; this.f34414u = 2; this.f34415v = 3; this.f34416w = "javascript:document.getElementsByTagName('HEAD').item(0).removeChild(document.getElementById('QQBrowserSDKNightMode'));"; this.f34417x = "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);"; this.A = null; this.B = null; mWebViewCreated = true; i iVar = new i(); this.f34409l = iVar; iVar.a("init_all", (byte) 1); this.f34407i = context; this.f34404f = null; this.f34403e = false; QbSdk.a(context, "failed to createTBSWebview!"); this.f34405g = new a(context, attributeSet); CookieManager.getInstance().a(context, true, false); CookieSyncManager.createInstance(this.f34407i).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.f34405g.setFocusableInTouchMode(true); addView(this.f34405g, 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(256, "WebView.constructor"); } private boolean a(View view) { Object a14; Context context = this.f34407i; if ((context == null || getTbsCoreVersion(context) <= 36200) && (a14 = c.a(this.A, "onLongClick", new Class[]{View.class}, view)) != null) { return ((Boolean) a14).booleanValue(); } return false; } public static void c() { try { new Thread(new Runnable() { /* class com.tencent.smtt.sdk.WebView.AnonymousClass6 */ public void run() { if (WebView.f34394j == null) { TbsLog.d("TbsNeedReboot", "WebView.updateNeeeRebootStatus--mAppContext == null"); return; } c a14 = c.a(true); if (c.f34493b) { TbsLog.d("TbsNeedReboot", "WebView.updateNeeeRebootStatus--needReboot = true"); return; } h a15 = h.a(WebView.f34394j); int c14 = a15.c(); TbsLog.d("TbsNeedReboot", "WebView.updateNeeeRebootStatus--installStatus = " + c14); if (c14 == 2) { TbsLog.d("TbsNeedReboot", "WebView.updateNeeeRebootStatus--install setTbsNeedReboot true"); a14.a(String.valueOf(a15.b())); a14.b(true); return; } int a16 = a15.a("copy_status"); TbsLog.d("TbsNeedReboot", "WebView.updateNeeeRebootStatus--copyStatus = " + a16); if (a16 == 1) { TbsLog.d("TbsNeedReboot", "WebView.updateNeeeRebootStatus--copy setTbsNeedReboot true"); a14.a(String.valueOf(a15.b("copy_core_ver"))); a14.b(true); return; } r.a(); if (r.b()) { return; } if (c14 == 3 || a16 == 3) { TbsLog.d("TbsNeedReboot", "WebView.updateNeeeRebootStatus--setTbsNeedReboot true"); a14.a(String.valueOf(c.c())); a14.b(true); } } }).start(); } catch (Throwable th3) { TbsLog.e("webview", "updateRebootStatus excpetion: " + th3); } } }