安全中心 v4.9.2版本的 MD5 值为:d64c0ec7920c532fa6e6d9bb001cf9bf

以下内容为反编译后的 f.java 源代码,内容仅作参考


package com.tencent.qqpimsecure.h5;

import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.net.Uri;
import android.net.http.Headers;
import android.net.http.SslError;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.Looper;
import android.telephony.TelephonyManager;
import android.text.ClipboardManager;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.InputMethodManager;
import android.webkit.CookieManager;
import android.webkit.CookieSyncManager;
import android.webkit.DownloadListener;
import android.webkit.GeolocationPermissions;
import android.webkit.JsResult;
import android.webkit.SslErrorHandler;
import android.webkit.URLUtil;
import android.webkit.ValueCallback;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import com.tencent.kingkong.database.SQLiteDatabase;
import com.tencent.map.lbsapi.api.SOSOMapLBSApiResult;
import com.tencent.qqpimsecure.account.AccountInfo;
import com.tencent.qqpimsecure.account.MainAccountInfo;
import com.tencent.qqpimsecure.dao.r;
import com.tencent.server.base.QQSecureApplication;
import com.tencent.server.fore.SafeDownloadActivity;
import com.tencent.server.task.g;
import com.tencent.tmassistantsdk.common.TMAssistantDownloadSDKErrorCode;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.InvocationTargetException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import meri.pluginsdk.d;
import meri.service.optimus.StrategyConst;
import meri.util.AccessHelper;
import meri.util.BaseReceiver;
import org.apache.http.protocol.HTTP;
import org.json.JSONException;
import org.json.JSONObject;
import tcs.aaf;
import tcs.aht;
import tcs.aig;
import tcs.ajg;
import tcs.ajk;
import tcs.ajy;
import tcs.akg;
import tcs.akn;
import tcs.aow;
import tcs.aqh;
import tcs.azr;
import tcs.bdh;
import tcs.bgh;
import tcs.bgm;
import tcs.bja;
import tcs.hv;
import tcs.jb;
import tcs.ph;
import tcs.pz;
import tcs.qa;
import tcs.qz;
import tcs.rl;
import tcs.sd;
import tcs.sn;
import tcs.ts;
import tcs.tw;
import tcs.tz;
import tcs.uc;
import tcs.uf;
import tcs.vb;
import tcs.vv;
import tcs.yz;
import tcs.za;
import tcs.zb;
import tmsdk.common.TMSDKContext;
import tmsdk.common.internal.utils.i;
import tmsdk.common.internal.utils.z;
import tmsdk.common.tcc.TccCryptor;

public class f extends uilib.frame.a implements View.OnClickListener {
    private static String ghM = "https";
    private static String ghN = "WeSecure";
    private static int giC = 0;
    private static final String giD = "WVSession_" + System.currentTimeMillis();
    private int bVO;
    private Handler bvp;
    private HandlerThread cDY;
    private Handler clZ;
    private uilib.templates.a ghO;
    private g ghP;
    private com.tencent.qqpimsecure.h5.b ghQ;
    private boolean ghR;
    private boolean ghS;
    private String ghT;
    private String ghU;
    private String ghV;
    private zb ghW;
    private a ghX;
    private com.tencent.server.task.g ghY;
    private boolean ghZ;
    private Map<String, g.a> giA;
    private Map<String, Boolean> giB;
    private boolean gia;
    private boolean gib;
    private boolean gic;
    private int gid;
    private int gie;
    private com.tencent.qqpimsecure.h5.e gif;
    private int gig;
    private String gih;
    private String gii;
    private boolean gij;
    private boolean gik;
    private boolean gil;
    private boolean gim;
    private String gin;
    private StringBuilder gio;
    private StringBuilder gip;
    private boolean giq;
    private int gir;
    private String gis;
    private long git;
    private String giu;
    DownloadListener giv;
    private byte[] giw;
    private byte[] gix;
    private String giy;
    private String giz;
    private Context mContext;

    public interface b {
        void kH(int i);
    }

    static boolean amI() {
        return amF();
    }

    static int amJ() {
        return amG();
    }

    public f(Context context) {
        super(context);
        this.ghR = false;
        this.ghS = false;
        this.ghT = null;
        this.ghU = null;
        this.ghV = null;
        this.ghW = null;
        this.bvp = null;
        this.clZ = new Handler(Looper.getMainLooper());
        this.cDY = null;
        this.ghX = null;
        this.ghY = null;
        this.ghZ = false;
        this.gia = true;
        this.gib = false;
        this.gid = 16;
        this.gie = 16;
        this.gig = -1;
        this.gij = false;
        this.gik = false;
        this.gil = false;
        this.gim = false;
        this.gio = new StringBuilder();
        this.gip = new StringBuilder();
        this.giq = false;
        this.gir = -1;
        this.gis = null;
        this.git = -1L;
        this.bVO = 0;
        this.giv = new DownloadListener() {
            @Override
            public void onDownloadStart(String str, String str2, String str3, String str4, long j) {
                try {
                    f.this.ghV = str;
                    yz.c(bgh.PQ().kH(), 260412, 4);
                    if (f.this.ghP.fqY != null) {
                        f.this.ghT = f.this.ghP.fqY.getUrl();
                    }
                    boolean CR = sn.CP().CR();
                    if (str.endsWith(".apk") && !CR) {
                        Uri parse = Uri.parse(str);
                        Intent intent = new Intent(f.this.mContext, (Class<?>) SafeDownloadActivity.class);
                        intent.setData(parse);
                        intent.putExtra("from_webview", true);
                        f.this.mContext.startActivity(intent);
                        Intent intent2 = new Intent(za.eqM);
                        intent2.putExtra(za.a.egA, str);
                        f.this.mContext.sendBroadcast(intent2, d.s.dvj);
                        return;
                    }
                    Intent intent3 = new Intent("android.intent.action.VIEW", Uri.parse(str));
                    intent3.putExtra("from_webview", true);
                    intent3.addFlags(SQLiteDatabase.CREATE_IF_NECESSARY);
                    f.this.mContext.startActivity(intent3);
                } catch (Exception e2) {
                }
            }
        };
        this.giw = null;
        this.gix = null;
        this.giy = null;
        this.giz = null;
        this.giA = new HashMap();
        this.giB = new HashMap();
        this.mContext = context;
        this.ghY = new com.tencent.server.task.g(context);
    }

    @Override
    public uilib.frame.b Zl() {
        this.gie = getActivity().getIntent().getIntExtra("xCI79Q", 16);
        this.gid = this.gie;
        this.ghR = getActivity().getIntent().getBooleanExtra(za.a.ecd, false);
        getActivity().getIntent().getStringExtra("HMt1KQ");
        this.ghO = new uilib.templates.a(this.mContext);
        return this.ghO;
    }

    @Override
    public View Zm() {
        try {
            this.gic = getActivity().getIntent().getBooleanExtra(za.a.ehj, false);
            if (uilib.frame.f.dvy) {
                this.ghO.aE(false);
            }
            if (this.gic) {
                return getActivity().getLayoutInflater().inflate(bdh.g.fjr, (ViewGroup) null);
            }
            return getActivity().getLayoutInflater().inflate(bdh.g.fjq, (ViewGroup) null);
        } catch (Throwable th) {
            getActivity().finish();
            return null;
        }
    }

