导航菜单

页面标题

页面副标题

Uptodown App Store v6.80 - m.java 源代码

正在查看: Uptodown App Store v6.80 应用的 m.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.mbridge.msdk.click;

import android.annotation.SuppressLint;
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 com.mbridge.msdk.playercommon.exoplayer2.DefaultLoadControl;
import java.util.HashMap;
import org.json.JSONObject;

public class m {
    public static long a = 0;
    private static final String d = "m";
    boolean b;
    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 r = new Runnable() {
        @Override
        public final void run() {
            m.this.p = true;
            m.this.o = 1;
            m.m(m.this);
        }
    };
    private final Runnable s = new Runnable() {
        @Override
        public final void run() {
            m.this.p = true;
            m.this.o = 2;
            m.m(m.this);
        }
    };
    private Handler g = new Handler(Looper.getMainLooper());

    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 m() {
        this.e = DefaultLoadControl.DEFAULT_MIN_BUFFER_MS;
        this.f = 3000;
        com.mbridge.msdk.c.g b = com.mbridge.msdk.c.h.a().b(com.mbridge.msdk.foundation.controller.c.m().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.aJ();
        this.e = (int) this.h.ar();
        this.f = (int) this.h.ar();
    }

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

    static void e(m mVar) {
        mVar.c();
        mVar.g.postDelayed(mVar.s, mVar.e);
    }

    static void l(m mVar) {
        mVar.d();
        mVar.g.postDelayed(mVar.r, mVar.f);
    }

    static void m(m mVar) {
        synchronized (d) {
            try {
                try {
                    mVar.b();
                    mVar.l.destroy();
                    a aVar = mVar.i;
                    if (aVar != null) {
                        aVar.a(mVar.j, mVar.p, mVar.n);
                    }
                } catch (Exception e) {
                    af.b(d, e.getMessage());
                } catch (Throwable th) {
                    af.b(d, th.getMessage());
                }
            } catch (Throwable th2) {
                throw th2;
            }
        }
    }

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

    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) {
        if (aVar != null) {
            this.k = str4;
            this.j = str3;
            this.i = 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.j = str3;
            this.i = 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.j);
        } else {
            this.g.post(new Runnable() {
                @Override
                public final void run() {
                    m mVar = m.this;
                    mVar.a(str, str2, context, mVar.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();
            }
        }
    }

    @SuppressLint({"SetJavaScriptEnabled"})
    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 (m.this.q) {
                        m.this.o = 0;
                        m.c(m.this);
                        return;
                    }
                    m.this.c = false;
                    if (webView2.getTag() == null) {
                        webView2.setTag("has_first_started");
                    } else {
                        m.this.b = true;
                    }
                    synchronized (m.d) {
                        try {
                            m.this.j = str3;
                            if (m.this.i == null || !m.this.i.a(str3)) {
                                m.e(m.this);
                            } else {
                                m.this.q = true;
                                m.c(m.this);
                            }
                        } finally {
                        }
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }

            @Override
            public final void onReceivedError(WebView webView2, int i, String str3, String str4) {
                synchronized (m.d) {
                    m.this.q = true;
                    m.this.b();
                    m.c(m.this);
                }
                if (m.this.i != null) {
                    m.this.i.a(i, webView2.getUrl(), str3, m.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.h(context);
                    String str3 = str;
                    String str4 = str2;
                    String url = webView2.getUrl();
                    try {
                        JSONObject jSONObject = new JSONObject();
                        jSONObject.put("click_type", "1");
                        jSONObject.put("cid", str3);
                        jSONObject.put(MBridgeConstans.PROPERTIES_UNIT_ID, str4);
                        jSONObject.put("key", "2000027");
                        jSONObject.put("http_url", url);
                        com.mbridge.msdk.foundation.same.report.d.d.a().a(jSONObject);
                    } catch (Exception e) {
                        af.b(com.mbridge.msdk.foundation.same.report.h.a, e.getMessage());
                    }
                } catch (Exception e4) {
                    e4.printStackTrace();
                }
            }

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

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