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;
        }
    }
相关推荐
Android小码家1 个月前
WSL 编译Android13+AVD环境搭建+WSL环境运行+Windows环境运行
wsl·虚拟机·android13·avd
a3158238062 个月前
Android13隐藏某个App需要关注的源码文件
android·java·framework·launcher3·隐藏app
Windra62 个月前
Android13后长按电源键实现关机
android13
毛豆的毛豆Y2 个月前
AOSP 14 Launcher3 - Taskbar UI 组成
aosp·launcher3·android14
科技道人8 个月前
Android15 launcher3
android·launcher3·android15·hotseat
ItJavawfc9 个月前
MTKAndroid13-Launcher3 屏蔽部分app不让显示
launcher3·隐藏app·ui 影藏·mtkandroid13
毛豆的毛豆Y9 个月前
AOSP Android14 Launcher3——动画核心类QuickstepTransitionManager详解
aosp·launcher3·android14
毛豆的毛豆Y9 个月前
AOSP Android14 Launcher3——RecentsView最近任务数据加载
aosp·launcher3·android14
毛豆的毛豆Y9 个月前
AOSP Android14 Launcher3——点击桌面图标启动应用动画流程
aosp·launcher3·android14
毛豆的毛豆Y9 个月前
AOSP Android14 Launcher3——远程窗口动画关键类SurfaceControl详解
aosp·launcher3·android14