导航菜单

页面标题

页面副标题

Top浏览器 v4.6.16 - c.java 源代码

正在查看: Top浏览器 v4.6.16 应用的 c.java JAVA 源代码文件

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


package c.x.a.d;

import android.R;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.net.Uri;
import android.net.http.SslError;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.os.SystemClock;
import android.text.TextUtils;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.SslErrorHandler;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import c.x.a.d.d;
import c.x.c.d;
import c.x.c.g.k;
import com.tencent.open.web.security.JniInterface;
import com.umeng.commonsdk.statistics.SdkVersion;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import org.json.JSONException;
import org.json.JSONObject;

public class c extends Dialog {
    public String a;
    public f b;

    public c.x.d.c f564c;

    public Handler f565d;

    public FrameLayout f566e;

    public LinearLayout f567f;

    public FrameLayout f568g;

    public ProgressBar f569h;

    public String f570i;

    public com.tencent.open.c.d f571j;

    public Context f572k;

    public c.x.c.h.b.c f573l;

    public boolean f574m;
    public int n;
    public String o;
    public String p;
    public long q;
    public long r;
    public HashMap<String, Runnable> s;

    public class a implements View.OnClickListener {
        public a() {
        }

        @Override
        public void onClick(View view) {
            c.this.dismiss();
            if (c.this.f574m || c.this.b == null) {
                return;
            }
            c.this.b.onCancel();
        }
    }

    public class b implements View.OnLongClickListener {
        public b() {
        }

        @Override
        public boolean onLongClick(View view) {
            return true;
        }
    }

    public class ViewOnTouchListenerC0033c implements View.OnTouchListener {
        public ViewOnTouchListenerC0033c() {
        }

        @Override
        public boolean onTouch(View view, MotionEvent motionEvent) {
            int action = motionEvent.getAction();
            if ((action != 0 && action != 1) || view.hasFocus()) {
                return false;
            }
            view.requestFocus();
            return false;
        }
    }

    public class d implements DialogInterface.OnDismissListener {
        public d() {
        }

        @Override
        public void onDismiss(DialogInterface dialogInterface) {
            try {
                if (JniInterface.a) {
                    JniInterface.clearAllPWD();
                }
            } catch (Exception unused) {
            }
        }
    }

    public class e extends WebViewClient {

        public class a implements Runnable {
            public a() {
            }

            @Override
            public void run() {
                c.this.f571j.loadUrl(c.this.o);
            }
        }

        public e() {
        }

        @Override
        public void onPageFinished(WebView webView, String str) {
            super.onPageFinished(webView, str);
            c.x.c.f.a.n("openSDK_LOG.AuthDialog", "-->onPageFinished, url: " + str);
            c.this.f568g.setVisibility(8);
            if (c.this.f571j != null) {
                c.this.f571j.setVisibility(0);
            }
            if (TextUtils.isEmpty(str)) {
                return;
            }
            c.this.f565d.removeCallbacks((Runnable) c.this.s.remove(str));
        }

        @Override
        public void onPageStarted(WebView webView, String str, Bitmap bitmap) {
            c.x.c.f.a.n("openSDK_LOG.AuthDialog", "-->onPageStarted, url: " + str);
            super.onPageStarted(webView, str, bitmap);
            c.this.f568g.setVisibility(0);
            c.this.q = SystemClock.elapsedRealtime();
            if (!TextUtils.isEmpty(c.this.o)) {
                c.this.f565d.removeCallbacks((Runnable) c.this.s.remove(c.this.o));
            }
            c.this.o = str;
            c cVar = c.this;
            h hVar = cVar.new h(cVar.o);
            c.this.s.put(str, hVar);
            c.this.f565d.postDelayed(hVar, 120000L);
        }

