导航菜单

页面标题

页面副标题

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

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

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


package c.x.a.d;

import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.graphics.NinePatch;
import android.graphics.Rect;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.NinePatchDrawable;
import android.graphics.drawable.PaintDrawable;
import android.os.Build;
import android.os.Bundle;
import android.os.SystemClock;
import android.util.DisplayMetrics;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.webkit.CookieSyncManager;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.fragment.app.Fragment;
import c.x.c.d;
import c.x.c.g.f;
import c.x.c.g.g;
import c.x.c.g.h;
import c.x.c.g.i;
import c.x.c.g.j;
import com.tencent.open.web.security.JniInterface;
import com.umeng.commonsdk.statistics.SdkVersion;
import java.io.IOException;
import java.io.InputStream;
import java.lang.ref.WeakReference;
import java.util.Map;
import org.adblockplus.libadblockplus.HttpClient;
import org.json.JSONException;
import org.json.JSONObject;

public class a extends c.x.a.f.a {

    public static String f541g = "libwbsafeedit";

    public static String f542h;

    public c.x.d.c f543i;

    public String f544j;

    public WeakReference<Activity> f545k;

    public class RunnableC0029a implements Runnable {
        public final String a;
        public final c.x.d.c b;

        public class RunnableC0030a implements Runnable {
            public final Activity a;

            public RunnableC0030a(Activity activity) {
                this.a = activity;
            }

            @Override
            public void run() {
                if (JniInterface.a) {
                    Activity activity = this.a;
                    RunnableC0029a runnableC0029a = RunnableC0029a.this;
                    c.x.a.d.c cVar = new c.x.a.d.c(activity, "action_login", runnableC0029a.a, runnableC0029a.b, a.this.f584f);
                    if (this.a.isFinishing()) {
                        return;
                    }
                    cVar.show();
                    return;
                }
                c.x.c.f.a.o("openSDK_LOG.AuthAgent", "OpenUi, secure so load failed, goto download QQ.");
                Activity activity2 = this.a;
                String c2 = a.this.c("");
                RunnableC0029a runnableC0029a2 = RunnableC0029a.this;
                c.x.c.a aVar = new c.x.c.a(activity2, "", c2, runnableC0029a2.b, a.this.f584f);
                if (this.a.isFinishing()) {
                    return;
                }
                aVar.show();
            }
        }

        public RunnableC0029a(String str, c.x.d.c cVar) {
            this.a = str;
            this.b = cVar;
        }

        @Override
        public void run() {
            Activity activity;
            i.i(a.f541g, a.f542h, 5);
            JniInterface.a();
            if (a.this.f545k == null || (activity = (Activity) a.this.f545k.get()) == null) {
                return;
            }
            activity.runOnUiThread(new RunnableC0030a(activity));
        }
    }

    public class b extends c.x.d.a {
        public WeakReference<c.x.d.c> a;
        public final String b = "sendinstall";

        public final String f547c = "installwording";

        public final String f548d = "https://appsupport.qq.com/cgi-bin/qzapps/mapp_addapp.cgi";

        public class C0031a extends d {

            public final c.x.d.c f550c;

            public final Object f551d;

            public C0031a(Dialog dialog, c.x.d.c cVar, Object obj) {
                super(dialog);
                this.f550c = cVar;
                this.f551d = obj;
            }

            @Override
            public void onClick(View view) {
                b.this.e();
                Dialog dialog = this.a;
                if (dialog != null && dialog.isShowing()) {
                    this.a.dismiss();
                }
                c.x.d.c cVar = this.f550c;
                if (cVar != null) {
                    cVar.b(this.f551d);
                }
            }
        }

        public class C0032b extends d {

            public final c.x.d.c f553c;

            public final Object f554d;

            public C0032b(Dialog dialog, c.x.d.c cVar, Object obj) {
                super(dialog);
                this.f553c = cVar;
                this.f554d = obj;
            }

            @Override
            public void onClick(View view) {
                Dialog dialog = this.a;
                if (dialog != null && dialog.isShowing()) {
                    this.a.dismiss();
                }
                c.x.d.c cVar = this.f553c;
                if (cVar != null) {
                    cVar.b(this.f554d);
                }
            }
        }

