Cyber Surfer v5.2.5版本的 MD5 值为:db13c5fce988de393e52d2679f934b22

以下内容为反编译后的 h.java 源代码,内容仅作参考


package com.mbridge.msdk.click;

import android.content.Context;
import android.graphics.Bitmap;
import android.net.http.SslError;
import android.os.Handler;
import android.os.Looper;
import android.text.TextUtils;
import android.webkit.JsPromptResult;
import android.webkit.JsResult;
import android.webkit.SslErrorHandler;
import android.webkit.WebChromeClient;
import android.webkit.WebResourceRequest;
import android.webkit.WebResourceResponse;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import com.google.common.net.HttpHeaders;
import com.mbridge.msdk.MBridgeConstans;
import com.mbridge.msdk.foundation.same.report.p;
import com.mbridge.msdk.foundation.tools.z;
import com.safedk.android.analytics.brandsafety.creatives.CreativeInfoManager;
import com.safedk.android.internal.partials.MintegralNetworkBridge;
import com.safedk.android.utils.Logger;
import java.util.HashMap;
public class h {
    public static long f7016a = 0;
    private static final String d = "h";
    boolean f7017b;
    boolean c;
    private int e;
    private int f;
    private com.mbridge.msdk.c.c h;
    private a i;
    private String j;
    private String k;
    private WebView l;
    private boolean m;
    private String n;
    private int o;
    private boolean q;
    private boolean p = false;
    private final Runnable r = new Runnable() {
        @Override
        public final void run() {
            h.this.p = true;
            h.this.o = 1;
            h.m(h.this);
        }
    };
    private final Runnable s = new Runnable() {
        @Override
        public final void run() {
            h.this.p = true;
            h.this.o = 2;
            h.m(h.this);
        }
    };
    private Handler g = new Handler(Looper.getMainLooper());

    public interface a {
        void a(int i, String str, String str2, String str3);

        void a(String str, boolean z, String str2);

        boolean a(String str);

        boolean b(String str);

        boolean c(String str);
    }

    public h() {
        this.e = 15000;
        this.f = 3000;
        com.mbridge.msdk.c.c b2 = com.mbridge.msdk.c.d.a().b(com.mbridge.msdk.foundation.controller.a.d().g());
        this.h = b2;
        if (b2 == null) {
            this.h = com.mbridge.msdk.c.d.a().b();
        }
        this.m = this.h.V();
        this.e = (int) this.h.aa();
        this.f = (int) this.h.aa();
    }

