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

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


package com.tencent.mtt.search;

import MTT.SmartBox_HotWordsItem;
import MTT.SmartBox_ReportReq;
import android.app.Activity;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Bundle;
import android.os.IBinder;
import android.text.TextUtils;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import com.dike.lib.apkmarker.Apk;
import com.huawei.hms.framework.common.ContainerUtils;
import com.huawei.hms.support.hianalytics.HiAnalyticsConstant;
import com.tencent.common.utils.StringUtils;
import com.tencent.common.utils.UrlUtils;
import com.tencent.common.wup.extension.WUPStatClient;
import com.tencent.common.wup.extension.WUPStatRequest;
import com.tencent.mtt.ContextHolder;
import com.tencent.mtt.R;
import com.tencent.mtt.base.functionwindow.ActivityHandler;
import com.tencent.mtt.base.skin.MttResources;
import com.tencent.mtt.base.stat.facade.IUserActionStatServer;
import com.tencent.mtt.base.stat.utils.PlatformStatUtils;
import com.tencent.mtt.base.utils.GetTask;
import com.tencent.mtt.base.utils.QBUrlUtils;
import com.tencent.mtt.base.wup.GUIDManager;
import com.tencent.mtt.browser.WebEngine;
import com.tencent.mtt.browser.hotword.search.SearchHotwordManager;
import com.tencent.mtt.browser.jsextension.open.IOpenJsApis;
import com.tencent.mtt.browser.window.IWebView;
import com.tencent.mtt.browser.window.WindowManager;
import com.tencent.mtt.browser.window.home.view.HomePage;
import com.tencent.mtt.businesscenter.facade.IH5Preloader;
import com.tencent.mtt.businesscenter.facade.IPreLoadCallback;
import com.tencent.mtt.external.reader.IReaderCallbackListener;
import com.tencent.mtt.external.setting.base.BusinessSettingManager;
import com.tencent.mtt.external.weapp.facade.IWeAppService;
import com.tencent.mtt.hippy.common.HippyArray;
import com.tencent.mtt.hippy.common.HippyMap;
import com.tencent.mtt.hippy.modules.Promise;
import com.tencent.mtt.hippy.qb.preload.HippyDataPreloadController;
import com.tencent.mtt.hippy.qb.views.pan.PanEventHelper;
import com.tencent.mtt.qbcontext.core.QBContext;
import com.tencent.mtt.qbinfo.QUAUtils;
import com.tencent.mtt.sdkcontext.SDKContext;
import com.tencent.mtt.search.backForward.SearchCommonNativePage;
import com.tencent.mtt.search.data.SearchData;
import com.tencent.mtt.search.data.SearchOpenData;
import com.tencent.mtt.search.data.entrance.SearchEntranceInfo;
import com.tencent.mtt.search.data.entrance.SearchEntranceManager;
import com.tencent.mtt.search.data.history.SearchInputHistory;
import com.tencent.mtt.search.facade.SearchVReportBean;
import com.tencent.mtt.search.hotwords.TKDSearchHotwordBaseInfoHolder;
import com.tencent.mtt.search.operation.InterceptNativeSearchConfig;
import com.tencent.mtt.search.searchEngine.SearchEngineManager;
import com.tencent.mtt.search.statistics.SearchLog;
import com.tencent.mtt.search.view.reactnative.SearchRNHistoryBean;
import com.tencent.mtt.searchresult.nativepage.SearchResultHippyPage;
import com.tencent.mtt.video.browser.export.wc.m3u8.M3U8Constants;
import com.tencent.mtt.view.toast.MttToaster;
import com.tencent.mtt.wechatminiprogram.IMiniAuthStateService;
import com.tencent.mtt.wechatminiprogram.IWeChatMiniProgramService;
import com.tencent.smtt.sdk.QbTbsWizard;
import com.xiaomi.mipush.sdk.Constants;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class SearchUtils {

    public static long f70068a;

    public static boolean f70069b;

    private static String f70070c;

    private static volatile String f70071d;

    public static Bundle a(HashMap<String, String> hashMap) {
        Bundle bundle = new Bundle(9);
        if (hashMap == null) {
            return bundle;
        }
        for (String str : hashMap.keySet()) {
            bundle.putString(str, hashMap.get(str));
        }
        return bundle;
    }

    private static View a(Activity activity) {
        if (activity == null || activity.getWindow() == null) {
            return null;
        }
        return activity.getWindow().getDecorView();
    }

    public static SearchRNHistoryBean a(SearchData searchData) {
        SearchRNHistoryBean searchRNHistoryBean = new SearchRNHistoryBean();
        if (searchData != null && searchData.e != null) {
            searchRNHistoryBean.f70772b = searchData.f70127c;
            Object obj = searchData.e;
            if (obj instanceof SearchInputHistory) {
                SearchInputHistory searchInputHistory = (SearchInputHistory) obj;
                searchRNHistoryBean.f70773c = searchInputHistory.e();
                searchRNHistoryBean.f70774d = searchInputHistory.A;
                searchRNHistoryBean.g = searchInputHistory.f70167b;
                searchRNHistoryBean.h = searchInputHistory.B;
                searchRNHistoryBean.e = searchInputHistory.z;
                if (searchRNHistoryBean.e == 0 || searchRNHistoryBean.e == -1) {
                    searchRNHistoryBean.e = searchInputHistory.g() ? 5 : 3;
                }
                searchRNHistoryBean.f70771a = searchInputHistory.e;
                searchRNHistoryBean.f70772b = searchInputHistory.y;
                searchRNHistoryBean.f = searchInputHistory.g;
                searchRNHistoryBean.i = searchInputHistory.E;
            }
        }
        return searchRNHistoryBean;
    }

    public static String a(String str) {
        CopyOnWriteArrayList<String> d2 = SearchEntranceManager.a().d();
        if (d2 == null) {
            return null;
        }
        Iterator<String> it = d2.iterator();
        while (it.hasNext()) {
            String next = it.next();
            if (str.startsWith(next)) {
                return next;
            }
        }
        return null;
    }

    public static String a(String str, SearchVReportBean searchVReportBean) {
        return (TextUtils.isEmpty(str) || searchVReportBean == null) ? str : a(a(a(a(a(a(str, "entryScene", searchVReportBean.q()), "entryContent", searchVReportBean.t()), "entryStatus", searchVReportBean.r()), "searchPageStatus", searchVReportBean.s()), "searchPageContent", searchVReportBean.u()), "entryTime", searchVReportBean.v());
    }

    public static String a(String str, String str2, String str3) {
        if (TextUtils.isEmpty(str) || TextUtils.isEmpty(str2)) {
            return str;
        }
        return UrlUtils.addParamsToUrl(UrlUtils.removeArg(str, str2), str2 + ContainerUtils.KEY_VALUE_DELIMITER + str3);
    }

    public static void a(Context context) {
        try {
            ((InputMethodManager) context.getSystemService("input_method")).hideSoftInputFromWindow(i(), 0);
        } catch (Exception unused) {
        }
    }

    public static void a(Context context, boolean z, int i, int i2, int i3) {
        String l;
        int i4;
        if (z) {
            l = MttResources.l(R.string.ag3);
            i4 = 350;
        } else {
            l = MttResources.l(R.string.ag2);
            i4 = 351;
        }
        MttToaster.showImageSysToast(context, l, R.drawable.a52, 0, i, i2, i3);
        ((IUserActionStatServer) QBContext.getInstance().getService(IUserActionStatServer.class)).addUserAction(i4);
        BusinessSettingManager.a().a(z);
    }

    public static void a(HippyMap hippyMap, final Promise promise) {
        HippyArray array;
        if (hippyMap == null || (array = hippyMap.getArray("urlList")) == null || array.size() == 0) {
            return;
        }
        for (int i = 0; i < array.size(); i++) {
            HippyMap map = array.getMap(i);
            if (map != null) {
                ((IH5Preloader) QBContext.getInstance().getService(IH5Preloader.class)).doPreload(map.getString("url"), map.getInt("freshnessTime"), new IPreLoadCallback() {
                    @Override
                    public void onResult(int i2, String str, String str2) {
                        HippyMap hippyMap2 = new HippyMap();
                        hippyMap2.pushString("url", str);
                        hippyMap2.pushInt("result", i2);
                        hippyMap2.pushString("msg", str2);
                        Promise promise2 = Promise.this;
                        if (promise2 != null) {
                            promise2.resolve(hippyMap2);
                        }
                    }
                });
            }
        }
    }

    public static void a(String str, int i) {
        if (TextUtils.isEmpty(str)) {
            return;
        }
        WUPStatRequest wUPStatRequest = new WUPStatRequest("smartboxsearch", "reportLog");
        SmartBox_ReportReq smartBox_ReportReq = new SmartBox_ReportReq();
        smartBox_ReportReq.sGuid = GUIDManager.a().f();
        smartBox_ReportReq.sQua = QUAUtils.a();
        smartBox_ReportReq.sReport = str;
        smartBox_ReportReq.eType = i;
        wUPStatRequest.put(HiAnalyticsConstant.Direction.REQUEST, smartBox_ReportReq);
        WUPStatClient.a().a(wUPStatRequest);
    }

    public static void a(String str, long j) {
        PlatformStatUtils.a(str, j);
    }

    public static boolean a() {
        NetworkInfo activeNetworkInfo = ((ConnectivityManager) ContextHolder.getAppContext().getSystemService("connectivity")).getActiveNetworkInfo();
        return activeNetworkInfo != null && activeNetworkInfo.isConnectedOrConnecting();
    }

    public static boolean a(int i) {
        return i == 0 || i == 2 || i == 3 || i == 96 || i == 4 || i == 21 || i == 22 || i == 6 || i == 14 || i == 5 || i == 7 || i == 8 || i == 10 || i == 9 || i == 11 || i == 12 || i == 13 || i == 15 || i == 16 || i == 17 || i == 18 || i == 19 || i == 95;
    }

    public static boolean a(IWebView iWebView) {
        return iWebView instanceof HomePage;
    }

    public static boolean a(ISearchUrlDispatcher iSearchUrlDispatcher) {
        if (iSearchUrlDispatcher == null) {
            return false;
        }
        int i = -1;
        try {
            i = Integer.valueOf(iSearchUrlDispatcher.g()).intValue();
        } catch (Exception unused) {
        }
        return i == 14 || i == 15;
    }

    public static boolean a(String str, String str2) {
        return !TextUtils.isEmpty(str2) && !TextUtils.isEmpty(str) && d(str2) && str.split(Constants.ACCEPT_TIME_SEPARATOR_SERVER).length == 2 && str.endsWith("搜狗搜索") && str2.toLowerCase().contains(IWeAppService.PARAM_KEYWORD);
    }

    public static int b() {
        IWeChatMiniProgramService iWeChatMiniProgramService = (IWeChatMiniProgramService) SDKContext.getInstance().getService(IWeChatMiniProgramService.class);
        if (iWeChatMiniProgramService != null) {
            return iWeChatMiniProgramService.enableMiniProgramMode() ? 1 : 0;
        }
        return 0;
    }

    public static int b(String str) {
        if (str != null) {
            str = str.trim();
        }
        if (TextUtils.isEmpty(str) || TextUtils.isEmpty(str.replace(" ", ""))) {
            return 0;
        }
        if (str.contains("ا")) {
            return 2;
        }
        String lowerCase = str.toLowerCase();
        if (QBUrlUtils.i(lowerCase) || UrlUtils.isIpv6Url(lowerCase)) {
            return 1;
        }
        String l = QBUrlUtils.l(str);
        if ((l == null || l.startsWith(M3U8Constants.COMMENT_PREFIX)) && !QBUrlUtils.n(str)) {
            return 2;
        }
        if (l != null) {
            return 1;
        }
        str.startsWith(Constants.COLON_SEPARATOR);
        return 2;
    }

    public static String b(int i) {
        SearchEntranceInfo a2 = SearchEntranceManager.a().a(i);
        return a2 == null ? "" : a2.e;
    }

    public static String b(String str, SearchVReportBean searchVReportBean) {
        if (TextUtils.isEmpty(str) || searchVReportBean == null) {
            return str;
        }
        if (!TextUtils.isEmpty(searchVReportBean.q())) {
            str = b(str, "entryScene", searchVReportBean.q());
        }
        if (!TextUtils.isEmpty(searchVReportBean.t())) {
            str = b(str, "entryContent", searchVReportBean.t());
        }
        if (!TextUtils.isEmpty(searchVReportBean.r())) {
            str = b(str, "entryStatus", searchVReportBean.r());
        }
        if (!TextUtils.isEmpty(searchVReportBean.s())) {
            str = b(str, "searchPageStatus", searchVReportBean.s());
        }
        if (!TextUtils.isEmpty(searchVReportBean.u())) {
            str = b(str, "searchPageContent", searchVReportBean.u());
        }
        return !TextUtils.isEmpty(searchVReportBean.v()) ? b(str, "entryTime", searchVReportBean.v()) : str;
    }

    public static String b(String str, String str2, String str3) {
        if (TextUtils.isEmpty(str) || TextUtils.isEmpty(str2)) {
            return str;
        }
        return h(str, str2) + ContainerUtils.FIELD_DELIMITER + str2 + ContainerUtils.KEY_VALUE_DELIMITER + str3;
    }

    public static boolean b(IWebView iWebView) {
        return (iWebView instanceof SearchCommonNativePage) || (iWebView instanceof SearchResultHippyPage);
    }

    public static boolean b(String str, String str2) {
        return !TextUtils.isEmpty(str2) && !TextUtils.isEmpty(str) && d(str2) && str2.toLowerCase().contains("sogou-waps") && str2.toLowerCase().contains(IWeAppService.PARAM_KEYWORD);
    }

    public static String c() {
        IWeChatMiniProgramService iWeChatMiniProgramService = (IWeChatMiniProgramService) SDKContext.getInstance().getService(IWeChatMiniProgramService.class);
        return iWeChatMiniProgramService != null ? iWeChatMiniProgramService.getMiniSdkVersion() : "";
    }

    public static boolean c(int i) {
        return i != 0;
    }

    public static boolean c(String str) {
        if (TextUtils.isEmpty(str)) {
            return false;
        }
        String trim = str.toLowerCase().trim();
        return trim.startsWith("www.baidu.com") || trim.startsWith("http://www.baidu.com") || trim.startsWith("https://www.baidu.com") || trim.startsWith("m.baidu.com") || trim.startsWith("http://m.baidu.com") || trim.startsWith("https://m.baidu.com") || trim.equals("https://www.m.baidu.com") || trim.equals(MttResources.l(R.string.b9v));
    }

    public static boolean c(String str, String str2) {
        return !TextUtils.isEmpty(str2) && !TextUtils.isEmpty(str) && c(str2) && str.split(Constants.ACCEPT_TIME_SEPARATOR_SERVER).length == 2 && str.trim().endsWith("百度") && str2.toLowerCase().contains("word");
    }

    public static int d() {
        IWeChatMiniProgramService iWeChatMiniProgramService = (IWeChatMiniProgramService) SDKContext.getInstance().getService(IWeChatMiniProgramService.class);
        if (iWeChatMiniProgramService != null) {
            return iWeChatMiniProgramService.isXwebEnable() ? 1 : 0;
        }
        return 0;
    }

    public static IWebView d(int i) {
        if (WindowManager.a() == null || WindowManager.a().s() == null) {
            return null;
        }
        return WindowManager.a().s().getWebViewOffset(i);
    }

    public static boolean d(String str) {
        if (TextUtils.isEmpty(str)) {
            return false;
        }
        String trim = str.toLowerCase().trim();
        return trim.startsWith("www.sogou.com") || trim.startsWith("http://www.sogou.com") || trim.startsWith("https://www.sogou.com") || trim.startsWith("wap.sogou.com") || trim.startsWith("http://wap.sogou.com") || trim.startsWith("https://wap.sogou.com") || trim.startsWith("m.sogou.com") || trim.startsWith("http://m.sogou.com") || trim.startsWith("https://m.sogou.com") || trim.equals("https://www.m.sogou.com") || trim.equals(MttResources.l(R.string.ba2));
    }

    public static boolean d(String str, String str2) {
        return c(str, str2) || a(str, str2) || b(str, str2);
    }

    public static int e() {
        IMiniAuthStateService iMiniAuthStateService = (IMiniAuthStateService) SDKContext.getInstance().getService(IMiniAuthStateService.class);
        if (iMiniAuthStateService != null) {
            return iMiniAuthStateService.getAuthState();
        }
        return 0;
    }

    public static SearchOpenData e(String str, String str2) {
        if (TextUtils.isEmpty(str)) {
            return null;
        }
        Iterator<Map.Entry<String, String>> it = UrlUtils.getUrlParam(str).entrySet().iterator();
        int i = 0;
        String str3 = null;
        String str4 = null;
        String str5 = null;
        String str6 = null;
        String str7 = null;
        String str8 = null;
        String str9 = null;
        String str10 = null;
        String str11 = null;
        String str12 = null;
        String str13 = null;
        String str14 = null;
        String str15 = null;
        String str16 = null;
        String str17 = null;
        String str18 = null;
        String str19 = null;
        String str20 = null;
        String str21 = null;
        String str22 = null;
        String str23 = null;
        String str24 = null;
        String str25 = null;
        String str26 = "0";
        String str27 = str26;
        String str28 = str27;
        int i2 = 0;
        int i3 = 0;
        boolean z = true;
        boolean z2 = true;
        long j = 0;
        boolean z3 = false;
        boolean z4 = false;
        String str29 = null;
        int i4 = 0;
        while (it.hasNext()) {
            Map.Entry<String, String> next = it.next();
            if (TextUtils.equals(next.getKey(), PanEventHelper.PAN_DIRECTION_VERTICAL)) {
                i2 = SearchCommonNativePage.a(next.getValue().trim(), i);
                z4 = true;
            }
            if (TextUtils.equals(next.getKey(), "searchFrom")) {
                i4 = SearchCommonNativePage.a(next.getValue().trim(), i);
            }
            if (TextUtils.equals(next.getKey(), str2)) {
                str7 = next.getValue();
            }
            if (TextUtils.equals(next.getKey(), "searchEngine")) {
                str6 = next.getValue().trim();
            }
            if (TextUtils.equals(next.getKey(), "hintKeyword")) {
                str8 = next.getValue().trim();
            }
            if (TextUtils.equals(next.getKey(), "hintWordColor")) {
                str9 = next.getValue().trim();
            }
            if (TextUtils.equals(next.getKey(), "hintKeywordUrl")) {
                str3 = next.getValue().trim();
            }
            if (TextUtils.equals(next.getKey(), "buEchoParam")) {
                str4 = UrlUtils.getUrlParamValue(str, "buEchoParam");
            }
            if (TextUtils.equals(next.getKey(), "transferParam")) {
                str5 = UrlUtils.getUrlParamValue(str, "transferParam");
            }
            if (TextUtils.equals(next.getKey(), Apk.IEditor.KEY_CHANNEL)) {
                str26 = UrlUtils.getUrlParamValue(str, Apk.IEditor.KEY_CHANNEL);
            }
            if (TextUtils.equals(next.getKey(), "enhanceMode")) {
                str27 = UrlUtils.getUrlParamValue(str, "enhanceMode");
            }
            if (TextUtils.equals(next.getKey(), "kbhide")) {
                str28 = UrlUtils.getUrlParamValue(str, "kbhide");
            }
            if (TextUtils.equals(next.getKey(), "iconType")) {
                i3 = SearchCommonNativePage.a(next.getValue().trim(), 0);
            }
            if (TextUtils.equals(next.getKey(), "page")) {
                String value = next.getValue();
                f70070c = value;
                str11 = value;
            }
            if (TextUtils.equals(next.getKey(), "module")) {
                str12 = next.getValue();
            }
            if (TextUtils.equals(next.getKey(), "moduleType")) {
                str13 = next.getValue();
            }
            if (TextUtils.equals(next.getKey(), "entryUrl")) {
                str14 = next.getValue();
            }
            if (TextUtils.equals(next.getKey(), "entryScene")) {
                str15 = next.getValue();
            }
            if (TextUtils.equals(next.getKey(), "entryTime")) {
                str20 = next.getValue();
            }
            if (TextUtils.equals(next.getKey(), "entryStatus")) {
                str16 = next.getValue();
            }
            if (TextUtils.equals(next.getKey(), "searchPageStatus")) {
                str17 = next.getValue();
            }
            if (TextUtils.equals(next.getKey(), "action")) {
                str18 = next.getValue();
            }
            if (TextUtils.equals(next.getKey(), "entryContent")) {
                str19 = next.getValue();
            }
            if (TextUtils.equals(next.getKey(), "searchPageContent")) {
                str21 = next.getValue();
            }
            if (TextUtils.equals(next.getKey(), "searchDirectExtraInfo")) {
                str22 = next.getValue();
            }
            if (TextUtils.equals(next.getKey(), "searchResultExtraData")) {
                str23 = next.getValue();
            }
            if (TextUtils.equals(next.getKey(), "preload")) {
                z3 = TextUtils.equals(IOpenJsApis.TRUE, next.getValue());
            }
            Iterator<Map.Entry<String, String>> it2 = it;
            if (TextUtils.equals(next.getKey(), "uesLocalHotword")) {
                z = TextUtils.equals(IOpenJsApis.TRUE, next.getValue());
            }
            if (TextUtils.equals(next.getKey(), "isHintCanSearch")) {
                z2 = TextUtils.equals(IOpenJsApis.TRUE, next.getValue());
            }
            if (TextUtils.equals(next.getKey(), "open_action")) {
                str29 = next.getValue();
            }
            if (TextUtils.equals(next.getKey(), "ext_param")) {
                str24 = next.getValue();
            }
            if (TextUtils.equals(next.getKey(), HippyDataPreloadController.START_TIME)) {
                j = StringUtils.a(next.getValue(), 0L);
                f70068a = j;
            }
            if (TextUtils.equals(next.getKey(), IReaderCallbackListener.KEY_ERR_CATEGORY)) {
                str10 = UrlUtils.decode(next.getValue());
            }
            if (TextUtils.equals(next.getKey(), "welfaredata")) {
                f70071d = next.getValue().trim();
            }
            if (TextUtils.equals(next.getKey(), "btnGuideAnim")) {
                str25 = next.getValue().trim();
            }
            it = it2;
            i = 0;
        }
        SearchOpenData E = new SearchOpenData().c(i4).C(str29).w(str4).g(str5).x(str6).u(str7).d(i2).d(false).s(str8).z(str9).v(str10).h(str3).e(false).t(str26).r(str27).y(str28).e(i3).i(str11).j(str12).D(str13).k(str14).l(str15).m(str16).n(str17).o(str18).p(str19).d(str20).q(str21).c(z).b(str22).c(str23).b(z2).a(str24).A(str).B(str25).a(j).E();
        E.j = z3;
        if (z4) {
            E.a(SearchOpenData.f70129d);
        }
        return E;
    }

    public static void e(String str) {
        a(str, 0);
    }

    public static int f() {
        IMiniAuthStateService iMiniAuthStateService = (IMiniAuthStateService) SDKContext.getInstance().getService(IMiniAuthStateService.class);
        if (iMiniAuthStateService != null) {
            return iMiniAuthStateService.getRefusedCount();
        }
        return 0;
    }

    public static String f(String str, String str2) {
        if (TextUtils.isEmpty(str) || !str.startsWith("qb://enginesearch")) {
            return str;
        }
        String urlParamValue = UrlUtils.getUrlParamValue(str, "engine");
        if (TextUtils.isEmpty(urlParamValue)) {
            return str;
        }
        if (!urlParamValue.contains("whitebox") && !urlParamValue.contains("huichuan") && !urlParamValue.contains("sogou") && !urlParamValue.contains(GetTask.ICustomForegroundPredication.QB)) {
            return str;
        }
        String urlParamValue2 = UrlUtils.getUrlParamValue(str, "extraquery");
        if (TextUtils.isEmpty(urlParamValue2)) {
            return str;
        }
        String b2 = b(UrlUtils.decode(urlParamValue2), SearchVReportManager.a());
        if (!TextUtils.isEmpty(str2)) {
            b2 = b(b2, "jump_from", str2);
        }
        return a(str, "extraquery", UrlUtils.encode(b2));
    }

    public static boolean f(String str) {
        return TextUtils.isEmpty(str) || TextUtils.isEmpty(str.trim().replaceAll("\\u00A0", ""));
    }

    public static String g() {
        return f70071d;
    }

    public static boolean g(String str) {
        QbTbsWizard qbTbsWizard = (QbTbsWizard) WebEngine.e().d();
        if (qbTbsWizard != null) {
            return qbTbsWizard.prefetchDNS(str);
        }
        SearchLog.a("预解析DNS", "wizard为空", "", -1);
        return false;
    }

    public static boolean g(String str, String str2) {
        return i(str, str2) || j(str);
    }

    private static String h(String str, String str2) {
        StringBuilder sb;
        if (TextUtils.isEmpty(str) || TextUtils.isEmpty(str2)) {
            return str;
        }
        Matcher matcher = Pattern.compile("(#|\\?|&)(" + str2 + "=.*?)(#|&|$)", 2).matcher(str);
        if (!matcher.find() || matcher.groupCount() <= 2) {
            return str;
        }
        String group = matcher.group(2);
        if (TextUtils.isEmpty(group)) {
            return str;
        }
        int indexOf = str.indexOf(group);
        if (indexOf <= 0 || str.charAt(indexOf - 1) != '&') {
            if (group.length() + indexOf < str.length() - 1 && str.charAt(indexOf + group.length() + 1) == '&') {
                sb = new StringBuilder();
                sb.append(group);
                sb.append(ContainerUtils.FIELD_DELIMITER);
            }
            return str.replace(group, "");
        }
        sb = new StringBuilder();
        sb.append(ContainerUtils.FIELD_DELIMITER);
        sb.append(group);
        group = sb.toString();
        return str.replace(group, "");
    }

    public static void h() {
        f70071d = null;
    }

    public static boolean h(String str) {
        String str2;
        InterceptNativeSearchConfig interceptNativeSearchConfig = new InterceptNativeSearchConfig();
        if (!interceptNativeSearchConfig.a()) {
            return false;
        }
        int length = interceptNativeSearchConfig.f70351a.length();
        for (int i = 0; i < length; i++) {
            try {
                str2 = interceptNativeSearchConfig.f70351a.getString(i);
            } catch (Exception unused) {
                str2 = "";
            }
            if (!TextUtils.isEmpty(str2) && str.startsWith(str2)) {
                return true;
            }
        }
        return false;
    }

    private static IBinder i() {
        View a2;
        ActivityHandler.ActivityInfo m = ActivityHandler.b().m();
        if (m != null && m.b() != null) {
            Activity b2 = m.b();
            if (b2.getCurrentFocus() != null) {
                a2 = b2.getCurrentFocus();
            } else if (a(b2) != null) {
                a2 = a(b2);
            }
            return a2.getWindowToken();
        }
        return null;
    }

    public static void i(String str) {
        StringBuilder sb;
        String str2;
        if (TextUtils.isEmpty(str) || !"home_page".equals(f70070c)) {
            return;
        }
        if (SearchEngineManager.getInstance().b()) {
            sb = new StringBuilder();
            str2 = "SEARCH_COLD_BOOT_";
        } else {
            sb = new StringBuilder();
            str2 = "SEARCH_HOT_BOOT_";
        }
        sb.append(str2);
        sb.append(str);
        a(sb.toString(), System.currentTimeMillis() - f70068a);
    }

    private static boolean i(String str, String str2) {
        Iterator<SmartBox_HotWordsItem> it = SearchHotwordManager.a().e().iterator();
        boolean z = false;
        while (it.hasNext()) {
            SmartBox_HotWordsItem next = it.next();
            if (next != null && TextUtils.equals(next.sShowTitle, str) && TextUtils.equals(next.sUrl, str2)) {
                z = true;
            }
        }
        return z;
    }

    private static boolean j(String str) {
        return TextUtils.isEmpty(str) || TextUtils.equals(str, TKDSearchHotwordBaseInfoHolder.k());
    }
}