Android13--移除最近任务长按图标弹出菜单

最近在改Android13最近任务的一些功能,其中一个需求是把长按图标弹出菜单的功能屏蔽掉。

涉及到的类

quickstep\src\com\android\quickstep\views\TaskView.java

最近任务里面每一个任务对应的是一个TaskView

长按图标后,会调用showTaskMenu方法,弹出菜单,菜单类为TaskMenuView,如下:

java 复制代码
    private boolean showTaskMenu(IconView iconView) {
        if (!getRecentsView().canLaunchFullscreenTask()) {
            // Don't show menu when selecting second split screen app
            return true;
        }

        if (!mActivity.getDeviceProfile().isTablet
                && !getRecentsView().isClearAllHidden()) {
            getRecentsView().snapToPage(getRecentsView().indexOfChild(this));
            return false;
        } else {
            mActivity.getStatsLogManager().logger().withItemInfo(getItemInfo())
                    .log(LAUNCHER_TASK_ICON_TAP_OR_LONGPRESS);
            return showTaskMenuWithContainer(iconView);
        }
    }

在平板上,会去调用showTaskMenuWithContainer方法,弹出菜单

如果想不显示这个菜单,直接不调用这个方法就行了,直接访问true

java 复制代码
    private boolean showTaskMenu(IconView iconView) {
        if (!getRecentsView().canLaunchFullscreenTask()) {
            // Don't show menu when selecting second split screen app
            return true;
        }

        if (!mActivity.getDeviceProfile().isTablet
                && !getRecentsView().isClearAllHidden()) {
            getRecentsView().snapToPage(getRecentsView().indexOfChild(this));
            return false;
        } else {
            mActivity.getStatsLogManager().logger().withItemInfo(getItemInfo())
                    .log(LAUNCHER_TASK_ICON_TAP_OR_LONGPRESS);
            // return showTaskMenuWithContainer(iconView);
               return true;
        }
    }
相关推荐
科技道人2 天前
Android15 launcher3
android·launcher3·android15·hotseat
ItJavawfc1 个月前
MTKAndroid13-Launcher3 屏蔽部分app不让显示
launcher3·隐藏app·ui 影藏·mtkandroid13
毛豆的毛豆Y1 个月前
AOSP Android14 Launcher3——动画核心类QuickstepTransitionManager详解
aosp·launcher3·android14
毛豆的毛豆Y2 个月前
AOSP Android14 Launcher3——RecentsView最近任务数据加载
aosp·launcher3·android14
毛豆的毛豆Y2 个月前
AOSP Android14 Launcher3——点击桌面图标启动应用动画流程
aosp·launcher3·android14
毛豆的毛豆Y2 个月前
AOSP Android14 Launcher3——远程窗口动画关键类SurfaceControl详解
aosp·launcher3·android14
毛豆的毛豆Y2 个月前
AOSP Android14 Launcher3——底部任务栏Taskbar详解
aosp·launcher3·android14
a3158238064 个月前
Android设置个性化按钮按键的快捷启动应用
android·开发语言·framework·源码·android13
Sgq丶7 个月前
Android 13 aosp Launcher 隐藏“壁纸和样式“入口
android·aosp·launcher3
ItJavawfc7 个月前
Launcher3 去掉桌面搜索索框
launcher3·去掉搜索框·谷歌搜索框