【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不一样,修改待定
相关推荐
郑州光合科技余经理9 分钟前
海外版外卖系统源码:支付/地图/多语言核心代码实现
android·java·前端·后端·架构·uni-app·php
核电机组19 分钟前
flutter集成到Android混合开发
android·flutter
恋猫de小郭1 小时前
Android 17 内存管理将严格管控,App 要注意适配
android·前端·flutter
赏金术士1 小时前
Android 组件化学习项目(Kotlin + AGP8+)
android·学习·kotlin
问心无愧05131 小时前
ctf show web入门100
android·ide·笔记·android studio
暗冰ཏོ2 小时前
2026 App 开发完整指南:Android、iOS、跨平台开发与安卓应用上线全流程
android·ios·uni-app·web app·app开发
三少爷的鞋2 小时前
为什么 Clean Architecture 能让 ViewModel 保持轻量?
android
AD钙奶-lalala2 小时前
kotlin反射
android·开发语言·kotlin
le1616162 小时前
Android Compose——尺寸修饰符的调用顺序构成的不同尺寸约束效果
android·compose·modifier