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

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


package com.tencent.mtt.search;

import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.text.TextUtils;
import com.huawei.hms.framework.common.ContainerUtils;
import com.tencent.common.manifest.AppManifest;
import com.tencent.common.utils.UrlUtils;
import com.tencent.mtt.ContextHolder;
import com.tencent.mtt.abtest.search.ABTestManagerSC;
import com.tencent.mtt.search.data.entrance.SearchEntranceInfo;
import com.tencent.mtt.search.data.entrance.SearchEntranceManager;
import com.tencent.mtt.search.data.history.SearchHistoryManager;
import com.tencent.mtt.search.data.history.SearchInputHistory;
import com.tencent.mtt.search.facade.ISearchDirectExtension;
import com.tencent.mtt.search.searchEngine.urlloader.SearchUrlLoaderConfig;
import com.tencent.mtt.setting.PublicSettingManager;
import com.tencent.smtt.sdk.WebView;
import java.util.Map;

public class SearchHistoryUtil {
    public static String a(String str) {
        String urlParamValue = UrlUtils.getUrlParamValue(str, "jump_from");
        if (TextUtils.isEmpty(urlParamValue)) {
            urlParamValue = "his";
        } else if (!urlParamValue.startsWith("his_")) {
            urlParamValue = "his_" + urlParamValue;
        }
        return UrlUtils.addParamsToUrl(UrlUtils.removeArg(str, "jump_from"), "jump_from=" + urlParamValue);
    }

    private static String a(Map.Entry<String, String> entry, String str, String str2) {
        String key = entry.getKey();
        String value = entry.getValue();
        if (str2.equals(key)) {
            return UrlUtils.removeArg(str, str2);
        }
        if (!UrlUtils.isWebUrl(value)) {
            return str;
        }
        entry.setValue(UrlUtils.removeArg(value, str2));
        return str;
    }

    public static void a(Context context, SearchInputHistory searchInputHistory, ISearchUrlDispatcher iSearchUrlDispatcher, int i, int i2) {
        if (a(context, searchInputHistory)) {
            return;
        }
        if (searchInputHistory.g()) {
            a(searchInputHistory, iSearchUrlDispatcher, i, i2);
        } else {
            a(searchInputHistory, iSearchUrlDispatcher, i);
        }
    }

    private static void a(SearchOpenHistoryConfig searchOpenHistoryConfig) {
        String c2 = searchOpenHistoryConfig.c();
        SearchUrlLoaderConfig searchUrlLoaderConfig = new SearchUrlLoaderConfig();
        searchUrlLoaderConfig.a(searchOpenHistoryConfig.f());
        searchUrlLoaderConfig.b("1_01_22_01");
        searchOpenHistoryConfig.a().a(searchOpenHistoryConfig.b(), b(c2), searchOpenHistoryConfig.d(), searchOpenHistoryConfig.e(), searchUrlLoaderConfig);
    }

    private static void a(SearchInputHistory searchInputHistory, int i, String str) {
        if (PublicSettingManager.a().e()) {
            return;
        }
        SearchHistoryManager.a().b(new SearchInputHistory(searchInputHistory.e(), str, i));
    }

    private static void a(SearchInputHistory searchInputHistory, ISearchUrlDispatcher iSearchUrlDispatcher, int i) {
        String str = searchInputHistory.e;
        SearchOpenHistoryConfig searchOpenHistoryConfig = new SearchOpenHistoryConfig(iSearchUrlDispatcher, true, str, (byte) searchInputHistory.z, i);
        if (a(i, str)) {
            searchOpenHistoryConfig.a(4);
        } else {
            searchInputHistory.f = System.currentTimeMillis();
            SearchHistoryManager.a().b(searchInputHistory);
            if (searchInputHistory.z != 21) {
                searchOpenHistoryConfig.a(97);
            }
            if (ABTestManagerSC.c() == 0) {
                searchOpenHistoryConfig.a(false);
            }
            searchOpenHistoryConfig.b(0);
            if (1 != SearchUtils.b(searchInputHistory.e())) {
                searchOpenHistoryConfig.a(searchInputHistory.e());
            }
            SearchUtils.e(searchInputHistory.q);
        }
        a(searchOpenHistoryConfig);
    }

    private static void a(SearchInputHistory searchInputHistory, ISearchUrlDispatcher iSearchUrlDispatcher, int i, int i2) {
        if (i == 0) {
            iSearchUrlDispatcher.a(searchInputHistory.e(), 97, 0, "1_01_22_01", i2);
            return;
        }
        SearchEntranceInfo a2 = SearchEntranceManager.a().a(i);
        String a3 = iSearchUrlDispatcher.a(a2.e, searchInputHistory.e(), a2);
        a(searchInputHistory, i, a3);
        a(new SearchOpenHistoryConfig(iSearchUrlDispatcher, true, a3, 94, i));
    }

    private static boolean a(int i, String str) {
        return str.startsWith("https://smartbox.html5.qq.com/search?") && i != 0;
    }

    private static boolean a(Context context, SearchInputHistory searchInputHistory) {
        int b2 = searchInputHistory.b();
        ISearchDirectExtension iSearchDirectExtension = (ISearchDirectExtension) AppManifest.getInstance().queryExtension(ISearchDirectExtension.class, Integer.valueOf(b2));
        if (iSearchDirectExtension != null) {
            iSearchDirectExtension.open(context, b2, searchInputHistory.e(), searchInputHistory.e, null);
            return true;
        }
        if (!searchInputHistory.e.startsWith(WebView.SCHEME_TEL)) {
            return false;
        }
        c(searchInputHistory.e);
        return true;
    }

    private static String b(String str) {
        for (Map.Entry<String, String> entry : UrlUtils.getUrlParam(str).entrySet()) {
            String value = entry.getValue();
            str = a(entry, a(entry, a(entry, a(entry, a(entry, a(entry, a(entry, str, "jump_from"), "entryScene"), "entryTime"), "entryStatus"), "entryContent"), "searchPageStatus"), "entryUrl");
            if (!entry.getValue().equals(value)) {
                str = UrlUtils.addParamsToUrl(UrlUtils.removeArg(str, entry.getKey()), entry.getKey() + ContainerUtils.KEY_VALUE_DELIMITER + UrlUtils.encode(entry.getValue()));
            }
        }
        return str;
    }

    private static void c(String str) {
        try {
            Intent intent = new Intent("android.intent.action.DIAL");
            intent.setData(Uri.parse(str));
            ContextHolder.getAppContext().startActivity(intent);
        } catch (Throwable unused) {
        }
    }
}