【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不一样,修改待定
相关推荐
河铃旅鹿19 小时前
Android开发-java版:Framgent
android·java·笔记·学习
2501_916008891 天前
手机抓包app大全:无需root的安卓抓包软件列表
android·ios·智能手机·小程序·uni-app·iphone·webview
百锦再1 天前
第18章 高级特征
android·java·开发语言·后端·python·rust·django
gcygeeker1 天前
安卓 4.4.2 电视盒子 ADB 设置应用开机自启动
android·adb·电视盒子
小驰行动派1 天前
安卓上的极简番茄钟 | 开源
android·开源
jzlhll1231 天前
android抽屉DrawerLayout在2025的沉浸式兼容
android
基哥的奋斗历程1 天前
Kotlin_Flow_完整使用指南
android·开发语言·kotlin
j***82701 天前
【玩转全栈】----Django连接MySQL
android·mysql·django
雨白1 天前
深入理解 Android DocumentFile:性能陷阱与最佳实践
android
inputA1 天前
【LwIP源码学习8】netbuf源码分析
android·c语言·笔记·嵌入式硬件·学习