Kufar v3.2.0版本的 MD5 值为:6a4d203db1c561c7e3bcd50d23fed59f

以下内容为反编译后的 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.WebView;
import android.webkit.WebViewClient;
import com.mbridge.msdk.MBridgeConstans;
import com.mbridge.msdk.foundation.tools.x;
import com.mbridge.msdk.playercommon.exoplayer2.DefaultLoadControl;
import java.util.HashMap;

public class h {

    public static long f46243a = 0;

    private static final String f46244d = "h";

    boolean f46245b;

    boolean f46246c;

    private int f46247e;

    private int f46248f;

    private com.mbridge.msdk.c.a f46250h;

    private a f46251i;

    private String f46252j;

    private String f46253k;

    private WebView f46254l;

    private boolean f46255m;

    private String f46256n;

    private int f46257o;

    private boolean f46259q;

    private boolean f46258p = false;

    private final Runnable f46260r = new Runnable() {
        @Override
        public final void run() {
            h.this.f46258p = true;
            h.this.f46257o = 1;
            h.m(h.this);
        }
    };

    private final Runnable f46261s = new Runnable() {
        @Override
        public final void run() {
            h.this.f46258p = true;
            h.this.f46257o = 2;
            h.m(h.this);
        }
    };

    private Handler f46249g = new Handler(Looper.getMainLooper());

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

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

        boolean a(String str);

        boolean b(String str);

