新浪彩票 v0.96.37版本的 MD5 值为:0c7ddce345383506e2959f5d75bdceab
以下内容为反编译后的 AgentWebView.java 源代码,内容仅作参考
package com.just.agentweb;
import android.annotation.TargetApi;
import android.content.Context;
import android.graphics.Bitmap;
import android.os.Build;
import android.util.AttributeSet;
import android.util.Log;
import android.util.Pair;
import android.view.ViewGroup;
import android.view.accessibility.AccessibilityManager;
import android.webkit.JsPromptResult;
import android.webkit.WebBackForwardList;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Toast;
import ewUlBWKNoApzb1Mnhgn4.HXk9MjYIhUuuFvxoWclq.tuTnrQl15gwcjciRsKuT.C3453;
import ewUlBWKNoApzb1Mnhgn4.HXk9MjYIhUuuFvxoWclq.tuTnrQl15gwcjciRsKuT.C3458;
import ewUlBWKNoApzb1Mnhgn4.HXk9MjYIhUuuFvxoWclq.tuTnrQl15gwcjciRsKuT.C3471;
import ewUlBWKNoApzb1Mnhgn4.HXk9MjYIhUuuFvxoWclq.tuTnrQl15gwcjciRsKuT.C3475;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.net.URI;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.Map;
import org.json.JSONObject;
public class AgentWebView extends LollipopFixedWebView {
private static final String f11542 = AgentWebView.class.getSimpleName();
private C3243 f11543;
private Map<String, C3458> f11544;
private Map<String, String> f11545;
private boolean f11546;
private Boolean f11547;
public static class C3242 extends C3453 {
private AgentWebView f11548;
@Override
public boolean onJsPrompt(WebView webView, String str, String str2, String str3, JsPromptResult jsPromptResult) {
C3458 c3458;
String unused = AgentWebView.f11542;
String str4 = "onJsPrompt:" + str + " message:" + str2 + " d:" + str3 + " ";
if (this.f11548.f11544 != null && C3458.m15569(str2)) {
JSONObject m15568 = C3458.m15568(str2);
String m15570 = C3458.m15570(m15568);
if (m15570 == null || (c3458 = (C3458) this.f11548.f11544.get(m15570)) == null) {
return true;
}
jsPromptResult.confirm(c3458.m15573(webView, m15568));
return true;
}
return super.onJsPrompt(webView, str, str2, str3, jsPromptResult);
}
@Override
public void onProgressChanged(WebView webView, int i) {
if (this.f11548.f11544 != null) {
this.f11548.m14140();
if (C3471.m15594()) {
String unused = AgentWebView.f11542;
String str = "injectJavaScript, onProgressChanged.newProgress = " + i + ", url = " + webView.getUrl();
}
}
if (this.f11548.f11545 != null) {
this.f11548.m14131();
}
super.onProgressChanged(webView, i);
}
@Override
public void onReceivedTitle(WebView webView, String str) {
this.f11548.f11543.m14152();
super.onReceivedTitle(webView, str);
}
private C3242(AgentWebView agentWebView) {
this.f11548 = agentWebView;
}
}
public static class C3243 {
private WebChromeClient f11549;
private boolean f11550;
private C3243() {
}
public void m14149(WebView webView) {
if (this.f11550 || this.f11549 == null) {
return;
}
WebBackForwardList webBackForwardList = null;
try {
webBackForwardList = webView.copyBackForwardList();
} catch (NullPointerException e) {
if (C3471.m15594()) {
e.printStackTrace();
}
}
if (webBackForwardList == null || webBackForwardList.getSize() <= 0 || webBackForwardList.getCurrentIndex() < 0 || webBackForwardList.getItemAtIndex(webBackForwardList.getCurrentIndex()) == null) {
return;
}
this.f11549.onReceivedTitle(webView, webBackForwardList.getItemAtIndex(webBackForwardList.getCurrentIndex()).getTitle());
}
public void m14150() {
this.f11550 = false;
}
public void m14151(WebChromeClient webChromeClient) {
this.f11549 = webChromeClient;
}
public void m14152() {
this.f11550 = true;
}
}
public static class C3244 extends C3475 {
private AgentWebView f11551;
@Override
public void onPageFinished(WebView webView, String str) {
super.onPageFinished(webView, str);
this.f11551.f11543.m14149(webView);
if (C3471.m15594()) {
String unused = AgentWebView.f11542;
String str2 = "onPageFinished.url = " + webView.getUrl();
}
}
@Override
public void onPageStarted(WebView webView, String str, Bitmap bitmap) {
super.onPageStarted(webView, str, bitmap);
if (this.f11551.f11544 != null) {
this.f11551.m14140();
if (C3471.m15594()) {
String unused = AgentWebView.f11542;
String str2 = "injectJavaScript, onPageStarted.url = " + webView.getUrl();
}
}
if (this.f11551.f11545 != null) {
this.f11551.m14131();
}
this.f11551.f11543.m14150();
this.f11551.m14144(str);
}
private C3244(AgentWebView agentWebView) {
this.f11551 = agentWebView;
}
}
public AgentWebView(Context context) {
this(context, null);
}
private void setAccessibilityEnabled(boolean z) {
AccessibilityManager accessibilityManager = (AccessibilityManager) getContext().getSystemService("accessibility");
try {
Method declaredMethod = accessibilityManager.getClass().getDeclaredMethod("setAccessibilityState", Boolean.TYPE);
declaredMethod.setAccessible(true);
declaredMethod.invoke(accessibilityManager, Boolean.valueOf(z));
declaredMethod.setAccessible(false);
} catch (Throwable th) {
if (C3471.m15594()) {
C3471.m15593(f11542, "setAccessibilityEnabled", th);
}
}
}
private void m14128() {
Boolean bool = this.f11547;
if (bool != null) {
setAccessibilityEnabled(bool.booleanValue());
}
}
public static Pair<Boolean, String> m14129(Throwable th) {
String th2 = th.getCause() == null ? th.toString() : th.getCause().toString();
String stackTraceString = Log.getStackTraceString(th);
if (!stackTraceString.contains("android.content.pm.PackageManager$NameNotFoundException") && !stackTraceString.contains("java.lang.RuntimeException: Cannot load WebView") && !stackTraceString.contains("android.webkit.WebViewFactory$MissingWebViewPackageException: Failed to load WebView provider: No WebView installed")) {
return new Pair<>(Boolean.FALSE, th2);
}
C3471.m15590(f11542, "isWebViewPackageException", th);
Boolean bool = Boolean.TRUE;
return new Pair<>(bool, "WebView load failed, " + th2);
}
private void m14130() {
if (getParent() instanceof ViewGroup) {
((ViewGroup) getParent()).removeAllViewsInLayout();
}
}
public void m14131() {
for (Map.Entry<String, String> entry : this.f11545.entrySet()) {
loadUrl(m14146(entry.getKey(), entry.getValue()));
}
}
private boolean m14135() {
return ((AccessibilityManager) getContext().getSystemService("accessibility")).isEnabled();
}
private void m14139() {
int i = Build.VERSION.SDK_INT;
if (i < 16) {
try {
Field declaredField = WebView.class.getDeclaredField("mWebViewCore").getType().getDeclaredField("mBrowserFrame").getType().getDeclaredField("sConfigCallback");
declaredField.setAccessible(true);
declaredField.set(null, null);
} catch (IllegalAccessException e) {
if (C3471.m15594()) {
e.printStackTrace();
}
} catch (NoSuchFieldException e2) {
if (C3471.m15594()) {
e2.printStackTrace();
}
}
} else if (i < 19) {
try {
Field declaredField2 = Class.forName("android.webkit.BrowserFrame").getDeclaredField("sConfigCallback");
if (declaredField2 != null) {
declaredField2.setAccessible(true);
declaredField2.set(null, null);
}
} catch (ClassNotFoundException e3) {
if (C3471.m15594()) {
e3.printStackTrace();
}
} catch (IllegalAccessException e4) {
if (C3471.m15594()) {
e4.printStackTrace();
}
} catch (NoSuchFieldException e5) {
if (C3471.m15594()) {
e5.printStackTrace();
}
}
}
}
public void m14140() {
for (Map.Entry<String, C3458> entry : this.f11544.entrySet()) {
loadUrl(m14146(entry.getKey(), entry.getValue().m15572()));
}
}
@Override
@Deprecated
public final void addJavascriptInterface(Object obj, String str) {
if (Build.VERSION.SDK_INT >= 17) {
super.addJavascriptInterface(obj, str);
return;
}
String str2 = "use mJsCallJavas:" + str;
C3471.m15595(f11542, "addJavascriptInterface:" + obj + " interfaceName:" + str);
if (this.f11544 == null) {
this.f11544 = new HashMap();
}
this.f11544.put(str, new C3458(obj, str));
m14140();
if (C3471.m15594()) {
String str3 = "injectJavaScript, addJavascriptInterface.interfaceObj = " + obj + ", interfaceName = " + str;
}
m14147(obj, str);
}
@Override
public void clearHistory() {
if (this.f11546) {
super.clearHistory();
}
}
@Override
public void destroy() {
setVisibility(8);
Map<String, C3458> map = this.f11544;
if (map != null) {
map.clear();
}
Map<String, String> map2 = this.f11545;
if (map2 != null) {
map2.clear();
}
removeAllViewsInLayout();
m14130();
m14139();
if (this.f11546) {
m14128();
C3471.m15595(f11542, "destroy web");
super.destroy();
}
}
@Override
public boolean isPrivateBrowsingEnabled() {
if (Build.VERSION.SDK_INT == 15 && getSettings() == null) {
return false;
}
return super.isPrivateBrowsingEnabled();
}
@Override
public void setOverScrollMode(int i) {
try {
super.setOverScrollMode(i);
} catch (Throwable th) {
Pair<Boolean, String> m14129 = m14129(th);
if (((Boolean) m14129.first).booleanValue()) {
Toast.makeText(getContext(), (CharSequence) m14129.second, 0).show();
destroy();
return;
}
throw th;
}
}
@Override
public final void setWebChromeClient(WebChromeClient webChromeClient) {
C3242 c3242 = new C3242();
c3242.mo15554(webChromeClient);
this.f11543.m14151(webChromeClient);
super.setWebChromeClient(c3242);
setWebChromeClientSupport(c3242);
}
public final void setWebChromeClientSupport(WebChromeClient webChromeClient) {
}
@Override
public final void setWebViewClient(WebViewClient webViewClient) {
C3244 c3244 = new C3244();
c3244.mo15536(webViewClient);
super.setWebViewClient(c3244);
setWebViewClientSupport(c3244);
}
public final void setWebViewClientSupport(WebViewClient webViewClient) {
}
@TargetApi(19)
public void m14141() {
if (!C3471.m15594() || Build.VERSION.SDK_INT < 19) {
return;
}
try {
WebView.class.getMethod("setWebContentsDebuggingEnabled", Boolean.TYPE).invoke(null, Boolean.TRUE);
} catch (Throwable th) {
if (C3471.m15594()) {
th.printStackTrace();
}
}
}
public String m14142(String str) {
return "javascript:try{" + str + "}catch(e){console.warn(e)}";
}
@TargetApi(11)
public boolean m14143() {
try {
int i = Build.VERSION.SDK_INT;
if (i >= 11 && i < 17) {
getClass().getMethod("removeJavascriptInterface", String.class).invoke(this, "searchBoxJavaBridge_");
return true;
}
} catch (Exception e) {
if (C3471.m15594()) {
e.printStackTrace();
}
}
return false;
}
public void m14144(String str) {
if (Build.VERSION.SDK_INT == 16 && getSettings().getJavaScriptEnabled() && this.f11547 == null && m14135()) {
try {
try {
URLEncoder.encode(String.valueOf(new URI(str)), "utf-8");
} catch (IllegalArgumentException e) {
if ("bad parameter".equals(e.getMessage())) {
this.f11547 = Boolean.TRUE;
setAccessibilityEnabled(false);
String str2 = f11542;
C3471.m15590(str2, "fixedAccessibilityInjectorExceptionForOnPageFinished.url = " + str, e);
}
}
} catch (Throwable th) {
if (C3471.m15594()) {
C3471.m15593(f11542, "fixedAccessibilityInjectorExceptionForOnPageFinished", th);
}
}
}
}
public void m14145() {
if (Build.VERSION.SDK_INT == 17 && this.f11547 == null && m14135()) {
this.f11547 = Boolean.TRUE;
setAccessibilityEnabled(false);
}
}
public String m14146(String str, String str2) {
String format = String.format("__injectFlag_%1$s__", str);
return "javascript:try{(function(){if(window." + format + "){console.log('" + format + " has been injected');return;}window." + format + "=true;" + str2 + "}())}catch(e){console.warn(e)}";
}
public void m14147(Object obj, String str) {
}
public void m14148(String str) {
if (this.f11545 == null) {
this.f11545 = new HashMap();
}
this.f11545.put(String.valueOf(str.hashCode()), str);
m14131();
}
public AgentWebView(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
m14143();
this.f11546 = true;
this.f11543 = new C3243();
}
}