Apk Done v1.0版本的 MD5 值为:44cfb8e1ce639995aa7f0de6a3a6388b
以下内容为反编译后的 SSWebView.java 源代码,内容仅作参考
package com.bytedance.sdk.component.widget;
import android.content.Context;
import android.content.res.Configuration;
import android.graphics.Paint;
import android.net.Uri;
import android.os.Build;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewParent;
import android.view.accessibility.AccessibilityManager;
import android.webkit.DownloadListener;
import android.webkit.ValueCallback;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.AbsListView;
import android.widget.FrameLayout;
import android.widget.HorizontalScrollView;
import android.widget.ScrollView;
import com.bytedance.sdk.component.utils.t;
import com.bytedance.sdk.component.utils.v;
import java.lang.reflect.Method;
import java.util.Map;
import org.json.JSONObject;
public class SSWebView extends FrameLayout {
private com.bytedance.sdk.component.widget.b.a a;
private String b;
private JSONObject c;
private boolean d;
private float e;
private float f;
private long g;
private long h;
private long i;
private boolean j;
private WebView k;
private float l;
private float m;
private a n;
private v o;
private b p;
public interface a {
}
public interface b {
void a(boolean z);
}
public SSWebView(Context context) {
super(a(context));
this.e = 0.0f;
this.f = 0.0f;
this.g = 0L;
this.h = 0L;
this.i = 0L;
this.j = false;
this.l = 20.0f;
this.m = 50.0f;
try {
this.k = new WebView(a(context));
a();
} catch (Throwable unused) {
}
b(a(context));
}
public SSWebView(Context context, AttributeSet attributeSet) {
super(a(context), attributeSet);
this.e = 0.0f;
this.f = 0.0f;
this.g = 0L;
this.h = 0L;
this.i = 0L;
this.j = false;
this.l = 20.0f;
this.m = 50.0f;
try {
this.k = new WebView(a(context), attributeSet);
a();
} catch (Throwable unused) {
}
b(a(context));
}
public SSWebView(Context context, AttributeSet attributeSet, int i) {
super(a(context), attributeSet, i);
this.e = 0.0f;
this.f = 0.0f;
this.g = 0L;
this.h = 0L;
this.i = 0L;
this.j = false;
this.l = 20.0f;
this.m = 50.0f;
try {
this.k = new WebView(a(context), attributeSet, i);
a();
} catch (Throwable unused) {
}
b(a(context));
}
private static Context a(Context context) {
return (Build.VERSION.SDK_INT < 21 || Build.VERSION.SDK_INT >= 23) ? context : context.createConfigurationContext(new Configuration());
}
private void a(MotionEvent motionEvent) {
if (!this.d || this.a == null) {
return;
}
if ((this.b == null && this.c == null) || motionEvent == null) {
return;
}
try {
int action = motionEvent.getAction();
if (action == 0) {
this.e = motionEvent.getRawX();
this.f = motionEvent.getRawY();
this.g = System.currentTimeMillis();
this.c = new JSONObject();
if (this.k != null) {
this.k.setTag(t.e(getContext(), "tt_id_click_begin"), Long.valueOf(this.g));
}
} else if (action == 1 || action == 3) {
this.c.put("start_x", String.valueOf(this.e));
this.c.put("start_y", String.valueOf(this.f));
this.c.put("offset_x", String.valueOf(motionEvent.getRawX() - this.e));
this.c.put("offset_y", String.valueOf(motionEvent.getRawY() - this.f));
this.c.put("url", String.valueOf(getUrl()));
this.c.put("tag", "");
this.h = System.currentTimeMillis();
if (this.k != null) {
this.k.setTag(t.e(getContext(), "tt_id_click_end"), Long.valueOf(this.h));
}
this.c.put("down_time", this.g);
this.c.put("up_time", this.h);
if (com.bytedance.sdk.component.widget.a.a.a().b() == null || this.i == this.g) {
return;
}
this.i = this.g;
com.bytedance.sdk.component.widget.a.a.a().b().a(this.a, this.b, "in_web_click", this.c, this.h - this.g);
}
} catch (Throwable th) {
th.printStackTrace();
}
}
private void b(Context context) {
c(context);
l();
k();
}
private static boolean b(View view) {
try {
Class<?> loadClass = view.getClass().getClassLoader().loadClass("androidx.viewpager.widget.ViewPager");
if (loadClass != null) {
if (loadClass.isInstance(view)) {
return true;
}
}
} catch (Throwable th) {
th.printStackTrace();
}
try {
Class<?> loadClass2 = view.getClass().getClassLoader().loadClass("androidx.viewpager.widget.ViewPager");
if (loadClass2 != null) {
return loadClass2.isInstance(view);
}
return false;
} catch (Throwable th2) {
th2.printStackTrace();
return false;
}
}
private static void c(Context context) {
if (Build.VERSION.SDK_INT != 17 || context == null) {
return;
}
try {
AccessibilityManager accessibilityManager = (AccessibilityManager) context.getSystemService("accessibility");
if (accessibilityManager != null && accessibilityManager.isEnabled()) {
Method declaredMethod = accessibilityManager.getClass().getDeclaredMethod("setState", Integer.TYPE);
declaredMethod.setAccessible(true);
declaredMethod.invoke(accessibilityManager, 0);
}
} catch (Throwable unused) {
}
}
private static boolean c(View view) {
try {
Class<?> loadClass = view.getClass().getClassLoader().loadClass("androidx.core.view.ScrollingView");
if (loadClass != null) {
if (loadClass.isInstance(view)) {
return true;
}
}
} catch (Throwable th) {
th.printStackTrace();
}
try {
Class<?> loadClass2 = view.getClass().getClassLoader().loadClass("androidx.core.view.ScrollingView");
if (loadClass2 != null) {
return loadClass2.isInstance(view);
}
return false;
} catch (Throwable th2) {
th2.printStackTrace();
return false;
}
}
private void k() {
try {
this.k.removeJavascriptInterface("searchBoxJavaBridge_");
this.k.removeJavascriptInterface("accessibility");
this.k.removeJavascriptInterface("accessibilityTraversal");
} catch (Throwable unused) {
}
}
private void l() {
try {
WebSettings settings = this.k.getSettings();
if (settings != null) {
settings.setSavePassword(false);
}
} catch (Throwable unused) {
}
}
public static void setDataDirectorySuffix(String str) {
if (Build.VERSION.SDK_INT >= 28) {
WebView.setDataDirectorySuffix(str);
}
}
private void setJavaScriptEnabled(String str) {
WebSettings settings;
try {
if (TextUtils.isEmpty(str) || (settings = this.k.getSettings()) == null) {
return;
}
settings.setJavaScriptEnabled(!Uri.parse(str).getScheme().equals("file"));
} catch (Throwable unused) {
}
}
protected ViewParent a(View view) {
ViewParent parent = view.getParent();
if ((parent instanceof AbsListView) || (parent instanceof ScrollView) || (parent instanceof HorizontalScrollView) || !(parent instanceof View)) {
return parent;
}
View view2 = (View) parent;
return (b(view2) || c(view2)) ? parent : a(view2);
}
public void a() {
if (this.k != null) {
removeAllViews();
setBackground(null);
try {
this.k.setId(t.e(getContext(), "tt_id_root_web_view"));
} catch (Throwable unused) {
}
addView(this.k, new FrameLayout.LayoutParams(-1, -1));
}
}
public void a(Object obj, String str) {
try {
this.k.addJavascriptInterface(obj, str);
} catch (Throwable unused) {
}
}
public void a(String str) {
try {
setJavaScriptEnabled(str);
this.k.loadUrl(str);
} catch (Throwable unused) {
}
}
public void a(String str, ValueCallback<String> valueCallback) {
try {
if (Build.VERSION.SDK_INT >= 19) {
this.k.evaluateJavascript(str, valueCallback);
}
} catch (Throwable unused) {
}
}
public void a(String str, Map<String, String> map) {
try {
setJavaScriptEnabled(str);
this.k.loadUrl(str, map);
} catch (Throwable unused) {
}
}
public void a(boolean z) {
try {
this.k.clearCache(z);
} catch (Throwable unused) {
}
}
public void b() {
try {
this.k.stopLoading();
} catch (Throwable unused) {
}
}
public void b(String str) {
try {
this.k.removeJavascriptInterface(str);
} catch (Throwable unused) {
}
}
public boolean c() {
try {
return this.k.canGoBack();
} catch (Throwable unused) {
return false;
}
}
@Override
public void computeScroll() {
try {
this.k.computeScroll();
} catch (Throwable unused) {
}
}
public void d() {
try {
this.k.goBack();
} catch (Throwable unused) {
}
}
@Override
public boolean dispatchTouchEvent(MotionEvent motionEvent) {
b bVar = this.p;
if (bVar != null) {
bVar.a(true);
}
return super.dispatchTouchEvent(motionEvent);
}
public void e() {
WebView webView = this.k;
if (webView != null) {
webView.onResume();
}
}
public void f() {
try {
this.k.clearHistory();
} catch (Throwable unused) {
}
}
public void g() {
try {
this.k.onPause();
if (this.p != null) {
this.p.a(false);
}
} catch (Throwable unused) {
}
}
public int getContentHeight() {
try {
return this.k.getContentHeight();
} catch (Throwable unused) {
return 1;
}
}
public com.bytedance.sdk.component.widget.b.a getMaterialMeta() {
return this.a;
}
public String getOriginalUrl() {
String url;
try {
String originalUrl = this.k.getOriginalUrl();
return (originalUrl == null || !originalUrl.startsWith("data:text/html") || (url = this.k.getUrl()) == null) ? originalUrl : url.startsWith("file://") ? url : originalUrl;
} catch (Throwable unused) {
return null;
}
}
public int getProgress() {
try {
return this.k.getProgress();
} catch (Throwable unused) {
return 100;
}
}
@Override
public String getTag() {
return this.b;
}
public String getUrl() {
try {
return this.k.getUrl();
} catch (Throwable unused) {
return null;
}
}
public String getUserAgentString() {
try {
return this.k.getSettings().getUserAgentString();
} catch (Throwable unused) {
return "";
}
}
public WebView getWebView() {
return this.k;
}
public void h() {
try {
this.k.destroy();
} catch (Throwable unused) {
}
}
@Override
public boolean hasOverlappingRendering() {
return false;
}
public void i() {
try {
this.k.clearView();
} catch (Throwable unused) {
}
}
public void j() {
try {
this.k.pauseTimers();
} catch (Throwable unused) {
}
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
v vVar = this.o;
if (vVar != null) {
vVar.b();
}
}
@Override
public boolean onInterceptTouchEvent(MotionEvent motionEvent) {
ViewParent a2;
try {
a(motionEvent);
boolean onInterceptTouchEvent = super.onInterceptTouchEvent(motionEvent);
if ((motionEvent.getActionMasked() == 2 || motionEvent.getActionMasked() == 0) && this.j && (a2 = a(this)) != null) {
a2.requestDisallowInterceptTouchEvent(true);
}
return onInterceptTouchEvent;
} catch (Throwable unused) {
return super.onInterceptTouchEvent(motionEvent);
}
}
@Override
public void onWindowFocusChanged(boolean z) {
v vVar = this.o;
if (vVar != null) {
if (z) {
vVar.a();
} else {
vVar.b();
}
}
}
@Override
public void removeAllViews() {
try {
this.k.removeAllViews();
} catch (Throwable unused) {
}
}
public void setAllowFileAccess(boolean z) {
try {
this.k.getSettings().setAllowFileAccess(z);
} catch (Throwable unused) {
}
}
@Override
public void setAlpha(float f) {
try {
super.setAlpha(f);
this.k.setAlpha(f);
} catch (Throwable unused) {
}
}
public void setAppCacheEnabled(boolean z) {
try {
this.k.getSettings().setAppCacheEnabled(z);
} catch (Throwable unused) {
}
}
@Override
public void setBackgroundColor(int i) {
try {
this.k.setBackgroundColor(i);
} catch (Throwable unused) {
}
}
public void setBuiltInZoomControls(boolean z) {
try {
this.k.getSettings().setBuiltInZoomControls(z);
} catch (Throwable unused) {
}
}
public void setCacheMode(int i) {
try {
this.k.getSettings().setCacheMode(i);
} catch (Throwable unused) {
}
}
public void setDatabaseEnabled(boolean z) {
try {
this.k.getSettings().setDatabaseEnabled(z);
} catch (Throwable unused) {
}
}
public void setDefaultFontSize(int i) {
try {
this.k.getSettings().setDefaultFontSize(i);
} catch (Throwable unused) {
}
}
public void setDefaultTextEncodingName(String str) {
try {
this.k.getSettings().setDefaultTextEncodingName(str);
} catch (Throwable unused) {
}
}
public void setDisplayZoomControls(boolean z) {
try {
this.k.getSettings().setDisplayZoomControls(z);
} catch (Throwable unused) {
}
}
public void setDomStorageEnabled(boolean z) {
try {
this.k.getSettings().setDomStorageEnabled(z);
} catch (Throwable unused) {
}
}
public void setDownloadListener(DownloadListener downloadListener) {
try {
this.k.setDownloadListener(downloadListener);
} catch (Throwable unused) {
}
}
public void setIsPreventTouchEvent(boolean z) {
this.j = z;
}
public void setJavaScriptCanOpenWindowsAutomatically(boolean z) {
try {
this.k.getSettings().setJavaScriptCanOpenWindowsAutomatically(z);
} catch (Throwable unused) {
}
}
public void setJavaScriptEnabled(boolean z) {
try {
this.k.getSettings().setJavaScriptEnabled(z);
} catch (Throwable unused) {
}
}
public void setLandingPage(boolean z) {
this.d = z;
}
@Override
public void setLayerType(int i, Paint paint) {
try {
this.k.setLayerType(i, paint);
} catch (Throwable unused) {
}
}
public void setLayoutAlgorithm(WebSettings.LayoutAlgorithm layoutAlgorithm) {
try {
this.k.getSettings().setLayoutAlgorithm(layoutAlgorithm);
} catch (Throwable unused) {
}
}
public void setLoadWithOverviewMode(boolean z) {
try {
this.k.getSettings().setLoadWithOverviewMode(z);
} catch (Throwable unused) {
}
}
public void setMaterialMeta(com.bytedance.sdk.component.widget.b.a aVar) {
this.a = aVar;
}
public void setMixedContentMode(int i) {
try {
if (Build.VERSION.SDK_INT >= 21) {
this.k.getSettings().setMixedContentMode(i);
}
} catch (Throwable unused) {
}
}
public void setNetworkAvailable(boolean z) {
try {
this.k.setNetworkAvailable(z);
} catch (Throwable unused) {
}
}
public void setOnShakeListener(a aVar) {
this.n = aVar;
}
@Override
public void setOverScrollMode(int i) {
try {
this.k.setOverScrollMode(i);
super.setOverScrollMode(i);
} catch (Throwable unused) {
}
}
public void setShakeValue(float f) {
this.l = f;
}
public void setSupportZoom(boolean z) {
try {
this.k.getSettings().setSupportZoom(z);
} catch (Throwable unused) {
}
}
public void setTag(String str) {
this.b = str;
}
public void setTouchStateListener(b bVar) {
this.p = bVar;
}
public void setUseWideViewPort(boolean z) {
try {
this.k.getSettings().setUseWideViewPort(z);
} catch (Throwable unused) {
}
}
public void setUserAgentString(String str) {
try {
this.k.getSettings().setUserAgentString(str);
} catch (Throwable unused) {
}
}
@Override
public void setVisibility(int i) {
try {
super.setVisibility(i);
this.k.setVisibility(i);
} catch (Throwable unused) {
}
}
public void setWebChromeClient(WebChromeClient webChromeClient) {
try {
this.k.setWebChromeClient(webChromeClient);
} catch (Throwable unused) {
}
}
public void setWebViewClient(WebViewClient webViewClient) {
try {
if (webViewClient instanceof b) {
setTouchStateListener((b) webViewClient);
} else {
setTouchStateListener(null);
}
if (webViewClient == null) {
webViewClient = new WebViewClient();
}
this.k.setWebViewClient(webViewClient);
} catch (Throwable unused) {
}
}
public void setWriggleValue(float f) {
this.m = f;
}
}