        public class c implements DialogInterface.OnCancelListener {
            public final c.x.d.c a;
            public final Object b;

            public c(c.x.d.c cVar, Object obj) {
                this.a = cVar;
                this.b = obj;
            }

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

        public abstract class d implements View.OnClickListener {
            public Dialog a;

            public d(Dialog dialog) {
                this.a = dialog;
            }
        }

        public b(c.x.d.c cVar) {
            this.a = new WeakReference<>(cVar);
        }

        @Override
        public void a(c.x.d.e eVar) {
            if (this.a.get() != null) {
                this.a.get().a(eVar);
            }
        }

        @Override
        public void b(java.lang.Object r8) {
            throw new UnsupportedOperationException("Method not decompiled: c.x.a.d.a.b.b(java.lang.Object):void");
        }

        public final Drawable c(String str, Context context) {
            InputStream open;
            Bitmap bitmap;
            Drawable drawable = null;
            try {
                open = context.getApplicationContext().getAssets().open(str);
            } catch (IOException e2) {
                e2.printStackTrace();
            }
            if (open == null) {
                return null;
            }
            if (!str.endsWith(".9.png")) {
                drawable = Drawable.createFromStream(open, str);
                open.close();
                return drawable;
            }
            try {
                bitmap = BitmapFactory.decodeStream(open);
            } catch (OutOfMemoryError e3) {
                e3.printStackTrace();
                bitmap = null;
            }
            if (bitmap == null) {
                return null;
            }
            byte[] ninePatchChunk = bitmap.getNinePatchChunk();
            NinePatch.isNinePatchChunk(ninePatchChunk);
            return new NinePatchDrawable(bitmap, ninePatchChunk, new Rect(), null);
        }

