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

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


package com.tencent.mtt.browser.intent;

import android.content.Context;
import android.content.Intent;
import android.graphics.drawable.Icon;
import android.net.Uri;
import com.qq.e.comm.constants.TangramHippyConstants;
import com.tencent.mtt.ContextHolder;
import com.tencent.mtt.R;
import com.tencent.mtt.external.qrcode.common.ActionConstants2;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.List;

public class AndroidMShortcus {

    public static class BuildShortcutStruct {

        public String f42210a;

        public String f42211b;

        public String f42212c;

        public int f42213d;
        public Intent e;

        public BuildShortcutStruct(String str, String str2, String str3, int i, Intent intent) {
            this.f42210a = str;
            this.f42211b = str2;
            this.f42212c = str3;
            this.f42213d = i;
            this.e = intent;
        }
    }

    public static void a(ClassLoader classLoader) {
        Intent intent = new Intent();
        intent.setAction(ActionConstants2.f56473d);
        intent.setData(Uri.parse("https://so.html5.qq.com/landingpage/page/hst-inBox?q=%E7%83%AD%E6%90%9C%E6%A6%9C&mext=inBox&jump_from=desk_quick"));
        intent.setPackage("com.tencent.mtt");
        intent.putExtra("internal_back", true);
        intent.putExtra("ChannelID", "shotcut");
        intent.putExtra(TangramHippyConstants.LOGIN_TYPE, 10);
        intent.setFlags(270532608);
        BuildShortcutStruct buildShortcutStruct = new BuildShortcutStruct("search_short_cut", "快速搜索", "查看今日热搜", R.drawable.a1o, intent);
        Intent intent2 = new Intent();
        intent2.setAction(ActionConstants2.f56473d);
        intent2.setData(Uri.parse("qb://bookmark"));
        intent2.setPackage("com.tencent.mtt");
        intent2.putExtra("internal_back", true);
        intent2.putExtra("ChannelID", "shotcut");
        intent2.setFlags(270532608);
        intent2.putExtra(TangramHippyConstants.LOGIN_TYPE, 10);
        BuildShortcutStruct buildShortcutStruct2 = new BuildShortcutStruct("history_short_cut", "查看书签", "查看书签", R.drawable.a1m, intent2);
        Intent intent3 = new Intent();
        intent3.setAction(ActionConstants2.f56473d);
        intent3.setData(Uri.parse("qb://camera"));
        intent3.putExtra("internal_back", true);
        intent3.putExtra("ChannelID", "shotcut");
        intent3.putExtra("PosID", "5");
        intent3.putExtra(TangramHippyConstants.LOGIN_TYPE, 10);
        intent3.setFlags(270532608);
        intent3.setPackage("com.tencent.mtt");
        a(classLoader, buildShortcutStruct, buildShortcutStruct2, new BuildShortcutStruct("scan_short_cut", "识你所见", "识你所见", R.drawable.a1n, intent3));
    }

    private static void a(ClassLoader classLoader, BuildShortcutStruct... buildShortcutStructArr) {
        Object systemService = ContextHolder.getAppContext().getSystemService("shortcut");
        if (systemService != null) {
            String str = ("android.content.pm.ShortcutInfo") + "$Builder";
            ArrayList arrayList = new ArrayList();
            try {
                for (BuildShortcutStruct buildShortcutStruct : buildShortcutStructArr) {
                    Object newInstance = classLoader.loadClass(str).getConstructor(Context.class, String.class).newInstance(ContextHolder.getAppContext(), buildShortcutStruct.f42210a);
                    Class<?> cls = newInstance.getClass();
                    cls.getMethod("setShortLabel", CharSequence.class).invoke(newInstance, buildShortcutStruct.f42211b);
                    cls.getMethod("setLongLabel", CharSequence.class).invoke(newInstance, buildShortcutStruct.f42212c);
                    cls.getMethod("setIcon", Icon.class).invoke(newInstance, Icon.createWithResource(ContextHolder.getAppContext(), buildShortcutStruct.f42213d));
                    cls.getMethod("setIntent", Intent.class).invoke(newInstance, buildShortcutStruct.e);
                    arrayList.add(cls.getMethod("build", new Class[0]).invoke(newInstance, new Object[0]));
                }
                systemService.getClass().getMethod("removeAllDynamicShortcuts", new Class[0]).invoke(systemService, new Object[0]);
                systemService.getClass().getMethod("setDynamicShortcuts", List.class).invoke(systemService, arrayList);
            } catch (ClassNotFoundException | IllegalAccessException | InstantiationException | NoSuchMethodException | InvocationTargetException | Exception unused) {
            }
        }
    }
}