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;
        }
    }
相关推荐
Kwanvin12 天前
Android13 Hotseat客制化--Hotseat修改布局、支持滑动、去掉开机弹动效果、禁止创建文件夹
android·java·launcher3·hotseat
Kwanvin18 天前
仿华为车机UI--图标从Workspace拖动到Hotseat同时保留图标在原来位置
android·java·ui·华为·launcher3
42nf2 个月前
Android Launcher3桌面图标样式修改(添加圆角)
android·launcher3
suifen_3 个月前
RK3588 Android13自定义一个按键实现长按短按
linux·驱动开发·rk3588·android13
林多10 个月前
【Android】Android Framework系列--Launcher3各启动场景源码分析
android·启动·launcher·launcher3·home
Mr. 码农10 个月前
[P7885][Android13] 解决5G信号良好状态栏信号只有两格的问题
android13·p7885·展锐5g·信号格数
Mr. 码农1 年前
[QCM6125][Android13] 解决应用调用静态广播无法接收到的问题
android13·qcm6125·静态广播·setcomponent
Mr. 码农1 年前
[QCM6125][Android13] 屏蔽Launcher3桌面的搜索栏
android13·qcm6125·launcher3·搜索栏
Mr. 码农1 年前
[QCM6125][Android13] 默认允许使用usb权限
android13·qcm6125·usb权限·默认授权