        public final View d(Context context, Drawable drawable, String str, View.OnClickListener onClickListener, View.OnClickListener onClickListener2) {
            DisplayMetrics displayMetrics = new DisplayMetrics();
            ((WindowManager) context.getSystemService("window")).getDefaultDisplay().getMetrics(displayMetrics);
            float f2 = displayMetrics.density;
            RelativeLayout relativeLayout = new RelativeLayout(context);
            ImageView imageView = new ImageView(context);
            imageView.setImageDrawable(drawable);
            imageView.setScaleType(ImageView.ScaleType.FIT_XY);
            imageView.setId(1);
            int i2 = (int) (60.0f * f2);
            int i3 = (int) (f2 * 14.0f);
            int i4 = (int) (18.0f * f2);
            RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(i2, i2);
            layoutParams.addRule(9);
            layoutParams.setMargins(0, i4, (int) (6.0f * f2), i4);
            relativeLayout.addView(imageView, layoutParams);
            TextView textView = new TextView(context);
            textView.setText(str);
            textView.setTextSize(14.0f);
            textView.setGravity(3);
            textView.setIncludeFontPadding(false);
            textView.setPadding(0, 0, 0, 0);
            textView.setLines(2);
            textView.setId(5);
            textView.setMinWidth((int) (185.0f * f2));
            RelativeLayout.LayoutParams layoutParams2 = new RelativeLayout.LayoutParams(-2, -2);
            layoutParams2.addRule(1, 1);
            layoutParams2.addRule(6, 1);
            float f3 = 5.0f * f2;
            layoutParams2.setMargins(0, 0, (int) f3, 0);
            relativeLayout.addView(textView, layoutParams2);
            View view = new View(context);
            view.setBackgroundColor(Color.rgb(214, 214, 214));
            view.setId(3);
            RelativeLayout.LayoutParams layoutParams3 = new RelativeLayout.LayoutParams(-2, 2);
            layoutParams3.addRule(3, 1);
            layoutParams3.addRule(5, 1);
            layoutParams3.addRule(7, 5);
            int i5 = (int) (12.0f * f2);
            layoutParams3.setMargins(0, 0, 0, i5);
            relativeLayout.addView(view, layoutParams3);
            LinearLayout linearLayout = new LinearLayout(context);
            RelativeLayout.LayoutParams layoutParams4 = new RelativeLayout.LayoutParams(-2, -2);
            layoutParams4.addRule(5, 1);
            layoutParams4.addRule(7, 5);
            layoutParams4.addRule(3, 3);
            Button button = new Button(context);
            button.setText("跳过");
            button.setBackgroundDrawable(c("buttonNegt.png", context));
            button.setTextColor(Color.rgb(36, 97, 131));
            button.setTextSize(20.0f);
            button.setOnClickListener(onClickListener2);
            button.setId(4);
            int i6 = (int) (45.0f * f2);
            LinearLayout.LayoutParams layoutParams5 = new LinearLayout.LayoutParams(0, i6);
            layoutParams5.rightMargin = i3;
            int i7 = (int) (4.0f * f2);
            layoutParams5.leftMargin = i7;
            layoutParams5.weight = 1.0f;
            linearLayout.addView(button, layoutParams5);
            Button button2 = new Button(context);
            button2.setText("确定");
            button2.setTextSize(20.0f);
            button2.setTextColor(Color.rgb(255, 255, 255));
            button2.setBackgroundDrawable(c("buttonPost.png", context));
            button2.setOnClickListener(onClickListener);
            LinearLayout.LayoutParams layoutParams6 = new LinearLayout.LayoutParams(0, i6);
            layoutParams6.weight = 1.0f;
            layoutParams6.rightMargin = i7;
            linearLayout.addView(button2, layoutParams6);
            relativeLayout.addView(linearLayout, layoutParams4);
            ViewGroup.LayoutParams layoutParams7 = new FrameLayout.LayoutParams((int) (279.0f * f2), (int) (f2 * 163.0f));
            relativeLayout.setPadding(i3, 0, i5, i5);
            relativeLayout.setLayoutParams(layoutParams7);
            relativeLayout.setBackgroundColor(Color.rgb(247, 251, 247));
            PaintDrawable paintDrawable = new PaintDrawable(Color.rgb(247, 251, 247));
            paintDrawable.setCornerRadius(f3);
            relativeLayout.setBackgroundDrawable(paintDrawable);
            return relativeLayout;
        }

        public void e() {
            Activity activity;
            Bundle g2 = a.this.g();
            if (a.this.f545k == null || (activity = (Activity) a.this.f545k.get()) == null) {
                return;
            }
            c.x.c.g.a.i(a.this.f584f, activity, "https://appsupport.qq.com/cgi-bin/qzapps/mapp_addapp.cgi", g2, HttpClient.REQUEST_METHOD_POST, null);
        }

        public final void f(String str, c.x.d.c cVar, Object obj) {
            PackageInfo packageInfo;
            if (a.this.f545k == null) {
                c.x.c.f.a.k("openSDK_LOG.AuthAgent", "showFeedConfrimDialog mActivity null and return");
                return;
            }
            Activity activity = (Activity) a.this.f545k.get();
            if (activity == null) {
                c.x.c.f.a.k("openSDK_LOG.AuthAgent", "showFeedConfrimDialog mActivity.get() null and return");
                return;
            }
            Dialog dialog = new Dialog(activity);
            dialog.requestWindowFeature(1);
            PackageManager packageManager = activity.getPackageManager();
            try {
                packageInfo = packageManager.getPackageInfo(activity.getPackageName(), 0);
            } catch (PackageManager.NameNotFoundException e2) {
                c.x.c.f.a.h("openSDK_LOG.AuthAgent", "showFeedConfrimDialog exception:" + e2.getStackTrace().toString());
                packageInfo = null;
            }
            Drawable loadIcon = packageInfo != null ? packageInfo.applicationInfo.loadIcon(packageManager) : null;
            View.OnClickListener c0031a = new C0031a(dialog, cVar, obj);
            View.OnClickListener c0032b = new C0032b(dialog, cVar, obj);
            ColorDrawable colorDrawable = new ColorDrawable();
            colorDrawable.setAlpha(0);
            dialog.getWindow().setBackgroundDrawable(colorDrawable);
            dialog.setContentView(d(activity, loadIcon, str, c0031a, c0032b));
            dialog.setOnCancelListener(new c(cVar, obj));
            if (activity.isFinishing()) {
                return;
            }
            dialog.show();
        }