        @Override
        public void onReceivedError(WebView webView, int i2, String str, String str2) {
            super.onReceivedError(webView, i2, str, str2);
            c.x.c.f.a.k("openSDK_LOG.AuthDialog", "-->onReceivedError, errorCode: " + i2 + " | description: " + str);
            if (!k.n(c.this.f572k)) {
                c.this.b.a(new c.x.d.e(9001, "当前网络不可用,请稍后重试!", str2));
                c.this.dismiss();
                return;
            }
            if (c.this.o.startsWith("https://imgcache.qq.com/ptlogin/static/qzsjump.html?")) {
                c.this.b.a(new c.x.d.e(i2, str, str2));
                c.this.dismiss();
                return;
            }
            long elapsedRealtime = SystemClock.elapsedRealtime() - c.this.q;
            if (c.this.n >= 1 || elapsedRealtime >= c.this.r) {
                c.this.f571j.loadUrl(c.this.c());
            } else {
                c.C(c.this);
                c.this.f565d.postDelayed(new a(), 500L);
            }
        }

        @Override
        @TargetApi(8)
        public void onReceivedSslError(WebView webView, SslErrorHandler sslErrorHandler, SslError sslError) {
            c.x.c.f.a.h("openSDK_LOG.AuthDialog", "-->onReceivedSslError " + sslError.getPrimaryError() + "请求不合法,请检查手机安全设置,如系统时间、代理等");
            sslErrorHandler.cancel();
        }

        @Override
        public boolean shouldOverrideUrlLoading(WebView webView, String str) {
            List<String> pathSegments;
            c.x.c.f.a.n("openSDK_LOG.AuthDialog", "-->Redirect URL: " + str);
            if (str.startsWith("auth://browser")) {
                JSONObject p = k.p(str);
                c cVar = c.this;
                cVar.f574m = cVar.u();
                if (!c.this.f574m) {
                    if (p.optString("fail_cb", null) != null) {
                        c.this.h(p.optString("fail_cb"), "");
                    } else if (p.optInt("fall_to_wv") == 1) {
                        c cVar2 = c.this;
                        StringBuilder sb = new StringBuilder();
                        sb.append(c.this.a);
                        sb.append(c.this.a.indexOf("?") > -1 ? "&" : "?");
                        cVar2.a = sb.toString();
                        c.this.a = c.this.a + "browser_error=1";
                        c.this.f571j.loadUrl(c.this.a);
                    } else {
                        String optString = p.optString("redir", null);
                        if (optString != null) {
                            c.this.f571j.loadUrl(optString);
                        }
                    }
                }
                return true;
            }
            if (str.startsWith("auth://tauth.qq.com/")) {
                c.this.b.b(k.p(str));
                c.this.dismiss();
                return true;
            }
            if (str.startsWith("auth://cancel")) {
                c.this.b.onCancel();
                c.this.dismiss();
                return true;
            }
            if (str.startsWith("auth://close")) {
                c.this.dismiss();
                return true;
            }
            if (str.startsWith("download://") || str.endsWith(".apk")) {
                try {
                    Intent intent = new Intent("android.intent.action.VIEW", str.startsWith("download://") ? Uri.parse(Uri.decode(str.substring(11))) : Uri.parse(Uri.decode(str)));
                    intent.addFlags(268435456);
                    c.this.f572k.startActivity(intent);
                } catch (Exception e2) {
                    c.x.c.f.a.i("openSDK_LOG.AuthDialog", "-->start download activity exception, e: ", e2);
                }
                return true;
            }
            if (!str.startsWith("auth://progress")) {
                if (str.startsWith("auth://onLoginSubmit")) {
                    try {
                        List<String> pathSegments2 = Uri.parse(str).getPathSegments();
                        if (!pathSegments2.isEmpty()) {
                            c.this.p = pathSegments2.get(0);
                        }
                    } catch (Exception unused) {
                    }
                    return true;
                }
                if (c.this.f573l.c(c.this.f571j, str)) {
                    return true;
                }
                c.x.c.f.a.k("openSDK_LOG.AuthDialog", "-->Redirect URL: return false");
                return false;
            }
            try {
                pathSegments = Uri.parse(str).getPathSegments();
            } catch (Exception unused2) {
            }
            if (pathSegments.isEmpty()) {
                return true;
            }
            int intValue = Integer.valueOf(pathSegments.get(0)).intValue();
            if (intValue == 0) {
                c.this.f568g.setVisibility(8);
                c.this.f571j.setVisibility(0);
            } else if (intValue == 1) {
                c.this.f568g.setVisibility(0);
            }
            return true;
        }

