导航菜单

页面标题

页面副标题

小柿子 v1.3.8 - p.java 源代码

正在查看: 小柿子 v1.3.8 应用的 p.java JAVA 源代码文件

本页面展示 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.RenderProcessGoneDetail;
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.af;
import java.util.HashMap;
import java.util.Objects;

public class p {
    public static long a = 0;
    private static final String d = "p";
    public boolean b;
    public boolean c;
    private int e;
    private int f;
    private com.mbridge.msdk.c.g 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 f56r = new Runnable() {
        @Override
        public final void run() {
            p.this.p = true;
            p.this.o = 1;
            p.m(p.this);
        }
    };

    private final Runnable f57s = new Runnable() {
        @Override
        public final void run() {
            p.this.p = true;
            p.this.o = 2;
            p.m(p.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 z2, String str2);

        boolean a(String str);

        boolean b(String str);

        boolean c(String str);
    }

    public p() {
        this.e = 15000;
        this.f = 3000;
        com.mbridge.msdk.c.g b = com.mbridge.msdk.c.h.a().b(com.mbridge.msdk.foundation.controller.c.q().k());
        this.h = b;
        if (b == null) {
            com.mbridge.msdk.c.h.a();
            this.h = com.mbridge.msdk.c.i.a();
        }
        this.m = this.h.aI();
        this.e = (int) this.h.aq();
        this.f = (int) this.h.aq();
    }

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

    public static void e(p pVar) {
        pVar.c();
        pVar.g.postDelayed(pVar.f57s, pVar.e);
    }

    public static void l(p pVar) {
        pVar.d();
        pVar.g.postDelayed(pVar.f56r, pVar.f);
    }

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

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

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

    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() {
                    p pVar = p.this;
                    pVar.a(str, str2, context, pVar.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;
                af.c(d, this.k);
                this.l.loadDataWithBaseURL(str3, this.k, "*/*", "utf-8", str3);
                return;
            }
            if (this.m) {
                HashMap hashMap = new HashMap();
                if (this.l.getUrl() != null) {
                    hashMap.put("Referer", this.l.getUrl());
                }
                this.l.loadUrl(str3, hashMap);
                return;
            }
            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 (p.this.q) {
                        p.this.o = 0;
                        p.c(p.this);
                        return;
                    }
                    p.this.c = false;
                    if (webView2.getTag() == null) {
                        webView2.setTag("has_first_started");
                    } else {
                        p.this.b = true;
                    }
                    synchronized (p.d) {
                        p.this.j = str3;
                        if (p.this.i == null || !p.this.i.a(str3)) {
                            p.e(p.this);
                        } else {
                            p.this.q = true;
                            p.c(p.this);
                        }
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }

            @Override
            public final void onReceivedError(WebView webView2, int i, String str3, String str4) {
                synchronized (p.d) {
                    p.this.q = true;
                    p.this.b();
                    p.c(p.this);
                }
                if (p.this.i != null) {
                    p.this.i.a(i, webView2.getUrl(), str3, p.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.i(context).a(str, str2, webView2.getUrl());
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }

            @Override
            public final boolean onRenderProcessGone(WebView webView2, RenderProcessGoneDetail renderProcessGoneDetail) {
                try {
                    synchronized (p.d) {
                        p.this.q = true;
                        p.this.b();
                        p.c(p.this);
                    }
                    if (p.this.i != null) {
                        p.this.i.a(-1, webView2.getUrl(), "WebView render process crash.", p.this.n);
                    }
                    if (webView2 != null) {
                        webView2.destroy();
                    }
                    return true;
                } catch (Throwable th) {
                    af.b(p.d, th.getMessage());
                    return true;
                }
            }

            @Override
            public final boolean shouldOverrideUrlLoading(WebView webView2, String str3) {
                synchronized (p.d) {
                    p pVar = p.this;
                    pVar.c = true;
                    pVar.d();
                    if (p.this.q) {
                        p.this.c();
                        p.c(p.this);
                        return true;
                    }
                    p.this.j = str3;
                    if (p.this.i != null && p.this.i.b(str3)) {
                        p.this.q = true;
                        p.this.c();
                        p.c(p.this);
                        return true;
                    }
                    if (p.this.m) {
                        HashMap hashMap = new HashMap();
                        if (p.this.l.getUrl() != null) {
                            hashMap.put("Referer", p.this.l.getUrl());
                        }
                        p.this.l.loadUrl(str3, hashMap);
                    } else {
                        p.this.l.loadUrl(str3);
                    }
                    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 (!p.this.q) {
                            p pVar = p.this;
                            if (!pVar.c) {
                                p.l(pVar);
                            }
                        }
                        if (p.this.i != null) {
                            p.this.i.c(webView2.getUrl());
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
            }
        });
    }
}