【Android】隐藏settings中的二级菜单

需求:隐藏安全性和位置信息下的安全更新二级条目

系统:Android8.1

代码地址:MtkSettings/src/com/android/settings/SecuritySettings.java

java 复制代码
private PreferenceScreen createPreferenceHierarchy() {
....
PreferenceGroup securityStatusPreferenceGroup =
                (PreferenceGroup) root.findPreference(KEY_SECURITY_STATUS);
        final List<Preference> tilePrefs = mDashboardFeatureProvider.getPreferencesForCategory(
            getActivity(), getPrefContext(), getMetricsCategory(),
            CategoryKey.CATEGORY_SECURITY);
        int numSecurityStatusPrefs = 0;
        if (tilePrefs != null && !tilePrefs.isEmpty()) {
            for (Preference preference : tilePrefs) {
                if (!TextUtils.isEmpty(preference.getKey())
                    && preference.getKey().startsWith(SECURITY_STATUS_KEY_PREFIX)) {
                    // Injected security status settings are placed under the Security status
                    // category.
                    securityStatusPreferenceGroup.addPreference(preference);
                    numSecurityStatusPrefs++;
                } else {
                    // Other injected settings are placed under the Security preference screen.
                    root.addPreference(preference);
                }
            }
        }
....
}

打印log

分别对应:

保护机制、查找设备、安全更新

添加过滤即可

  • 系统Android9.0不一样,修改待定
相关推荐
行稳方能走远20 分钟前
Android C++ 学习笔记
android·c++
2501_9462309822 分钟前
Cordova&OpenHarmony用户账户管理
android·javascript
x66ccff24 分钟前
Claude Code 安装方法
android·java·数据库
码农搬砖_202037 分钟前
【一站式学会compose】 Android UI体系之 Image的使用和介绍
android·image·compose·content·contentscale·scaletype
粤M温同学1 小时前
Android Room数据库的基本使用
android·数据库
lkbhua莱克瓦241 小时前
基础-约束
android·开发语言·数据库·笔记·sql·mysql·约束
戴西软件1 小时前
CAxWorks.VPG车辆工程仿真软件:打造新能源汽车安全的“数字防线“
android·大数据·运维·人工智能·安全·低代码·汽车
ljt27249606612 小时前
Compose笔记(六十三)--SegmentedButton
android·笔记·android jetpack
Android系统攻城狮2 小时前
Android ALSA驱动进阶之设置共享内存snd_pcm_lib_mmap_iomem:用法实例(九十九)
android·pcm·音频进阶·alsa驱动·android驱动
ZHANG13HAO2 小时前
Android 13 系统源码定制的保活方案,
android