【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不一样,修改待定
相关推荐
Kapaseker5 分钟前
为什么 Java 要废弃 Thread.stop()?看完这篇你就懂了
android·kotlin
苦瓜花15 分钟前
【Android】三大动画的实践
android
Mars-xq21 分钟前
VSCode 开发 Android 时,类、方法无法跳转
android·ide·vscode
2601_961766641 小时前
【分享】Resprite安卓版|专业像素绘画,游戏美术创作工具
android·游戏美术
Mars-xq1 小时前
VSCode 开发Android 新手必装插件清单
android·ide·vscode
Wonderful U1 小时前
Python+Django实战|社区物业管理系统:业主档案、车位管理、物业费收缴、线上报修、投诉建议、园区公告、日常巡检
android·python·django
三少爷的鞋2 小时前
现代 Android 官方为什么更推荐 Repository 暴露 `suspend fun`,而不是在内部 `launch`
android
黄林晴13 小时前
Google Play 发版链路全面重构:合规前置、审核自动化、生态全面收紧
android·google
通玄15 小时前
Jetpack Compose 入门系列(四):动画基本使用
android
杉氧15 小时前
Kotlin 协程深度解析②:生存指南——掌握结构化并发的生命线
android·kotlin