        public e(c cVar, a aVar) {
            this();
        }
    }

    public class f extends c.x.d.a {
        public String a;
        public String b;

        public String f575c;

        public c.x.d.c f576d;

        public f(String str, String str2, String str3, c.x.d.c cVar) {
            this.a = str;
            this.b = str2;
            this.f575c = str3;
            this.f576d = cVar;
        }

        @Override
        public void a(c.x.d.e eVar) {
            String str;
            if (eVar.b != null) {
                str = eVar.b + this.b;
            } else {
                str = this.b;
            }
            d.j.b().e(this.a + "_H5", SystemClock.elapsedRealtime(), 0L, 0L, eVar.a, str, false);
            c.this.e(str);
            c.x.d.c cVar = this.f576d;
            if (cVar != null) {
                cVar.a(eVar);
                this.f576d = null;
            }
        }

        @Override
        public void b(Object obj) {
            JSONObject jSONObject = (JSONObject) obj;
            d.j.b().e(this.a + "_H5", SystemClock.elapsedRealtime(), 0L, 0L, jSONObject.optInt("ret", -6), this.b, false);
            c.x.d.c cVar = this.f576d;
            if (cVar != null) {
                cVar.b(jSONObject);
                this.f576d = null;
            }
        }

        public final void d(String str) {
            try {
                b(k.s(str));
            } catch (JSONException e2) {
                e2.printStackTrace();
                a(new c.x.d.e(-4, "服务器返回数据格式有误!", str));
            }
        }

        @Override
        public void onCancel() {
            c.x.d.c cVar = this.f576d;
            if (cVar != null) {
                cVar.onCancel();
                this.f576d = null;
            }
        }
    }

    public class g extends Handler {
        public f a;

        public g(f fVar, Looper looper) {
            super(looper);
            this.a = fVar;
        }

        @Override
        public void handleMessage(Message message) {
            int i2 = message.what;
            if (i2 == 1) {
                this.a.d((String) message.obj);
            } else if (i2 == 2) {
                this.a.onCancel();
            } else {
                if (i2 != 3) {
                    return;
                }
                c.l(c.this.f572k, (String) message.obj);
            }
        }
    }

    public class h implements Runnable {
        public String a;

        public h(String str) {
            this.a = "";
            this.a = str;
        }

        @Override
        public void run() {
            c.x.c.f.a.n("openSDK_LOG.AuthDialog", "-->timeoutUrl: " + this.a + " | mRetryUrl: " + c.this.o);
            if (this.a.equals(c.this.o)) {
                c.this.b.a(new c.x.d.e(9002, "请求页面超时,请稍后重试!", c.this.o));
                c.this.dismiss();
            }
        }
    }

    public c(Context context, String str, String str2, c.x.d.c cVar, c.x.a.d.b bVar) {
        super(context, R.style.Theme.Translucent.NoTitleBar);
        this.f574m = false;
        this.q = 0L;
        this.r = 30000L;
        this.f572k = context;
        this.a = str2;
        this.b = new f(str, str2, bVar.f(), cVar);
        this.f565d = new g(this.b, context.getMainLooper());
        this.f564c = cVar;
        this.f570i = str;
        this.f573l = new c.x.c.h.b.c();
        getWindow().setSoftInputMode(32);
    }

    public static int C(c cVar) {
        int i2 = cVar.n;
        cVar.n = i2 + 1;
        return i2;
    }