        @Override
        public void onCancel() {
            if (this.a.get() != null) {
                this.a.get().onCancel();
            }
        }
    }

    public class c extends c.x.d.a {
        public final c.x.d.c a;
        public final boolean b;

        public final Context f557c;

        public c(Context context, c.x.d.c cVar, boolean z, boolean z2) {
            this.f557c = context;
            this.a = cVar;
            this.b = z;
            c.x.c.f.a.f("openSDK_LOG.AuthAgent", "OpenUi, TokenListener()");
        }

        @Override
        public void a(c.x.d.e eVar) {
            c.x.c.f.a.f("openSDK_LOG.AuthAgent", "OpenUi, TokenListener() onError");
            this.a.a(eVar);
            c.x.c.f.a.m();
        }

        @Override
        public void b(Object obj) {
            c.x.c.f.a.f("openSDK_LOG.AuthAgent", "OpenUi, TokenListener() onComplete");
            JSONObject jSONObject = (JSONObject) obj;
            try {
                String string = jSONObject.getString("access_token");
                String string2 = jSONObject.getString("expires_in");
                String string3 = jSONObject.getString("openid");
                if (string != null && a.this.f584f != null && string3 != null) {
                    a.this.f584f.k(string, string2);
                    a.this.f584f.l(string3);
                    c.x.a.b.a.e(this.f557c, a.this.f584f);
                }
                String string4 = jSONObject.getString("pf");
                if (string4 != null) {
                    try {
                        this.f557c.getSharedPreferences("pfStore", 0).edit().putString("pf", string4).commit();
                    } catch (Exception e2) {
                        e2.printStackTrace();
                        c.x.c.f.a.i("openSDK_LOG.AuthAgent", "OpenUi, TokenListener() onComplete error", e2);
                    }
                }
                if (this.b) {
                    CookieSyncManager.getInstance().sync();
                }
            } catch (JSONException e3) {
                e3.printStackTrace();
                c.x.c.f.a.i("openSDK_LOG.AuthAgent", "OpenUi, TokenListener() onComplete error", e3);
            }
            this.a.b(jSONObject);
            a.this.A();
            c.x.c.f.a.m();
        }

        @Override
        public void onCancel() {
            c.x.c.f.a.f("openSDK_LOG.AuthAgent", "OpenUi, TokenListener() onCancel");
            this.a.onCancel();
            c.x.c.f.a.m();
        }
    }

    static {
        f542h = f541g + ".so";
        String str = Build.CPU_ABI;
        if (str == null || str.equals("")) {
            f541g = "libwbsafeedit";
            f542h = f541g + ".so";
            c.x.c.f.a.k("openSDK_LOG.AuthAgent", "is arm(default) architecture");
            return;
        }
        if (str.equalsIgnoreCase("arm64-v8a")) {
            f541g = "libwbsafeedit_64";
            f542h = f541g + ".so";
            c.x.c.f.a.k("openSDK_LOG.AuthAgent", "is arm64-v8a architecture");
            return;
        }
        if (str.equalsIgnoreCase("x86")) {
            f541g = "libwbsafeedit_x86";
            f542h = f541g + ".so";
            c.x.c.f.a.k("openSDK_LOG.AuthAgent", "is x86 architecture");
            return;
        }
        if (str.equalsIgnoreCase("x86_64")) {
            f541g = "libwbsafeedit_x86_64";
            f542h = f541g + ".so";
            c.x.c.f.a.k("openSDK_LOG.AuthAgent", "is x86_64 architecture");
            return;
        }
        f541g = "libwbsafeedit";
        f542h = f541g + ".so";
        c.x.c.f.a.k("openSDK_LOG.AuthAgent", "is arm(default) architecture");
    }

    public a(c.x.a.d.b bVar) {
        super(bVar);
    }

