【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不一样,修改待定
相关推荐
赏金术士6 小时前
Kotlin 数据流与单双向绑定
android·开发语言·kotlin
小白学鸿蒙7 小时前
Unity 3D 2023解压安装,配置安卓运行环境后打包安卓应用(踩坑无数之差点放弃)
android·unity·游戏引擎
阿巴斯甜8 小时前
2026小知识点(9)
android
古月-一个C++方向的小白9 小时前
MySQL数据库——数据类型
android·数据库·mysql
张小潇11 小时前
AOSP15 WMS/AMS系统开发 - WindowManagerService finishDraw与prepareSurface流程详解
android
帅次13 小时前
Modifier 链与顺序、测量与命中区域
android·kotlin·compose·modifier
leory13 小时前
请详细描述Handler消息机制的工作原理
android·面试
leory13 小时前
请描述Binder IPC的基本原理和工作流程
android·面试
leory13 小时前
View的事件分发机制是怎样的?dispatchTouchEvent、onInterceptTouchEvent、onTouchEvent的关系?
android·面试
zander25814 小时前
Canal本地部署保姆级教程
android