Android 13 关闭相册的编辑功能

介绍

因为做的是学生机,客户不希望相册的图片可以编辑。

分析

通过字符串我们找到了几个资源文件,以下只展示其中一个

路径:vendor/mediatek/proprietary/packages/apps/Gallery2/res/menu/operation.xml

XML 复制代码
    <item android:id="@+id/action_edit"
            android:title="@string/edit"
            android:showAsAction="never"
            android:visible="false" />

接着我们通过id排查,看是由哪个JAVA文件调用了该ID,到这里我们发现是在updateSupportedMenuEnabled调用了该项,这里有个if条件supportEdit,这里是通过MediaObject.SUPPORT_EDIT的值来判断是否启用。

路径:vendor/mediatek/proprietary/packages/apps/Gallery2/src/com/android/gallery3d/ui/MenuExecutor.java

java 复制代码
    public static void updateSupportedMenuEnabled(Menu menu, int supported, boolean enabled) {
        boolean supportDelete = (supported & MediaObject.SUPPORT_DELETE) != 0;
        boolean supportRotate = (supported & MediaObject.SUPPORT_ROTATE) != 0;
        boolean supportCrop = (supported & MediaObject.SUPPORT_CROP) != 0;
        boolean supportShare = (supported & MediaObject.SUPPORT_SHARE) != 0;
        boolean supportSetAs = (supported & MediaObject.SUPPORT_SETAS) != 0;
        boolean supportShowOnMap = (supported & MediaObject.SUPPORT_SHOW_ON_MAP) != 0;
        boolean supportCache = (supported & MediaObject.SUPPORT_CACHE) != 0;
        boolean supportEdit = (supported & MediaObject.SUPPORT_EDIT) != 0;
        boolean supportInfo = (supported & MediaObject.SUPPORT_INFO) != 0;
        //add for Bluetooth Print feature
        boolean supportPrint = (supported & MediaObject.SUPPORT_PRINT) != 0;

        if (supportDelete) {
            setMenuItemEnable(menu, R.id.action_delete, enabled);
        }
        if (supportRotate) {
            setMenuItemEnable(menu, R.id.action_rotate_ccw, enabled);
            setMenuItemEnable(menu, R.id.action_rotate_cw, enabled);
        }
        if (supportCrop) {
            setMenuItemEnable(menu, R.id.action_crop, enabled);
        }
        if (supportShare) {
            setMenuItemEnable(menu, R.id.action_share, enabled);
        }
        if (supportSetAs) {
            setMenuItemEnable(menu, R.id.action_setas, enabled);
        }
        if (supportShowOnMap) {
            setMenuItemEnable(menu, R.id.action_show_on_map, enabled);
        }
        if (supportEdit) {
            setMenuItemEnable(menu, R.id.action_edit, enabled);
        }
        if (supportInfo) {
            setMenuItemEnable(menu, R.id.action_details, enabled);
        }
    }

修改

我们只需将SUPPORT_EDIT 的值改为0即可,编译后查看编辑功能确实消失了。

路径:vendor/mediatek/proprietary/packages/apps/Gallery2/src/com/android/gallery3d/data/MediaObject.java

java 复制代码
    //*/soda water.Remove Photo editing
    public static final int SUPPORT_EDIT = 0;
    /*/
    public static final int SUPPORT_EDIT = 1 << 9;
    //*/
相关推荐
uwvwko10 小时前
BUUCTF——web刷题第一页题解
android·前端·数据库·php·web·ctf
fzxwl10 小时前
隆重推荐(Android 和 iOS)UI 自动化工具—Maestro
android·ui·ios
LittleLoveBoy13 小时前
踩坑:uiautomatorviewer.bat 打不开
android
居然是阿宋13 小时前
Android核心系统服务:AMS、WMS、PMS 与 system_server 进程解析
android
CGG9216 小时前
【单例模式】
android·java·单例模式
kp0000017 小时前
PHP弱类型安全漏洞解析与防范指南
android·开发语言·安全·web安全·php·漏洞
编程乐学(Arfan开发工程师)1 天前
06、基础入门-SpringBoot-依赖管理特性
android·spring boot·后端
androidwork1 天前
使用 Kotlin 和 Jetpack Compose 开发 Wear OS 应用的完整指南
android·kotlin
繁依Fanyi1 天前
Animaster:一次由 CodeBuddy 主导的 CSS 动画编辑器诞生记
android·前端·css·编辑器·codebuddy首席试玩官
奔跑吧 android1 天前
【android bluetooth 框架分析 02】【Module详解 6】【StorageModule 模块介绍】
android·bluetooth·bt·aosp13·storagemodule