        boolean c(String str);
    }

    public h() {
        this.f46247e = DefaultLoadControl.DEFAULT_MIN_BUFFER_MS;
        this.f46248f = 3000;
        com.mbridge.msdk.c.a b11 = com.mbridge.msdk.c.b.a().b(com.mbridge.msdk.foundation.controller.a.d().g());
        this.f46250h = b11;
        if (b11 == null) {
            this.f46250h = com.mbridge.msdk.c.b.a().b();
        }
        this.f46255m = this.f46250h.R();
        this.f46247e = (int) this.f46250h.W();
        this.f46248f = (int) this.f46250h.W();
    }

    public void c() {
        this.f46249g.removeCallbacks(this.f46261s);
    }

    public static void e(h hVar) {
        hVar.c();
        hVar.f46249g.postDelayed(hVar.f46261s, hVar.f46247e);
    }

    public static void l(h hVar) {
        hVar.d();
        hVar.f46249g.postDelayed(hVar.f46260r, hVar.f46248f);
    }

    public static void m(h hVar) {
        synchronized (f46244d) {
            try {
                try {
                    hVar.b();
                    hVar.f46254l.destroy();
                    a aVar = hVar.f46251i;
                    if (aVar != null) {
                        aVar.a(hVar.f46252j, hVar.f46258p, hVar.f46256n);
                    }
                } finally {
                }
            } catch (Exception e11) {
                x.d(f46244d, e11.getMessage());
            }
        }
    }

    public static void c(h hVar) {
        synchronized (f46244d) {
            try {
                hVar.b();
                a aVar = hVar.f46251i;
                if (aVar != null) {
                    aVar.a(hVar.f46252j, hVar.f46258p, hVar.f46256n);
                }
            } catch (Exception e11) {
                x.d(f46244d, e11.getMessage());
            } catch (Throwable th2) {
                x.d(f46244d, th2.getMessage());
            }
        }
    }

    public void d() {
        this.f46249g.removeCallbacks(this.f46260r);
    }

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

    public final void a(String str, String str2, Context context, String str3, String str4, a aVar) {
        if (aVar != null) {
            this.f46253k = str4;
            this.f46252j = str3;
            this.f46251i = aVar;
            a(str, str2, context);
            return;
        }
        throw new NullPointerException("OverrideUrlLoadingListener can not be null");
    }

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

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

    public void a(String str, String str2, Context context, String str3) {
        try {
            a(context, str, str2);
            if (!TextUtils.isEmpty(this.f46253k)) {
                this.f46254l.getSettings().setDefaultTextEncodingName("utf-8");
                this.f46248f = 2000;
                this.f46247e = 2000;
                x.b(f46244d, this.f46253k);
                this.f46254l.loadDataWithBaseURL(str3, this.f46253k, "*/*", "utf-8", str3);
                return;
            }
            if (this.f46255m) {
                HashMap hashMap = new HashMap();
                if (this.f46254l.getUrl() != null) {
                    hashMap.put("Referer", this.f46254l.getUrl());
                }
                this.f46254l.loadUrl(str3, hashMap);
                return;
            }
            this.f46254l.loadUrl(str3);
        } catch (Throwable th2) {
            try {
                a aVar = this.f46251i;
                if (aVar != null) {
                    aVar.a(0, this.f46252j, th2.getMessage(), this.f46256n);
                }
            } catch (Exception e11) {
                e11.printStackTrace();
            }
        }
    }

    private void a(final Context context, final String str, final String str2) {
        WebView webView = new WebView(context);
        this.f46254l = webView;
        webView.getSettings().setJavaScriptEnabled(true);
        this.f46254l.getSettings().setCacheMode(2);
        this.f46254l.getSettings().setLoadsImagesAutomatically(false);
        this.f46254l.setWebViewClient(new WebViewClient() {
            @Override
            public final void onPageFinished(WebView webView2, String str3) {
                super.onPageFinished(webView2, str3);
                try {
                    webView2.loadUrl("javascript:window.navigator.vibrate([]);");
                } catch (Exception e11) {
                    e11.printStackTrace();
                }
            }

            @Override
            public final void onPageStarted(WebView webView2, String str3, Bitmap bitmap) {
                try {
                    webView2.loadUrl("javascript:window.navigator.vibrate([]);");
                    if (h.this.f46259q) {
                        h.this.f46257o = 0;
                        h.c(h.this);
                        return;
                    }
                    h.this.f46246c = false;
                    if (webView2.getTag() == null) {
                        webView2.setTag("has_first_started");
                    } else {
                        h.this.f46245b = true;
                    }
                    synchronized (h.f46244d) {
                        h.this.f46252j = str3;
                        if (h.this.f46251i != null && h.this.f46251i.a(str3)) {
                            h.this.f46259q = true;
                            h.c(h.this);
                        } else {
                            h.e(h.this);
                        }
                    }
                } catch (Exception e11) {
                    e11.printStackTrace();
                }
            }

            @Override
            public final void onReceivedError(WebView webView2, int i11, String str3, String str4) {
                synchronized (h.f46244d) {
                    h.this.f46259q = true;
                    h.this.b();
                    h.c(h.this);
                }
                if (h.this.f46251i != null) {
                    h.this.f46251i.a(i11, webView2.getUrl(), str3, h.this.f46256n);
                }
            }

            @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)) {
                        new com.mbridge.msdk.foundation.same.report.d(context).a(str, str2, webView2.getUrl());
                    }
                } catch (Exception e11) {
                    e11.printStackTrace();
                }
            }

            @Override
            public final boolean shouldOverrideUrlLoading(WebView webView2, String str3) {
                synchronized (h.f46244d) {
                    h hVar = h.this;
                    hVar.f46246c = true;
                    hVar.d();
                    if (h.this.f46259q) {
                        h.this.c();
                        h.c(h.this);
                        return true;
                    }
                    h.this.f46252j = str3;
                    if (h.this.f46251i != null && h.this.f46251i.b(str3)) {
                        h.this.f46259q = true;
                        h.this.c();
                        h.c(h.this);
                        return true;
                    }
                    if (h.this.f46255m) {
                        HashMap hashMap = new HashMap();
                        if (h.this.f46254l.getUrl() != null) {
                            hashMap.put("Referer", h.this.f46254l.getUrl());
                        }
                        h.this.f46254l.loadUrl(str3, hashMap);
                    } else {
                        h.this.f46254l.loadUrl(str3);
                    }
                    return true;
                }
            }
        });
        this.f46254l.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 i11) {
                if (i11 == 100) {
                    try {
                        webView2.loadUrl("javascript:window.navigator.vibrate([]);");
                        if (!h.this.f46259q) {
                            h hVar = h.this;
                            if (!hVar.f46246c) {
                                h.l(hVar);
                            }
                        }
                        if (h.this.f46251i != null) {
                            h.this.f46251i.c(webView2.getUrl());
                        }
                    } catch (Exception e11) {
                        e11.printStackTrace();
                    }
                }
            }
        });
    }
}