    public static void l(Context context, String str) {
        try {
            JSONObject s = k.s(str);
            int i2 = s.getInt(com.umeng.analytics.pro.d.y);
            Toast.makeText(context.getApplicationContext(), s.getString("msg"), i2).show();
        } catch (JSONException e2) {
            e2.printStackTrace();
        }
    }

    public final String c() {
        String str = this.a;
        String str2 = "https://imgcache.qq.com/ptlogin/static/qzsjump.html?" + str.substring(str.indexOf("?") + 1);
        c.x.c.f.a.k("openSDK_LOG.AuthDialog", "-->generateDownloadUrl, url: https://imgcache.qq.com/ptlogin/static/qzsjump.html?");
        return str2;
    }

    @Override
    public void dismiss() {
        this.s.clear();
        this.f565d.removeCallbacksAndMessages(null);
        try {
            Context context = this.f572k;
            if ((context instanceof Activity) && !((Activity) context).isFinishing() && isShowing()) {
                super.dismiss();
                c.x.c.f.a.k("openSDK_LOG.AuthDialog", "-->dismiss dialog");
            }
        } catch (Exception e2) {
            c.x.c.f.a.i("openSDK_LOG.AuthDialog", "-->dismiss dialog exception:", e2);
        }
        com.tencent.open.c.d dVar = this.f571j;
        if (dVar != null) {
            dVar.destroy();
            this.f571j = null;
        }
    }

    public final String e(String str) {
        StringBuilder sb = new StringBuilder(str);
        if (!TextUtils.isEmpty(this.p) && this.p.length() >= 4) {
            String str2 = this.p;
            String substring = str2.substring(str2.length() - 4);
            sb.append("_u_");
            sb.append(substring);
        }
        return sb.toString();
    }

    public final void g(ViewGroup viewGroup) {
        ImageView imageView = new ImageView(this.f572k);
        int a2 = c.x.a.e.a.a(this.f572k, 15.6f);
        int a3 = c.x.a.e.a.a(this.f572k, 25.2f);
        int a4 = c.x.a.e.a.a(this.f572k, 10.0f);
        int i2 = a4 * 2;
        FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(a2 + i2, a3 + i2);
        layoutParams.leftMargin = a4;
        imageView.setLayoutParams(layoutParams);
        imageView.setPadding(a4, a4, a4, a4);
        imageView.setImageDrawable(k.a("h5_qr_back.png", this.f572k));
        imageView.setScaleType(ImageView.ScaleType.FIT_CENTER);
        imageView.setOnClickListener(new a());
        viewGroup.addView(imageView);
    }

    public void h(String str, String str2) {
        this.f571j.loadUrl("javascript:" + str + "(" + str2 + ");void(" + System.currentTimeMillis() + ");");
    }

    public final void k() {
        o();
        FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(-1, -1);
        com.tencent.open.c.d dVar = new com.tencent.open.c.d(this.f572k);
        this.f571j = dVar;
        if (Build.VERSION.SDK_INT >= 11) {
            dVar.setLayerType(1, null);
        }
        this.f571j.setLayoutParams(layoutParams);
        layoutParams.gravity = 17;
        com.tencent.open.c.c cVar = new com.tencent.open.c.c(this.f572k);
        cVar.setLayoutParams(layoutParams);
        cVar.addView(this.f571j);
        FrameLayout frameLayout = new FrameLayout(this.f572k);
        this.f566e = frameLayout;
        frameLayout.addView(cVar);
        this.f566e.setBackgroundColor(-1);
        this.f566e.addView(this.f568g);
        String string = k.k(this.a).getString("style");
        if (string != null && "qr".equals(string)) {
            g(this.f566e);
        }
        setContentView(this.f566e);
    }