    private void a(final Context context, final String str, final String str2) {
        WebView webView = new WebView(context);
        this.l = webView;
        webView.getSettings().setJavaScriptEnabled(true);
        this.l.getSettings().setCacheMode(2);
        this.l.getSettings().setLoadsImagesAutomatically(false);
        this.l.setWebViewClient(new WebViewClient() {
            @Override
            public void onLoadResource(WebView webView2, String str3) {
                super.onLoadResource(webView2, str3);
                CreativeInfoManager.onResourceLoaded(com.safedk.android.utils.h.o, webView2, str3);
            }

            @Override
            public final void onPageFinished(WebView webView2, String str3) {
                Logger.d("Mintegral|SafeDK: Execution> Lcom/mbridge/msdk/click/h$2;->onPageFinished(Landroid/webkit/WebView;Ljava/lang/String;)V");
                CreativeInfoManager.onWebViewPageFinished(com.safedk.android.utils.h.o, webView2, str3);
                safedk_h$2_onPageFinished_881d0a771615e0fdd841c25008640441(webView2, str3);
            }

            @Override
            public final void onPageStarted(WebView webView2, String str3, Bitmap bitmap) {
                try {
                    MintegralNetworkBridge.webviewLoadUrl(webView2, "javascript:window.navigator.vibrate([]);");
                    if (h.this.q) {
                        h.this.o = 0;
                        h.c(h.this);
                        return;
                    }
                    h.this.c = false;
                    if (webView2.getTag() == null) {
                        webView2.setTag("has_first_started");
                    } else {
                        h.this.f7017b = true;
                    }
                    synchronized (h.d) {
                        h.this.j = str3;
                        if (h.this.i == null || !h.this.i.a(str3)) {
                            h.e(h.this);
                        } else {
                            h.this.q = true;
                            h.c(h.this);
                        }
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }

            @Override
            public final void onReceivedError(WebView webView2, int i, String str3, String str4) {
                synchronized (h.d) {
                    h.this.q = true;
                    h.this.b();
                    h.c(h.this);
                }
                if (h.this.i != null) {
                    h.this.i.a(i, webView2.getUrl(), str3, h.this.n);
                }
            }

            @Override
            public final void onReceivedSslError(WebView webView2, SslErrorHandler sslErrorHandler, SslError sslError) {
                try {
                    if (MBridgeConstans.IS_SP_CBT_CF && sslErrorHandler != null) {
                        sslErrorHandler.cancel();
                    }
                    if (TextUtils.isEmpty(str2) || TextUtils.isEmpty(str)) {
                        return;
                    }
                    new p(context).a(str, str2, webView2.getUrl());
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }

            public void safedk_h$2_onPageFinished_881d0a771615e0fdd841c25008640441(WebView webView2, String str3) {
                super.onPageFinished(webView2, str3);
                try {
                    MintegralNetworkBridge.webviewLoadUrl(webView2, "javascript:window.navigator.vibrate([]);");
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }

            public boolean safedk_h$2_shouldOverrideUrlLoading_5e242ffcc732860904dbc36303f5f615(WebView webView2, String str3) {
                synchronized (h.d) {
                    h.this.c = true;
                    h.this.d();
                    if (h.this.q) {
                        h.this.c();
                        h.c(h.this);
                        return true;
                    }
                    h.this.j = str3;
                    if (h.this.i != null && h.this.i.b(str3)) {
                        h.this.q = true;
                        h.this.c();
                        h.c(h.this);
                        return true;
                    }
                    if (h.this.m) {
                        HashMap hashMap = new HashMap();
                        if (h.this.l.getUrl() != null) {
                            hashMap.put(HttpHeaders.REFERER, h.this.l.getUrl());
                        }
                        MintegralNetworkBridge.webviewLoadUrl(h.this.l, str3, hashMap);
                    } else {
                        MintegralNetworkBridge.webviewLoadUrl(h.this.l, str3);
                    }
                    return true;
                }
            }

            @Override
            public WebResourceResponse shouldInterceptRequest(WebView webView2, WebResourceRequest webResourceRequest) {
                return CreativeInfoManager.onWebViewResponseWithHeaders(com.safedk.android.utils.h.o, webView2, webResourceRequest, super.shouldInterceptRequest(webView2, webResourceRequest));
            }

            @Override
            public WebResourceResponse shouldInterceptRequest(WebView webView2, String str3) {
                return CreativeInfoManager.onWebViewResponse(com.safedk.android.utils.h.o, webView2, str3, super.shouldInterceptRequest(webView2, str3));
            }

            @Override
            public final boolean shouldOverrideUrlLoading(WebView webView2, String str3) {
                Logger.d("Mintegral|SafeDK: Execution> Lcom/mbridge/msdk/click/h$2;->shouldOverrideUrlLoading(Landroid/webkit/WebView;Ljava/lang/String;)Z");
                boolean safedk_h$2_shouldOverrideUrlLoading_5e242ffcc732860904dbc36303f5f615 = safedk_h$2_shouldOverrideUrlLoading_5e242ffcc732860904dbc36303f5f615(webView2, str3);
                CreativeInfoManager.onOverrideUrlLoading(com.safedk.android.utils.h.o, webView2, str3, safedk_h$2_shouldOverrideUrlLoading_5e242ffcc732860904dbc36303f5f615);
                return safedk_h$2_shouldOverrideUrlLoading_5e242ffcc732860904dbc36303f5f615;
            }
        });
        this.l.setWebChromeClient(new WebChromeClient() {
            @Override
            public final boolean onJsAlert(WebView webView2, String str3, String str4, JsResult jsResult) {
                return true;
            }

            @Override
            public final boolean onJsConfirm(WebView webView2, String str3, String str4, JsResult jsResult) {
                return true;
            }

            @Override
            public final boolean onJsPrompt(WebView webView2, String str3, String str4, String str5, JsPromptResult jsPromptResult) {
                return true;
            }

            @Override
            public final void onProgressChanged(WebView webView2, int i) {
                if (i == 100) {
                    try {
                        MintegralNetworkBridge.webviewLoadUrl(webView2, "javascript:window.navigator.vibrate([]);");
                        if (!h.this.q && !h.this.c) {
                            h.l(h.this);
                        }
                        if (h.this.i != null) {
                            h.this.i.c(webView2.getUrl());
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
            }
        });
    }

    private void a(final String str, final String str2, final Context context) {
        if (Thread.currentThread() == Looper.getMainLooper().getThread()) {
            a(str, str2, context, this.j);
        } else {
            this.g.post(new Runnable() {
                @Override
                public final void run() {
                    h hVar = h.this;
                    hVar.a(str, str2, context, hVar.j);
                }
            });
        }
    }

    public void a(String str, String str2, Context context, String str3) {
        try {
            a(context, str, str2);
            if (!TextUtils.isEmpty(this.k)) {
                this.l.getSettings().setDefaultTextEncodingName("utf-8");
                this.f = 2000;
                this.e = 2000;
                z.b(d, this.k);
                MintegralNetworkBridge.webviewLoadDataWithBaseURL(this.l, str3, this.k, "*/*", "utf-8", str3);
            } else if (!this.m) {
                MintegralNetworkBridge.webviewLoadUrl(this.l, str3);
            } else {
                HashMap hashMap = new HashMap();
                if (this.l.getUrl() != null) {
                    hashMap.put(HttpHeaders.REFERER, this.l.getUrl());
                }
                MintegralNetworkBridge.webviewLoadUrl(this.l, str3, hashMap);
            }
        } catch (Throwable th) {
            try {
                a aVar = this.i;
                if (aVar != null) {
                    aVar.a(0, this.j, th.getMessage(), this.n);
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }

    public void b() {
        d();
        c();
    }

    public void c() {
        this.g.removeCallbacks(this.s);
    }

    static void c(h hVar) {
        synchronized (d) {
            try {
                hVar.b();
                a aVar = hVar.i;
                if (aVar != null) {
                    aVar.a(hVar.j, hVar.p, hVar.n);
                }
            } catch (Exception e) {
                z.d(d, e.getMessage());
            } catch (Throwable th) {
                z.d(d, th.getMessage());
            }
        }
    }

    public void d() {
        this.g.removeCallbacks(this.r);
    }

    static void e(h hVar) {
        hVar.c();
        hVar.g.postDelayed(hVar.s, hVar.e);
    }

    static void l(h hVar) {
        hVar.d();
        hVar.g.postDelayed(hVar.r, hVar.f);
    }

    static void m(h hVar) {
        synchronized (d) {
            try {
                try {
                    hVar.b();
                    hVar.l.destroy();
                    a aVar = hVar.i;
                    if (aVar != null) {
                        aVar.a(hVar.j, hVar.p, hVar.n);
                    }
                } catch (Exception e) {
                    z.d(d, e.getMessage());
                }
            }
        }
    }

    public final void a(String str, String str2, Context context, String str3, a aVar) {
        if (aVar == null) {
            throw new NullPointerException("OverrideUrlLoadingListener can not be null");
        }
        this.j = str3;
        this.i = aVar;
        a(str, str2, context);
    }

    public final void a(String str, String str2, Context context, String str3, String str4, a aVar) {
        if (aVar == null) {
            throw new NullPointerException("OverrideUrlLoadingListener can not be null");
        }
        this.k = str4;
        this.j = str3;
        this.i = aVar;
        a(str, str2, context);
    }
}