手机管家 v7.2.0版本的 MD5 值为:dd92ba71696e35a4b841cd1b5de53cd3

以下内容为反编译后的 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.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.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.conch.ConchService;
import meri.service.optimus.StrategyConst;
import meri.util.BaseReceiver;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import tcs.aht;
import tcs.aig;
import tcs.ajg;
import tcs.ajk;
import tcs.ajy;
import tcs.akg;
import tcs.akn;
import tcs.aky;
import tcs.ala;
import tcs.ale;
import tcs.anr;
import tcs.aow;
import tcs.ap;
import tcs.aqh;
import tcs.azr;
import tcs.bim;
import tcs.bir;
import tcs.blw;
import tcs.bql;
import tcs.hv;
import tcs.jb;
import tcs.ph;
import tcs.pz;
import tcs.qa;
import tcs.qz;
import tcs.rl;
import tcs.rv;
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 gEC = "https";
    private static String gED = "WeSecure";
    private static int gFw = 0;
    private static final String gFx = "WVSession_" + System.currentTimeMillis();
    private int bVO;
    private Handler bvp;
    private HandlerThread cDY;
    private Handler clZ;
    private uilib.templates.a gEE;
    private g gEF;
    private com.tencent.qqpimsecure.h5.b gEG;
    private boolean gEH;
    private boolean gEI;
    private String gEJ;
    private String gEK;
    private String gEL;
    private zb gEM;
    private a gEN;
    private com.tencent.server.task.g gEO;
    private boolean gEP;
    private boolean gEQ;
    private boolean gER;
    private boolean gES;
    private boolean gET;
    private boolean gEU;
    private boolean gEV;
    private int gEW;
    private int gEX;
    private com.tencent.qqpimsecure.h5.e gEY;
    private int gEZ;
    private String gFa;
    private String gFb;
    private boolean gFc;
    private boolean gFd;
    private boolean gFe;
    private boolean gFf;
    private String gFg;
    private StringBuilder gFh;
    private StringBuilder gFi;
    private boolean gFj;
    private int gFk;
    private String gFl;
    private long gFm;
    private boolean gFn;
    private String gFo;
    DownloadListener gFp;
    private byte[] gFq;
    private byte[] gFr;
    private String gFs;
    private String gFt;
    private Map<String, g.a> gFu;
    private Map<String, Boolean> gFv;
    private Context mContext;
    private final Object mLock;

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

    static boolean amX() {
        return amU();
    }

    static int amY() {
        return amV();
    }

    public f(Context context) {
        super(context);
        this.gEH = false;
        this.gEI = false;
        this.gEJ = null;
        this.gEK = null;
        this.gEL = null;
        this.gEM = null;
        this.bvp = null;
        this.clZ = new Handler(Looper.getMainLooper());
        this.cDY = null;
        this.gEN = null;
        this.gEO = null;
        this.gEP = false;
        this.gEQ = true;
        this.gER = false;
        this.gES = false;
        this.gET = false;
        this.gEU = false;
        this.gEW = 16;
        this.gEX = 16;
        this.gEZ = -1;
        this.gFc = false;
        this.gFd = false;
        this.gFe = false;
        this.gFf = false;
        this.gFh = new StringBuilder();
        this.gFi = new StringBuilder();
        this.gFj = false;
        this.gFk = -1;
        this.gFl = null;
        this.gFm = -1L;
        this.bVO = 0;
        this.mLock = new Object();
        this.gFn = true;
        this.gFp = new DownloadListener() {
            @Override
            public void onDownloadStart(String str, String str2, String str3, String str4, long j) {
                try {
                    f.this.gEL = str;
                    yz.c(bim.QJ().kH(), 260412, 4);
                    if (f.this.gEF.gGI != null) {
                        f.this.gEJ = f.this.gEF.gGI.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.gFq = null;
        this.gFr = null;
        this.gFs = null;
        this.gFt = null;
        this.gFu = new HashMap();
        this.gFv = new HashMap();
        this.mContext = context;
        this.gEO = new com.tencent.server.task.g(context);
    }

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

    @Override
    public View Zm() {
        try {
            this.gEV = getActivity().getIntent().getBooleanExtra(za.a.ehj, false);
            if (uilib.frame.f.dvy) {
                this.gEE.aE(false);
            }
            if (this.gEV) {
                return getActivity().getLayoutInflater().inflate(bql.g.gxP, (ViewGroup) null);
            }
            return getActivity().getLayoutInflater().inflate(bql.g.gxO, (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.gEF = new g(getActivity(), getContentView());
        this.gFj = getActivity().getIntent().getBooleanExtra(za.a.eir, false);
        this.gFk = getActivity().getIntent().getIntExtra(za.a.eis, -1);
        this.gFo = getActivity().getIntent().getStringExtra(za.a.eOf);
        amK();
        if (this.gEF.gGI == null) {
            getActivity().finish();
        } else {
            amM();
            amL();
        }
    }

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

    private void amK() {
        this.gEK = getActivity().getIntent().getStringExtra(za.a.ehk);
        boolean booleanExtra = getActivity().getIntent().getBooleanExtra(za.a.eqO, false);
        try {
            switch (this.gEW) {
                case 16:
                    this.gEF.p(getActivity().getResources().getDrawable(bql.e.gsY));
                    break;
                case 64:
                    this.gEF.p(getActivity().getResources().getDrawable(bql.e.gsY));
                    break;
                default:
                    this.gEF.p(getActivity().getResources().getDrawable(bql.e.gsX));
                    break;
            }
            if (this.gEH) {
                this.gEI = booleanExtra;
            } else {
                this.gEF.q(getActivity().getResources().getDrawable(bql.e.gsW));
            }
        } catch (Exception e2) {
        }
        if (getActivity().getIntent().getBooleanExtra("XF0wBA", false)) {
            this.gEF.fd(false);
        } else {
            this.gEF.fd(true);
        }
        this.gEF.dHr.setOnClickListener(this);
        this.gEF.gGG.setOnClickListener(this);
        this.gEF.dHq.setOnClickListener(this);
        this.gEG = new e();
        this.gEF.gGJ.setOnClickListener(this);
        boolean booleanExtra2 = getActivity().getIntent().getBooleanExtra(za.a.fmZ, false);
        String stringExtra = getActivity().getIntent().getStringExtra(za.a.fna);
        String stringExtra2 = getActivity().getIntent().getStringExtra(za.a.fnb);
        if (booleanExtra2 && !TextUtils.isEmpty(stringExtra)) {
            this.gEF.bf(stringExtra, stringExtra2);
            this.gEF.gGM.setOnClickListener(this);
        } else if (this.gEF.gGM != null) {
            this.gEF.gGM.setVisibility(8);
        }
    }

    @Override
    public void onClick(View view) {
        int id = view.getId();
        if (id == bql.f.gvc) {
            if (this.gEF.gGI != null) {
                clearView();
                this.gEF.gGI.reload();
                amS();
                return;
            }
            return;
        }
        if (id == bql.f.gws) {
            switch (this.gEW) {
                case 16:
                    if (this.gEF.gGI != null) {
                        clearView();
                        this.gEF.gGI.reload();
                        amS();
                    }
                    yz.c(com.tencent.server.base.d.aTe(), 260410, 4);
                    return;
                case 64:
                    if (this.gEK != null) {
                        this.gEF.gGI.loadUrl(this.gEK);
                        return;
                    }
                    return;
                default:
                    yz.c(com.tencent.server.base.d.aTe(), 260408, 4);
                    this.gEG.onClick(view);
                    return;
            }
        }
        if (id == bql.f.gvh) {
            if (!amP()) {
                if (this.gEH) {
                    if (this.gEF.gGI != null && this.gEF.gGI.canGoBack()) {
                        clearView();
                        this.gEU = true;
                        this.gEF.gGI.goBack();
                        return;
                    }
                    getActivity().finish();
                    return;
                }
                getActivity().finish();
                return;
            }
            return;
        }
        if (id == bql.f.gvg) {
            getActivity().finish();
            return;
        }
        if (id == bql.f.guC) {
            String stringExtra = getActivity().getIntent().getStringExtra(za.a.fnc);
            if (!TextUtils.isEmpty(stringExtra) && URLUtil.isNetworkUrl(stringExtra)) {
                this.gEF.gGI.loadUrl(stringExtra);
            } else {
                try {
                    int intValue = Integer.valueOf(stringExtra).intValue();
                    Intent launchIntentForPackage = this.mContext.getPackageManager().getLaunchIntentForPackage("com.tencent.qqpimsecure");
                    if (launchIntentForPackage != null) {
                        Bundle bundle = new Bundle();
                        bundle.putString(rl.cZS, rl.b.dcU);
                        if (intValue > 0) {
                            bundle.putInt(rl.cZT, intValue);
                        }
                        launchIntentForPackage.putExtras(bundle);
                        this.mContext.startActivity(launchIntentForPackage);
                    }
                } catch (Exception e2) {
                }
            }
            this.gEF.gGM.setVisibility(8);
        }
    }

    private void clearView() {
        if (this.gEF.gGJ != null && this.gEF.gGJ.isShown()) {
            this.gEF.gGI.clearView();
            this.gEF.gGJ.setVisibility(4);
        }
    }

    private void amL() {
        try {
            String stringExtra = getActivity().getIntent().getStringExtra("bF6efA");
            if (this.gEF.gGF != null) {
                if (stringExtra != null) {
                    this.gEF.gGF.setBackgroundColor(Color.parseColor(stringExtra));
                } else if (this.gEV) {
                    this.gEF.gGF.setBackgroundColor(0);
                }
            }
        } catch (Exception e2) {
        }
    }

    private void amM() {
        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(bim.QJ().kH(), 260403, 4);
        if (getActivity().getIntent().getBooleanExtra(vb.aQS, false)) {
            yz.c(bim.QJ().kH(), 260288, 4);
        }
        this.gEZ = getActivity().getIntent().getIntExtra(za.a.ehQ, -1);
        this.gFa = getActivity().getIntent().getStringExtra(za.a.eqR);
        this.gFb = getActivity().getIntent().getStringExtra(za.a.eqS);
        this.gER = getActivity().getIntent().getBooleanExtra(za.a.eSd, false);
        try {
            String stringExtra = getActivity().getIntent().getStringExtra("lxKcgA");
            this.gFl = 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.gEF.gGI != null) {
                this.gFm = System.currentTimeMillis();
                this.gEF.gGI.loadUrl(stringExtra);
            } else {
                getActivity().finish();
            }
        } catch (Throwable th) {
        }
    }

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

    @Override
    public void onNewIntent(Intent intent) {
        super.onNewIntent(intent);
        amM();
        amL();
        vr();
    }

    @Override
    public void WP() {
        super.WP();
        Intent intent = getActivity().getIntent();
        this.gFg = intent.getStringExtra(za.a.evB);
        if (!TextUtils.isEmpty(this.gFg)) {
            this.gFh.append("0-").append(this.gFg);
        }
        if (!TextUtils.isEmpty(this.gFg)) {
            this.gFh.append(",").append("1-").append(String.valueOf(System.currentTimeMillis()));
        }
        try {
            ConchService.ConchPushInfo conchPushInfo = (ConchService.ConchPushInfo) intent.getParcelableExtra("conch");
            if (conchPushInfo != null) {
                com.meri.service.notification.a.Xw().a(conchPushInfo, true);
            }
        } catch (Throwable th) {
            com.tencent.server.base.d.a(th, (String) null, (byte[]) null);
        }
        amN();
    }

    @SuppressLint({"SetJavaScriptEnabled"})
    private void amN() {
        try {
            this.cDY = new HandlerThread("webview-work", -2);
            this.cDY.start();
            this.bvp = new Handler(this.cDY.getLooper());
            this.gEF.gGI.setDownloadListener(this.gFp);
            this.gEF.gGI.setWebViewClient(new d());
            this.gEF.gGI.setWebChromeClient(new c());
            this.gEF.gGI.getSettings().setJavaScriptEnabled(true);
            this.gEF.gGI.getSettings().setDatabaseEnabled(true);
            this.gEF.gGI.getSettings().setDomStorageEnabled(true);
            this.gEF.gGI.getSettings().setCacheMode(-1);
            amO();
            if (!amT()) {
                this.gEF.gGI.getSettings().setSupportZoom(true);
                this.gEF.gGI.getSettings().setBuiltInZoomControls(true);
            }
            this.gEM = new zb(getActivity());
            this.gEN = new a();
            this.gEN.vr();
            String path = QQSecureApplication.getContext().getDir("database", 0).getPath();
            this.gEF.gGI.getSettings().setGeolocationEnabled(true);
            this.gEF.gGI.getSettings().setGeolocationDatabasePath(path);
            if (Build.VERSION.SDK_INT >= 21) {
                this.gEF.gGI.getSettings().setMixedContentMode(2);
            }
            if (Build.VERSION.SDK_INT >= 21) {
                CookieManager.getInstance().setAcceptThirdPartyCookies(this.gEF.gGI, true);
            }
        } catch (Throwable th) {
        }
        try {
            if (11 <= uc.KF()) {
                this.gEF.gGI.getClass().getDeclaredMethod("removeJavascriptInterface", String.class).invoke(this.gEF.gGI, "searchBoxJavaBridge_");
            }
        } catch (Throwable th2) {
        }
        vr();
    }

    private void amO() {
        try {
            String userAgentString = this.gEF.gGI.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(gED).append("/").append(packageManager.getPackageInfo(packageName, 0).versionCode);
            } else {
                sb.append(" ").append(packageName).append("/").append(packageManager.getPackageInfo(packageName, 0).versionCode);
            }
            this.gEF.gGI.getSettings().setUserAgentString(userAgentString + sb.toString());
        } catch (Throwable th) {
        }
    }

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

    private boolean amP() {
        if (this.gEZ != 1) {
            return false;
        }
        Bundle bundle = new Bundle();
        bundle.putInt(za.a.ehQ, this.gEZ);
        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 (amP()) {
                return true;
            }
            if (this.gES) {
                getActivity().finish();
                return true;
            }
            if (this.gEF.gGI != null && this.gEF.gGI.canGoBack()) {
                if (this.gEF.gGJ != null && this.gEF.gGJ.isShown()) {
                    this.gEF.gGI.clearView();
                    this.gEF.gGJ.setVisibility(4);
                }
                this.gEU = true;
                this.gEF.gGI.goBack();
                return true;
            }
        }
        return super.onKeyDown(i, keyEvent);
    }

    @Override
    public void onActivityResult(int i, int i2, Intent intent) {
        if (i == 100 && this.gEY != null) {
            this.gEY.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.gES = 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);
            if (f.this.gET && !TextUtils.isEmpty(f.this.gFl) && f.this.gFl.equals(str) && f.this.gEU) {
                f.this.getActivity().finish();
            }
            f.this.gEQ = true;
            f.this.gEJ = str;
            f.this.gEP = false;
            if (!f.this.gFf && !TextUtils.isEmpty(f.this.gFg)) {
                f.this.gFf = true;
                f.this.gFi.append(",").append("2-").append(String.valueOf(System.currentTimeMillis()));
            }
        }

        @Override
        public void onPageFinished(WebView webView, String str) {
            try {
                super.onPageFinished(webView, str);
            } catch (Exception e) {
            }
            try {
                if (f.this.gEL == null || !f.this.gEL.equals(str)) {
                    if (webView != null && !f.this.gEP) {
                        String title = webView.getTitle();
                        if (title == null) {
                            title = SQLiteDatabase.KeyEmpty;
                        }
                        f.this.gEF.nK(title);
                    }
                    f.this.gEW = f.this.gEX;
                    new Thread(new Runnable() {
                        @Override
                        public void run() {
                            f.this.amQ();
                        }
                    }).start();
                }
                if (f.this.gEF.gGI != null && f.this.gEI && f.this.gEF.gGI.canGoBack()) {
                    f.this.gEF.rL(0);
                }
                if (!f.this.gFc && !TextUtils.isEmpty(f.this.gFg)) {
                    f.this.gFc = true;
                    f.this.gFi.append(",").append("5-").append(String.valueOf(System.currentTimeMillis()));
                }
                if (f.this.gFj) {
                    if (f.this.gFk != -1 && !TextUtils.isEmpty(f.this.gFl)) {
                        long currentTimeMillis = System.currentTimeMillis() - f.this.gFm;
                        ArrayList arrayList = new ArrayList();
                        arrayList.add(String.valueOf(f.this.gFk));
                        arrayList.add(String.valueOf(currentTimeMillis));
                        arrayList.add(String.valueOf(f.this.bVO));
                        arrayList.add(f.this.gFl);
                        yz.b(bim.QJ().kH(), 263247, arrayList, 1);
                        f.this.gFk = -1;
                    }
                    f.this.gFj = false;
                }
            } catch (Throwable th) {
            }
        }

        @Override
        public void onReceivedSslError(WebView webView, SslErrorHandler sslErrorHandler, SslError sslError) {
            f.this.gEQ = 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.gEP = true;
            f.this.bVO = i;
            if (f.this.gEF.gGJ != null) {
                f.this.gEF.gGJ.setVisibility(0);
            }
            if (f.this.gEF.gGL != null && !TextUtils.isEmpty(f.this.gFb)) {
                f.this.gEF.gGL.setText(f.this.gFb);
            }
            try {
                if (!TextUtils.isEmpty(f.this.gFa)) {
                    f.this.gEF.nK(f.this.gFa);
                } else {
                    f.this.gEF.nK(f.this.mContext.getResources().getString(bql.i.gAC));
                }
            } catch (Exception e) {
            }
            if (!f.this.gFd && !TextUtils.isEmpty(f.this.gFg)) {
                f.this.gFd = true;
                f.this.gFi.append(",").append("4-").append(String.valueOf(System.currentTimeMillis()));
            }
        }
    }

    private String pJ(String str) {
        try {
            return new String(TccCryptor.decrypt(i.oK(str), null), "UTF-8");
        } catch (Exception e2) {
            return SQLiteDatabase.KeyEmpty;
        }
    }

    public void amQ() {
        if (this.gEF.gGI != null) {
            try {
                if (this.gFq == null) {
                    this.gFq = i.a(this.mContext, "jsapi.js");
                }
                if (this.gFq != null && this.gFq.length > 0) {
                    if (this.gFr == null) {
                        this.gFr = TccCryptor.decrypt(this.mContext, this.gFq, null);
                    }
                    if (this.gFr != null && this.gFr.length > 0) {
                        if (this.gFs == null) {
                            this.gFs = new String(this.gFr, "utf-8");
                        }
                        if (!TextUtils.isEmpty(this.gFo) && this.gFt == null) {
                            this.gFt = pJ(this.gFo);
                        }
                        this.clZ.post(new Runnable() {
                            @Override
                            public void run() {
                                if (f.this.gEF.gGI != null) {
                                    f.this.gEF.gGI.loadUrl("javascript:" + f.this.gFs);
                                    JSONObject jSONObject = new JSONObject();
                                    try {
                                        jSONObject.put("logType", tw.kG() ? "alert" : "console");
                                        jSONObject.put("sessionId", "WebSession_" + System.currentTimeMillis());
                                    } catch (JSONException e2) {
                                    }
                                    f.this.gEF.gGI.loadUrl(String.format("javascript:handleMessageFromTcs('sys:init', '%s')", jSONObject.toString()));
                                    if (!TextUtils.isEmpty(f.this.gFt)) {
                                        f.this.gEF.gGI.loadUrl("javascript:" + f.this.gFt);
                                    }
                                }
                            }
                        });
                    }
                }
            } catch (Throwable th) {
            }
        }
    }

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

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

        @Override
        public void onReceivedTitle(WebView webView, String str) {
            super.onReceivedTitle(webView, str);
            if (!f.this.gEP) {
                if (str == null) {
                    str = SQLiteDatabase.KeyEmpty;
                }
                f.this.gEF.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.gEN != null) {
                                f.this.gEN.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.gEN != null) {
                                f.this.gEN.on(str3, str4);
                            }
                        }
                    });
                }
                if (jsResult == null) {
                    return true;
                }
                jsResult.confirm();
                return true;
            }
            return super.onJsConfirm(webView, str, str2, jsResult);
        }

        @Override
        public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> valueCallback, WebChromeClient.FileChooserParams fileChooserParams) {
            f.this.gEY = new com.tencent.qqpimsecure.h5.e(f.this.mContext);
            f.this.gEY.onShowFileChooser(webView, valueCallback, fileChooserParams);
            return true;
        }

        public void openFileChooser(ValueCallback<Uri> valueCallback, String str, String str2) {
            f.this.gEY = new com.tencent.qqpimsecure.h5.e(f.this.mContext);
            f.this.gEY.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 C0041a gFK;
        private List<C0043f> gFL;
        private Map<String, Integer> gFM;

        private a() {
            this.gFK = null;
            this.gFL = null;
            this.gFM = null;
        }

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

            @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, bql.i.gAz);
                                break;
                            case -4:
                            case -3:
                            case -1:
                                uilib.components.g.d(context, bql.i.gAx);
                                break;
                            case 0:
                                uilib.components.g.d(context, bql.i.gAA);
                                if (stringExtra != null) {
                                    synchronized (f.this.gFv) {
                                        bool = (Boolean) f.this.gFv.remove(stringExtra);
                                    }
                                    if (bool != null) {
                                        if (bool.booleanValue()) {
                                            yz.c(bim.QJ().kH(), 261130, 4);
                                            break;
                                        } else {
                                            yz.c(bim.QJ().kH(), 261131, 4);
                                            break;
                                        }
                                    }
                                }
                                break;
                        }
                        if (stringExtra != null) {
                            synchronized (f.this.gFu) {
                                aVar = (g.a) f.this.gFu.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.O(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.gFL = a.this.ana();
                                    }
                                }
                            });
                            return;
                        }
                        return;
                    }
                    if (za.egz.equals(action)) {
                        a.this.M(intent);
                        return;
                    }
                    if (za.euu.equals(action)) {
                        a.this.N(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);
                            return;
                        } catch (JSONException e) {
                            e.printStackTrace();
                            return;
                        }
                    }
                    if (za.fhC.equals(action)) {
                        try {
                            f.this.gFn = intent.getBooleanExtra(za.a.fhD, true);
                            synchronized (f.this.mLock) {
                                f.this.mLock.notify();
                            }
                        } catch (Throwable th) {
                        }
                    }
                }
            }
        }

        public void vr() {
            if (this.gFK == null) {
                this.gFK = new C0041a();
                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);
                intentFilter.addAction(za.fhC);
                try {
                    f.this.getActivity().registerReceiver(this.gFK, intentFilter, d.s.dvj, null);
                } catch (Exception e) {
                }
            }
        }

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

        @Override
        public void on(String str, String str2) {
            if (str2 != null && E(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(E(null, true)));
                yz.c(bim.QJ().kH(), 260415, 4);
                return;
            }
            int E = E(str2, true);
            if (E == 2) {
                e(str, i, "access_control:not_allow");
                return;
            }
            if (E == 3) {
                e(str, i, "system:function_not_exist");
                return;
            }
            if ("appKey".equals(str2)) {
                a(str, i, rl.ab(f.this.mContext));
                f.this.pP(String.valueOf(this.gFM.get("appKey")));
                return;
            }
            if (TMSDKContext.CON_PLATFORM.equals(str2)) {
                a(str, i, "android");
                f.this.pP(String.valueOf(this.gFM.get(TMSDKContext.CON_PLATFORM)));
                return;
            }
            if ("apiVersion".equals(str2)) {
                a(str, i, "20160728");
                f.this.pP(String.valueOf(this.gFM.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.pP(String.valueOf(a.this.gFM.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.anb()));
                        f.this.pP(String.valueOf(a.this.gFM.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.pP(String.valueOf(a.this.gFM.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.pP(String.valueOf(a.this.gFM.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.pP(String.valueOf(a.this.gFM.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.pP(String.valueOf(a.this.gFM.get("shareTimeline")));
                        } else {
                            f.this.pP(String.valueOf(a.this.gFM.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.gEJ == null ? SQLiteDatabase.KeyEmpty : f.this.gEJ;
                            }
                            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)) {
                f(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.pK(a)));
                        }
                        f.this.pP(String.valueOf(a.this.gFM.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.pL(a)));
                        }
                        f.this.pP(String.valueOf(a.this.gFM.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.pM(a));
                        }
                        f.this.pP(String.valueOf(a.this.gFM.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.be(string, string2)));
                            }
                            f.this.pP(String.valueOf(a.this.gFM.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.pP(String.valueOf(a.this.gFM.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.pS(a)));
                            a.this.pR("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.dg(z)));
                            if (z) {
                                f.this.pP(String.valueOf(a.this.gFM.get("setRightTopBtnShowable")) + "_show");
                            } else {
                                f.this.pP(String.valueOf(a.this.gFM.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.R(32, jSONObject.getBoolean("share"));
                                i3 = 0;
                            } catch (JSONException e) {
                            }
                            try {
                                f.this.R(1, jSONObject.getBoolean("shareTimeline"));
                                i3 = 0;
                            } catch (JSONException e2) {
                            }
                            try {
                                f.this.R(2, jSONObject.getBoolean("shareFriends"));
                                i3 = 0;
                            } catch (JSONException e3) {
                            }
                            try {
                                f.this.R(4, jSONObject.getBoolean("copyLink"));
                                i3 = 0;
                            } catch (JSONException e4) {
                            }
                            try {
                                f.this.R(8, jSONObject.getBoolean("browser"));
                                i3 = 0;
                            } catch (JSONException e5) {
                            }
                            try {
                                f.this.R(16, jSONObject.getBoolean("refresh"));
                            } catch (JSONException e6) {
                                i2 = i3;
                            }
                            f.this.clZ.post(new Runnable() {
                                @Override
                                public void run() {
                                    if ((f.this.gEW & 4) != 0 || (f.this.gEW & 8) != 0 || (f.this.gEW & 32) != 0) {
                                        f.this.gEF.p(f.this.getActivity().getResources().getDrawable(bql.e.gsX));
                                    } else {
                                        f.this.gEF.p(f.this.getActivity().getResources().getDrawable(bql.e.gsY));
                                    }
                                }
                            });
                            a.this.a(str, i, Integer.valueOf(i2));
                            f.this.pP(String.valueOf(a.this.gFM.get("setMenuItemsShowable")));
                        } catch (JSONException e7) {
                            a.this.e(str, i, "invoke " + str2 + ", parse arguments exception: " + e7.getMessage());
                        }
                    }
                });
                return;
            }
            if ("setThemeColor".equals(str2)) {
                l(str, i, str2, str3);
                return;
            }
            if ("getLocation".equals(str2)) {
                a(f.this.mContext, str, i, str2);
                return;
            }
            if ("share2App".equals(str2)) {
                m(str, i, str2, str3);
                return;
            }
            if ("getQQLoginState".equals(str2)) {
                s(str, i, str2, str3);
                return;
            }
            if ("getQQLoginKey".equals(str2)) {
                w(str, i, str2, str3);
                return;
            }
            if ("getWXLoginKey".equals(str2)) {
                x(str, i, str2, str3);
                return;
            }
            if ("login".equals(str2)) {
                z(str, i, str2, str3);
                return;
            }
            if ("loginQQ".equals(str2)) {
                A(str, i, str2, str3);
                return;
            }
            if ("logoutQQ".equals(str2)) {
                E(str, i, str2, str3);
                return;
            }
            if ("getWXLoginState".equals(str2)) {
                t(str, i, str2, str3);
                return;
            }
            if ("loginWX".equals(str2)) {
                B(str, i, str2, str3);
                return;
            }
            if ("loginByPhone".equals(str2)) {
                C(str, i, str2, str3);
                return;
            }
            if ("getMainAccountInfo".equals(str2)) {
                u(str, i, str2, str3);
                return;
            }
            if ("getActToken".equals(str2)) {
                q(str, i, str2, str3);
                return;
            }
            if ("getAccountFace".equals(str2)) {
                r(str, i, str2, str3);
                return;
            }
            if ("getInfo".equals(str2)) {
                o(str, i, str2, str3);
                return;
            }
            if ("launch3rdApp".equals(str2)) {
                p(str, i, str2, str3);
                return;
            }
            if ("sendMessage".equals(str2)) {
                j(str, i, str2, str3);
                return;
            }
            if ("copy2Clipboard".equals(str2)) {
                k(str, i, str2, str3);
                return;
            }
            if ("toggleSoftInput".equals(str2)) {
                h(str, i, str2, str3);
                return;
            }
            if ("gotoAppView".equals(str2)) {
                f(str, i, str2, str3);
                return;
            }
            if ("gotoWXWebView".equals(str2)) {
                g(str, i, str2, str3);
                return;
            }
            if ("download".equals(str2)) {
                i(str, i, str2, str3);
                return;
            }
            if ("getNetworkType".equals(str2)) {
                n(str, i, str2, str3);
                return;
            }
            if ("clearAllCookie".equals(str2)) {
                e(str, i, str2, str3);
                return;
            }
            if ("insertQQSecureUsageRecord".equals(str2)) {
                d(str, i, str2, str3);
                return;
            }
            if ("setRedirect".equals(str2)) {
                c(str, i, str2, str3);
            } else if ("stringEmid".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");
                            return;
                        }
                        JSONObject jSONObject = new JSONObject(str3);
                        int i2 = jSONObject.getInt("emid");
                        JSONArray jSONArray = jSONObject.getJSONArray(ala.c.eMs);
                        ArrayList arrayList = new ArrayList();
                        for (int i3 = 0; i3 < jSONArray.length(); i3++) {
                            arrayList.add(jSONArray.getString(i3));
                        }
                        if (i2 > 0 && arrayList.size() > 0) {
                            yz.b(bim.QJ().kH(), i2, arrayList, 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, 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 {
                            f.this.gET = new JSONObject(str3).optBoolean("redirect");
                            a.this.a(str, i, 0);
                        }
                    } catch (Throwable th) {
                        a.this.e(str, i, "invoke " + str2 + "exception: " + th.getMessage());
                    }
                }
            });
        }

        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() {
                    try {
                        if (str3 == null) {
                            a.this.e(str, i, "check_arg:params is null");
                        } else {
                            yz.a(bim.QJ().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 e(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 AnonymousClass11 implements Runnable {
            final String gFO;
            final int gFP;
            final String gFQ;
            final String gFR;

            AnonymousClass11(String str, String str2, String str3, int i) {
                this.gFQ = str;
                this.gFR = str2;
                this.gFO = str3;
                this.gFP = i;
            }

            @Override
            public void run() {
                int i;
                int i2;
                final boolean z;
                int a;
                boolean equals = "gotoQQSecure".equals(this.gFQ);
                f.this.pP(String.valueOf(a.this.gFM.get(this.gFQ)));
                if (this.gFR == null) {
                    a.this.e(this.gFO, this.gFP, "check_arg:params is null");
                    return;
                }
                String str = SQLiteDatabase.KeyEmpty;
                String str2 = SQLiteDatabase.KeyEmpty;
                String str3 = SQLiteDatabase.KeyEmpty;
                try {
                    JSONObject jSONObject = new JSONObject(this.gFR);
                    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.gFO, this.gFP, "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.gFO, this.gFP, 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.gFO, this.gFP, "invoke " + this.gFQ + ", parse arguments exception: " + e7.getMessage());
                }
            }
        }

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

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

        public class AnonymousClass13 implements Runnable {
            final String gFO;
            final int gFP;
            final String gFQ;
            final String gFR;

            AnonymousClass13(String str, String str2, String str3, int i) {
                this.gFQ = str;
                this.gFR = str2;
                this.gFO = str3;
                this.gFP = i;
            }

            @Override
            public void run() {
                try {
                    f.this.pP(String.valueOf(a.this.gFM.get(this.gFQ)));
                    JSONObject jSONObject = new JSONObject(this.gFR);
                    String optString = jSONObject.optString("url");
                    final boolean optBoolean = jSONObject.optBoolean("finishSelf");
                    if (!TextUtils.isEmpty(optString)) {
                        a.this.a(this.gFO, this.gFP, Integer.valueOf(f.this.gEM.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.gFO, this.gFP, "check_arg:params is null");
                    }
                } catch (Exception e) {
                    a.this.e(this.gFO, this.gFP, "invoke " + this.gFQ + "exception: " + e.getMessage());
                }
            }
        }

        private void h(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 i(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 j(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.gEQ) {
                                    f.this.pP(String.valueOf(a.this.gFM.get("sendMessage")) + "_" + optString + "_UnTrust");
                                    a.this.e(str, i, "check_arg:info_type is null");
                                    return;
                                }
                                String scheme = Uri.parse(f.this.gEJ).getScheme();
                                if (!f.gEC.equals(scheme)) {
                                    f.this.pP(String.valueOf(a.this.gFM.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.gFM.get("sendMessage")) + "_" + optString);
                                    yz.b(bim.QJ().kH(), 261186, arrayList, 1);
                                }
                            } else {
                                f.this.pP(String.valueOf(a.this.gFM.get("sendMessage")) + "_" + optString);
                            }
                            if (!optBoolean) {
                                intent = new Intent(za.getAction(optInt));
                            } else {
                                intent = new Intent(za.egy);
                            }
                            String l = f.l("sendMessage", str, i);
                            intent.putExtra(za.a.egA, str3);
                            intent.putExtra(za.a.egC, optString);
                            intent.putExtra(za.a.egD, l);
                            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 k(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(bql.i.gAm));
                            }
                            a.this.a(str, i, 1);
                            f.this.pP(String.valueOf(a.this.gFM.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 l(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.amX()) {
                f.this.clZ.post(new Runnable() {
                    @Override
                    public void run() {
                        f.this.pP(String.valueOf(a.this.gFM.get("setThemeColor")));
                        int i2 = -1;
                        try {
                            try {
                                f.this.gEF.gGF.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 m(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.pP(String.valueOf(a.this.gFM.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.gEJ;
                            }
                            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, bql.i.gAo);
                                    } else if (i2 == -100 && !za.ff(str7)) {
                                        uilib.components.g.B(f.this.mContext, String.format(f.this.mContext.getResources().getString(bql.i.gAv), 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("com.tencent.mm")) {
                                    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.gEO.a(str7, str9, string, (Bitmap) null, !za.ff(str8) ? f.pN(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) {
            try {
                f.this.mContext.sendBroadcast(new Intent(za.fhB), d.s.dvj);
                synchronized (f.this.mLock) {
                    f.this.mLock.wait(anr.dZK);
                }
            } catch (Throwable th) {
            }
            if (!f.this.gFn) {
                a(str, i, -3);
            } else {
                ((aig) bir.pC(4)).e(new AnonymousClass20(str, i), "H5_getLocation").start();
            }
        }

        public class AnonymousClass20 implements Runnable {
            final String gFO;
            final int gFP;

            AnonymousClass20(String str, int i) {
                this.gFO = str;
                this.gFP = i;
            }

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

                        @Override
                        public void a(final SOSOMapLBSApiResult sOSOMapLBSApiResult, boolean z) {
                            if (!this.gGf) {
                                this.gGf = true;
                                if (sOSOMapLBSApiResult.ErrorCode == 0 && f.this.gEF.gGI != null) {
                                    f.this.clZ.post(new Runnable() {
                                        @Override
                                        public void run() {
                                            JSONObject jSONObject = new JSONObject();
                                            try {
                                                jSONObject.put("sessionId", SQLiteDatabase.KeyEmpty + AnonymousClass20.this.gFO);
                                                jSONObject.put("callbackId", SQLiteDatabase.KeyEmpty + AnonymousClass20.this.gFP);
                                                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.gEF.gGI != null) {
                                                f.this.gEF.gGI.loadUrl(String.format("javascript:handleMessageFromTcs('onCallback', '%s')", jSONObject.toString()));
                                            }
                                        }
                                    });
                                }
                                BC();
                            }
                        }

                        @Override
                        public void BD() {
                            if (!this.gGf) {
                                this.gGf = true;
                                a.this.a(AnonymousClass20.this.gFO, AnonymousClass20.this.gFP, -2);
                                BC();
                            }
                        }

                        @Override
                        public void BE() {
                            if (!this.gGf) {
                                this.gGf = true;
                                a.this.a(AnonymousClass20.this.gFO, AnonymousClass20.this.gFP, -1);
                                BC();
                            }
                        }

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

        private void n(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 o(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.gFM.get("getInfo")) + "_" + i3);
                    yz.b(bim.QJ().kH(), 261186, arrayList, 22);
                }
            });
        }

        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;
                    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.pK(str4)) {
                                    a.this.e(str, i, "app not installed!");
                                    return;
                                }
                                if (!za.ff(str5) && !f.this.be(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 aky().a(f.this.getActivity(), optString, optInt2, -1, -1);
                                            str10 = str12;
                                            break;
                                        case 3:
                                            blw blwVar = new blw();
                                            blwVar.oo(optString);
                                            blwVar.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(bim.QJ().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 q(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;
                    f.this.pP(String.valueOf(a.this.gFM.get(str2)));
                    if (za.ff(str3)) {
                        str4 = null;
                    } else {
                        try {
                            JSONObject jSONObject = new JSONObject(str3);
                            str4 = jSONObject.optString("id");
                            try {
                                str5 = jSONObject.optString("biz_data");
                            } catch (JSONException e) {
                            }
                        } catch (JSONException e2) {
                            str4 = null;
                        }
                    }
                    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);
                    String str6 = f.l(str2, str, i) + "|" + str4;
                    intent.putExtra(azr.eiY, !TextUtils.isEmpty(str5) ? str6 + "|" + str5 : str6);
                    intent.putExtra(azr.eiW, bundle);
                    try {
                        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 r(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.pP(String.valueOf(a.this.gFM.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.l(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.l(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 s(String str, int i, String str2, String str3) {
            v(str, i, str2, str3);
        }

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

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

        private void v(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.pP(String.valueOf(a.this.gFM.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.l(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 pQ(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 rK(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 w(String str, int i, String str2, String str3) {
            y(str, i, str2, str3);
        }

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

        private void y(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.pP(String.valueOf(a.this.gFM.get("getQQLoginKey")));
                    } else {
                        f.this.pP(String.valueOf(a.this.gFM.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.pQ(str5));
                        }
                        Intent intent = new Intent(azr.eiU);
                        intent.putExtra(azr.eiY, f.l(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 z(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;
                    JSONObject jSONObject;
                    String str7 = null;
                    int i3 = 0;
                    f.this.pP(String.valueOf(a.this.gFM.get(str2)));
                    try {
                        jSONObject = new JSONObject(str3);
                        str5 = jSONObject.optString(za.e.eqU);
                        try {
                            str6 = jSONObject.optString(za.e.eqV);
                        } catch (JSONException e) {
                            str4 = null;
                            str7 = str5;
                        }
                    } catch (JSONException e2) {
                        str4 = null;
                    }
                    try {
                        i2 = jSONObject.optInt(za.e.dWO);
                    } catch (JSONException e3) {
                        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, f.this.gER);
                        bundle.putBoolean(azr.b.ejT, false);
                        bundle.putBoolean(azr.b.dFc, false);
                        Intent intent = new Intent(azr.eiU);
                        intent.putExtra(azr.eiY, f.l(str2, str, i));
                        intent.putExtra(azr.eiW, bundle);
                        f.this.mContext.sendBroadcast(intent, d.s.dvj);
                        if (i3 == 0) {
                        }
                    }
                    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, f.this.gER);
                    bundle2.putBoolean(azr.b.ejT, false);
                    bundle2.putBoolean(azr.b.dFc, false);
                    Intent intent2 = new Intent(azr.eiU);
                    intent2.putExtra(azr.eiY, f.l(str2, str, i));
                    intent2.putExtra(azr.eiW, bundle2);
                    f.this.mContext.sendBroadcast(intent2, d.s.dvj);
                    if (i3 == 0) {
                        a.this.a(str, i, Integer.valueOf(i3));
                    }
                }
            });
        }

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

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

        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() {
                    String str4;
                    boolean z;
                    int i2;
                    int i3;
                    String str5 = null;
                    f.this.pP(String.valueOf(a.this.gFM.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.l(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 E(String str, int i, String str2, String str3) {
            F(str, i, str2, str3);
        }

        private void F(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.pP(String.valueOf(a.this.gFM.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.l("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 g(boolean z, int i) {
            return z ? i == 1 : i == 2;
        }

        public void M(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 N(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 O(Intent intent) {
            String str;
            AccountInfo accountInfo;
            String str2;
            String str3;
            String str4;
            String str5;
            String str6;
            String str7;
            Bundle bundle;
            String string;
            AccountInfo accountInfo2;
            AccountInfo accountInfo3;
            String str8 = 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 str9 = split[3];
                String str10 = split[4];
                if (intExtra != 0) {
                    a(str9, Integer.valueOf(str10).intValue(), Integer.valueOf(intExtra));
                    return;
                }
                if (bundleExtra == null) {
                    a(str9, Integer.valueOf(str10).intValue(), -1);
                    return;
                }
                final JSONObject jSONObject = new JSONObject();
                try {
                    jSONObject.put("sessionId", str9);
                    jSONObject.put("callbackId", str10);
                    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);
                            str4 = null;
                            str5 = "online";
                            str3 = null;
                            str8 = mainAccountInfo.an;
                            str6 = valueOf;
                            str7 = null;
                        } else {
                            str7 = null;
                            str3 = null;
                            str4 = null;
                            str5 = "none";
                            str6 = 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 {
                            AccountInfo accountInfo5 = (AccountInfo) bundleExtra.getParcelable(azr.b.ekj);
                            str = null;
                            accountInfo = accountInfo5;
                            str2 = null;
                        }
                        if (accountInfo == null) {
                            str4 = null;
                            str5 = "none";
                            str3 = null;
                            str8 = str2;
                            str6 = str;
                            str7 = null;
                        } else if (!g(equals, accountInfo.type)) {
                            str4 = null;
                            str5 = "none";
                            str3 = null;
                            str8 = str2;
                            str6 = str;
                            str7 = null;
                        } else if (accountInfo.status == 0) {
                            str4 = accountInfo.dxQ;
                            String str11 = accountInfo.dxP;
                            str3 = accountInfo.name;
                            str5 = "online";
                            String str12 = str2;
                            str6 = str;
                            str7 = str11;
                            str8 = str12;
                        } else if (accountInfo.status == 1) {
                            str4 = accountInfo.dxQ;
                            String str13 = accountInfo.dxP;
                            str3 = accountInfo.name;
                            str5 = "offline";
                            String str14 = str2;
                            str6 = str;
                            str7 = str13;
                            str8 = str14;
                        } else if (accountInfo.status == 2) {
                            str4 = accountInfo.dxQ;
                            String str15 = accountInfo.dxP;
                            str3 = accountInfo.name;
                            str5 = "offline";
                            String str16 = str2;
                            str6 = str;
                            str7 = str15;
                            str8 = str16;
                        } else {
                            str3 = null;
                            str4 = null;
                            str5 = null;
                            String str17 = str2;
                            str6 = str;
                            str7 = null;
                            str8 = str17;
                        }
                    }
                    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 (str7 != null) {
                        jSONObject.put("openid", str7);
                    }
                    if (str6 != null) {
                        jSONObject.put("accountid", str6);
                    }
                    if (str8 != null) {
                        jSONObject.put(azr.b.KEY_TOKEN, str8);
                    }
                } 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", rK(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.gEF.gGI != null) {
                    f.this.clZ.post(new Runnable() {
                        @Override
                        public void run() {
                            if (f.this.gEF.gGI != null) {
                                f.this.gEF.gGI.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);
                    if (split.length == 7) {
                        String str22 = split[6];
                        String[] split2 = !TextUtils.isEmpty(str22) ? str22.split("&") : null;
                        StringBuilder sb = new StringBuilder();
                        if (split2 != null && split2.length > 0) {
                            for (String str23 : split2) {
                                if ("guid".equals(str23)) {
                                    sb.append(r.afP().aj()).append("&");
                                } else if ("wx_unionid".equals(str23) && mainAccountInfo2.dxZ != null) {
                                    sb.append(mainAccountInfo2.dxZ.dxQ).append("&");
                                } else if ("qq_unionid".equals(str23) && mainAccountInfo2.dxY != null) {
                                    sb.append(mainAccountInfo2.dxY.dxQ).append("&");
                                }
                            }
                        }
                        if (!TextUtils.isEmpty(sb.toString())) {
                            intent2.putExtra(za.a.fhW, sb.toString());
                        }
                    }
                    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.gEF.gGI != null) {
                    f.this.clZ.post(new Runnable() {
                        @Override
                        public void run() {
                            if (f.this.gEF.gGI != null) {
                                f.this.gEF.gGI.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 pR(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.gEF.gGI != null) {
                f.this.clZ.post(new Runnable() {
                    @Override
                    public void run() {
                        if (f.this.gEF.gGI != null) {
                            f.this.gEF.gGI.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.gEF.gGI != 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.gEF.gGI != null) {
                            f.this.gEF.gGI.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.gEF.gGI != 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.gEF.gGI != null) {
                            f.this.gEF.gGI.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.gEF.gGI != 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.gEF.gGI != null) {
                            f.this.gEF.gGI.loadUrl(String.format("javascript:handleMessageFromTcs('onCallback', '%s')", jSONObject.toString()));
                        }
                    }
                });
            }
        }

        private int E(String str, boolean z) {
            int i;
            String str2 = f.this.gEJ;
            if (str2 == null || !URLUtil.isNetworkUrl(str2)) {
                return 2;
            }
            synchronized (this) {
                if (this.gFL == null) {
                    this.gFL = ana();
                }
                if (this.gFM == null) {
                    this.gFM = amZ();
                }
            }
            try {
                String host = Uri.parse(str2).getHost();
                C0043f c0043f = null;
                synchronized (this) {
                    Iterator<C0043f> it = this.gFL.iterator();
                    while (true) {
                        if (!it.hasNext()) {
                            break;
                        }
                        C0043f next = it.next();
                        if (host.endsWith(next.gGC)) {
                            c0043f = next;
                            break;
                        }
                    }
                }
                if (c0043f == null) {
                    i = 2;
                } else if (!z || str == null) {
                    i = 1;
                } else {
                    synchronized (this) {
                        Integer num = this.gFM.get(str);
                        if (num == null) {
                            return 3;
                        }
                        int intValue = num.intValue();
                        if (c0043f.gGD.size() > 0) {
                            i = c0043f.gGD.contains(Integer.valueOf(intValue)) ? 1 : 2;
                        } else if (c0043f.gGE.size() > 0) {
                            i = c0043f.gGE.contains(Integer.valueOf(intValue)) ? 2 : 1;
                        } else {
                            i = 1;
                        }
                    }
                }
            } catch (Exception e) {
                com.tencent.server.base.d.l(e);
                i = 2;
            }
            return i;
        }

        private Map<String, Integer> amZ() {
            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", Integer.valueOf(ap.fr));
            hashMap.put("gotoAppView", 401);
            hashMap.put("gotoWXWebView", 402);
            hashMap.put("setTitle", 500);
            hashMap.put("setRightTopBtnShowable", 501);
            hashMap.put("setMenuItemsShowable", 502);
            hashMap.put("setThemeColor", Integer.valueOf(rv.bIO));
            hashMap.put("download", 504);
            hashMap.put("getLocation", 600);
            hashMap.put("getQQLoginState", Integer.valueOf(TMAssistantDownloadSDKErrorCode.DownloadSDKErrorCode_URL_INVALID));
            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", 708);
            hashMap.put("getAccountFace", 709);
            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", Integer.valueOf(ale.eRM));
            hashMap.put("toggleSoftInput", 1600);
            hashMap.put("clearAllCookie", 1601);
            hashMap.put("insertQQSecureUsageRecord", Integer.valueOf(vv.e.aXW));
            hashMap.put("setRedirect", 1603);
            hashMap.put("stringEmid", Integer.valueOf(vv.e.aXY));
            return hashMap;
        }

        public List<C0043f> ana() {
            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(), "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 {
                            C0043f c0043f = new C0043f();
                            c0043f.gGC = 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)) {
                                        c0043f.gGD.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)) {
                                        c0043f.gGE.add(Integer.valueOf(trim2));
                                    }
                                }
                            }
                            arrayList2.add(c0043f);
                        } catch (Exception e) {
                            com.tencent.server.base.d.l(e);
                        }
                    }
                }
            }
            if (arrayList2.isEmpty()) {
                C0043f c0043f2 = new C0043f();
                c0043f2.gGC = ".qq.com";
                arrayList2.add(c0043f2);
            }
            return arrayList2;
        }

        public boolean anb() {
            sd e;
            qz qzVar = (qz) bir.pC(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.gEZ == 1) {
                        bundle.putInt(za.a.ehQ, f.this.gEZ);
                    }
                    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 pS(final String str) {
            if (f.this.gEE == null) {
                return -1;
            }
            if (str != null) {
                f.this.clZ.post(new Runnable() {
                    @Override
                    public void run() {
                        f.this.gEF.nK(str);
                    }
                });
                return 0;
            }
            return -2;
        }

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

    public boolean pK(String str) {
        qz qzVar;
        if (str != null && (qzVar = (qz) bir.pC(12)) != null) {
            return qzVar.df(str);
        }
        return false;
    }

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

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

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

    public boolean amR() {
        String pM = pM("com.tencent.mm");
        return pM == null || !pM.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.gEM.isWXAppInstalled()) {
            uilib.components.g.d(this.mContext, bql.i.gAB);
            if (aVar != null) {
                aVar.onError(-1000);
                return;
            }
            return;
        }
        if (!this.gEM.isWXAppSupportAPI()) {
            uilib.components.g.d(this.mContext, bql.i.gAz);
            if (aVar != null) {
                aVar.onError(-1001);
                return;
            }
            return;
        }
        if (z && !this.gEM.rm()) {
            uilib.components.g.d(this.mContext, bql.i.gAz);
            if (aVar != null) {
                aVar.onError(-1002);
                return;
            }
            return;
        }
        new Thread(new Runnable() {
            @Override
            public void run() {
                File pN;
                String O = zb.O(zb.cZu, SQLiteDatabase.KeyEmpty + f.amY());
                boolean amR = f.this.amR();
                if (aVar != null && amR) {
                    synchronized (f.this.gFu) {
                        f.this.gFu.put(O, aVar);
                    }
                    synchronized (f.this.gFv) {
                        f.this.gFv.put(O, Boolean.valueOf(z));
                    }
                }
                try {
                    if (bitmap != null) {
                        f.this.gEM.a(str, str2, str3, bitmap, z, O);
                    } else {
                        Bitmap bitmap2 = null;
                        if (!za.ff(str4) && (pN = f.pN(str4)) != null && pN.exists()) {
                            bitmap2 = ajg.eg(pN.getAbsolutePath());
                        }
                        if (bitmap2 == null) {
                            bitmap2 = BitmapFactory.decodeResource(f.this.mContext.getResources(), bql.e.gsn);
                        }
                        f.this.gEM.a(str, str2, str3, bitmap2, z, O);
                    }
                    if (aVar != null && !amR) {
                        aVar.onSuccess();
                    }
                } catch (Exception e2) {
                    synchronized (f.this.gFu) {
                        f.this.gFu.remove(O);
                        synchronized (f.this.gFv) {
                            f.this.gFv.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(bql.i.gzI));
        eVar.eK(false);
        ArrayList arrayList = new ArrayList();
        List<g.b> sj = this.gEO.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("com.tencent.mm")) {
                            boolean z2 = bVar2.iaG == g.c.WeiXinTime;
                            if (z) {
                                if (z2) {
                                    yz.c(bim.QJ().kH(), 260406, 4);
                                } else {
                                    yz.c(bim.QJ().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.pN(str4);
                                }
                                f.this.gEO.a(bVar2.dfY, str, str2 + " 地址:" + str3, bitmap, file, aVar);
                            }
                        }).start();
                    }
                }
            });
            if (aqhVar != null) {
                arrayList.add(aqhVar);
            }
        }
        eVar.a(getActivity().getResources().getString(bql.i.cancel), new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (eVar != null) {
                    eVar.dismiss();
                }
            }
        });
        eVar.G(arrayList);
        eVar.show();
    }

    public static File pN(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 anc() {
            if (f.this.gEF.gGI != null) {
                final String title = f.this.gEF.gGI.getTitle();
                final String url = f.this.gEF.gGI.getUrl();
                if (title == null) {
                    title = SQLiteDatabase.KeyEmpty;
                }
                if (url == null) {
                    url = SQLiteDatabase.KeyEmpty;
                }
                final String format = String.format(f.this.mContext.getResources().getString(bql.i.gAw), title);
                f.this.bvp.post(new Runnable() {
                    @Override
                    public void run() {
                        try {
                            yz.c(bim.QJ().kH(), 260736, 4);
                            final Bitmap bitmap = null;
                            try {
                                WebView webView = f.this.gEF.gGI;
                                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(), bql.e.gsn);
                            }
                            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 amB() {
            List<g.b> sj;
            int i;
            super.amB();
            final com.tencent.qqpimsecure.h5.d amA = amA();
            amA.amE();
            if (za.ff(f.this.gEJ) || (!f.this.pO(f.this.gEJ) && !URLUtil.isNetworkUrl(f.this.gEJ))) {
                if ((f.this.gEW & 16) != 0) {
                    amA.a(0, f.this.mContext.getResources().getString(bql.i.gAu), f.this.mContext.getResources().getDrawable(bql.e.grz), false, new View.OnClickListener() {
                        @Override
                        public void onClick(View view) {
                            amA.dismiss();
                            if (f.this.gEF.gGI != null) {
                                f.this.gEF.gGI.reload();
                                f.this.amS();
                            }
                            yz.c(bim.QJ().kH(), 260410, 4);
                        }
                    });
                    return;
                }
                return;
            }
            if (((f.this.gEW & 32) == 0 && (f.this.gEW & 1) == 0 && (f.this.gEW & 2) == 0) || (sj = f.this.gEO.sj()) == null || sj.isEmpty()) {
                i = 0;
            } else {
                amA.a(0, f.this.mContext.getResources().getString(bql.i.gAy), f.this.mContext.getResources().getDrawable(bql.e.grA), false, new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        amA.dismiss();
                        e.this.anc();
                    }
                });
                i = 1;
            }
            if ((f.this.gEW & 4) != 0) {
                amA.a(i, f.this.mContext.getResources().getString(bql.i.gAk), f.this.mContext.getResources().getDrawable(bql.e.grw), false, new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        ClipboardManager clipboardManager;
                        amA.dismiss();
                        if (f.this.gEF.gGI != null && (clipboardManager = (ClipboardManager) f.this.getActivity().getSystemService("clipboard")) != null) {
                            String url = f.this.gEF.gGI.getUrl();
                            if (url == null) {
                                url = SQLiteDatabase.KeyEmpty;
                            }
                            clipboardManager.setText(url);
                            uilib.components.g.B(f.this.getActivity(), f.this.mContext.getResources().getString(bql.i.gAl));
                        }
                        yz.c(bim.QJ().kH(), 260409, 4);
                    }
                });
                i++;
            }
            if ((f.this.gEW & 8) != 0) {
                amA.a(i, f.this.mContext.getResources().getString(bql.i.gAq), f.this.mContext.getResources().getDrawable(bql.e.grv), false, new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        amA.dismiss();
                        if (f.this.gEF.gGI != null) {
                            try {
                                String url = f.this.gEF.gGI.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, bql.i.gAr);
                            }
                        }
                        yz.c(bim.QJ().kH(), 260411, 4);
                    }
                });
                i++;
            }
            if ((f.this.gEW & 16) != 0) {
                amA.a(i, f.this.mContext.getResources().getString(bql.i.gAu), f.this.mContext.getResources().getDrawable(bql.e.grz), false, new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        amA.dismiss();
                        if (f.this.gEF.gGI != null) {
                            if (f.this.gEF.gGJ != null && f.this.gEF.gGJ.isShown()) {
                                f.this.gEF.gGI.clearView();
                                f.this.gEF.gGJ.setVisibility(4);
                            }
                            f.this.gEF.gGI.reload();
                            f.this.amS();
                        }
                        yz.c(bim.QJ().kH(), 260410, 4);
                    }
                });
            }
        }

        @Override
        protected com.tencent.qqpimsecure.h5.d amz() {
            return new com.tencent.qqpimsecure.h5.d(f.this.mContext, bql.e.gqf);
        }
    }

    public void amS() {
        this.gFc = false;
        this.gFd = false;
        this.gFf = false;
        this.gFe = false;
        this.gFi = new StringBuilder();
    }

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

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

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

    public static String l(String str, String str2, int i) {
        return str + "|" + amV() + "|" + gFx + "|" + str2 + "|" + i;
    }

    public void pP(String str) {
        ArrayList arrayList = new ArrayList();
        arrayList.add(str);
        yz.b(bim.QJ().kH(), 261186, arrayList, 4);
    }

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

    public class C0043f {
        private String gGC;
        private List<Integer> gGD;
        private List<Integer> gGE;

        private C0043f() {
            this.gGC = SQLiteDatabase.KeyEmpty;
            this.gGD = new ArrayList();
            this.gGE = new ArrayList();
        }
    }
}