    public final void o() {
        TextView textView;
        this.f569h = new ProgressBar(this.f572k);
        this.f569h.setLayoutParams(new LinearLayout.LayoutParams(-2, -2));
        this.f567f = new LinearLayout(this.f572k);
        if (this.f570i.equals("action_login")) {
            LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(-2, -2);
            layoutParams.gravity = 16;
            layoutParams.leftMargin = 5;
            textView = new TextView(this.f572k);
            if (Locale.getDefault().getLanguage().equals("zh")) {
                textView.setText("登录中...");
            } else {
                textView.setText("Logging in...");
            }
            textView.setTextColor(Color.rgb(255, 255, 255));
            textView.setTextSize(18.0f);
            textView.setLayoutParams(layoutParams);
        } else {
            textView = null;
        }
        FrameLayout.LayoutParams layoutParams2 = new FrameLayout.LayoutParams(-2, -2);
        layoutParams2.gravity = 17;
        this.f567f.setLayoutParams(layoutParams2);
        this.f567f.addView(this.f569h);
        if (textView != null) {
            this.f567f.addView(textView);
        }
        this.f568g = new FrameLayout(this.f572k);
        FrameLayout.LayoutParams layoutParams3 = new FrameLayout.LayoutParams(-1, -1);
        layoutParams3.gravity = 17;
        this.f568g.setLayoutParams(layoutParams3);
        this.f568g.setBackgroundColor(Color.parseColor("#B3000000"));
        this.f568g.addView(this.f567f);
    }

    @Override
    public void onBackPressed() {
        if (!this.f574m) {
            this.b.onCancel();
        }
        super.onBackPressed();
    }

    @Override
    public void onCreate(Bundle bundle) {
        requestWindowFeature(1);
        super.onCreate(bundle);
        c.x.c.c.a(getWindow());
        k();
        s();
        this.s = new HashMap<>();
    }

    @Override
    public void onStop() {
        super.onStop();
    }

    @SuppressLint({"SetJavaScriptEnabled"})
    public final void s() {
        this.f571j.setVerticalScrollBarEnabled(false);
        this.f571j.setHorizontalScrollBarEnabled(false);
        this.f571j.setWebViewClient(new e(this, null));
        this.f571j.setWebChromeClient(new WebChromeClient());
        this.f571j.clearFormData();
        this.f571j.clearSslPreferences();
        this.f571j.setOnLongClickListener(new b());
        this.f571j.setOnTouchListener(new ViewOnTouchListenerC0033c());
        WebSettings settings = this.f571j.getSettings();
        c.x.c.h.a.b(this.f571j);
        settings.setSaveFormData(false);
        settings.setCacheMode(-1);
        settings.setNeedInitialFocus(false);
        settings.setBuiltInZoomControls(true);
        settings.setSupportZoom(true);
        settings.setRenderPriority(WebSettings.RenderPriority.HIGH);
        settings.setDatabaseEnabled(true);
        settings.setDatabasePath(this.f572k.getDir("databases", 0).getPath());
        settings.setDomStorageEnabled(true);
        c.x.c.f.a.n("openSDK_LOG.AuthDialog", "-->mUrl : " + this.a);
        String str = this.a;
        this.o = str;
        this.f571j.loadUrl(str);
        this.f571j.setVisibility(4);
        this.f573l.a(new c.x.c.h.b.a(), "SecureJsInterface");
        c.x.c.h.b.a.a = false;
        super.setOnDismissListener(new d());
    }

    public final boolean u() {
        c.x.a.d.d a2 = c.x.a.d.d.a();
        String d2 = a2.d();
        d.a aVar = new d.a();
        aVar.a = this.f564c;
        aVar.b = this;
        aVar.f580c = d2;
        String b2 = a2.b(aVar);
        String str = this.a;
        String substring = str.substring(0, str.indexOf("?"));
        Bundle k2 = k.k(this.a);
        k2.putString("token_key", d2);
        k2.putString("serial", b2);
        k2.putString("browser", SdkVersion.MINI_VERSION);
        String str2 = substring + "?" + c.x.c.g.a.e(k2);
        this.a = str2;
        return k.h(this.f572k, str2);
    }
}