    public void A() {
        this.f543i = null;
    }

    public int h(Activity activity, String str, c.x.d.c cVar, boolean z, Fragment fragment, boolean z2) {
        return s(activity, str, cVar, z, fragment, z2, null);
    }

    public final int i(boolean z, c.x.d.c cVar, boolean z2, Map<String, Object> map) {
        CookieSyncManager.createInstance(f.a());
        Bundle b2 = b();
        if (z) {
            b2.putString("isadd", SdkVersion.MINI_VERSION);
        }
        b2.putString("scope", this.f544j);
        b2.putString("client_id", this.f584f.f());
        if (c.x.a.f.a.f582d) {
            b2.putString("pf", "desktop_m_qq-" + c.x.a.f.a.b + "-android-" + c.x.a.f.a.a + "-" + c.x.a.f.a.f581c);
        } else {
            b2.putString("pf", "openmobile_android");
        }
        String str = (System.currentTimeMillis() / 1000) + "";
        b2.putString("sign", i.j(f.a(), str));
        b2.putString("time", str);
        b2.putString("display", "mobile");
        b2.putString("response_type", "token");
        b2.putString("redirect_uri", "auth://tauth.qq.com/");
        b2.putString("cancel_display", SdkVersion.MINI_VERSION);
        b2.putString("switch", SdkVersion.MINI_VERSION);
        b2.putString("compat_v", SdkVersion.MINI_VERSION);
        if (z2) {
            b2.putString("style", "qr");
        }
        boolean o = o(map);
        b2.putString("show_download_ui", Boolean.toString(o));
        c.x.c.f.a.k("openSDK_LOG.AuthAgent", "OpenUi, showDialog -- start, isShowDownloadUi=" + o);
        String str2 = h.a().b(f.a(), "https://openmobile.qq.com/oauth2.0/m_authorize?") + c.x.c.g.a.e(b2);
        c cVar2 = new c(f.a(), cVar, true, false);
        c.x.c.f.a.f("openSDK_LOG.AuthAgent", "OpenUi, showDialog TDialog");
        j.d(new RunnableC0029a(str2, cVar2));
        c.x.c.f.a.k("openSDK_LOG.AuthAgent", "OpenUi, showDialog -- end");
        return 2;
    }

    public final String k(Bundle bundle) {
        String string = bundle.getString("status_os");
        String string2 = bundle.getString("status_machine");
        String string3 = bundle.getString("status_version");
        String string4 = bundle.getString("sdkv");
        String string5 = bundle.getString("client_id");
        String string6 = bundle.getString("need_pay");
        String string7 = bundle.getString("pf");
        c.x.c.f.a.f("openSDK_LOG.AuthAgent", "os=" + string + ", machine=" + string2 + ", version=" + string3 + ", sdkv=" + string4 + ", appId=" + string5 + ", needPay=" + string6 + ", pf=" + string7);
        StringBuilder sb = new StringBuilder();
        if (string == null) {
            string = "";
        }
        sb.append(string);
        if (string2 == null) {
            string2 = "";
        }
        sb.append(string2);
        if (string3 == null) {
            string3 = "";
        }
        sb.append(string3);
        if (string4 == null) {
            string4 = "";
        }
        sb.append(string4);
        if (string5 == null) {
            string5 = "";
        }
        sb.append(string5);
        if (string6 == null) {
            string6 = "";
        }
        sb.append(string6);
        if (string7 == null) {
            string7 = "";
        }
        sb.append(string7);
        return sb.toString();
    }

    public final void m(Bundle bundle, Map<String, Object> map) {
    }

