QQ浏览器 v12.2.3.7053版本的 MD5 值为:8285ab3059e5c8b521a264dfbc5c3685

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


package com.tencent.mtt.external.explorerone.newcamera.scan.framework.qrcode;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.text.TextUtils;
import com.tencent.common.http.NetUtils;
import com.tencent.common.utils.StringUtils;
import com.tencent.common.utils.UrlUtils;
import com.tencent.mtt.R;
import com.tencent.mtt.base.functionwindow.ActivityHandler;
import com.tencent.mtt.base.skin.MttResources;
import com.tencent.mtt.base.utils.QBUrlUtils;
import com.tencent.mtt.browser.window.UrlParams;
import com.tencent.mtt.businesscenter.facade.IFrameworkDelegate;
import com.tencent.mtt.businesscenter.facade.IInternalDispatchServer;
import com.tencent.mtt.cmc.CMC;
import com.tencent.mtt.compliance.MethodDelegate;
import com.tencent.mtt.external.explorerone.newcamera.scan.framework.qrcode.adapter.CameraQrCodeResult;
import com.tencent.mtt.external.qrcode.common.ActionConstants2;
import com.tencent.mtt.external.qrcode.common.AddressBookParsedResult;
import com.tencent.mtt.external.qrcode.common.AddressBookResultHandler;
import com.tencent.mtt.external.qrcode.common.ResultHandler;
import com.tencent.mtt.external.qrcode.common.URIParsedResult;
import com.tencent.mtt.external.qrcode.common.URIResultHandler;
import com.tencent.mtt.external.qrcode.common.WifiParsedResult;
import com.tencent.mtt.external.qrcode.common.WifiResultHandler;
import com.tencent.mtt.external.qrcode.inhost.AddressResultActivity;
import com.tencent.mtt.external.qrcode.inhost.NormalResultActivity;
import com.tencent.mtt.external.qrcode.inhost.ParsedResultType;
import com.tencent.mtt.external.weapp.facade.IWeAppService;
import com.tencent.mtt.hippy.qb.views.base.ITextInputController;
import com.tencent.mtt.qbcontext.core.QBContext;
import com.tencent.mtt.qbinfo.IQConfigure;
import com.tencent.mtt.view.toast.MttToaster;
import java.util.ArrayList;
import java.util.HashMap;