    @Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        if (getContentView() == null) {
            getActivity().finish();
            return;
        }
        this.ghP = new g(getActivity(), getContentView());
        this.giq = getActivity().getIntent().getBooleanExtra(za.a.eir, false);
        this.gir = getActivity().getIntent().getIntExtra(za.a.eis, -1);
        this.giu = getActivity().getIntent().getStringExtra(za.a.eOf);
        amv();
        if (this.ghP.fqY == null) {
            getActivity().finish();
        } else {
            amx();
            amw();
        }
    }

    @Override
    public void onResume() {
        super.onResume();
        try {
            if (this.ghX != null) {
                JSONObject jSONObject = new JSONObject();
                jSONObject.put("eventName", "onResume");
                this.ghX.d(jSONObject);
            }
        } catch (JSONException e2) {
        }
    }

    private void amv() {
        this.ghU = getActivity().getIntent().getStringExtra(za.a.ehk);
        boolean booleanExtra = getActivity().getIntent().getBooleanExtra(za.a.eqO, false);
        try {
            switch (this.gid) {
                case 16:
                    this.ghP.p(getActivity().getResources().getDrawable(bdh.e.ffu));
                    break;
                case 64:
                    this.ghP.p(getActivity().getResources().getDrawable(bdh.e.ffu));
                    break;
                default:
                    this.ghP.p(getActivity().getResources().getDrawable(bdh.e.fft));
                    break;
            }
            if (this.ghR) {
                this.ghS = booleanExtra;
            } else {
                this.ghP.q(getActivity().getResources().getDrawable(bdh.e.ffs));
            }
        } catch (Exception e2) {
        }
        if (getActivity().getIntent().getBooleanExtra("XF0wBA", false)) {
            this.ghP.fd(false);
        } else {
            this.ghP.fd(true);
        }
        this.ghP.dHr.setOnClickListener(this);
        this.ghP.gjL.setOnClickListener(this);
        this.ghP.dHq.setOnClickListener(this);
        this.ghQ = new e();
        this.ghP.gjN.setOnClickListener(this);
    }

    @Override
    public void onClick(View view) {
        int id = view.getId();
        if (id == bdh.f.fhk) {
            if (this.ghP.fqY != null) {
                clearView();
                this.ghP.fqY.reload();
                amD();
                return;
            }
            return;
        }
        if (id == bdh.f.fib) {
            switch (this.gid) {
                case 16:
                    if (this.ghP.fqY != null) {
                        clearView();
                        this.ghP.fqY.reload();
                        amD();
                    }
                    yz.c(com.tencent.server.base.d.aTK(), 260410, 4);
                    return;
                case 64:
                    if (this.ghU != null) {
                        this.ghP.fqY.loadUrl(this.ghU);
                        return;
                    }
                    return;
                default:
                    yz.c(com.tencent.server.base.d.aTK(), 260408, 4);
                    this.ghQ.onClick(view);
                    return;
            }
        }
        if (id == bdh.f.fhn) {
            if (!amA()) {
                if (this.ghR) {
                    if (this.ghP.fqY != null && this.ghP.fqY.canGoBack()) {
                        clearView();
                        this.ghP.fqY.goBack();
                        return;
                    } else {
                        getActivity().finish();
                        return;
                    }
                }
                getActivity().finish();
                return;
            }
            return;
        }
        if (id == bdh.f.fhm) {
            getActivity().finish();
        }
    }

    private void clearView() {
        if (this.ghP.gjN != null && this.ghP.gjN.isShown()) {
            this.ghP.fqY.clearView();
            this.ghP.gjN.setVisibility(4);
        }
    }

    private void amw() {
        try {
            String stringExtra = getActivity().getIntent().getStringExtra("bF6efA");
            if (this.ghP.gjK != null) {
                if (stringExtra != null) {
                    this.ghP.gjK.setBackgroundColor(Color.parseColor(stringExtra));
                } else if (this.gic) {
                    this.ghP.gjK.setBackgroundColor(0);
                }
            }
        } catch (Exception e2) {
        }
    }

    private void amx() {
        Intent intent = getActivity().getIntent();
        try {
            String stringExtra = intent.getStringExtra(meri.pluginsdk.d.egj);
            if (!TextUtils.isEmpty(stringExtra)) {
                JSONObject jSONObject = new JSONObject(stringExtra);
                String optString = jSONObject.optString(za.c.blp);
                String optString2 = jSONObject.optString(za.c.EXTRA_TITLE);
                boolean optBoolean = jSONObject.optBoolean(za.c.egE);
                int optInt = jSONObject.optInt(za.c.egF, 65535);
                String optString3 = jSONObject.optString(za.c.egG);
                String optString4 = jSONObject.optString(za.c.egH);
                String optString5 = jSONObject.optString(za.c.egI);
                if (!TextUtils.isEmpty(optString)) {
                    intent.putExtra("lxKcgA", optString);
                }
                if (!TextUtils.isEmpty(optString2)) {
                    intent.putExtra("HMt1KQ", optString2);
                }
                if (!TextUtils.isEmpty(optString3)) {
                    intent.putExtra("I1dDIA", optString3);
                }
                if (!TextUtils.isEmpty(optString4)) {
                    intent.putExtra("bF6efA", optString4);
                }
                if (!TextUtils.isEmpty(optString5)) {
                    intent.putExtra("p8idlQ", optString5);
                }
                intent.putExtra("xCI79Q", optInt);
                intent.putExtra("XF0wBA", optBoolean);
            }
        } catch (Exception e2) {
        }
        getActivity().setIntent(intent);
    }

    private void vr() {
        yz.c(bgh.PQ().kH(), 260403, 4);
        if (getActivity().getIntent().getBooleanExtra(vb.aQS, false)) {
            yz.c(bgh.PQ().kH(), 260288, 4);
        }
        this.gig = getActivity().getIntent().getIntExtra(za.a.ehQ, -1);
        this.gih = getActivity().getIntent().getStringExtra(za.a.eqR);
        this.gii = getActivity().getIntent().getStringExtra(za.a.eqS);
        try {
            String stringExtra = getActivity().getIntent().getStringExtra("lxKcgA");
            this.gis = stringExtra;
            if (stringExtra != null && stringExtra.equals("file:///sdcard/demo.html") && !new File("/sdcard/demo.html").exists()) {
                stringExtra = "file:///android_asset/demo.html";
            }
            if (stringExtra != null && this.ghP.fqY != null) {
                this.git = System.currentTimeMillis();
                this.ghP.fqY.loadUrl(stringExtra);
            } else {
                getActivity().finish();
            }
        } catch (Throwable th) {
        }
    }

    public void Q(int i, boolean z) {
        if (z) {
            this.gid |= i;
        } else {
            this.gid &= i ^ (-1);
        }
    }

    @Override
    public void onNewIntent(Intent intent) {
        super.onNewIntent(intent);
        amx();
        amw();
        vr();
    }

    @Override
    public void WP() {
        super.WP();
        this.gin = getActivity().getIntent().getStringExtra(za.a.evB);
        if (!TextUtils.isEmpty(this.gin)) {
            this.gio.append("0-").append(this.gin);
        }
        if (!TextUtils.isEmpty(this.gin)) {
            this.gio.append(",").append("1-").append(String.valueOf(System.currentTimeMillis()));
        }
        amy();
    }

    @SuppressLint({"SetJavaScriptEnabled"})
    private void amy() {
        try {
            this.cDY = new HandlerThread("webview-work", -2);
            this.cDY.start();
            this.bvp = new Handler(this.cDY.getLooper());
            this.ghP.fqY.setDownloadListener(this.giv);
            this.ghP.fqY.setWebViewClient(new d());
            this.ghP.fqY.setWebChromeClient(new c());
            this.ghP.fqY.getSettings().setJavaScriptEnabled(true);
            this.ghP.fqY.getSettings().setDatabaseEnabled(true);
            this.ghP.fqY.getSettings().setDomStorageEnabled(true);
            this.ghP.fqY.getSettings().setCacheMode(-1);
            amz();
            if (!amE()) {
                this.ghP.fqY.getSettings().setSupportZoom(true);
                this.ghP.fqY.getSettings().setBuiltInZoomControls(true);
            }
            this.ghW = new zb(getActivity());
            this.ghX = new a();
            this.ghX.vr();
            String path = QQSecureApplication.getContext().getDir("database", 0).getPath();
            this.ghP.fqY.getSettings().setGeolocationEnabled(true);
            this.ghP.fqY.getSettings().setGeolocationDatabasePath(path);
            if (Build.VERSION.SDK_INT >= 21) {
                this.ghP.fqY.getSettings().setMixedContentMode(2);
            }
            if (Build.VERSION.SDK_INT >= 21) {
                CookieManager.getInstance().setAcceptThirdPartyCookies(this.ghP.fqY, true);
            }
        } catch (Throwable th) {
        }
        if (11 <= uc.KF()) {
            try {
                this.ghP.fqY.getClass().getDeclaredMethod("removeJavascriptInterface", String.class).invoke(this.ghP.fqY, "searchBoxJavaBridge_");
            } catch (IllegalAccessException e2) {
                e2.printStackTrace();
            } catch (IllegalArgumentException e3) {
                e3.printStackTrace();
            } catch (NoSuchMethodException e4) {
                e4.printStackTrace();
            } catch (InvocationTargetException e5) {
                e5.printStackTrace();
            }
        }
        vr();
    }

    private void amz() {
        try {
            String userAgentString = this.ghP.fqY.getSettings().getUserAgentString();
            PackageManager packageManager = QQSecureApplication.getContext().getPackageManager();
            StringBuilder sb = new StringBuilder();
            String packageName = getActivity().getPackageName();
            if ("com.tencent.qqpimsecure".equals(getActivity().getPackageName())) {
                sb.append(" ").append(ghN).append("/").append(packageManager.getPackageInfo(packageName, 0).versionCode);
            } else {
                sb.append(" ").append(packageName).append("/").append(packageManager.getPackageInfo(packageName, 0).versionCode);
            }
            this.ghP.fqY.getSettings().setUserAgentString(userAgentString + sb.toString());
        } catch (Throwable th) {
        }
    }

    @Override
    public void onDestroy() {
        try {
            if (this.ghP.fqY != null) {
                this.ghP.fqY.setVisibility(8);
                this.ghP.fqY.stopLoading();
                this.ghP.fqY.clearCache(true);
                this.ghP.gjM.removeView(this.ghP.fqY);
                this.ghP.fqY.removeAllViews();
                this.ghP.fqY = null;
            }
        } catch (Exception e2) {
        }
        try {
            if (this.ghX != null) {
                this.ghX.destroy();
                this.ghX = null;
            }
            if (this.cDY != null) {
                this.cDY.quit();
            }
        } catch (Exception e3) {
        }
        super.onDestroy();
    }

    private boolean amA() {
        if (this.gig != 1) {
            return false;
        }
        Bundle bundle = new Bundle();
        bundle.putInt(za.a.ehQ, this.gig);
        rl.b(this.mContext, rl.b.dcU, 0, bundle);
        this.clZ.postDelayed(new Runnable() {
            @Override
            public void run() {
                f.this.getActivity().finish();
            }
        }, 2000L);
        return true;
    }

    @Override
    public boolean onKeyDown(int i, KeyEvent keyEvent) {
        if (i == 4) {
            if (amA()) {
                return true;
            }
            if (this.gib) {
                getActivity().finish();
                return true;
            }
            if (this.ghP.fqY != null && this.ghP.fqY.canGoBack()) {
                if (this.ghP.gjN != null && this.ghP.gjN.isShown()) {
                    this.ghP.fqY.clearView();
                    this.ghP.gjN.setVisibility(4);
                }
                this.ghP.fqY.goBack();
                return true;
            }
        }
        return super.onKeyDown(i, keyEvent);
    }

    @Override
    public void onActivityResult(int i, int i2, Intent intent) {
        if (i == 100 && this.gif != null) {
            this.gif.g(i2, intent);
        }
        super.onActivityResult(i, i2, intent);
    }

    public class d extends WebViewClient {
        private d() {
        }

        @Override
        public boolean shouldOverrideUrlLoading(WebView webView, String str) {
            if (URLUtil.isNetworkUrl(str)) {
                return false;
            }
            try {
                if (!str.startsWith("tel:")) {
                    f.this.gib = true;
                    Intent intent = new Intent("android.intent.action.VIEW", Uri.parse(str));
                    intent.addFlags(SQLiteDatabase.CREATE_IF_NECESSARY);
                    f.this.mContext.startActivity(intent);
                } else {
                    f.this.getActivity().startActivity(new Intent("android.intent.action.DIAL", Uri.parse(str)));
                }
                return true;
            } catch (Exception e) {
                return true;
            }
        }

        @Override
        public void onPageStarted(WebView webView, String str, Bitmap bitmap) {
            super.onPageStarted(webView, str, bitmap);
            f.this.gia = true;
            f.this.ghT = str;
            f.this.ghZ = false;
            if (!f.this.gim && !TextUtils.isEmpty(f.this.gin)) {
                f.this.gim = true;
                f.this.gip.append(",").append("2-").append(String.valueOf(System.currentTimeMillis()));
            }
        }

        @Override
        public void onPageFinished(WebView webView, String str) {
            try {
                super.onPageFinished(webView, str);
            } catch (Exception e) {
            }
            if (f.this.ghV == null || !f.this.ghV.equals(str)) {
                if (webView != null && !f.this.ghZ) {
                    String title = webView.getTitle();
                    if (title == null) {
                        title = SQLiteDatabase.KeyEmpty;
                    }
                    f.this.ghP.nK(title);
                }
                f.this.gid = f.this.gie;
                new Thread(new Runnable() {
                    @Override
                    public void run() {
                        f.this.amB();
                    }
                }).start();
            }
            if (f.this.ghS && f.this.ghP.fqY.canGoBack()) {
                f.this.ghP.qL(0);
            }
            if (!f.this.gij && !TextUtils.isEmpty(f.this.gin)) {
                f.this.gij = true;
                f.this.gip.append(",").append("5-").append(String.valueOf(System.currentTimeMillis()));
            }
            try {
                if (f.this.giq) {
                    if (f.this.gir != -1 && !TextUtils.isEmpty(f.this.gis)) {
                        long currentTimeMillis = System.currentTimeMillis() - f.this.git;
                        ArrayList arrayList = new ArrayList();
                        arrayList.add(String.valueOf(f.this.gir));
                        arrayList.add(String.valueOf(currentTimeMillis));
                        arrayList.add(String.valueOf(f.this.bVO));
                        arrayList.add(f.this.gis);
                        yz.b(bgh.PQ().kH(), 263247, arrayList, 1);
                        f.this.gir = -1;
                    }
                    f.this.giq = false;
                }
            } catch (Throwable th) {
            }
        }

        @Override
        public void onReceivedSslError(WebView webView, SslErrorHandler sslErrorHandler, SslError sslError) {
            f.this.gia = false;
            super.onReceivedSslError(webView, sslErrorHandler, sslError);
        }

        @Override
        public void onReceivedError(WebView webView, int i, String str, String str2) {
            super.onReceivedError(webView, i, str, str2);
            f.this.ghZ = true;
            f.this.bVO = i;
            if (f.this.ghP.gjN != null) {
                f.this.ghP.gjN.setVisibility(0);
            }
            if (f.this.ghP.gjO != null && !TextUtils.isEmpty(f.this.gii)) {
                f.this.ghP.gjO.setText(f.this.gii);
            }
            try {
                if (!TextUtils.isEmpty(f.this.gih)) {
                    f.this.ghP.nK(f.this.gih);
                } else {
                    f.this.ghP.nK(f.this.mContext.getResources().getString(bdh.h.flY));
                }
            } catch (Exception e) {
            }
            if (!f.this.gik && !TextUtils.isEmpty(f.this.gin)) {
                f.this.gik = true;
                f.this.gip.append(",").append("4-").append(String.valueOf(System.currentTimeMillis()));
            }
        }
    }

    private String pt(String str) {
        try {
            return new String(TccCryptor.decrypt(i.oK(str), null), HTTP.UTF_8);
        } catch (Exception e2) {
            return SQLiteDatabase.KeyEmpty;
        }
    }

    public void amB() {
        if (this.ghP.fqY != null) {
            try {
                if (this.giw == null) {
                    this.giw = i.a(this.mContext, "jsapi.js");
                }
                if (this.giw != null && this.giw.length > 0) {
                    if (this.gix == null) {
                        this.gix = TccCryptor.decrypt(this.mContext, this.giw, null);
                    }
                    if (this.gix != null && this.gix.length > 0) {
                        if (this.giy == null) {
                            this.giy = new String(this.gix, "utf-8");
                        }
                        if (!TextUtils.isEmpty(this.giu) && this.giz == null) {
                            this.giz = pt(this.giu);
                        }
                        this.clZ.post(new Runnable() {
                            @Override
                            public void run() {
                                if (f.this.ghP.fqY != null) {
                                    f.this.ghP.fqY.loadUrl("javascript:" + f.this.giy);
                                    JSONObject jSONObject = new JSONObject();
                                    try {
                                        jSONObject.put("logType", tw.kG() ? "alert" : "console");
                                        jSONObject.put("sessionId", "WebSession_" + System.currentTimeMillis());
                                    } catch (JSONException e2) {
                                    }
                                    f.this.ghP.fqY.loadUrl(String.format("javascript:handleMessageFromTcs('sys:init', '%s')", jSONObject.toString()));
                                    if (!TextUtils.isEmpty(f.this.giz)) {
                                        f.this.ghP.fqY.loadUrl("javascript:" + f.this.giz);
                                    }
                                }
                            }
                        });
                    }
                }
            } catch (Throwable th) {
            }
        }
    }

    public class c extends WebChromeClient {
        private c() {
        }

        @Override
        public void onProgressChanged(WebView webView, int i) {
            if (!f.this.gil && i > 0) {
                f.this.gil = true;
                if (!TextUtils.isEmpty(f.this.gin)) {
                    f.this.gip.append(",").append("3-").append(String.valueOf(System.currentTimeMillis()));
                }
            }
            if (i < 100) {
                f.this.ghP.fqX.setVisibility(0);
            } else {
                f.this.ghP.fqX.setVisibility(8);
            }
            f.this.ghP.fqX.setProgress(i);
        }

        @Override
        public void onReceivedTitle(WebView webView, String str) {
            super.onReceivedTitle(webView, str);
            if (!f.this.ghZ) {
                if (str == null) {
                    str = SQLiteDatabase.KeyEmpty;
                }
                f.this.ghP.nK(str);
            }
        }

        @Override
        public boolean onJsConfirm(WebView webView, String str, String str2, JsResult jsResult) {
            if (str2 == null) {
                return super.onJsConfirm(webView, str, str2, jsResult);
            }
            if (str2.startsWith("#js_invoke#")) {
                final String substring = str2.substring("#js_invoke#".length());
                if (f.this.bvp != null) {
                    f.this.bvp.post(new Runnable() {
                        @Override
                        public void run() {
                            String str3;
                            String str4;
                            String str5 = null;
                            int i = 0;
                            try {
                                JSONObject jSONObject = new JSONObject(substring);
                                str4 = jSONObject.getString("sessionId");
                                try {
                                    i = jSONObject.getInt("callbackId");
                                    str3 = jSONObject.getString("funcName");
                                    try {
                                        str5 = jSONObject.getString("paramStr");
                                    } catch (JSONException e) {
                                    }
                                } catch (JSONException e2) {
                                    str3 = null;
                                }
                            } catch (JSONException e3) {
                                str3 = null;
                                str4 = null;
                            }
                            if (f.this.ghX != null) {
                                f.this.ghX.invoke(str4, i, str3, str5);
                            }
                        }
                    });
                }
                if (jsResult == null) {
                    return true;
                }
                jsResult.confirm();
                return true;
            }
            if (str2.startsWith("#js_on#")) {
                final String substring2 = str2.substring("#js_on#".length());
                if (f.this.bvp != null) {
                    f.this.bvp.post(new Runnable() {
                        @Override
                        public void run() {
                            String str3;
                            String str4 = null;
                            try {
                                JSONObject jSONObject = new JSONObject(substring2);
                                str3 = jSONObject.getString("sessionId");
                                try {
                                    str4 = jSONObject.getString("eventName");
                                } catch (JSONException e) {
                                }
                            } catch (JSONException e2) {
                                str3 = null;
                            }
                            if (f.this.ghX != null) {
                                f.this.ghX.on(str3, str4);
                            }
                        }
                    });
                }
                if (jsResult == null) {
                    return true;
                }
                jsResult.confirm();
                return true;
            }
            return super.onJsConfirm(webView, str, str2, jsResult);
        }

        public void openFileChooser(ValueCallback<Uri> valueCallback, String str, String str2) {
            f.this.gif = new com.tencent.qqpimsecure.h5.e(f.this.mContext);
            f.this.gif.openFileChooser(valueCallback, str, str2);
        }

        public void openFileChooser(ValueCallback<Uri> valueCallback, String str) {
            openFileChooser(valueCallback, str, SQLiteDatabase.KeyEmpty);
        }

        public void openFileChooser(ValueCallback<Uri> valueCallback) {
            openFileChooser(valueCallback, SQLiteDatabase.KeyEmpty, SQLiteDatabase.KeyEmpty);
        }

        @Override
        public void onGeolocationPermissionsShowPrompt(String str, GeolocationPermissions.Callback callback) {
            callback.invoke(str, true, false);
            super.onGeolocationPermissionsShowPrompt(str, callback);
        }
    }

    public class a implements IApiForJS {
        private C0036a giP;
        private List<C0038f> giQ;
        private Map<String, Integer> giR;

        private a() {
            this.giP = null;
            this.giQ = null;
            this.giR = null;
        }

        public class C0036a extends BaseReceiver {
            private C0036a() {
            }

            @Override
            public void p(Context context, Intent intent) {
                Boolean bool;
                g.a aVar;
                if (intent != null && intent.getAction() != null) {
                    String action = intent.getAction();
                    if (zb.cZv.equals(action)) {
                        String stringExtra = intent.getStringExtra(zb.cZH);
                        int intExtra = intent.getIntExtra(zb.cZJ, 0);
                        switch (intExtra) {
                            case -5:
                                uilib.components.g.d(context, bdh.h.flV);
                                break;
                            case -4:
                            case -3:
                            case -1:
                                uilib.components.g.d(context, bdh.h.flT);
                                break;
                            case 0:
                                uilib.components.g.d(context, bdh.h.flW);
                                if (stringExtra != null) {
                                    synchronized (f.this.giB) {
                                        bool = (Boolean) f.this.giB.remove(stringExtra);
                                    }
                                    if (bool != null) {
                                        if (bool.booleanValue()) {
                                            yz.c(bgh.PQ().kH(), 261130, 4);
                                            break;
                                        } else {
                                            yz.c(bgh.PQ().kH(), 261131, 4);
                                            break;
                                        }
                                    }
                                }
                                break;
                        }
                        if (stringExtra != null) {
                            synchronized (f.this.giA) {
                                aVar = (g.a) f.this.giA.remove(stringExtra);
                            }
                            if (aVar != null) {
                                if (intExtra == 0) {
                                    aVar.onSuccess();
                                    return;
                                } else {
                                    aVar.onError(intExtra);
                                    return;
                                }
                            }
                            return;
                        }
                        return;
                    }
                    if (azr.eiV.equals(action)) {
                        a.this.H(intent);
                        return;
                    }
                    if ("p.c.f.updated".equals(action)) {
                        if (f.this.bvp != null) {
                            f.this.bvp.post(new Runnable() {
                                @Override
                                public void run() {
                                    synchronized (a.this) {
                                        a.this.giQ = a.this.amL();
                                    }
                                }
                            });
                            return;
                        }
                        return;
                    }
                    if (za.egz.equals(action)) {
                        a.this.F(intent);
                        return;
                    }
                    if (za.euu.equals(action)) {
                        a.this.G(intent);
                        return;
                    }
                    if (za.eqN.equals(action)) {
                        float floatExtra = intent.getFloatExtra(za.a.eqP, 0.0f);
                        int intExtra2 = intent.getIntExtra(za.a.eqQ, -1);
                        JSONObject jSONObject = new JSONObject();
                        try {
                            jSONObject.put("eventName", "downloadChange");
                            jSONObject.put("state", SQLiteDatabase.KeyEmpty + intExtra2);
                            jSONObject.put("progress", SQLiteDatabase.KeyEmpty + floatExtra);
                            a.this.d(jSONObject);
                        } catch (JSONException e) {
                            e.printStackTrace();
                        }
                    }
                }
            }
        }

        public void vr() {
            if (this.giP == null) {
                this.giP = new C0036a();
                IntentFilter intentFilter = new IntentFilter();
                intentFilter.addAction(zb.cZv);
                intentFilter.addAction(azr.eiV);
                intentFilter.addAction("p.c.f.updated");
                intentFilter.addAction(za.egz);
                intentFilter.addAction(za.eqN);
                intentFilter.addAction(za.euu);
                try {
                    f.this.getActivity().registerReceiver(this.giP, intentFilter, d.s.dvj, null);
                } catch (Exception e) {
                }
            }
        }

        public void destroy() {
            if (this.giP != null) {
                try {
                    f.this.getActivity().unregisterReceiver(this.giP);
                    this.giP = null;
                } catch (Exception e) {
                }
            }
        }

        @Override
        public void on(String str, String str2) {
            if (str2 != null && F(str2, false) == 1) {
                f.this.bvp.post(new Runnable() {
                    @Override
                    public void run() {
                    }
                });
            }
        }

        @Override
        public void invoke(final String str, final int i, final String str2, final String str3) {
            if (str2 == null) {
                e(str, i, "check_arg:funcName is null");
                return;
            }
            if ("isTcsWebview".equals(str2)) {
                a(str, i, true);
                return;
            }
            if ("checkPermission".equals(str2)) {
                a(str, i, Integer.valueOf(F(null, true)));
                yz.c(bgh.PQ().kH(), 260415, 4);
                return;
            }
            int F = F(str2, true);
            if (F == 2) {
                e(str, i, "access_control:not_allow");
                return;
            }
            if (F == 3) {
                e(str, i, "system:function_not_exist");
                return;
            }
            if ("appKey".equals(str2)) {
                a(str, i, rl.ab(f.this.mContext));
                f.this.pz(String.valueOf(this.giR.get("appKey")));
                return;
            }
            if (TMSDKContext.CON_PLATFORM.equals(str2)) {
                a(str, i, "android");
                f.this.pz(String.valueOf(this.giR.get(TMSDKContext.CON_PLATFORM)));
                return;
            }
            if ("apiVersion".equals(str2)) {
                a(str, i, "20160728");
                f.this.pz(String.valueOf(this.giR.get("apiVersion")));
                return;
            }
            if ("isQQSecureInstalled".equals(str2)) {
                f.this.bvp.post(new Runnable() {
                    @Override
                    public void run() {
                        a.this.a(str, i, true);
                        f.this.pz(String.valueOf(a.this.giR.get("isQQSecureInstalled")));
                    }
                });
                return;
            }
            if ("isQQSecureOfficial".equals(str2)) {
                f.this.bvp.post(new Runnable() {
                    @Override
                    public void run() {
                        a.this.a(str, i, Boolean.valueOf(a.this.amM()));
                        f.this.pz(String.valueOf(a.this.giR.get("isQQSecureOfficial")));
                    }
                });
                return;
            }
            if ("getQQSecureVersionCode".equals(str2)) {
                f.this.bvp.post(new Runnable() {
                    @Override
                    public void run() {
                        a.this.a(str, i, Integer.valueOf(com.tencent.server.base.d.bL()));
                        f.this.pz(String.valueOf(a.this.giR.get("getQQSecureVersionCode")));
                    }
                });
                return;
            }
            if ("getQQSecureVersionName".equals(str2)) {
                f.this.bvp.post(new Runnable() {
                    @Override
                    public void run() {
                        a.this.a(str, i, TMSDKContext.getStrFromEnvMap(TMSDKContext.CON_SOFTVERSION));
                        f.this.pz(String.valueOf(a.this.giR.get("getQQSecureVersionName")));
                    }
                });
                return;
            }
            if ("getQQSecureBuildNo".equals(str2)) {
                f.this.bvp.post(new Runnable() {
                    @Override
                    public void run() {
                        a.this.a(str, i, Integer.valueOf(TMSDKContext.getIntFromEnvMap(TMSDKContext.CON_BUILD)));
                        f.this.pz(String.valueOf(a.this.giR.get("getQQSecureBuildNo")));
                    }
                });
                return;
            }
            if ("shareTimeline".equals(str2) || "sendAppMessage".equals(str2)) {
                final boolean equals = "shareTimeline".equals(str2);
                f.this.bvp.post(new Runnable() {
                    @Override
                    public void run() {
                        if (equals) {
                            f.this.pz(String.valueOf(a.this.giR.get("shareTimeline")));
                        } else {
                            f.this.pz(String.valueOf(a.this.giR.get("sendAppMessage")));
                        }
                        if (str3 == null) {
                            a.this.e(str, i, "check_arg:params is null");
                            return;
                        }
                        String str4 = SQLiteDatabase.KeyEmpty;
                        String str5 = SQLiteDatabase.KeyEmpty;
                        try {
                            JSONObject jSONObject = new JSONObject(str3);
                            String string = jSONObject.getString("title");
                            String string2 = jSONObject.getString(azr.b.ejV);
                            try {
                                str4 = jSONObject.getString("link");
                            } catch (JSONException e) {
                            }
                            try {
                                str5 = jSONObject.getString("img_url");
                            } catch (JSONException e2) {
                            }
                            if (string == null) {
                                string = SQLiteDatabase.KeyEmpty;
                            }
                            if (string2 == null) {
                                string2 = SQLiteDatabase.KeyEmpty;
                            }
                            String str6 = str5 == null ? SQLiteDatabase.KeyEmpty : str5;
                            if (za.ff(str4)) {
                                str4 = f.this.ghT == null ? SQLiteDatabase.KeyEmpty : f.this.ghT;
                            }
                            f.this.a(string, string2, str4, str6, (Bitmap) null, equals, new g.a() {
                                @Override
                                public void onSuccess() {
                                    a.this.a(str, i, 0);
                                }

                                @Override
                                public void onError(int i2) {
                                    a.this.a(str, i, Integer.valueOf(i2));
                                }
                            });
                        } catch (JSONException e3) {
                            a.this.e(str, i, "invoke " + str2 + ", parse arguments exception: " + e3.getMessage());
                        }
                    }
                });
                return;
            }
            if ("gotoQQSecure".equals(str2)) {
                d(str, i, str2, str3);
                return;
            }
            if ("isPkgInstalled".equals(str2)) {
                f.this.bvp.post(new Runnable() {
                    @Override
                    public void run() {
                        String a = a.this.a(str, i, str2, str3, "pkgName", false);
                        if (!za.ff(a)) {
                            a.this.a(str, i, Boolean.valueOf(f.this.pu(a)));
                        }
                        f.this.pz(String.valueOf(a.this.giR.get("isPkgInstalled")));
                    }
                });
                return;
            }
            if ("getPkgVersionCode".equals(str2)) {
                f.this.bvp.post(new Runnable() {
                    @Override
                    public void run() {
                        String a = a.this.a(str, i, str2, str3, "pkgName", false);
                        if (!za.ff(a)) {
                            a.this.a(str, i, Integer.valueOf(f.this.pv(a)));
                        }
                        f.this.pz(String.valueOf(a.this.giR.get("getPkgVersionCode")));
                    }
                });
                return;
            }
            if ("getPkgVersionName".equals(str2)) {
                f.this.bvp.post(new Runnable() {
                    @Override
                    public void run() {
                        String a = a.this.a(str, i, str2, str3, "pkgName", false);
                        if (!za.ff(a)) {
                            a.this.a(str, i, f.this.pw(a));
                        }
                        f.this.pz(String.valueOf(a.this.giR.get("getPkgVersionName")));
                    }
                });
                return;
            }
            if ("isPkgOfficial".equals(str2)) {
                f.this.bvp.post(new Runnable() {
                    @Override
                    public void run() {
                        if (str3 == null) {
                            a.this.e(str, i, "check_arg:params is null");
                            return;
                        }
                        try {
                            JSONObject jSONObject = new JSONObject(str3);
                            String string = jSONObject.getString("pkgName");
                            String string2 = jSONObject.getString("certMd5");
                            if (za.ff(string) || za.ff(string2)) {
                                a.this.e(str, i, "pkgName and certMd5 must not be null or empty");
                            } else {
                                a.this.a(str, i, Boolean.valueOf(f.this.aZ(string, string2)));
                            }
                            f.this.pz(String.valueOf(a.this.giR.get("isPkgOfficial")));
                        } catch (JSONException e) {
                            a.this.e(str, i, "invoke " + str2 + ", parse arguments exception: " + e.getMessage());
                        }
                    }
                });
                return;
            }
            if ("setTitle".equals(str2)) {
                f.this.bvp.post(new Runnable() {
                    @Override
                    public void run() {
                        f.this.pz(String.valueOf(a.this.giR.get("setTitle")));
                        String a = a.this.a(str, i, str2, str3, "title", true);
                        if (a != null) {
                            a.this.a(str, i, Integer.valueOf(a.this.pC(a)));
                            a.this.pB("titleChange");
                        }
                    }
                });
                return;
            }
            if ("setRightTopBtnShowable".equals(str2)) {
                f.this.bvp.post(new Runnable() {
                    @Override
                    public void run() {
                        if (str3 == null) {
                            a.this.e(str, i, "check_arg:params is null");
                            return;
                        }
                        try {
                            boolean z = new JSONObject(str3).getBoolean("showable");
                            a.this.a(str, i, Integer.valueOf(a.this.di(z)));
                            if (z) {
                                f.this.pz(String.valueOf(a.this.giR.get("setRightTopBtnShowable")) + "_show");
                            } else {
                                f.this.pz(String.valueOf(a.this.giR.get("setRightTopBtnShowable")) + "_hide");
                            }
                        } catch (JSONException e) {
                            a.this.e(str, i, "invoke " + str2 + ", parse arguments exception: " + e.getMessage());
                        }
                    }
                });
                return;
            }
            if ("setMenuItemsShowable".equals(str2)) {
                f.this.bvp.post(new Runnable() {
                    @Override
                    public void run() {
                        int i2 = 0;
                        if (str3 == null) {
                            a.this.e(str, i, "check_arg:params is null");
                            return;
                        }
                        int i3 = -1;
                        try {
                            JSONObject jSONObject = new JSONObject(str3);
                            try {
                                f.this.Q(32, jSONObject.getBoolean("share"));
                                i3 = 0;
                            } catch (JSONException e) {
                            }
                            try {
                                f.this.Q(1, jSONObject.getBoolean("shareTimeline"));
                                i3 = 0;
                            } catch (JSONException e2) {
                            }
                            try {
                                f.this.Q(2, jSONObject.getBoolean("shareFriends"));
                                i3 = 0;
                            } catch (JSONException e3) {
                            }
                            try {
                                f.this.Q(4, jSONObject.getBoolean("copyLink"));
                                i3 = 0;
                            } catch (JSONException e4) {
                            }
                            try {
                                f.this.Q(8, jSONObject.getBoolean("browser"));
                                i3 = 0;
                            } catch (JSONException e5) {
                            }
                            try {
                                f.this.Q(16, jSONObject.getBoolean(Headers.REFRESH));
                            } catch (JSONException e6) {
                                i2 = i3;
                            }
                            f.this.clZ.post(new Runnable() {
                                @Override
                                public void run() {
                                    if ((f.this.gid & 4) != 0 || (f.this.gid & 8) != 0 || (f.this.gid & 32) != 0) {
                                        f.this.ghP.p(f.this.getActivity().getResources().getDrawable(bdh.e.fft));
                                    } else {
                                        f.this.ghP.p(f.this.getActivity().getResources().getDrawable(bdh.e.ffu));
                                    }
                                }
                            });
                            a.this.a(str, i, Integer.valueOf(i2));
                            f.this.pz(String.valueOf(a.this.giR.get("setMenuItemsShowable")));
                        } catch (JSONException e7) {
                            a.this.e(str, i, "invoke " + str2 + ", parse arguments exception: " + e7.getMessage());
                        }
                    }
                });
                return;
            }
            if ("setThemeColor".equals(str2)) {
                j(str, i, str2, str3);
                return;
            }
            if ("getLocation".equals(str2)) {
                a(f.this.mContext, str, i, str2);
                return;
            }
            if ("share2App".equals(str2)) {
                k(str, i, str2, str3);
                return;
            }
            if ("getQQLoginState".equals(str2)) {
                q(str, i, str2, str3);
                return;
            }
            if ("getQQLoginKey".equals(str2)) {
                u(str, i, str2, str3);
                return;
            }
            if ("getWXLoginKey".equals(str2)) {
                v(str, i, str2, str3);
                return;
            }
            if ("login".equals(str2)) {
                x(str, i, str2, str3);
                return;
            }
            if ("loginQQ".equals(str2)) {
                y(str, i, str2, str3);
                return;
            }
            if ("logoutQQ".equals(str2)) {
                C(str, i, str2, str3);
                return;
            }
            if ("getWXLoginState".equals(str2)) {
                r(str, i, str2, str3);
                return;
            }
            if ("loginWX".equals(str2)) {
                z(str, i, str2, str3);
                return;
            }
            if ("loginByPhone".equals(str2)) {
                A(str, i, str2, str3);
                return;
            }
            if ("getMainAccountInfo".equals(str2)) {
                s(str, i, str2, str3);
                return;
            }
            if ("getActToken".equals(str2)) {
                o(str, i, str2, str3);
                return;
            }
            if ("getAccountFace".equals(str2)) {
                p(str, i, str2, str3);
                return;
            }
            if ("getInfo".equals(str2)) {
                m(str, i, str2, str3);
                return;
            }
            if ("launch3rdApp".equals(str2)) {
                n(str, i, str2, str3);
                return;
            }
            if ("sendMessage".equals(str2)) {
                h(str, i, str2, str3);
                return;
            }
            if ("copy2Clipboard".equals(str2)) {
                i(str, i, str2, str3);
                return;
            }
            if ("toggleSoftInput".equals(str2)) {
                f(str, i, str2, str3);
                return;
            }
            if ("gotoAppView".equals(str2)) {
                d(str, i, str2, str3);
                return;
            }
            if ("gotoWXWebView".equals(str2)) {
                e(str, i, str2, str3);
                return;
            }
            if ("download".equals(str2)) {
                g(str, i, str2, str3);
                return;
            }
            if ("getNetworkType".equals(str2)) {
                l(str, i, str2, str3);
                return;
            }
            if ("clearAllCookie".equals(str2)) {
                c(str, i, str2, str3);
            } else if ("insertQQSecureUsageRecord".equals(str2)) {
                b(str, i, str2, str3);
            } else {
                e(str, i, "system:function_not_exist");
            }
        }

        private void b(final String str, final int i, final String str2, final String str3) {
            f.this.bvp.post(new Runnable() {
                @Override
                public void run() {
                    try {
                        if (str3 == null) {
                            a.this.e(str, i, "check_arg:params is null");
                        } else {
                            yz.a(bgh.PQ().kH(), 264585, Integer.valueOf(new JSONObject(str3).optString("recordType")).intValue(), 4);
                            a.this.a(str, i, 0);
                        }
                    } catch (Throwable th) {
                        a.this.e(str, i, "invoke " + str2 + "exception: " + th.getMessage());
                    }
                }
            });
        }

        private void c(final String str, final int i, final String str2, String str3) {
            f.this.bvp.post(new Runnable() {
                @Override
                public void run() {
                    try {
                        CookieSyncManager.createInstance(f.this.mContext);
                        CookieManager.getInstance().removeAllCookie();
                        CookieSyncManager.getInstance().sync();
                    } catch (Throwable th) {
                        a.this.e(str, i, "invoke " + str2 + "exception: " + th.getMessage());
                    }
                }
            });
        }

        public class AnonymousClass9 implements Runnable {
            final String giT;
            final int giU;
            final String giV;
            final String giW;

            AnonymousClass9(String str, String str2, String str3, int i) {
                this.giV = str;
                this.giW = str2;
                this.giT = str3;
                this.giU = i;
            }

            @Override
            public void run() {
                int i;
                int i2;
                final boolean z;
                int a;
                boolean equals = "gotoQQSecure".equals(this.giV);
                f.this.pz(String.valueOf(a.this.giR.get(this.giV)));
                if (this.giW == null) {
                    a.this.e(this.giT, this.giU, "check_arg:params is null");
                    return;
                }
                String str = SQLiteDatabase.KeyEmpty;
                String str2 = SQLiteDatabase.KeyEmpty;
                String str3 = SQLiteDatabase.KeyEmpty;
                try {
                    JSONObject jSONObject = new JSONObject(this.giW);
                    int i3 = jSONObject.getInt("viewId");
                    try {
                        str = jSONObject.getString("str1");
                    } catch (JSONException e) {
                    }
                    try {
                        str2 = jSONObject.getString("str2");
                    } catch (JSONException e2) {
                    }
                    try {
                        i = jSONObject.getInt("int1");
                    } catch (JSONException e3) {
                        i = 0;
                    }
                    try {
                        i2 = jSONObject.getInt("int2");
                    } catch (JSONException e4) {
                        i2 = 0;
                    }
                    try {
                        str3 = jSONObject.getString("pkg");
                    } catch (JSONException e5) {
                    }
                    try {
                        z = jSONObject.getBoolean("finishSelf");
                    } catch (JSONException e6) {
                        z = false;
                    }
                    if (equals) {
                        a = a.this.a(i3, str, str2, i, i2, (String) null);
                    } else {
                        if (TextUtils.isEmpty(str3)) {
                            a.this.e(this.giT, this.giU, "check_arg:params is null");
                            return;
                        }
                        a = a.this.a(i3, str, str2, i, i2, str3);
                    }
                    final int i4 = i3 != -1 ? 2000 : 0;
                    a.this.a(this.giT, this.giU, Integer.valueOf(a), new b() {
                        @Override
                        public void kH(int i5) {
                            if (z) {
                                f.this.clZ.postDelayed(new Runnable() {
                                    @Override
                                    public void run() {
                                        f.this.getActivity().finish();
                                    }
                                }, i4);
                            }
                        }
                    });
                } catch (JSONException e7) {
                    a.this.e(this.giT, this.giU, "invoke " + this.giV + ", parse arguments exception: " + e7.getMessage());
                }
            }
        }

        private void d(String str, int i, String str2, String str3) {
            f.this.bvp.post(new AnonymousClass9(str2, str3, str, i));
        }

        private void e(String str, int i, String str2, String str3) {
            if (!za.ff(str3)) {
                f.this.bvp.post(new AnonymousClass10(str2, str3, str, i));
            } else {
                e(str, i, "check_arg:params is null");
            }
        }

        public class AnonymousClass10 implements Runnable {
            final String giT;
            final int giU;
            final String giV;
            final String giW;

            AnonymousClass10(String str, String str2, String str3, int i) {
                this.giV = str;
                this.giW = str2;
                this.giT = str3;
                this.giU = i;
            }

            @Override
            public void run() {
                try {
                    f.this.pz(String.valueOf(a.this.giR.get(this.giV)));
                    JSONObject jSONObject = new JSONObject(this.giW);
                    String optString = jSONObject.optString("url");
                    final boolean optBoolean = jSONObject.optBoolean("finishSel");
                    if (!TextUtils.isEmpty(optString)) {
                        a.this.a(this.giT, this.giU, Integer.valueOf(f.this.ghW.w(optString) ? 0 : -1), new b() {
                            @Override
                            public void kH(int i) {
                                if (optBoolean) {
                                    f.this.clZ.postDelayed(new Runnable() {
                                        @Override
                                        public void run() {
                                            f.this.getActivity().finish();
                                        }
                                    }, 2000L);
                                }
                            }
                        });
                    } else {
                        a.this.e(this.giT, this.giU, "check_arg:params is null");
                    }
                } catch (Exception e) {
                    a.this.e(this.giT, this.giU, "invoke " + this.giV + "exception: " + e.getMessage());
                }
            }
        }

        private void f(String str, int i, String str2, String str3) {
            if (!za.ff(str3)) {
                f.this.clZ.postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        ((InputMethodManager) f.this.getActivity().getSystemService("input_method")).toggleSoftInput(0, 2);
                    }
                }, 500L);
            } else {
                e(str, i, "check_arg:params is null");
            }
        }

        private void g(final String str, final int i, final String str2, final String str3) {
            if (!za.ff(str3)) {
                f.this.clZ.post(new Runnable() {
                    @Override
                    public void run() {
                        String str4;
                        int i2;
                        String str5;
                        String str6;
                        JSONObject jSONObject;
                        String str7 = null;
                        try {
                            jSONObject = new JSONObject(str3);
                            i2 = Integer.valueOf(jSONObject.optString("categoryId")).intValue();
                            try {
                                str5 = jSONObject.optString("url");
                                try {
                                    str4 = jSONObject.optString("pkgName");
                                    try {
                                        str6 = jSONObject.optString("channel_id");
                                    } catch (Exception e) {
                                        e = e;
                                        str6 = null;
                                    }
                                } catch (Exception e2) {
                                    e = e2;
                                    str6 = null;
                                    str4 = null;
                                }
                            } catch (Exception e3) {
                                e = e3;
                                str6 = null;
                                str4 = null;
                                str5 = null;
                            }
                        } catch (Exception e4) {
                            e = e4;
                            str4 = null;
                            i2 = -1;
                            str5 = null;
                            str6 = null;
                        }
                        try {
                            str7 = jSONObject.optString("extStr");
                        } catch (Exception e5) {
                            e = e5;
                            a.this.e(str, i, "invoke " + str2 + " exception: " + e.getMessage());
                            if (str5 != null) {
                            }
                        }
                        if (str5 != null) {
                            a.this.e(str, i, "err_msg_err_params");
                            return;
                        }
                        Uri parse = Uri.parse(str5);
                        Intent intent = new Intent(f.this.mContext, (Class<?>) SafeDownloadActivity.class);
                        intent.setData(parse);
                        intent.putExtra("from_webview", true);
                        intent.putExtra("src_id", i2);
                        intent.putExtra("apk_pkg_name", str4);
                        intent.putExtra("channel_id", str6);
                        intent.putExtra("extStr", str7);
                        f.this.mContext.startActivity(intent);
                        Intent intent2 = new Intent(za.eqM);
                        intent2.putExtra(za.a.egA, str5);
                        f.this.mContext.sendBroadcast(intent2, d.s.dvj);
                        a.this.a(str, i, 0);
                    }
                });
            } else {
                e(str, i, "check_arg:params is null");
            }
        }

        private void h(final String str, final int i, final String str2, final String str3) {
            if (!za.ff(str3)) {
                f.this.bvp.post(new Runnable() {
                    @Override
                    public void run() {
                        Intent intent;
                        try {
                            JSONObject jSONObject = new JSONObject(str3);
                            String optString = jSONObject.optString(za.a.egC);
                            int optInt = jSONObject.optInt(za.a.deG);
                            boolean optBoolean = jSONObject.optBoolean(za.a.dWN);
                            if (za.d.egK.equals(optString)) {
                                if (!f.this.gia) {
                                    f.this.pz(String.valueOf(a.this.giR.get("sendMessage")) + "_" + optString + "_UnTrust");
                                    a.this.e(str, i, "check_arg:info_type is null");
                                    return;
                                }
                                String scheme = Uri.parse(f.this.ghT).getScheme();
                                if (!f.ghM.equals(scheme)) {
                                    f.this.pz(String.valueOf(a.this.giR.get("sendMessage")) + "_" + optString + "_" + scheme);
                                    a.this.e(str, i, "check_arg:params is null");
                                    return;
                                } else {
                                    ArrayList arrayList = new ArrayList();
                                    arrayList.add(String.valueOf(a.this.giR.get("sendMessage")) + "_" + optString);
                                    yz.b(bgh.PQ().kH(), 261186, arrayList, 1);
                                }
                            } else {
                                f.this.pz(String.valueOf(a.this.giR.get("sendMessage")) + "_" + optString);
                            }
                            if (!optBoolean) {
                                intent = new Intent(za.getAction(optInt));
                            } else {
                                intent = new Intent(za.egy);
                            }
                            String i2 = f.i("sendMessage", str, i);
                            intent.putExtra(za.a.egA, str3);
                            intent.putExtra(za.a.egC, optString);
                            intent.putExtra(za.a.egD, i2);
                            intent.putExtra(za.a.deG, optInt);
                            f.this.mContext.sendBroadcast(intent, d.s.dvj);
                        } catch (Exception e) {
                            a.this.e(str, i, "invoke " + str2 + "exception: " + e.getMessage());
                        }
                    }
                });
            } else {
                e(str, i, "check_arg:params is null");
            }
        }

        private void i(final String str, final int i, final String str2, final String str3) {
            if (!za.ff(str3)) {
                f.this.bvp.post(new Runnable() {
                    @Override
                    public void run() {
                        try {
                            String optString = new JSONObject(str3).optString(za.a.deF);
                            String str4 = optString == null ? SQLiteDatabase.KeyEmpty : optString;
                            ClipboardManager clipboardManager = (ClipboardManager) f.this.getActivity().getSystemService("clipboard");
                            if (clipboardManager != null) {
                                clipboardManager.setText(str4);
                                uilib.components.g.B(f.this.getActivity(), f.this.mContext.getResources().getString(bdh.h.flI));
                            }
                            a.this.a(str, i, 1);
                            f.this.pz(String.valueOf(a.this.giR.get("copy2Clipboard")) + "_" + str4);
                        } catch (Exception e) {
                            a.this.e(str, i, "invoke " + str2 + "exception: " + e.getMessage());
                        }
                    }
                });
            } else {
                e(str, i, "check_arg:params is null");
            }
        }

        private void j(final String str, final int i, final String str2, final String str3) {
            if (str3 == null) {
                e(str, i, "check_arg:params is null");
            } else if (f.amI()) {
                f.this.clZ.post(new Runnable() {
                    @Override
                    public void run() {
                        f.this.pz(String.valueOf(a.this.giR.get("setThemeColor")));
                        int i2 = -1;
                        try {
                            try {
                                f.this.ghP.gjK.setBackgroundColor(Color.parseColor(new JSONObject(str3).getString("titleBar")));
                                i2 = 0;
                            } catch (JSONException e) {
                            } catch (Exception e2) {
                                i2 = -3;
                            }
                            a.this.a(str, i, Integer.valueOf(i2));
                        } catch (JSONException e3) {
                            a.this.e(str, i, "invoke " + str2 + ", parse arguments exception: " + e3.getMessage());
                        }
                    }
                });
            } else {
                e(str, i, "not_working_below_android4_4");
            }
        }

        private void k(final String str, final int i, final String str2, final String str3) {
            if (str3 != null) {
                f.this.bvp.post(new Runnable() {
                    @Override
                    public void run() {
                        f.this.pz(String.valueOf(a.this.giR.get("share2App")));
                        try {
                            final String str4 = SQLiteDatabase.KeyEmpty;
                            final String str5 = SQLiteDatabase.KeyEmpty;
                            final String str6 = SQLiteDatabase.KeyEmpty;
                            final String str7 = SQLiteDatabase.KeyEmpty;
                            JSONObject jSONObject = new JSONObject(str3);
                            final String string = jSONObject.getString(azr.b.ejV);
                            try {
                                str4 = jSONObject.getString("title");
                            } catch (JSONException e) {
                            }
                            if (str4 == null) {
                                str4 = SQLiteDatabase.KeyEmpty;
                            }
                            try {
                                str7 = jSONObject.getString("pkg_name");
                            } catch (JSONException e2) {
                            }
                            try {
                                str5 = jSONObject.getString("img_url");
                            } catch (JSONException e3) {
                            }
                            try {
                                str6 = jSONObject.getString("link");
                            } catch (JSONException e4) {
                            }
                            if (za.ff(str6)) {
                                str6 = f.this.ghT;
                            }
                            final g.a aVar = new g.a() {
                                @Override
                                public void onSuccess() {
                                    a.this.a(str, i, 0);
                                }

                                @Override
                                public void onError(int i2) {
                                    if (i2 == -101) {
                                        uilib.components.g.d(f.this.mContext, bdh.h.flK);
                                    } else if (i2 == -100 && !za.ff(str7)) {
                                        uilib.components.g.B(f.this.mContext, String.format(f.this.mContext.getResources().getString(bdh.h.flR), com.tencent.server.task.g.aX(str7)));
                                    }
                                    a.this.a(str, i, Integer.valueOf(i2));
                                }
                            };
                            if (za.ff(str7)) {
                                f.this.clZ.post(new Runnable() {
                                    @Override
                                    public void run() {
                                        f.this.a(false, str4, string, str6, str5, (Bitmap) null, aVar);
                                    }
                                });
                            } else {
                                if (str7.equals(aaf.b.dnj)) {
                                    f.this.a(str4, string, str6, str5, (Bitmap) null, false, aVar);
                                    return;
                                }
                                final String str8 = str5;
                                final String str9 = str4;
                                new Thread(new Runnable() {
                                    @Override
                                    public void run() {
                                        f.this.ghY.a(str7, str9, string, (Bitmap) null, !za.ff(str8) ? f.px(str8) : null, aVar);
                                    }
                                }).start();
                            }
                        } catch (JSONException e5) {
                            a.this.e(str, i, "invoke " + str2 + ", parse arguments exception: " + e5.getMessage());
                        }
                    }
                });
            } else {
                e(str, i, "check_arg:params is null");
            }
        }

        private void a(Context context, String str, int i, String str2) {
            ((aig) bgm.nL(4)).e(new AnonymousClass18(str, i), "H5_getLocation").start();
        }

        public class AnonymousClass18 implements Runnable {
            final String giT;
            final int giU;

            AnonymousClass18(String str, int i) {
                this.giT = str;
                this.giU = i;
            }

            @Override
            public void run() {
                f.this.pz(String.valueOf(a.this.giR.get("getLocation")));
                try {
                    Looper.prepare();
                    final Looper myLooper = Looper.myLooper();
                    ph.a aVar = new ph.a() {
                        boolean gjk = false;

                        @Override
                        public void a(final SOSOMapLBSApiResult sOSOMapLBSApiResult, boolean z) {
                            if (!this.gjk) {
                                this.gjk = true;
                                if (sOSOMapLBSApiResult.ErrorCode == 0 && f.this.ghP.fqY != null) {
                                    f.this.clZ.post(new Runnable() {
                                        @Override
                                        public void run() {
                                            JSONObject jSONObject = new JSONObject();
                                            try {
                                                jSONObject.put("sessionId", SQLiteDatabase.KeyEmpty + AnonymousClass18.this.giT);
                                                jSONObject.put("callbackId", SQLiteDatabase.KeyEmpty + AnonymousClass18.this.giU);
                                                jSONObject.put("err_msg", StrategyConst.e.cGe);
                                                jSONObject.put("ret", "0");
                                                jSONObject.put("latitude", SQLiteDatabase.KeyEmpty + sOSOMapLBSApiResult.Latitude);
                                                jSONObject.put("longitude", SQLiteDatabase.KeyEmpty + sOSOMapLBSApiResult.Longitude);
                                                jSONObject.put("speed", SQLiteDatabase.KeyEmpty + sOSOMapLBSApiResult.Speed);
                                                jSONObject.put("accuracy", SQLiteDatabase.KeyEmpty + sOSOMapLBSApiResult.Accuracy);
                                            } catch (JSONException e) {
                                                e.printStackTrace();
                                            }
                                            if (f.this.ghP.fqY != null) {
                                                f.this.ghP.fqY.loadUrl(String.format("javascript:handleMessageFromTcs('onCallback', '%s')", jSONObject.toString()));
                                            }
                                        }
                                    });
                                }
                                BC();
                            }
                        }

                        @Override
                        public void BD() {
                            if (!this.gjk) {
                                this.gjk = true;
                                a.this.a(AnonymousClass18.this.giT, AnonymousClass18.this.giU, -2);
                                BC();
                            }
                        }

                        @Override
                        public void BE() {
                            if (!this.gjk) {
                                this.gjk = true;
                                a.this.a(AnonymousClass18.this.giT, AnonymousClass18.this.giU, -1);
                                BC();
                            }
                        }

                        @Override
                        public void BC() {
                            try {
                                myLooper.quit();
                            } catch (Exception e) {
                                e.printStackTrace();
                            }
                        }
                    };
                    ph phVar = (ph) bgm.nL(28);
                    phVar.a(aVar);
                    phVar.BB();
                    Looper.loop();
                } catch (Exception e) {
                }
            }
        }

        private void l(final String str, final int i, String str2, String str3) {
            f.this.bvp.post(new Runnable() {
                @Override
                public void run() {
                    String kP = tz.kP(tz.Ef());
                    try {
                        JSONObject jSONObject = new JSONObject();
                        jSONObject.put("networkType", kP);
                        a.this.a(str, i, jSONObject, (b) null);
                    } catch (JSONException e) {
                        a.this.e(str, i, e.getMessage());
                    }
                }
            });
        }

        private void m(final String str, final int i, final String str2, final String str3) {
            f.this.bvp.post(new Runnable() {
                @Override
                public void run() {
                    String str4;
                    String str5;
                    int i2;
                    String str6;
                    int i3 = 0;
                    String str7 = null;
                    if (za.ff(str3)) {
                        i2 = 0;
                        str5 = null;
                    } else {
                        try {
                            JSONObject jSONObject = new JSONObject(str3);
                            str5 = jSONObject.getString("key");
                            try {
                                i2 = Integer.valueOf(jSONObject.optString("simplot")).intValue();
                            } catch (Exception e) {
                                str4 = str5;
                                str5 = str4;
                                i2 = 0;
                                if (!za.ff(str5)) {
                                }
                            }
                        } catch (Exception e2) {
                            str4 = null;
                        }
                    }
                    if (!za.ff(str5)) {
                        a.this.e(str, i, "invoke " + str2 + ", argument key must be set");
                        return;
                    }
                    if (str5.equals("imei")) {
                        try {
                            str6 = aht.d((TelephonyManager) f.this.mContext.getSystemService("phone"));
                        } catch (Exception e3) {
                            str7 = e3.getMessage();
                            str6 = null;
                        }
                    } else if (str5.equals("guid")) {
                        i3 = 1;
                        try {
                            str6 = r.afP().aj();
                        } catch (Exception e4) {
                            str7 = e4.getMessage();
                            str6 = null;
                        }
                    } else if (str5.equals("phone_number")) {
                        i3 = 2;
                        try {
                            str6 = ajy.j(f.this.mContext);
                        } catch (Exception e5) {
                            str7 = e5.getMessage();
                            str6 = null;
                        }
                    } else if (str5.equals(TMSDKContext.CON_LC)) {
                        i3 = 3;
                        try {
                            str6 = uf.eu(TMSDKContext.getStrFromEnvMap(TMSDKContext.CON_LC));
                        } catch (Exception e6) {
                            str7 = e6.getMessage();
                            str6 = null;
                        }
                    } else if (str5.equals("android_os_build_model")) {
                        i3 = 4;
                        try {
                            str6 = Build.MODEL;
                        } catch (Exception e7) {
                            str7 = e7.getMessage();
                            str6 = null;
                        }
                    } else if (str5.equals("android_os_build_brand")) {
                        try {
                            str6 = Build.BRAND;
                            i3 = 6;
                        } catch (Exception e8) {
                            i3 = 6;
                            str7 = e8.getMessage();
                            str6 = null;
                        }
                    } else if (str5.equals("android_os_build_version_release")) {
                        i3 = 5;
                        try {
                            str6 = Build.VERSION.RELEASE;
                        } catch (Exception e9) {
                            str7 = e9.getMessage();
                            str6 = null;
                        }
                    } else if ("imsi".equals(str5)) {
                        try {
                            str6 = ajy.b(f.this.getActivity(), i2);
                            i3 = 6;
                        } catch (Exception e10) {
                            i3 = 6;
                            str7 = e10.getMessage();
                            str6 = null;
                        }
                    } else {
                        i3 = 99;
                        str7 = "unsupported key: " + str5;
                        str6 = null;
                    }
                    if (str7 != null) {
                        a.this.e(str, i, str7);
                    } else {
                        if (str6 == null) {
                            str6 = SQLiteDatabase.KeyEmpty;
                        }
                        a.this.a(str, i, str6);
                    }
                    new ArrayList().add(Integer.valueOf(i3));
                    ArrayList arrayList = new ArrayList();
                    arrayList.add(String.valueOf(a.this.giR.get("getInfo")) + "_" + i3);
                    yz.b(bgh.PQ().kH(), 261186, arrayList, 22);
                }
            });
        }

        private void n(final String str, final int i, final String str2, final String str3) {
            f.this.bvp.post(new Runnable() {
                @Override
                public void run() {
                    String str4;
                    String str5;
                    String str6;
                    String str7;
                    String str8;
                    String str9;
                    String str10;
                    Intent intent;
                    Intent intent2;
                    if (za.ff(str3)) {
                        a.this.e(str, i, "check_arg:params is null");
                        return;
                    }
                    try {
                        try {
                            JSONObject jSONObject = new JSONObject(str3);
                            try {
                                str4 = jSONObject.getString("pkgName");
                            } catch (JSONException e) {
                                str4 = null;
                            }
                            try {
                                str5 = jSONObject.getString("signature");
                            } catch (JSONException e2) {
                                str5 = null;
                            }
                            try {
                                str6 = jSONObject.getString("activity");
                            } catch (JSONException e3) {
                                str6 = null;
                            }
                            try {
                                str7 = jSONObject.getString("param");
                            } catch (JSONException e4) {
                                str7 = null;
                            }
                            try {
                                str8 = jSONObject.getString("action");
                            } catch (JSONException e5) {
                                str8 = null;
                            }
                            try {
                                str9 = jSONObject.getString("url");
                            } catch (JSONException e6) {
                                str9 = null;
                            }
                            int optInt = jSONObject.optInt("tipType");
                            int optInt2 = jSONObject.optInt("tipTime");
                            String optString = jSONObject.optString("tipMsg");
                            if (str8 != null) {
                                str10 = "1300_action:" + str8;
                                if (!za.ff(str9)) {
                                    intent2 = new Intent(str8, Uri.parse(str9));
                                } else {
                                    intent2 = new Intent(str8);
                                }
                                if (!za.ff(str7)) {
                                    intent2.putExtra("param", str7);
                                }
                                intent2.addFlags(SQLiteDatabase.CREATE_IF_NECESSARY);
                                f.this.getActivity().getApplicationContext().startActivity(intent2);
                            } else if (!za.ff(str4)) {
                                if (!f.this.pu(str4)) {
                                    a.this.e(str, i, "app not installed!");
                                    return;
                                }
                                if (!za.ff(str5) && !f.this.aZ(str4, str5)) {
                                    a.this.e(str, i, "signature not match!");
                                    return;
                                }
                                if (!za.ff(str6)) {
                                    Intent intent3 = new Intent();
                                    intent3.setClassName(str4, str6);
                                    str10 = "1300_" + str4 + "_" + str6;
                                    intent = intent3;
                                } else {
                                    String str11 = "1300_" + str4;
                                    Intent launchIntentForPackage = f.this.mContext.getPackageManager().getLaunchIntentForPackage(str4);
                                    if (launchIntentForPackage == null) {
                                        a.this.e(str, i, "app launch intent not found!");
                                        return;
                                    } else {
                                        str10 = str11;
                                        intent = launchIntentForPackage;
                                    }
                                }
                                if (!za.ff(str7)) {
                                    intent.putExtra("param", str7);
                                }
                                intent.addFlags(SQLiteDatabase.CREATE_IF_NECESSARY);
                                f.this.getActivity().getApplicationContext().startActivity(intent);
                                if (!TextUtils.isEmpty(optString) && optInt != -1) {
                                    String str12 = str10 + "_" + optInt;
                                    switch (optInt) {
                                        case 1:
                                            uilib.components.g.F(f.this.getActivity(), optString);
                                            str10 = str12;
                                            break;
                                        case 2:
                                            new AccessHelper.b().a(f.this.getActivity(), optString, optInt2, -1, -1);
                                            str10 = str12;
                                            break;
                                        case 3:
                                            bja bjaVar = new bja();
                                            bjaVar.ol(optString);
                                            bjaVar.a(f.this.getActivity(), optInt2, -1, -1);
                                        default:
                                            str10 = str12;
                                            break;
                                    }
                                }
                            } else {
                                a.this.e(str, i, "bad argument, action or pkgName must be set");
                                return;
                            }
                            a.this.a(str, i, 0);
                            if (str10 != null) {
                                ArrayList arrayList = new ArrayList();
                                arrayList.add(str10);
                                yz.b(bgh.PQ().kH(), 261186, arrayList, 22);
                            }
                        } catch (Throwable th) {
                            a.this.e(str, i, "invoke " + str2 + ", exception: " + th.getMessage());
                        }
                    } catch (JSONException e7) {
                        a.this.e(str, i, "invoke " + str2 + ", parse arguments exception: " + e7.getMessage());
                    }
                }
            });
        }

        private void o(final String str, final int i, final String str2, final String str3) {
            f.this.bvp.post(new Runnable() {
                @Override
                public void run() {
                    int i2;
                    f.this.pz(String.valueOf(a.this.giR.get(str2)));
                    String str4 = null;
                    if (!za.ff(str3)) {
                        try {
                            str4 = new JSONObject(str3).optString("id");
                        } catch (JSONException e) {
                        }
                    }
                    Bundle bundle = new Bundle();
                    if (za.ff(str4)) {
                        a.this.e(str, i, "bad argument, id must be set");
                        return;
                    }
                    bundle.putInt(meri.pluginsdk.d.bss, azr.c.ekI);
                    Intent intent = new Intent(azr.eiT);
                    intent.putExtra(azr.eiY, f.i(str2, str, i) + "|" + str4);
                    intent.putExtra(azr.eiW, bundle);
                    try {
                        f.this.mContext.sendBroadcast(intent, d.s.dvj);
                        i2 = 0;
                    } catch (Exception e2) {
                        i2 = -1;
                    }
                    if (i2 != 0) {
                        a.this.a(str, i, Integer.valueOf(i2));
                    }
                }
            });
        }

        private void p(final String str, final int i, final String str2, final String str3) {
            f.this.bvp.post(new Runnable() {
                @Override
                public void run() {
                    String str4;
                    int i2;
                    String str5;
                    int i3;
                    int i4;
                    int i5 = -1;
                    f.this.pz(String.valueOf(a.this.giR.get(str2)));
                    if (za.ff(str3)) {
                        i3 = -1;
                        str5 = null;
                        i4 = 0;
                    } else {
                        try {
                            JSONObject jSONObject = new JSONObject(str3);
                            str4 = jSONObject.optString(za.e.eqU);
                            try {
                                i2 = jSONObject.optInt("accountType");
                            } catch (JSONException e) {
                                i2 = -1;
                            }
                            try {
                                int optInt = jSONObject.optInt("faceType");
                                str5 = str4;
                                i3 = i2;
                                i4 = optInt;
                            } catch (JSONException e2) {
                                str5 = str4;
                                i3 = i2;
                                i4 = 0;
                                if (i4 != 1) {
                                }
                                Bundle bundle = new Bundle();
                                if (i4 != 0) {
                                }
                                if (!za.ff(str5)) {
                                }
                                Intent intent = new Intent(azr.eiU);
                                intent.putExtra(azr.eiY, f.i(str2, str, i));
                                intent.putExtra(azr.eiW, bundle);
                                try {
                                    f.this.mContext.sendBroadcast(intent, d.s.dvj);
                                    i5 = 0;
                                } catch (Exception e3) {
                                }
                                if (i5 == 0) {
                                }
                            }
                        } catch (JSONException e4) {
                            str4 = null;
                            i2 = -1;
                        }
                    }
                    if (i4 != 1 && (i3 == -1 || TextUtils.isEmpty(str5))) {
                        a.this.e(str, i, "invoke " + str2 + ", params is not valid");
                        return;
                    }
                    Bundle bundle2 = new Bundle();
                    if (i4 != 0) {
                        bundle2.putInt(meri.pluginsdk.d.bss, azr.c.ekH);
                    } else {
                        bundle2.putInt(meri.pluginsdk.d.bss, azr.c.bxE);
                    }
                    if (!za.ff(str5)) {
                        bundle2.putInt(azr.b.KEY_ACCOUNT_TYPE, i3);
                        bundle2.putString(azr.b.ekg, str5);
                    }
                    Intent intent2 = new Intent(azr.eiU);
                    intent2.putExtra(azr.eiY, f.i(str2, str, i));
                    intent2.putExtra(azr.eiW, bundle2);
                    f.this.mContext.sendBroadcast(intent2, d.s.dvj);
                    i5 = 0;
                    if (i5 == 0) {
                        a.this.a(str, i, Integer.valueOf(i5));
                    }
                }
            });
        }

        private void q(String str, int i, String str2, String str3) {
            t(str, i, str2, str3);
        }

        private void r(String str, int i, String str2, String str3) {
            t(str, i, str2, str3);
        }

        private void s(String str, int i, String str2, String str3) {
            t(str, i, str2, str3);
        }

        private void t(final String str, final int i, final String str2, final String str3) {
            f.this.bvp.post(new Runnable() {
                @Override
                public void run() {
                    int i2;
                    int i3 = 1;
                    f.this.pz(String.valueOf(a.this.giR.get(str2)));
                    String str4 = null;
                    if (!za.ff(str3)) {
                        try {
                            str4 = new JSONObject(str3).getString(za.e.eqU);
                        } catch (JSONException e) {
                        }
                    }
                    Bundle bundle = new Bundle();
                    if (!za.ff(str4)) {
                        bundle.putInt(meri.pluginsdk.d.bss, azr.c.ekJ);
                        if (!"getQQLoginState".equals(str2) && "getWXLoginState".equals(str2)) {
                            i3 = 2;
                        }
                        bundle.putInt(azr.b.KEY_ACCOUNT_TYPE, i3);
                        bundle.putString(azr.b.ekg, str4);
                    } else {
                        bundle.putInt(meri.pluginsdk.d.bss, azr.c.ekI);
                    }
                    Intent intent = new Intent(azr.eiT);
                    intent.putExtra(azr.eiY, f.i(str2, str, i));
                    intent.putExtra(azr.eiW, bundle);
                    try {
                        f.this.mContext.sendBroadcast(intent, d.s.dvj);
                        i2 = 0;
                    } catch (Exception e2) {
                        i2 = -1;
                    }
                    if (i2 != 0) {
                        a.this.a(str, i, Integer.valueOf(i2));
                    }
                }
            });
        }

        public int pA(String str) {
            if (str.equals("skey")) {
                return 4096;
            }
            if (str.equals("vkey")) {
                return 131072;
            }
            if (str.equals("a2key")) {
                return 64;
            }
            if (str.equals("stwebkey")) {
                return 32;
            }
            if (str.equals("accesstoken")) {
                return 0;
            }
            throw new RuntimeException("unknow keyType: " + str);
        }

        private String qK(int i) {
            switch (i) {
                case 0:
                    return "accesstoken";
                case 32:
                    return "stwebkey";
                case 64:
                    return "a2key";
                case 4096:
                    return "skey";
                case 131072:
                    return "vkey";
                default:
                    throw new RuntimeException("unknow keyType: " + i);
            }
        }

        private void u(String str, int i, String str2, String str3) {
            w(str, i, str2, str3);
        }

        private void v(String str, int i, String str2, String str3) {
            w(str, i, str2, str3);
        }

        private void w(final String str, final int i, final String str2, final String str3) {
            f.this.bvp.post(new Runnable() {
                @Override
                public void run() {
                    String str4;
                    int i2;
                    String str5 = null;
                    boolean equals = "getQQLoginKey".equals(str2);
                    if (equals) {
                        f.this.pz(String.valueOf(a.this.giR.get("getQQLoginKey")));
                    } else {
                        f.this.pz(String.valueOf(a.this.giR.get("getWXLoginKey")));
                    }
                    try {
                        JSONObject jSONObject = new JSONObject(str3);
                        str4 = jSONObject.optString(za.e.eqU);
                        try {
                            str5 = jSONObject.optString("keytype");
                        } catch (JSONException e) {
                        }
                    } catch (JSONException e2) {
                        str4 = null;
                    }
                    if (za.ff(str4) || (equals && za.ff(str5))) {
                        a.this.e(str, i, "invoke " + str2 + ", argument uin and keytype must be set");
                        return;
                    }
                    try {
                        Bundle bundle = new Bundle();
                        bundle.putInt(meri.pluginsdk.d.bss, azr.c.ekF);
                        bundle.putInt(azr.b.KEY_ACCOUNT_TYPE, equals ? 1 : 2);
                        bundle.putString(azr.b.ekg, str4);
                        if (equals) {
                            bundle.putInt(azr.b.ekk, a.this.pA(str5));
                        }
                        Intent intent = new Intent(azr.eiU);
                        intent.putExtra(azr.eiY, f.i(equals ? "getQQLoginKey" : "getWXLoginKey", str, i));
                        intent.putExtra(azr.eiW, bundle);
                        f.this.mContext.sendBroadcast(intent, d.s.dvj);
                        i2 = 0;
                    } catch (Exception e3) {
                        i2 = -1;
                    }
                    if (i2 != 0) {
                        a.this.a(str, i, Integer.valueOf(i2));
                    }
                }
            });
        }

        private void x(final String str, final int i, final String str2, final String str3) {
            f.this.bvp.post(new Runnable() {
                @Override
                public void run() {
                    String str4;
                    String str5;
                    String str6;
                    int i2;
                    String str7 = null;
                    int i3 = 0;
                    f.this.pz(String.valueOf(a.this.giR.get(str2)));
                    try {
                        JSONObject jSONObject = new JSONObject(str3);
                        str5 = jSONObject.optString(za.e.eqU);
                        try {
                            str6 = jSONObject.optString(za.e.eqV);
                        } catch (JSONException e) {
                            str4 = null;
                            str7 = str5;
                        }
                        try {
                            i2 = jSONObject.optInt(za.e.dWO);
                        } catch (JSONException e2) {
                            str4 = str6;
                            str7 = str5;
                            str5 = str7;
                            str6 = str4;
                            i2 = 0;
                            Bundle bundle = new Bundle();
                            bundle.putInt(meri.pluginsdk.d.bss, azr.c.ekE);
                            if (TextUtils.isEmpty(str6)) {
                            }
                            bundle.putString("source", str6);
                            if (!za.ff(str5)) {
                            }
                            bundle.putInt(azr.b.eke, 1);
                            bundle.putInt(azr.b.ekf, i2);
                            bundle.putBoolean(azr.b.ekh, false);
                            bundle.putBoolean(azr.b.ejT, false);
                            bundle.putBoolean(azr.b.dFc, false);
                            Intent intent = new Intent(azr.eiU);
                            intent.putExtra(azr.eiY, f.i(str2, str, i));
                            intent.putExtra(azr.eiW, bundle);
                            f.this.mContext.sendBroadcast(intent, d.s.dvj);
                            if (i3 == 0) {
                            }
                        }
                    } catch (JSONException e3) {
                        str4 = null;
                    }
                    Bundle bundle2 = new Bundle();
                    bundle2.putInt(meri.pluginsdk.d.bss, azr.c.ekE);
                    if (TextUtils.isEmpty(str6)) {
                        str6 = "WebView";
                    }
                    bundle2.putString("source", str6);
                    if (!za.ff(str5)) {
                        bundle2.putString(azr.b.ekg, str5);
                    }
                    bundle2.putInt(azr.b.eke, 1);
                    bundle2.putInt(azr.b.ekf, i2);
                    bundle2.putBoolean(azr.b.ekh, false);
                    bundle2.putBoolean(azr.b.ejT, false);
                    bundle2.putBoolean(azr.b.dFc, false);
                    Intent intent2 = new Intent(azr.eiU);
                    intent2.putExtra(azr.eiY, f.i(str2, str, i));
                    intent2.putExtra(azr.eiW, bundle2);
                    try {
                        f.this.mContext.sendBroadcast(intent2, d.s.dvj);
                    } catch (Exception e4) {
                        i3 = -1;
                    }
                    if (i3 == 0) {
                        a.this.a(str, i, Integer.valueOf(i3));
                    }
                }
            });
        }

        private void y(String str, int i, String str2, String str3) {
            B(str, i, str2, str3);
        }

        private void z(String str, int i, String str2, String str3) {
            B(str, i, str2, str3);
        }

        private void A(String str, int i, String str2, String str3) {
            B(str, i, str2, str3);
        }

        private void B(final String str, final int i, final String str2, final String str3) {
            f.this.bvp.post(new Runnable() {
                @Override
                public void run() {
                    String str4;
                    boolean z;
                    int i2;
                    int i3;
                    String str5 = null;
                    f.this.pz(String.valueOf(a.this.giR.get(str2)));
                    try {
                        JSONObject jSONObject = new JSONObject(str3);
                        z = jSONObject.getBoolean(za.e.eqT);
                        try {
                            str4 = jSONObject.optString(za.e.eqU);
                            try {
                                str5 = jSONObject.optString(za.e.eqV);
                            } catch (JSONException e) {
                            }
                        } catch (JSONException e2) {
                            str4 = null;
                        }
                    } catch (JSONException e3) {
                        str4 = null;
                        z = true;
                    }
                    Bundle bundle = new Bundle();
                    bundle.putInt(meri.pluginsdk.d.bss, azr.c.ekE);
                    if (TextUtils.isEmpty(str5)) {
                        str5 = "WebView";
                    }
                    bundle.putString("source", str5);
                    if (!za.ff(str4)) {
                        bundle.putString(azr.b.ekg, str4);
                    }
                    if (z) {
                        bundle.putInt(azr.b.eke, 1);
                    } else {
                        bundle.putInt(azr.b.eke, 2);
                    }
                    if ("loginQQ".equals(str2)) {
                        i2 = 1;
                    } else if ("loginWX".equals(str2)) {
                        i2 = 2;
                    } else {
                        i2 = "loginByPhone".equals(str2) ? 10 : 1;
                    }
                    bundle.putInt(azr.b.ekf, i2);
                    Intent intent = new Intent(azr.eiU);
                    intent.putExtra(azr.eiY, f.i(str2, str, i));
                    intent.putExtra(azr.eiW, bundle);
                    try {
                        f.this.mContext.sendBroadcast(intent, d.s.dvj);
                        i3 = 0;
                    } catch (Exception e4) {
                        i3 = -1;
                    }
                    if (i3 != 0) {
                        a.this.a(str, i, Integer.valueOf(i3));
                    }
                }
            });
        }

        private void C(String str, int i, String str2, String str3) {
            D(str, i, str2, str3);
        }

        private void D(final String str, final int i, final String str2, final String str3) {
            f.this.bvp.post(new Runnable() {
                @Override
                public void run() {
                    int i2;
                    f.this.pz(String.valueOf(a.this.giR.get("logoutQQ")));
                    String str4 = null;
                    try {
                        str4 = new JSONObject(str3).getString(za.e.eqU);
                    } catch (JSONException e) {
                    }
                    if (za.ff(str4)) {
                        a.this.e(str, i, "invoke " + str2 + ", argument uin must be set");
                        return;
                    }
                    Bundle bundle = new Bundle();
                    bundle.putInt(meri.pluginsdk.d.bss, azr.c.ekE);
                    bundle.putInt(azr.b.eke, 3);
                    bundle.putInt(azr.b.ekf, 1);
                    bundle.putString(azr.b.ekg, str4);
                    Intent intent = new Intent(azr.eiU);
                    intent.putExtra(azr.eiY, f.i("logoutQQ", str, i));
                    intent.putExtra(azr.eiW, bundle);
                    try {
                        f.this.mContext.sendBroadcast(intent, d.s.dvj);
                        i2 = 0;
                    } catch (Exception e2) {
                        i2 = -1;
                    }
                    if (i2 != 0) {
                        a.this.a(str, i, Integer.valueOf(i2));
                    }
                }
            });
        }

        private boolean i(boolean z, int i) {
            return z ? i == 1 : i == 2;
        }

        public void F(Intent intent) {
            JSONObject jSONObject;
            try {
                String stringExtra = intent.getStringExtra(za.a.egD);
                String stringExtra2 = intent.getStringExtra(za.a.egA);
                try {
                    jSONObject = new JSONObject(stringExtra2);
                } catch (Exception e) {
                    jSONObject = null;
                }
                if (stringExtra2 == null) {
                    stringExtra2 = SQLiteDatabase.KeyEmpty;
                }
                if (stringExtra != null) {
                    String[] split = stringExtra.split("\\|");
                    if (split.length == 5) {
                        String str = split[3];
                        String str2 = split[4];
                        if (jSONObject == null) {
                            a(str, Integer.valueOf(str2).intValue(), stringExtra2);
                        } else {
                            jSONObject.put("ret", "0");
                            a(str, Integer.valueOf(str2).intValue(), jSONObject, (b) null);
                        }
                    }
                }
            } catch (Exception e2) {
            }
        }

        public void G(Intent intent) {
            try {
                String stringExtra = intent.getStringExtra(za.a.egD);
                String stringExtra2 = intent.getStringExtra(za.a.eux);
                int intExtra = intent.getIntExtra(za.a.evo, -1);
                JSONObject jSONObject = new JSONObject();
                jSONObject.put(azr.b.KEY_TOKEN, stringExtra2);
                jSONObject.put("ret", SQLiteDatabase.KeyEmpty + intExtra);
                if (stringExtra != null) {
                    String[] split = stringExtra.split("\\|");
                    if (split.length == 6) {
                        a(split[3], Integer.valueOf(split[4]).intValue(), jSONObject, (b) null);
                    }
                }
            } catch (Exception e) {
            }
        }

        public void H(Intent intent) {
            String str;
            AccountInfo accountInfo;
            String str2;
            String str3;
            String str4;
            String str5;
            String str6;
            Bundle bundle;
            String string;
            AccountInfo accountInfo2;
            AccountInfo accountInfo3;
            String str7 = null;
            String stringExtra = intent.getStringExtra(azr.eiY);
            int intExtra = intent.getIntExtra("result_code", 0);
            Bundle bundleExtra = intent.getBundleExtra(azr.eiX);
            String[] split = stringExtra.split("\\|");
            if (split.length == 5) {
                String str8 = split[3];
                String str9 = split[4];
                if (intExtra != 0) {
                    a(str8, Integer.valueOf(str9).intValue(), Integer.valueOf(intExtra));
                    return;
                }
                if (bundleExtra == null) {
                    a(str8, Integer.valueOf(str9).intValue(), -1);
                    return;
                }
                final JSONObject jSONObject = new JSONObject();
                try {
                    jSONObject.put("sessionId", str8);
                    jSONObject.put("callbackId", str9);
                    jSONObject.put("err_msg", StrategyConst.e.cGe);
                    jSONObject.put("ret", intExtra);
                } catch (JSONException e) {
                    e.printStackTrace();
                }
                if ("getQQLoginState".equals(split[0]) || "getWXLoginState".equals(split[0]) || "getMainAccountInfo".equals(split[0])) {
                    boolean equals = "getQQLoginState".equals(split[0]);
                    boolean equals2 = "getMainAccountInfo".equals(split[0]);
                    MainAccountInfo mainAccountInfo = (MainAccountInfo) bundleExtra.getParcelable(azr.b.ekp);
                    if (equals2) {
                        if (mainAccountInfo != null) {
                            String valueOf = String.valueOf(mainAccountInfo.dxX);
                            str2 = mainAccountInfo.an;
                            str4 = null;
                            str5 = "online";
                            str3 = null;
                            str6 = null;
                            str7 = valueOf;
                        } else {
                            str6 = null;
                            str3 = null;
                            str4 = null;
                            str5 = "none";
                            str2 = null;
                        }
                    } else {
                        if (mainAccountInfo != null) {
                            AccountInfo accountInfo4 = equals ? mainAccountInfo.dxY : mainAccountInfo.dxZ;
                            String valueOf2 = String.valueOf(mainAccountInfo.dxX);
                            str2 = mainAccountInfo.an;
                            accountInfo = accountInfo4;
                            str = valueOf2;
                        } else {
                            str = null;
                            accountInfo = (AccountInfo) bundleExtra.getParcelable(azr.b.ekj);
                            str2 = null;
                        }
                        if (accountInfo == null) {
                            str4 = null;
                            str5 = "none";
                            str3 = null;
                            String str10 = str;
                            str6 = null;
                            str7 = str10;
                        } else if (!i(equals, accountInfo.type)) {
                            str4 = null;
                            str5 = "none";
                            str3 = null;
                            String str11 = str;
                            str6 = null;
                            str7 = str11;
                        } else if (accountInfo.status == 0) {
                            str4 = accountInfo.dxQ;
                            String str12 = accountInfo.dxP;
                            str3 = accountInfo.name;
                            str5 = "online";
                            String str13 = str;
                            str6 = str12;
                            str7 = str13;
                        } else if (accountInfo.status == 1) {
                            str4 = accountInfo.dxQ;
                            String str14 = accountInfo.dxP;
                            str3 = accountInfo.name;
                            str5 = "offline";
                            String str15 = str;
                            str6 = str14;
                            str7 = str15;
                        } else if (accountInfo.status == 2) {
                            str4 = accountInfo.dxQ;
                            String str16 = accountInfo.dxP;
                            str3 = accountInfo.name;
                            str5 = "offline";
                            String str17 = str;
                            str6 = str16;
                            str7 = str17;
                        } else {
                            str3 = null;
                            str4 = null;
                            str5 = null;
                            str7 = str;
                            str6 = null;
                        }
                    }
                    if (str5 != null) {
                        try {
                            jSONObject.put("state", str5);
                        } catch (JSONException e2) {
                            e2.printStackTrace();
                        }
                    }
                    if (str4 != null) {
                        jSONObject.put(za.e.eqU, str4);
                    }
                    if (str3 != null) {
                        jSONObject.put("name", str3);
                    }
                    if (str6 != null) {
                        jSONObject.put("openid", str6);
                    }
                    if (str7 != null) {
                        jSONObject.put("accountid", str7);
                    }
                    if (str2 != null) {
                        jSONObject.put(azr.b.KEY_TOKEN, str2);
                    }
                } else if ("getQQLoginKey".equals(split[0]) || "getWXLoginKey".equals(split[0])) {
                    int i = bundleExtra.getInt("result");
                    try {
                        jSONObject.put("ret", i);
                    } catch (JSONException e3) {
                        e3.printStackTrace();
                    }
                    boolean equals3 = "getQQLoginKey".equals(split[0]);
                    if (i == 0) {
                        ArrayList parcelableArrayList = bundleExtra.getParcelableArrayList(azr.b.ekm);
                        String string2 = bundleExtra.getString(azr.b.ekg);
                        if (parcelableArrayList != null && parcelableArrayList.size() > 0 && (string = (bundle = (Bundle) parcelableArrayList.get(0)).getString(azr.a.ejg)) != null) {
                            if (equals3) {
                                try {
                                    jSONObject.put("keytype", qK(bundle.getInt("token_type")));
                                } catch (JSONException e4) {
                                } catch (Exception e5) {
                                }
                            }
                            jSONObject.put("key", string);
                            if (string2 != null) {
                                jSONObject.put(za.e.eqU, string2);
                            }
                        }
                    }
                } else if ("loginQQ".equals(split[0]) || "loginWX".equals(split[0]) || "loginByPhone".equals(split[0]) || "login".equals(split[0])) {
                    int i2 = bundleExtra.getInt("result");
                    try {
                        jSONObject.put("ret", i2);
                    } catch (JSONException e6) {
                        e6.printStackTrace();
                    }
                    if (i2 == 0 && (accountInfo2 = (AccountInfo) bundleExtra.getParcelable(azr.b.ekj)) != null) {
                        try {
                            jSONObject.put(za.e.eqU, accountInfo2.dxQ);
                            jSONObject.put("openid", accountInfo2.dxP);
                            String str18 = accountInfo2.name;
                            if (str18 != null) {
                                jSONObject.put("name", str18);
                            }
                        } catch (JSONException e7) {
                            e7.printStackTrace();
                        }
                    }
                } else if ("logoutQQ".equals(split[0])) {
                    int i3 = bundleExtra.getInt("result");
                    try {
                        jSONObject.put("ret", i3);
                    } catch (JSONException e8) {
                        e8.printStackTrace();
                    }
                    if (i3 == 0 && (accountInfo3 = (AccountInfo) bundleExtra.getParcelable(azr.b.ekj)) != null) {
                        try {
                            jSONObject.put(za.e.eqU, accountInfo3.dxQ);
                        } catch (JSONException e9) {
                            e9.printStackTrace();
                        }
                    }
                } else if ("getAccountFace".equals(split[0])) {
                    int i4 = bundleExtra.getInt("result");
                    byte[] byteArray = bundleExtra.getByteArray("face");
                    String string3 = bundleExtra.getString(azr.b.bxD);
                    if (i4 == 0) {
                        try {
                            jSONObject.put("ret", i4);
                            if (byteArray != null) {
                                jSONObject.put("avatar", ts.encodeToString(byteArray, 2));
                            }
                            if (!TextUtils.isEmpty(string3)) {
                                jSONObject.put("faceUrl", string3);
                            }
                        } catch (JSONException e10) {
                            e10.printStackTrace();
                        }
                    }
                }
                if (f.this.ghP.fqY != null) {
                    f.this.clZ.post(new Runnable() {
                        @Override
                        public void run() {
                            if (f.this.ghP.fqY != null) {
                                f.this.ghP.fqY.loadUrl(String.format("javascript:handleMessageFromTcs('onCallback', '%s')", jSONObject.toString()));
                            }
                        }
                    });
                    return;
                }
                return;
            }
            if (split.length == 6) {
                String str19 = split[3];
                String str20 = split[4];
                if (intExtra != 0) {
                    a(str19, Integer.valueOf(str20).intValue(), Integer.valueOf(intExtra));
                    return;
                }
                if (bundleExtra == null) {
                    a(str19, Integer.valueOf(str20).intValue(), -1);
                    return;
                }
                MainAccountInfo mainAccountInfo2 = (MainAccountInfo) bundleExtra.getParcelable(azr.b.ekp);
                if (mainAccountInfo2 != null) {
                    String valueOf3 = String.valueOf(mainAccountInfo2.dxX);
                    String str21 = mainAccountInfo2.an;
                    Intent intent2 = new Intent(za.eut);
                    intent2.putExtra(za.a.euv, valueOf3);
                    intent2.putExtra(za.a.eux, str21);
                    intent2.putExtra(za.a.egD, stringExtra);
                    f.this.mContext.sendBroadcast(intent2, d.s.dvj);
                    return;
                }
                final JSONObject jSONObject2 = new JSONObject();
                try {
                    jSONObject2.put("sessionId", str19);
                    jSONObject2.put("callbackId", str20);
                    jSONObject2.put("err_msg", StrategyConst.e.cGe);
                    jSONObject2.put("ret", -1);
                    jSONObject2.put("state", "none");
                } catch (JSONException e11) {
                }
                if (f.this.ghP.fqY != null) {
                    f.this.clZ.post(new Runnable() {
                        @Override
                        public void run() {
                            if (f.this.ghP.fqY != null) {
                                f.this.ghP.fqY.loadUrl(String.format("javascript:handleMessageFromTcs('onCallback', '%s')", jSONObject2.toString()));
                            }
                        }
                    });
                }
            }
        }

        public String a(String str, int i, String str2, String str3, String str4, boolean z) {
            if (str3 == null) {
                e(str, i, "check_arg:params is null");
                return null;
            }
            try {
                String string = new JSONObject(str3).getString(str4);
                if (string == null) {
                    e(str, i, String.format("argument %s must not be null or empty", str4));
                    return null;
                }
                if (z || !SQLiteDatabase.KeyEmpty.equals(string)) {
                    return string;
                }
                e(str, i, String.format("argument %s must not be null or empty", str4));
                return SQLiteDatabase.KeyEmpty;
            } catch (JSONException e) {
                e(str, i, "invoke " + str2 + ", parse arguments exception: " + e.getMessage());
                return null;
            }
        }

        public void pB(String str) {
            JSONObject jSONObject = new JSONObject();
            try {
                jSONObject.put("eventName", SQLiteDatabase.KeyEmpty + str);
            } catch (JSONException e) {
                e.printStackTrace();
            }
            d(jSONObject);
        }

        public void d(final JSONObject jSONObject) {
            if (f.this.ghP.fqY != null) {
                f.this.clZ.post(new Runnable() {
                    @Override
                    public void run() {
                        if (f.this.ghP.fqY != null) {
                            f.this.ghP.fqY.loadUrl(String.format("javascript:handleMessageFromTcs('event:broadcast', '%s')", jSONObject.toString()));
                        }
                    }
                });
            }
        }

        public void a(String str, int i, Object obj) {
            a(str, i, obj, (b) null);
        }

        public void a(final String str, final int i, final Object obj, final b bVar) {
            if (f.this.ghP.fqY != null) {
                f.this.clZ.post(new Runnable() {
                    @Override
                    public void run() {
                        JSONObject jSONObject = new JSONObject();
                        try {
                            jSONObject.put("sessionId", SQLiteDatabase.KeyEmpty + str);
                            jSONObject.put("callbackId", SQLiteDatabase.KeyEmpty + i);
                            jSONObject.put("err_msg", StrategyConst.e.cGe);
                            jSONObject.put("ret", SQLiteDatabase.KeyEmpty + obj);
                        } catch (JSONException e) {
                            e.printStackTrace();
                        }
                        if (f.this.ghP.fqY != null) {
                            f.this.ghP.fqY.loadUrl(String.format("javascript:handleMessageFromTcs('onCallback', '%s')", jSONObject.toString()));
                        }
                        if (bVar != null) {
                            bVar.kH(0);
                        }
                    }
                });
            } else if (bVar != null) {
                bVar.kH(-1);
            }
        }

        public void a(final String str, final int i, final JSONObject jSONObject, final b bVar) {
            if (f.this.ghP.fqY != null) {
                f.this.clZ.post(new Runnable() {
                    @Override
                    public void run() {
                        try {
                            jSONObject.put("sessionId", SQLiteDatabase.KeyEmpty + str);
                            jSONObject.put("callbackId", SQLiteDatabase.KeyEmpty + i);
                            jSONObject.put("err_msg", StrategyConst.e.cGe);
                        } catch (JSONException e) {
                            e.printStackTrace();
                        }
                        if (f.this.ghP.fqY != null) {
                            f.this.ghP.fqY.loadUrl(String.format("javascript:handleMessageFromTcs('onCallback', '%s')", jSONObject.toString()));
                        }
                        if (bVar != null) {
                            bVar.kH(0);
                        }
                    }
                });
            } else if (bVar != null) {
                bVar.kH(-1);
            }
        }

        public void e(final String str, final int i, final String str2) {
            if (f.this.ghP.fqY != null) {
                f.this.clZ.post(new Runnable() {
                    @Override
                    public void run() {
                        JSONObject jSONObject = new JSONObject();
                        try {
                            jSONObject.put("sessionId", SQLiteDatabase.KeyEmpty + str);
                            jSONObject.put("callbackId", SQLiteDatabase.KeyEmpty + i);
                            jSONObject.put("err_msg", SQLiteDatabase.KeyEmpty + str2);
                        } catch (JSONException e) {
                            e.printStackTrace();
                        }
                        if (f.this.ghP.fqY != null) {
                            f.this.ghP.fqY.loadUrl(String.format("javascript:handleMessageFromTcs('onCallback', '%s')", jSONObject.toString()));
                        }
                    }
                });
            }
        }

        private int F(String str, boolean z) {
            int i;
            String str2 = f.this.ghT;
            if (str2 == null || !URLUtil.isNetworkUrl(str2)) {
                return 2;
            }
            synchronized (this) {
                if (this.giQ == null) {
                    this.giQ = amL();
                }
                if (this.giR == null) {
                    this.giR = amK();
                }
            }
            try {
                String host = Uri.parse(str2).getHost();
                C0038f c0038f = null;
                synchronized (this) {
                    Iterator<C0038f> it = this.giQ.iterator();
                    while (true) {
                        if (!it.hasNext()) {
                            break;
                        }
                        C0038f next = it.next();
                        if (host.endsWith(next.gjH)) {
                            c0038f = next;
                            break;
                        }
                    }
                }
                if (c0038f == null) {
                    i = 2;
                } else if (!z || str == null) {
                    i = 1;
                } else {
                    synchronized (this) {
                        Integer num = this.giR.get(str);
                        if (num == null) {
                            return 3;
                        }
                        int intValue = num.intValue();
                        if (c0038f.gjI.size() > 0) {
                            i = c0038f.gjI.contains(Integer.valueOf(intValue)) ? 1 : 2;
                        } else if (c0038f.gjJ.size() > 0) {
                            i = c0038f.gjJ.contains(Integer.valueOf(intValue)) ? 2 : 1;
                        } else {
                            i = 1;
                        }
                    }
                }
            } catch (Exception e) {
                com.tencent.server.base.d.n(e);
                i = 2;
            }
            return i;
        }

        private Map<String, Integer> amK() {
            HashMap hashMap = new HashMap();
            hashMap.put("appKey", 3);
            hashMap.put(TMSDKContext.CON_PLATFORM, 4);
            hashMap.put("apiVersion", 5);
            hashMap.put("isTcsWebview", 6);
            hashMap.put("checkPermission", 7);
            hashMap.put("isQQSecureInstalled", 100);
            hashMap.put("isQQSecureOfficial", 101);
            hashMap.put("getQQSecureVersionCode", 102);
            hashMap.put("getQQSecureVersionName", 103);
            hashMap.put("getQQSecureBuildNo", 104);
            hashMap.put("shareTimeline", 300);
            hashMap.put("sendAppMessage", 301);
            hashMap.put("share2App", 302);
            hashMap.put("gotoQQSecure", 400);
            hashMap.put("gotoAppView", 401);
            hashMap.put("gotoWXWebView", 402);
            hashMap.put("setTitle", 500);
            hashMap.put("setRightTopBtnShowable", 501);
            hashMap.put("setMenuItemsShowable", 502);
            hashMap.put("setThemeColor", 503);
            hashMap.put("download", 504);
            hashMap.put("getLocation", 600);
            hashMap.put("getQQLoginState", 700);
            hashMap.put("getQQLoginKey", 701);
            hashMap.put("loginQQ", 702);
            hashMap.put("logoutQQ", 703);
            hashMap.put("loginWX", 704);
            hashMap.put("getWXLoginState", 705);
            hashMap.put("getWXLoginKey", 706);
            hashMap.put("loginByPhone", 707);
            hashMap.put("getMainAccountInfo", Integer.valueOf(TMAssistantDownloadSDKErrorCode.DownloadSDKErrorCode_URL_HOOK));
            hashMap.put("getAccountFace", Integer.valueOf(TMAssistantDownloadSDKErrorCode.DownloadSDKErrorCode_REDIRECT_TOO_MANY_TIMES));
            hashMap.put("login", Integer.valueOf(TMAssistantDownloadSDKErrorCode.DownloadSDKErrorCode_WRITE_FILE_NO_ENOUGH_SPACE));
            hashMap.put("getActToken", Integer.valueOf(TMAssistantDownloadSDKErrorCode.DownloadSDKErrorCode_WRITE_FILE_SDCARD_EXCEPTION));
            hashMap.put("isPkgInstalled", Integer.valueOf(akg.cPm));
            hashMap.put("isPkgOfficial", 801);
            hashMap.put("getPkgVersionCode", 802);
            hashMap.put("getPkgVersionName", 803);
            hashMap.put("getInfo", Integer.valueOf(hv.FL));
            hashMap.put("getNetworkType", 1201);
            hashMap.put("launch3rdApp", Integer.valueOf(hv.RJ));
            hashMap.put("sendMessage", 1400);
            hashMap.put("copy2Clipboard", 1500);
            hashMap.put("toggleSoftInput", 1600);
            hashMap.put("clearAllCookie", 1601);
            hashMap.put("insertQQSecureUsageRecord", Integer.valueOf(vv.e.aXW));
            return hashMap;
        }

        public List<C0038f> amL() {
            ArrayList<pz> arrayList;
            String[] split;
            String[] split2;
            String str = tmsdk.common.module.update.e.ecS;
            ArrayList arrayList2 = new ArrayList();
            qa qaVar = (qa) z.a(f.this.mContext, str, tmsdk.common.module.update.e.ms(jb.aid), new qa(), HTTP.UTF_8);
            if (qaVar != null && (arrayList = qaVar.ig) != null && arrayList.size() > 0) {
                Iterator<pz> it = arrayList.iterator();
                while (it.hasNext()) {
                    pz next = it.next();
                    if (next != null && next.ib != null) {
                        try {
                            C0038f c0038f = new C0038f();
                            c0038f.gjH = next.ib;
                            if (!TextUtils.isEmpty(next.ic) && (split2 = next.ic.split(",")) != null && split2.length > 0) {
                                for (String str2 : split2) {
                                    String trim = str2.trim();
                                    if (!TextUtils.isEmpty(trim)) {
                                        c0038f.gjI.add(Integer.valueOf(trim));
                                    }
                                }
                            }
                            if (!TextUtils.isEmpty(next.ie) && (split = next.ie.split(",")) != null && split.length > 0) {
                                for (String str3 : split) {
                                    String trim2 = str3.trim();
                                    if (!TextUtils.isEmpty(trim2)) {
                                        c0038f.gjJ.add(Integer.valueOf(trim2));
                                    }
                                }
                            }
                            arrayList2.add(c0038f);
                        } catch (Exception e) {
                            com.tencent.server.base.d.n(e);
                        }
                    }
                }
            }
            if (arrayList2.isEmpty()) {
                C0038f c0038f2 = new C0038f();
                c0038f2.gjH = ".qq.com";
                arrayList2.add(c0038f2);
            }
            return arrayList2;
        }

        public boolean amM() {
            sd e;
            qz qzVar = (qz) bgm.nL(12);
            if (qzVar == null || (e = qzVar.e("com.tencent.qqpimsecure", 16)) == null) {
                return false;
            }
            return "00B1208638DE0FCD3E920886D658DAF6".equalsIgnoreCase(e.sz());
        }

        public int a(int i, String str, String str2, int i2, int i3, String str3) {
            if (i != -1) {
                Bundle bundle = new Bundle();
                bundle.putString(za.f.eqW, str);
                bundle.putString(za.f.eqX, str2);
                bundle.putInt(za.f.eqY, i2);
                bundle.putInt(za.f.eqZ, i3);
                if (TextUtils.isEmpty(str3)) {
                    if (f.this.gig == 1) {
                        bundle.putInt(za.a.ehQ, f.this.gig);
                    }
                    rl.b(f.this.mContext, rl.b.dcU, i, bundle);
                } else {
                    rl.a(f.this.mContext, rl.b.dcU, str3, i, bundle);
                }
            }
            return 0;
        }

        public int pC(final String str) {
            if (f.this.ghO == null) {
                return -1;
            }
            if (str != null) {
                f.this.clZ.post(new Runnable() {
                    @Override
                    public void run() {
                        f.this.ghP.nK(str);
                    }
                });
                return 0;
            }
            return -2;
        }

        public int di(final boolean z) {
            if (f.this.ghO != null) {
                f.this.clZ.post(new Runnable() {
                    @Override
                    public void run() {
                        f.this.ghP.fd(z);
                    }
                });
                return 0;
            }
            return -1;
        }
    }

    public boolean pu(String str) {
        qz qzVar;
        if (str != null && (qzVar = (qz) bgm.nL(12)) != null) {
            return qzVar.df(str);
        }
        return false;
    }

    public boolean aZ(String str, String str2) {
        sd e2;
        if (str == null || str2 == null) {
            return false;
        }
        qz qzVar = (qz) bgm.nL(12);
        if (qzVar == null || (e2 = qzVar.e(str, 16)) == null) {
            return false;
        }
        return str2.equalsIgnoreCase(e2.sz());
    }

    public int pv(String str) {
        sd e2;
        if (str == null) {
            return 0;
        }
        qz qzVar = (qz) bgm.nL(12);
        if (qzVar == null || (e2 = qzVar.e(str, 8)) == null) {
            return 0;
        }
        return e2.bL();
    }

    public String pw(String str) {
        qz qzVar;
        sd e2;
        if (str != null && (qzVar = (qz) bgm.nL(12)) != null && (e2 = qzVar.e(str, 8)) != null) {
            return e2.getVersion();
        }
        return "0.0.0";
    }

    public boolean amC() {
        String pw = pw(aaf.b.dnj);
        return pw == null || !pw.contains("6.0.2");
    }

    public void a(final String str, final String str2, final String str3, final String str4, final Bitmap bitmap, final boolean z, final g.a aVar) {
        if (!this.ghW.isWXAppInstalled()) {
            uilib.components.g.d(this.mContext, bdh.h.flX);
            if (aVar != null) {
                aVar.onError(-1000);
                return;
            }
            return;
        }
        if (!this.ghW.isWXAppSupportAPI()) {
            uilib.components.g.d(this.mContext, bdh.h.flV);
            if (aVar != null) {
                aVar.onError(-1001);
                return;
            }
            return;
        }
        if (z && !this.ghW.rm()) {
            uilib.components.g.d(this.mContext, bdh.h.flV);
            if (aVar != null) {
                aVar.onError(-1002);
                return;
            }
            return;
        }
        new Thread(new Runnable() {
            @Override
            public void run() {
                File px;
                String O = zb.O(zb.cZu, SQLiteDatabase.KeyEmpty + f.amJ());
                boolean amC = f.this.amC();
                if (aVar != null && amC) {
                    synchronized (f.this.giA) {
                        f.this.giA.put(O, aVar);
                    }
                    synchronized (f.this.giB) {
                        f.this.giB.put(O, Boolean.valueOf(z));
                    }
                }
                try {
                    if (bitmap != null) {
                        f.this.ghW.a(str, str2, str3, bitmap, z, O);
                    } else {
                        Bitmap bitmap2 = null;
                        if (!za.ff(str4) && (px = f.px(str4)) != null && px.exists()) {
                            bitmap2 = ajg.eg(px.getAbsolutePath());
                        }
                        if (bitmap2 == null) {
                            bitmap2 = BitmapFactory.decodeResource(f.this.mContext.getResources(), bdh.e.feH);
                        }
                        f.this.ghW.a(str, str2, str3, bitmap2, z, O);
                    }
                    if (aVar != null && !amC) {
                        aVar.onSuccess();
                    }
                } catch (Exception e2) {
                    synchronized (f.this.giA) {
                        f.this.giA.remove(O);
                        synchronized (f.this.giB) {
                            f.this.giB.remove(O);
                        }
                    }
                }
            }
        }).start();
    }

    public void a(final boolean z, final String str, final String str2, final String str3, final String str4, final Bitmap bitmap, final g.a aVar) {
        final uilib.components.e eVar = new uilib.components.e(getActivity());
        eVar.setTitle(getActivity().getResources().getString(bdh.h.fls));
        eVar.eK(false);
        ArrayList arrayList = new ArrayList();
        List<g.b> sj = this.ghY.sj();
        if (sj == null || sj.isEmpty()) {
            if (aVar != null) {
                aVar.onError(-101);
                return;
            }
            return;
        }
        Resources resources = getActivity().getResources();
        for (g.b bVar : sj) {
            aqh aqhVar = new aqh(resources.getDrawable(bVar.dfZ), bVar.bcc);
            aqhVar.mF(3);
            aqhVar.setTag(bVar);
            aqhVar.a(new uilib.components.item.b() {
                @Override
                public void a(aow aowVar, int i) {
                    if (eVar != null) {
                        eVar.dismiss();
                    }
                    if (aowVar != null) {
                        final g.b bVar2 = (g.b) aowVar.getTag();
                        if (bVar2.dfY.activityInfo.packageName.equals(aaf.b.dnj)) {
                            boolean z2 = bVar2.hHd == g.c.WeiXinTime;
                            if (z) {
                                if (z2) {
                                    yz.c(bgh.PQ().kH(), 260406, 4);
                                } else {
                                    yz.c(bgh.PQ().kH(), 260407, 4);
                                }
                            }
                            f.this.a(str, str2, str3, str4, bitmap, z2, aVar);
                            return;
                        }
                        new Thread(new Runnable() {
                            @Override
                            public void run() {
                                File file = null;
                                if (!za.ff(str4)) {
                                    file = f.px(str4);
                                }
                                f.this.ghY.a(bVar2.dfY, str, str2 + " 地址:" + str3, bitmap, file, aVar);
                            }
                        }).start();
                    }
                }
            });
            if (aqhVar != null) {
                arrayList.add(aqhVar);
            }
        }
        eVar.a(getActivity().getResources().getString(bdh.h.cancel), new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (eVar != null) {
                    eVar.dismiss();
                }
            }
        });
        eVar.G(arrayList);
        eVar.show();
    }

    public static File px(String str) {
        InputStream inputStream;
        FileOutputStream fileOutputStream;
        InputStream inputStream2;
        FileOutputStream fileOutputStream2 = null;
        File file = new File(ajk.csT);
        int hashCode = str.hashCode();
        String str2 = hashCode >= 0 ? SQLiteDatabase.KeyEmpty + hashCode : SQLiteDatabase.KeyEmpty + hashCode + "_";
        File file2 = new File(file, str2 + ".temp");
        File file3 = new File(file, str2 + ".imgf");
        if (file3.exists()) {
            return file3;
        }
        if (URLUtil.isNetworkUrl(str) && "mounted".equals(Environment.getExternalStorageState())) {
            try {
                if (file2.exists()) {
                    file2.delete();
                }
                file2.getAbsoluteFile().getParentFile().mkdirs();
                file2.createNewFile();
                HttpURLConnection httpURLConnection = (HttpURLConnection) new URL(str).openConnection();
                httpURLConnection.setConnectTimeout(5000);
                httpURLConnection.setRequestMethod("GET");
                httpURLConnection.setDoInput(true);
                if (httpURLConnection.getResponseCode() == 200) {
                    inputStream = httpURLConnection.getInputStream();
                    try {
                        fileOutputStream = new FileOutputStream(file2);
                    } catch (Exception e2) {
                        fileOutputStream = null;
                        inputStream2 = inputStream;
                        if (inputStream2 != null) {
                            try {
                                inputStream2.close();
                            } catch (IOException e3) {
                            }
                        }
                        if (fileOutputStream != null) {
                            try {
                                fileOutputStream.close();
                            } catch (IOException e4) {
                            }
                        }
                        if (file2.exists()) {
                        }
                        return null;
                    } catch (Throwable th) {
                        th = th;
                        if (inputStream != null) {
                            try {
                                inputStream.close();
                            } catch (IOException e5) {
                            }
                        }
                        if (fileOutputStream2 != null) {
                            throw th;
                        }
                        try {
                            fileOutputStream2.close();
                            throw th;
                        } catch (IOException e6) {
                            throw th;
                        }
                    }
                    try {
                        byte[] bArr = new byte[1024];
                        while (true) {
                            int read = inputStream.read(bArr);
                            if (read == -1) {
                                break;
                            }
                            fileOutputStream.write(bArr, 0, read);
                        }
                        fileOutputStream.flush();
                    } catch (Exception e7) {
                        inputStream2 = inputStream;
                        if (inputStream2 != null) {
                        }
                        if (fileOutputStream != null) {
                        }
                        if (file2.exists()) {
                        }
                        return null;
                    } catch (Throwable th2) {
                        fileOutputStream2 = fileOutputStream;
                        th = th2;
                        if (inputStream != null) {
                        }
                        if (fileOutputStream2 != null) {
                        }
                    }
                } else {
                    fileOutputStream = null;
                    inputStream = null;
                }
            } catch (Exception e8) {
                fileOutputStream = null;
                inputStream2 = null;
            } catch (Throwable th3) {
                th = th3;
                inputStream = null;
            }
            if (file2.renameTo(file3)) {
                file2.delete();
                if (inputStream != null) {
                    try {
                        inputStream.close();
                    } catch (IOException e9) {
                    }
                }
                if (fileOutputStream != null) {
                    try {
                        fileOutputStream.close();
                    } catch (IOException e10) {
                    }
                }
                return file3;
            }
            if (inputStream != null) {
                try {
                    inputStream.close();
                } catch (IOException e11) {
                }
            }
            if (fileOutputStream != null) {
                try {
                    fileOutputStream.close();
                } catch (IOException e12) {
                }
            }
            if (file2.exists()) {
                file2.delete();
            }
            return null;
        }
        return null;
    }

    public class e extends com.tencent.qqpimsecure.h5.b {
        private e() {
        }

        public void amN() {
            if (f.this.ghP.fqY != null) {
                final String title = f.this.ghP.fqY.getTitle();
                final String url = f.this.ghP.fqY.getUrl();
                if (title == null) {
                    title = SQLiteDatabase.KeyEmpty;
                }
                if (url == null) {
                    url = SQLiteDatabase.KeyEmpty;
                }
                final String format = String.format(f.this.mContext.getResources().getString(bdh.h.flS), title);
                f.this.bvp.post(new Runnable() {
                    @Override
                    public void run() {
                        try {
                            yz.c(bgh.PQ().kH(), 260736, 4);
                            final Bitmap bitmap = null;
                            try {
                                WebView webView = f.this.ghP.fqY;
                                webView.setDrawingCacheEnabled(true);
                                webView.buildDrawingCache();
                                bitmap = webView.getDrawingCache().copy(Bitmap.Config.ARGB_8888, false);
                            } catch (Throwable th) {
                            }
                            if (bitmap == null) {
                                bitmap = BitmapFactory.decodeResource(f.this.mContext.getResources(), bdh.e.feH);
                            }
                            final g.a aVar = new g.a() {
                                @Override
                                public void onSuccess() {
                                }

                                @Override
                                public void onError(int i) {
                                }
                            };
                            f.this.clZ.post(new Runnable() {
                                @Override
                                public void run() {
                                    f.this.a(true, title, format, url, (String) null, bitmap, aVar);
                                }
                            });
                        } catch (Exception e) {
                        }
                    }
                });
            }
        }

        @Override
        public void amn() {
            List<g.b> sj;
            int i;
            super.amn();
            final com.tencent.qqpimsecure.h5.d amm = amm();
            amm.amq();
            if (za.ff(f.this.ghT) || (!f.this.py(f.this.ghT) && !URLUtil.isNetworkUrl(f.this.ghT))) {
                if ((f.this.gid & 16) != 0) {
                    amm.a(0, f.this.mContext.getResources().getString(bdh.h.flQ), f.this.mContext.getResources().getDrawable(bdh.e.fdI), false, new View.OnClickListener() {
                        @Override
                        public void onClick(View view) {
                            amm.dismiss();
                            if (f.this.ghP.fqY != null) {
                                f.this.ghP.fqY.reload();
                                f.this.amD();
                            }
                            yz.c(bgh.PQ().kH(), 260410, 4);
                        }
                    });
                    return;
                }
                return;
            }
            if (((f.this.gid & 32) == 0 && (f.this.gid & 1) == 0 && (f.this.gid & 2) == 0) || (sj = f.this.ghY.sj()) == null || sj.isEmpty()) {
                i = 0;
            } else {
                amm.a(0, f.this.mContext.getResources().getString(bdh.h.flU), f.this.mContext.getResources().getDrawable(bdh.e.fdJ), false, new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        amm.dismiss();
                        e.this.amN();
                    }
                });
                i = 1;
            }
            if ((f.this.gid & 4) != 0) {
                amm.a(i, f.this.mContext.getResources().getString(bdh.h.flG), f.this.mContext.getResources().getDrawable(bdh.e.fdF), false, new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        ClipboardManager clipboardManager;
                        amm.dismiss();
                        if (f.this.ghP.fqY != null && (clipboardManager = (ClipboardManager) f.this.getActivity().getSystemService("clipboard")) != null) {
                            String url = f.this.ghP.fqY.getUrl();
                            if (url == null) {
                                url = SQLiteDatabase.KeyEmpty;
                            }
                            clipboardManager.setText(url);
                            uilib.components.g.B(f.this.getActivity(), f.this.mContext.getResources().getString(bdh.h.flH));
                        }
                        yz.c(bgh.PQ().kH(), 260409, 4);
                    }
                });
                i++;
            }
            if ((f.this.gid & 8) != 0) {
                amm.a(i, f.this.mContext.getResources().getString(bdh.h.flM), f.this.mContext.getResources().getDrawable(bdh.e.fdE), false, new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        amm.dismiss();
                        if (f.this.ghP.fqY != null) {
                            try {
                                String url = f.this.ghP.fqY.getUrl();
                                if (url == null) {
                                    url = SQLiteDatabase.KeyEmpty;
                                }
                                akn.c(f.this.mContext, url, "6", 0);
                            } catch (Exception e) {
                                uilib.components.g.e(f.this.mContext, bdh.h.flN);
                            }
                        }
                        yz.c(bgh.PQ().kH(), 260411, 4);
                    }
                });
                i++;
            }
            if ((f.this.gid & 16) != 0) {
                amm.a(i, f.this.mContext.getResources().getString(bdh.h.flQ), f.this.mContext.getResources().getDrawable(bdh.e.fdI), false, new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        amm.dismiss();
                        if (f.this.ghP.fqY != null) {
                            if (f.this.ghP.gjN != null && f.this.ghP.gjN.isShown()) {
                                f.this.ghP.fqY.clearView();
                                f.this.ghP.gjN.setVisibility(4);
                            }
                            f.this.ghP.fqY.reload();
                            f.this.amD();
                        }
                        yz.c(bgh.PQ().kH(), 260410, 4);
                    }
                });
            }
        }

        @Override
        protected com.tencent.qqpimsecure.h5.d aml() {
            return new com.tencent.qqpimsecure.h5.d(f.this.mContext, bdh.e.fcu);
        }
    }

    public void amD() {
        this.gij = false;
        this.gik = false;
        this.gim = false;
        this.gil = false;
        this.gip = new StringBuilder();
    }

    public boolean py(String str) {
        if (str == null) {
            return false;
        }
        return str.equals("file:///android_asset/demo.html") || str.equals("file:///sdcard/demo.html");
    }

    public static boolean amE() {
        return Build.MODEL.toLowerCase().startsWith("oms");
    }

    private static boolean amF() {
        return uc.KF() >= 19 && !Build.MODEL.startsWith("MX");
    }

    public static String i(String str, String str2, int i) {
        return str + "|" + amG() + "|" + giD + "|" + str2 + "|" + i;
    }

    public void pz(String str) {
        ArrayList arrayList = new ArrayList();
        arrayList.add(str);
        yz.b(bgh.PQ().kH(), 261186, arrayList, 4);
    }

    private static int amG() {
        int i;
        synchronized (WebView.class) {
            if (giC + 1 == Integer.MAX_VALUE) {
                giC = 0;
            }
            i = giC + 1;
            giC = i;
        }
        return i;
    }

    public class C0038f {
        private String gjH;
        private List<Integer> gjI;
        private List<Integer> gjJ;

        private C0038f() {
            this.gjH = SQLiteDatabase.KeyEmpty;
            this.gjI = new ArrayList();
            this.gjJ = new ArrayList();
        }
    }
}