【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不一样,修改待定
相关推荐
wen_zhufeng1 小时前
用 vLLM 加速 TTS 推理:通用改造指南
android·vllm
长友cy3 小时前
windows 搭建Qt编译Android 应用程序,快速搭建
android·windows
智驭未来掌门人4 小时前
Android Kotlin 开发避坑指南:从语言特性到工程化实践
android
码农coding4 小时前
android12 ViewRootImpl分析
android
stevenzqzq4 小时前
compose项目返回到当前页面闪烁原因分析
android
古法安卓5 小时前
Android-显示流程
android·java·android studio
CircleMouse5 小时前
画一个Android智能手机机器人
android·智能手机·机器人
数据知道6 小时前
PHP 代码审计实战——ThinkPHP、Laravel 历史漏洞模式深度剖析
android·网络·web安全·网络安全·php·laravel
拍客圈6 小时前
换服务器 mozcjpeg 5.0.0
android
蜡台8 小时前
Jetpack Compose 稳定性、重组优化(Stable / @NonRestartableComposable)
android·kotlin·compose·jepack