【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不一样,修改待定
相关推荐
冬奇Lab1 小时前
一次必现ANR问题的深度分析与解决之旅:当NestedScrollView遇上VelocityTracker
android·性能优化·debug
三少爷的鞋2 小时前
2025 技术总结:我把技术重新结构化的一年
android
叶羽西2 小时前
查Google Android某个子仓库的修改情况
android
a176029317572 小时前
3DS模拟器 Azahar模拟器最新版 安卓汉化中文版+PC版附3DS中文游戏资源全集+3DS密匙key和字库
android·游戏
山山而川 潺潺如镜3 小时前
python防止程序多开,但程序运行脚本
android·开发语言·python
花开彼岸天~3 小时前
Flutter跨平台开发:Android View 在鸿蒙系统上的使用指南
android·flutter·harmonyos
子一!!3 小时前
MySQL==表的结构操作1
android·python·adb
你不是我我4 小时前
【Java 开发日记】我们来说一下 MySQL 的慢查询日志
android·java·mysql
梦幻通灵13 小时前
Mysql字段判空实用技巧
android·数据库·mysql
龘龍龙15 小时前
Python基础(九)
android·开发语言·python