AI Chat v1.1.8版本的 MD5 值为:1bcdce875f86738c8cfbf1e5f4064353

以下内容为反编译后的 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 java.util.HashMap;
import java.util.Objects;
public class h {
    public static long a = 0;
    private static final String f1503d = "h";
    public boolean b;
    public boolean c;
    private int e;
    private int f;
    private com.mbridge.msdk.c.a 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.a b = com.mbridge.msdk.c.b.a().b(com.mbridge.msdk.foundation.controller.a.d().g());
        this.h = b;
        if (b == null) {
            this.h = com.mbridge.msdk.c.b.a().b();
        }
        this.m = this.h.Q();
        this.e = (int) this.h.V();
        this.f = (int) this.h.V();
    }

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

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

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

    public static void m(h hVar) {
        synchronized (f1503d) {
            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) {
                    x.d(f1503d, e.getMessage());
                }
            }
        }
    }

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

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

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

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

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

    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(com.anythink.expressad.foundation.g.a.bN);
                this.f = 2000;
                this.e = 2000;
                x.b(f1503d, this.k);
                this.l.loadDataWithBaseURL(str3, this.k, "*/*", com.anythink.expressad.foundation.g.a.bN, str3);
            } else if (this.m) {
                HashMap hashMap = new HashMap();
                if (this.l.getUrl() != null) {
                    hashMap.put("Referer", this.l.getUrl());
                }
                this.l.loadUrl(str3, hashMap);
            } else {
                this.l.loadUrl(str3);
            }
        } 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();
            }
        }
    }

    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 final void onPageFinished(WebView webView2, String str3) {
                super.onPageFinished(webView2, str3);
                try {
                    webView2.loadUrl("javascript:window.navigator.vibrate([]);");
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }

            @Override
            public final void onPageStarted(WebView webView2, String str3, Bitmap bitmap) {
                try {
                    webView2.loadUrl("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.b = true;
                    }
                    synchronized (h.f1503d) {
                        h.this.j = str3;
                        if (h.this.i != null && h.this.i.a(str3)) {
                            h.this.q = true;
                            h.c(h.this);
                        } else {
                            h.e(h.this);
                        }
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }

            @Override
            public final void onReceivedError(WebView webView2, int i, String str3, String str4) {
                synchronized (h.f1503d) {
                    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 com.mbridge.msdk.foundation.same.report.d(context).a(str, str2, webView2.getUrl());
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }

            @Override
            public final boolean shouldOverrideUrlLoading(WebView webView2, String str3) {
                synchronized (h.f1503d) {
                    h hVar = h.this;
                    hVar.c = true;
                    hVar.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)) {
                        if (!h.this.m) {
                            h.this.l.loadUrl(str3);
                        } else {
                            HashMap hashMap = new HashMap();
                            if (h.this.l.getUrl() != null) {
                                hashMap.put("Referer", h.this.l.getUrl());
                            }
                            h.this.l.loadUrl(str3, hashMap);
                        }
                        return true;
                    }
                    h.this.q = true;
                    h.this.c();
                    h.c(h.this);
                    return true;
                }
            }
        });
        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 {
                        webView2.loadUrl("javascript:window.navigator.vibrate([]);");
                        if (!h.this.q) {
                            h hVar = h.this;
                            if (!hVar.c) {
                                h.l(hVar);
                            }
                        }
                        if (h.this.i != null) {
                            h.this.i.c(webView2.getUrl());
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
            }
        });
    }
}