MyRecorder v1.01.90.0219版本的 MD5 值为:c361f51174a0bf833abfa72929caf8d3
以下内容为反编译后的 SSWebView.java 源代码,内容仅作参考
package com.bytedance.sdk.component.widget;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
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.ViewGroup;
import android.view.ViewParent;
import android.webkit.DownloadListener;
import android.webkit.RenderProcessGoneDetail;
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.l;
import com.bytedance.sdk.component.utils.t;
import com.facebook.share.internal.ShareInternalUtility;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
import org.json.JSONObject;
public class SSWebView extends FrameLayout {
private static c f13118x;
private com.bytedance.sdk.component.widget.b.a f13119a;
private String f13120b;
private JSONObject f13121c;
private boolean f13122d;
private float f13123e;
private float f13124f;
private long f13125g;
private long f13126h;
private long f13127i;
private boolean f13128j;
private volatile WebView f13129k;
private float f13130l;
private float f13131m;
private float f13132n;
private int f13133o;
private b f13134p;
private t f13135q;
private AttributeSet f13136r;
private Context f13137s;
private AtomicBoolean f13138t;
private AtomicBoolean f13139u;
private AtomicBoolean f13140v;
private d f13141w;
private long f13142y;
private long f13143z;
public static class a extends WebViewClient {
@Override
public boolean onRenderProcessGone(final WebView webView, RenderProcessGoneDetail renderProcessGoneDetail) {
if (Build.VERSION.SDK_INT < 26) {
return super.onRenderProcessGone(webView, renderProcessGoneDetail);
}
if (webView != null) {
webView.post(new Runnable() {
@Override
public void run() {
try {
ViewGroup viewGroup = (ViewGroup) webView.getParent();
if (viewGroup != null) {
viewGroup.removeView(webView);
}
webView.destroy();
} catch (Exception e10) {
e10.printStackTrace();
}
}
});
return true;
}
return true;
}
}
public interface b {
}
public interface c {
WebView createWebView(Context context, AttributeSet attributeSet, int i10);
}
public interface d {
void a(boolean z7);
}
public SSWebView(Context context) {
this(a(context), false);
}
public SSWebView(Context context, boolean z7) {
super(a(context));
this.f13123e = 0.0f;
this.f13124f = 0.0f;
this.f13125g = 0L;
this.f13126h = 0L;
this.f13127i = 0L;
this.f13128j = false;
this.f13130l = 20.0f;
this.f13132n = 50.0f;
this.f13138t = new AtomicBoolean();
this.f13139u = new AtomicBoolean();
this.f13140v = new AtomicBoolean();
this.f13137s = context;
if (z7) {
return;
}
try {
this.f13129k = a((AttributeSet) null, 0);
b();
} catch (Throwable unused) {
}
b(a(context));
}
private static Context a(Context context) {
return Build.VERSION.SDK_INT < 23 ? context.createConfigurationContext(new Configuration()) : context;
}
private WebView a(AttributeSet attributeSet, int i10) {
c cVar = f13118x;
return cVar != null ? cVar.createWebView(getContext(), attributeSet, i10) : attributeSet == null ? new WebView(a(this.f13137s)) : new WebView(a(this.f13137s), attributeSet);
}
private void a(MotionEvent motionEvent) {
if (!this.f13122d || this.f13119a == null) {
return;
}
if ((this.f13120b == null && this.f13121c == null) || motionEvent == null) {
return;
}
try {
int action = motionEvent.getAction();
if (action == 0) {
this.f13123e = motionEvent.getRawX();
this.f13124f = motionEvent.getRawY();
this.f13125g = System.currentTimeMillis();
this.f13121c = new JSONObject();
if (this.f13129k != null) {
this.f13142y = this.f13125g;
}
} else if (action == 1 || action == 3) {
this.f13121c.put("start_x", String.valueOf(this.f13123e));
this.f13121c.put("start_y", String.valueOf(this.f13124f));
this.f13121c.put("offset_x", String.valueOf(motionEvent.getRawX() - this.f13123e));
this.f13121c.put("offset_y", String.valueOf(motionEvent.getRawY() - this.f13124f));
this.f13121c.put("url", String.valueOf(getUrl()));
this.f13121c.put("tag", "");
this.f13126h = System.currentTimeMillis();
if (this.f13129k != null) {
this.f13143z = this.f13126h;
}
this.f13121c.put("down_time", this.f13125g);
this.f13121c.put("up_time", this.f13126h);
if (com.bytedance.sdk.component.widget.a.a.a().b() != null) {
long j10 = this.f13127i;
long j11 = this.f13125g;
if (j10 != j11) {
this.f13127i = j11;
com.bytedance.sdk.component.widget.a.a.a().b().a(this.f13119a, this.f13120b, "in_web_click", this.f13121c, this.f13126h - this.f13125g);
}
}
}
} catch (Throwable th2) {
th2.printStackTrace();
}
}
private void b(Context context) {
c(context);
p();
o();
}
private static boolean b(View view) {
try {
Class<?> loadClass = view.getClass().getClassLoader().loadClass("android.support.v4.view.ViewPager");
if (loadClass != null) {
if (loadClass.isInstance(view)) {
return true;
}
}
} catch (Throwable th2) {
th2.printStackTrace();
}
try {
Class<?> loadClass2 = view.getClass().getClassLoader().loadClass("androidx.viewpager.widget.ViewPager");
if (loadClass2 != null) {
return loadClass2.isInstance(view);
}
return false;
} catch (Throwable th3) {
th3.printStackTrace();
return false;
}
}
private static void c(Context context) {
}
private static boolean c(View view) {
try {
Class<?> loadClass = view.getClass().getClassLoader().loadClass("android.support.v4.view.ScrollingView");
if (loadClass != null) {
if (loadClass.isInstance(view)) {
return true;
}
}
} catch (Throwable th2) {
th2.printStackTrace();
}
try {
Class<?> loadClass2 = view.getClass().getClassLoader().loadClass("androidx.core.view.ScrollingView");
if (loadClass2 != null) {
return loadClass2.isInstance(view);
}
return false;
} catch (Throwable th3) {
th3.printStackTrace();
return false;
}
}
private void o() {
if (this.f13129k == null) {
return;
}
try {
this.f13129k.removeJavascriptInterface("searchBoxJavaBridge_");
this.f13129k.removeJavascriptInterface("accessibility");
this.f13129k.removeJavascriptInterface("accessibilityTraversal");
} catch (Throwable unused) {
}
}
private void p() {
try {
WebSettings settings = this.f13129k.getSettings();
if (settings != null) {
settings.setSavePassword(false);
}
} catch (Throwable unused) {
}
}
private void q() {
if (this.f13135q == null) {
this.f13140v.set(false);
this.f13135q = new t(getContext());
}
this.f13135q.a(this.f13130l);
this.f13135q.c(this.f13131m);
this.f13135q.b(this.f13132n);
this.f13135q.a(this.f13133o);
this.f13135q.a(new t.a() {
});
this.f13140v.set(true);
this.f13135q.a();
}
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.f13129k.getSettings()) == null) {
return;
}
if (Uri.parse(str).getScheme().equals(ShareInternalUtility.STAGING_PARAM)) {
settings.setJavaScriptEnabled(false);
} else {
settings.setJavaScriptEnabled(true);
}
} catch (Throwable unused) {
}
}
public static void setWebViewProvider(c cVar) {
f13118x = cVar;
}
public 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);
}
@SuppressLint({"JavascriptInterface"})
public void a(Object obj, String str) {
try {
this.f13129k.addJavascriptInterface(obj, str);
} catch (Throwable unused) {
}
}
public void a(String str, String str2, String str3, String str4, String str5) {
try {
setJavaScriptEnabled(str);
this.f13129k.loadDataWithBaseURL(str, str2, str3, str4, str5);
} catch (Throwable unused) {
}
}
@TargetApi(19)
public void a(String str, Map<String, String> map) {
try {
setJavaScriptEnabled(str);
this.f13129k.loadUrl(str, map);
} catch (Throwable unused) {
}
}
public void a(boolean z7) {
try {
this.f13129k.clearCache(z7);
} catch (Throwable unused) {
}
}
public void a_(String str) {
try {
setJavaScriptEnabled(str);
this.f13129k.loadUrl(str);
} catch (Throwable unused) {
}
}
public void b() {
if (this.f13129k != null) {
removeAllViews();
setBackground(null);
try {
this.f13129k.setId(520093704);
} catch (Throwable unused) {
}
addView(this.f13129k, new FrameLayout.LayoutParams(-1, -1));
}
}
public void b_(String str) {
try {
this.f13129k.removeJavascriptInterface(str);
} catch (Throwable unused) {
}
}
public void c() {
try {
this.f13129k.stopLoading();
} catch (Throwable unused) {
}
}
public void c_() {
try {
this.f13129k = a(this.f13136r, 0);
b();
b(a(this.f13137s));
} catch (Throwable th2) {
l.e("SSWebView.TAG", "initWebview: " + th2.getMessage());
}
}
@Override
public void computeScroll() {
if (this.f13129k == null) {
return;
}
try {
this.f13129k.computeScroll();
} catch (Throwable unused) {
}
}
public void d() {
try {
this.f13129k.reload();
} catch (Throwable unused) {
}
}
@Override
public boolean dispatchTouchEvent(MotionEvent motionEvent) {
d dVar = this.f13141w;
if (dVar != null) {
dVar.a(true);
}
return super.dispatchTouchEvent(motionEvent);
}
public boolean e() {
if (this.f13129k == null) {
return false;
}
try {
return this.f13129k.canGoBack();
} catch (Throwable unused) {
return false;
}
}
public void f() {
try {
this.f13129k.goBack();
} catch (Throwable unused) {
}
}
public boolean g() {
if (this.f13129k == null) {
return false;
}
try {
return this.f13129k.canGoForward();
} catch (Throwable unused) {
return false;
}
}
public int getContentHeight() {
if (this.f13129k == null) {
return 0;
}
try {
return this.f13129k.getContentHeight();
} catch (Throwable unused) {
return 1;
}
}
public long getLandingPageClickBegin() {
return this.f13142y;
}
public long getLandingPageClickEnd() {
return this.f13143z;
}
public com.bytedance.sdk.component.widget.b.a getMaterialMeta() {
return this.f13119a;
}
public String getOriginalUrl() {
String url;
if (this.f13129k == null) {
return null;
}
try {
String originalUrl = this.f13129k.getOriginalUrl();
return (originalUrl == null || !originalUrl.startsWith("data:text/html") || (url = this.f13129k.getUrl()) == null) ? originalUrl : url.startsWith(xi.b.FILE_SCHEME) ? url : originalUrl;
} catch (Throwable unused) {
return null;
}
}
public int getProgress() {
if (this.f13129k == null) {
return 0;
}
try {
return this.f13129k.getProgress();
} catch (Throwable unused) {
return 100;
}
}
@Override
public String getTag() {
return this.f13120b;
}
public String getUrl() {
if (this.f13129k == null) {
return null;
}
try {
return this.f13129k.getUrl();
} catch (Throwable unused) {
return null;
}
}
public String getUserAgentString() {
if (this.f13129k == null) {
return "";
}
try {
return this.f13129k.getSettings().getUserAgentString();
} catch (Throwable unused) {
return "";
}
}
public WebView getWebView() {
return this.f13129k;
}
public void h() {
try {
this.f13129k.goForward();
} catch (Throwable unused) {
}
}
@Override
public boolean hasOverlappingRendering() {
return false;
}
public void i() {
if (this.f13129k != null) {
this.f13129k.onResume();
}
}
public void j() {
try {
this.f13129k.clearHistory();
} catch (Throwable unused) {
}
}
public void k() {
if (this.f13129k == null) {
return;
}
try {
this.f13129k.onPause();
d dVar = this.f13141w;
if (dVar != null) {
dVar.a(false);
}
} catch (Throwable unused) {
}
}
public void l() {
if (this.f13129k == null) {
return;
}
try {
this.f13129k.destroy();
} catch (Throwable unused) {
}
}
public void m() {
try {
this.f13129k.clearView();
} catch (Throwable unused) {
}
}
public void n() {
try {
this.f13129k.pauseTimers();
} catch (Throwable unused) {
}
}
@Override
public void onAttachedToWindow() {
super.onAttachedToWindow();
this.f13138t.set(true);
if (!this.f13139u.get() || this.f13140v.get()) {
return;
}
q();
}
@Override
public void onDetachedFromWindow() {
super.onDetachedFromWindow();
this.f13138t.set(false);
t tVar = this.f13135q;
if (tVar != null) {
tVar.b();
}
}
@Override
@SuppressLint({"ClickableViewAccessibility"})
public boolean onInterceptTouchEvent(MotionEvent motionEvent) {
ViewParent a10;
try {
a(motionEvent);
boolean onInterceptTouchEvent = super.onInterceptTouchEvent(motionEvent);
if ((motionEvent.getActionMasked() == 2 || motionEvent.getActionMasked() == 0) && this.f13128j && (a10 = a(this)) != null) {
a10.requestDisallowInterceptTouchEvent(true);
}
return onInterceptTouchEvent;
} catch (Throwable unused) {
return super.onInterceptTouchEvent(motionEvent);
}
}
@Override
public void onWindowFocusChanged(boolean z7) {
t tVar = this.f13135q;
if (tVar != null) {
if (z7) {
tVar.a();
} else {
tVar.b();
}
}
}
@Override
public void removeAllViews() {
try {
this.f13129k.removeAllViews();
} catch (Throwable unused) {
}
}
public void setAllowFileAccess(boolean z7) {
try {
this.f13129k.getSettings().setAllowFileAccess(z7);
} catch (Throwable unused) {
}
}
@Override
public void setAlpha(float f10) {
try {
super.setAlpha(f10);
this.f13129k.setAlpha(f10);
} catch (Throwable unused) {
}
}
public void setAppCacheEnabled(boolean z7) {
try {
this.f13129k.getSettings().setAppCacheEnabled(z7);
} catch (Throwable unused) {
}
}
@Override
public void setBackgroundColor(int i10) {
try {
this.f13129k.setBackgroundColor(i10);
} catch (Throwable unused) {
}
}
public void setBuiltInZoomControls(boolean z7) {
try {
this.f13129k.getSettings().setBuiltInZoomControls(z7);
} catch (Throwable unused) {
}
}
public void setCacheMode(int i10) {
try {
this.f13129k.getSettings().setCacheMode(i10);
} catch (Throwable unused) {
}
}
public void setCalculationMethod(int i10) {
this.f13133o = i10;
}
public void setDatabaseEnabled(boolean z7) {
try {
this.f13129k.getSettings().setDatabaseEnabled(z7);
} catch (Throwable unused) {
}
}
public void setDeepShakeValue(float f10) {
this.f13131m = f10;
}
public void setDefaultFontSize(int i10) {
try {
this.f13129k.getSettings().setDefaultFontSize(i10);
} catch (Throwable unused) {
}
}
public void setDefaultTextEncodingName(String str) {
try {
this.f13129k.getSettings().setDefaultTextEncodingName(str);
} catch (Throwable unused) {
}
}
public void setDisplayZoomControls(boolean z7) {
try {
this.f13129k.getSettings().setDisplayZoomControls(z7);
} catch (Throwable unused) {
}
}
public void setDomStorageEnabled(boolean z7) {
try {
this.f13129k.getSettings().setDomStorageEnabled(z7);
} catch (Throwable unused) {
}
}
public void setDownloadListener(DownloadListener downloadListener) {
try {
this.f13129k.setDownloadListener(downloadListener);
} catch (Throwable unused) {
}
}
public void setIsPreventTouchEvent(boolean z7) {
this.f13128j = z7;
}
public void setJavaScriptCanOpenWindowsAutomatically(boolean z7) {
try {
this.f13129k.getSettings().setJavaScriptCanOpenWindowsAutomatically(z7);
} catch (Throwable unused) {
}
}
public void setJavaScriptEnabled(boolean z7) {
try {
this.f13129k.getSettings().setJavaScriptEnabled(z7);
} catch (Throwable unused) {
}
}
public void setLandingPage(boolean z7) {
this.f13122d = z7;
}
public void setLandingPageClickBegin(long j10) {
this.f13142y = j10;
}
public void setLandingPageClickEnd(long j10) {
this.f13143z = j10;
}
@Override
public void setLayerType(int i10, Paint paint) {
try {
this.f13129k.setLayerType(i10, paint);
} catch (Throwable unused) {
}
}
public void setLayoutAlgorithm(WebSettings.LayoutAlgorithm layoutAlgorithm) {
try {
this.f13129k.getSettings().setLayoutAlgorithm(layoutAlgorithm);
} catch (Throwable unused) {
}
}
public void setLoadWithOverviewMode(boolean z7) {
try {
this.f13129k.getSettings().setLoadWithOverviewMode(z7);
} catch (Throwable unused) {
}
}
public void setMaterialMeta(com.bytedance.sdk.component.widget.b.a aVar) {
this.f13119a = aVar;
}
public void setMixedContentMode(int i10) {
try {
this.f13129k.getSettings().setMixedContentMode(i10);
} catch (Throwable unused) {
}
}
public void setNetworkAvailable(boolean z7) {
try {
this.f13129k.setNetworkAvailable(z7);
} catch (Throwable unused) {
}
}
public void setOnShakeListener(b bVar) {
this.f13134p = bVar;
}
@Override
public void setOverScrollMode(int i10) {
try {
this.f13129k.setOverScrollMode(i10);
super.setOverScrollMode(i10);
} catch (Throwable unused) {
}
}
public void setRecycler(boolean z7) {
if (this.f13129k == null || !(this.f13129k instanceof PangleWebView)) {
return;
}
((PangleWebView) this.f13129k).setRecycler(z7);
}
public void setShakeValue(float f10) {
this.f13130l = f10;
}
public void setSupportZoom(boolean z7) {
try {
this.f13129k.getSettings().setSupportZoom(z7);
} catch (Throwable unused) {
}
}
public void setTag(String str) {
this.f13120b = str;
}
public void setTouchStateListener(d dVar) {
this.f13141w = dVar;
}
public void setUseWideViewPort(boolean z7) {
try {
this.f13129k.getSettings().setUseWideViewPort(z7);
} catch (Throwable unused) {
}
}
public void setUserAgentString(String str) {
try {
this.f13129k.getSettings().setUserAgentString(str);
} catch (Throwable unused) {
}
}
@Override
public void setVisibility(int i10) {
try {
super.setVisibility(i10);
this.f13129k.setVisibility(i10);
} catch (Throwable unused) {
}
}
public void setWebChromeClient(WebChromeClient webChromeClient) {
try {
this.f13129k.setWebChromeClient(webChromeClient);
} catch (Throwable unused) {
}
}
public void setWebViewClient(WebViewClient webViewClient) {
try {
if (webViewClient instanceof d) {
setTouchStateListener((d) webViewClient);
} else {
setTouchStateListener(null);
}
if (webViewClient == null) {
webViewClient = new a();
}
this.f13129k.setWebViewClient(webViewClient);
} catch (Throwable unused) {
}
}
public void setWriggleValue(float f10) {
this.f13132n = f10;
}
}