    public final boolean n(Activity activity, Fragment fragment, Map<String, Object> map, boolean z, Object[] objArr) {
        c.x.c.f.a.k("openSDK_LOG.AuthAgent", "startActionActivity() -- start");
        Intent f2 = f("com.tencent.open.agent.AgentActivity");
        if (f2 != null) {
            Bundle b2 = b();
            if (z) {
                b2.putString("isadd", SdkVersion.MINI_VERSION);
            }
            b2.putString("scope", this.f544j);
            b2.putString("client_id", this.f584f.f());
            if (c.x.a.f.a.f582d) {
                b2.putString("pf", "desktop_m_qq-" + c.x.a.f.a.b + "-android-" + c.x.a.f.a.a + "-" + c.x.a.f.a.f581c);
            } else {
                b2.putString("pf", "openmobile_android");
            }
            b2.putString("need_pay", SdkVersion.MINI_VERSION);
            m(b2, map);
            b2.putString("oauth_app_name", i.f(f.a()));
            f2.putExtra("key_action", "action_login");
            f2.putExtra("key_params", b2);
            f2.putExtra("appid", this.f584f.f());
            b2.putString("ppsts", i.e(activity, k(b2)));
            try {
                this.f543i = new b(this.f543i);
                c.x.a.f.c.b().g(11101, this.f543i);
                if (fragment != null) {
                    c.x.c.f.a.f("openSDK_LOG.AuthAgent", "startAssitActivity fragment");
                    e(fragment, f2, 11101, map);
                } else {
                    c.x.c.f.a.f("openSDK_LOG.AuthAgent", "startAssitActivity activity");
                    d(activity, f2, 11101, map);
                }
                c.x.c.f.a.k("openSDK_LOG.AuthAgent", "startActionActivity() -- end, found activity for loginIntent");
                d.g.a().c(0, "LOGIN_CHECK_SDK", "1000", this.f584f.f(), "", Long.valueOf(SystemClock.elapsedRealtime()), 0, 1, "");
                objArr[0] = "0";
                objArr[1] = 1;
                return true;
            } catch (Exception e2) {
                c.x.c.f.a.i("openSDK_LOG.AuthAgent", "startActionActivity() exception", e2);
            }
        }
        d.g.a().c(1, "LOGIN_CHECK_SDK", "1000", this.f584f.f(), "", Long.valueOf(SystemClock.elapsedRealtime()), 0, 1, "startActionActivity fail");
        c.x.c.f.a.k("openSDK_LOG.AuthAgent", "startActionActivity() -- end, no target activity for loginIntent");
        return false;
    }

    public final boolean o(Map<String, Object> map) {
        if (map == null || map.isEmpty()) {
            return true;
        }
        Object obj = map.get(c.x.a.f.b.f589f);
        if (obj instanceof Boolean) {
            return ((Boolean) obj).booleanValue();
        }
        return true;
    }

    public int s(Activity activity, String str, c.x.d.c cVar, boolean z, Fragment fragment, boolean z2, Map<String, Object> map) {
        if (c.x.a.c.a("openSDK_LOG.AuthAgent", cVar)) {
            return -1;
        }
        this.f544j = str;
        this.f545k = new WeakReference<>(activity);
        this.f543i = cVar;
        Object[] objArr = new Object[2];
        boolean booleanExtra = activity.getIntent().getBooleanExtra("KEY_FORCE_QR_LOGIN", false);
        boolean i2 = g.c(activity, this.f584f.f()).i("C_LoginWeb");
        c.x.c.f.a.k("openSDK_LOG.AuthAgent", "doLogin needForceQrLogin=" + booleanExtra + ", toWebLogin=" + i2);
        if (!booleanExtra && !i2 && n(activity, fragment, map, z, objArr)) {
            c.x.c.f.a.k("openSDK_LOG.AuthAgent", "OpenUi, showUi, return Constants.UI_ACTIVITY");
            d.g.a().e(this.f584f.g(), this.f584f.f(), "2", SdkVersion.MINI_VERSION, "5", (String) objArr[0], "0", "0");
            return ((Integer) objArr[1]).intValue();
        }
        d.g.a().e(this.f584f.g(), this.f584f.f(), "2", SdkVersion.MINI_VERSION, "5", SdkVersion.MINI_VERSION, "0", "0");
        c.x.c.f.a.o("openSDK_LOG.AuthAgent", "doLogin startActivity fail show dialog.");
        b bVar = new b(this.f543i);
        this.f543i = bVar;
        return i(z, bVar, z2, map);
    }
}