Android 13 关闭相册的编辑功能

介绍

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

分析

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

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

    

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

路径:vendor/mediatek/proprietary/packages/apps/Gallery2/src/com/android/gallery3d/ui/MenuExecutor.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

    //*/soda water.Remove Photo editing
    public static final int SUPPORT_EDIT = 0;
    /*/
    public static final int SUPPORT_EDIT = 1 << 9;
    //*/

你可能感兴趣的:(Android,13,android)