public class CameraQrCodeScanUtils {
    public static int a(Activity activity, CameraQrCodeResult cameraQrCodeResult) {
        if (cameraQrCodeResult == null) {
            return 1;
        }
        String str = cameraQrCodeResult.f53227b;
        String str2 = cameraQrCodeResult.f53228c;
        ResultHandler resultHandler = cameraQrCodeResult.f53229d;
        if (resultHandler == null || resultHandler.g() == null) {
            return 1;
        }
        if (!resultHandler.g().equals(ParsedResultType.URI) || !(resultHandler instanceof URIResultHandler)) {
            if (!resultHandler.g().equals(ParsedResultType.ADDRESSBOOK) || !(resultHandler instanceof AddressBookResultHandler)) {
                if (resultHandler.g().equals(ParsedResultType.EXPRESS)) {
                    if (!TextUtils.isEmpty(str2) && str2.contains("CODE_")) {
                        StringBuilder sb = new StringBuilder("qb://weapp/?package=kuaidi100");
                        sb.append("&title=%e5%bf%ab%e9%80%92100&entry=75052&appid=124&pagepath=pages%2fresult%2fresult.html%3fnu%3d" + resultHandler.b().toString());
                        a(sb.toString());
                    }
                    return 4;
                }
                if (!resultHandler.g().equals(ParsedResultType.ISBN) && !resultHandler.g().equals(ParsedResultType.PRODUCT)) {
                    if (resultHandler.g().equals(ParsedResultType.WIFI) && (resultHandler instanceof WifiResultHandler)) {
                        WifiParsedResult wifiParsedResult = (WifiParsedResult) ((WifiResultHandler) resultHandler).d();
                        wifiParsedResult.a();
                        wifiParsedResult.d();
                        wifiParsedResult.b();
                        wifiParsedResult.e();
                        Intent intent = new Intent(activity, (Class<?>) NormalResultActivity.class);
                        Bundle bundle = new Bundle();
                        bundle.putSerializable("qrtype", resultHandler.g());
                        bundle.putCharSequence("qrcontent", resultHandler.b());
                        bundle.putCharSequence("ssid", wifiParsedResult.a());
                        bundle.putCharSequence(ITextInputController.KEYBOARD_TYPE_PASS_WORD, wifiParsedResult.d());
                        bundle.putCharSequence("encryption", wifiParsedResult.b());
                        bundle.putBoolean("hidden", wifiParsedResult.e());
                        intent.putExtras(bundle);
                        activity.startActivity(intent);
                        return 4;
                    }
                }
                return 4;
            }
            AddressBookParsedResult addressBookParsedResult = (AddressBookParsedResult) ((AddressBookResultHandler) resultHandler).d();
            HashMap hashMap = new HashMap();
            hashMap.put("url", addressBookParsedResult.n());
            hashMap.put("entry", String.valueOf(133));
            CMC.a("cmc://statistics/m?cmd=onStatEntryType", hashMap);
            String[] j = addressBookParsedResult.j();
            String str3 = null;
            String str4 = (j == null || j.length < 1) ? null : j[0];
            String[] k = addressBookParsedResult.k();
            if (k != null && k.length >= 1) {
                str3 = k[0];
            }
            Intent intent2 = new Intent(activity, (Class<?>) AddressResultActivity.class);
            Bundle bundle2 = new Bundle();
            bundle2.putStringArray("qrname", addressBookParsedResult.a());
            bundle2.putString("qrpronunciation", addressBookParsedResult.b());
            bundle2.putStringArray("qrphonenumbers", addressBookParsedResult.d());
            bundle2.putStringArray("qrphonetypes", addressBookParsedResult.e());
            bundle2.putStringArray("qremails", addressBookParsedResult.f());
            bundle2.putStringArray("qrpemailtypes", addressBookParsedResult.g());
            bundle2.putString("qrnotes", addressBookParsedResult.i());
            bundle2.putString("qrinstantmess", addressBookParsedResult.h());
            bundle2.putString("qraddress1", str4);
            bundle2.putString("qraddress1type", str3);
            bundle2.putString("qrorg", addressBookParsedResult.m());
            bundle2.putString("qrtitle", addressBookParsedResult.l());
            bundle2.putString("qrurl", addressBookParsedResult.n());
            bundle2.putString("qrbirthday", addressBookParsedResult.o());
            bundle2.putCharSequence("qrcontent", resultHandler.b());
            intent2.putExtras(bundle2);
            activity.startActivity(intent2);
            return 4;
        }
        URIParsedResult uRIParsedResult = (URIParsedResult) resultHandler.d();
        if (uRIParsedResult == null) {
            return 4;
        }
        String a2 = uRIParsedResult.a();
        if (a2 != null) {
            ArrayList<String> f = StringUtils.f(a2);
            try {
                if (QBUrlUtils.n(a2)) {
                    a(a2);
                    return 4;
                }
                if (b(a2)) {
                    MttToaster.show(MttResources.l(R.string.sj), 1);
                    HashMap hashMap2 = new HashMap();
                    hashMap2.put("url", a2);
                    hashMap2.put("entry", String.valueOf(133));
                    CMC.a("cmc://statistics/m?cmd=onStatEntryType", hashMap2);
                    return 1;
                }
                if (QBUrlUtils.m(a2)) {
                    HashMap hashMap3 = new HashMap();
                    hashMap3.put("url", a2);
                    hashMap3.put("entry", String.valueOf(133));
                    CMC.a("cmc://statistics/m?cmd=onStatEntryType", hashMap3);
                    ((IWeAppService) QBContext.getInstance().getService(IWeAppService.class)).launchMobikeWeApp(a2, "711");
                    return 4;
                }
                if (((IInternalDispatchServer) QBContext.getInstance().getService(IInternalDispatchServer.class)).lunchCustomUrl(a2, false)) {
                    HashMap hashMap4 = new HashMap();
                    hashMap4.put("url", a2);
                    hashMap4.put("entry", String.valueOf(133));
                    CMC.a("cmc://statistics/m?cmd=onStatEntryType", hashMap4);
                    return 4;
                }
                if (a2 != null && (a2.startsWith(NetUtils.SCHEME_HTTP) || a2.startsWith(NetUtils.SCHEME_HTTPS) || a2.startsWith("qb://"))) {
                    a(a2);
                    return 4;
                }
                if (f.size() > 0) {
                    return 4;
                }
            } catch (NoClassDefFoundError unused) {
            }
        }
        String trim = resultHandler.b().toString().trim();
        if (trim.toLowerCase().startsWith("kp_")) {
            Intent intent3 = new Intent(ActionConstants2.e, Uri.parse(UrlUtils.escapeAllChineseChar(UrlUtils.prepareUrl(String.format("https://tencent.kuaipai.cn/routing.html?key=%s&phonemodel=%s&phoneosversion=%s&appversion=%s&source=QQbrowser", trim, MethodDelegate.getModel().replaceAll("[ |\\/|\\_|\\&|\\|]", ""), Build.VERSION.RELEASE, IQConfigure.f69589b)))));
            intent3.setClass(activity, ActivityHandler.f32417a);
            activity.startActivity(intent3);
            return 4;
        }
        Intent intent4 = new Intent(activity, (Class<?>) NormalResultActivity.class);
        Bundle bundle3 = new Bundle();
        bundle3.putSerializable("qrtype", resultHandler.g());
        bundle3.putCharSequence("qrcontent", resultHandler.b());
        intent4.putExtras(bundle3);
        activity.startActivity(intent4);
        return 4;
    }

    private static void a(String str) {
        ((IFrameworkDelegate) QBContext.getInstance().getService(IFrameworkDelegate.class)).doLoad(new UrlParams(str).b(1).f(133).c(4).a((Bundle) null));
    }

    private static boolean b(String str) {
        String lowerCase;
        return (str == null || TextUtils.isEmpty(str) || (lowerCase = str.trim().toLowerCase()) == null || !lowerCase.contains("u.wechat.com")) ? false : true;
    }
}