【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不一样,修改待定
相关推荐
q***01778 小时前
【MySQL】数据类型
android·数据库·mysql
大数据女孩_Aimee8 小时前
AndroidAutoOverUsbInteractiveHostTest FAIL
android·测试用例
hqk8 小时前
鸿蒙 ArkUI 从零到精通:基础语法全解析
android·前端·harmonyos
5***g2989 小时前
MySQL 数据库连接池爆满问题排查与解决
android·数据库·mysql
牛奔9 小时前
php 8.2 配置安装php-zbarcode扩展
android·开发语言·php
hudawei9969 小时前
kotlin协程编译成Android字节码后是什么样的
android·开发语言·kotlin
2501_9151063210 小时前
iOS 抓不到包怎么办?从 HTTPS 代理排查到 TCP 数据流捕获的全链路解决方案
android·tcp/ip·ios·小程序·https·uni-app·iphone
游戏开发爱好者810 小时前
APP上架苹果应用商店经验教训与注意事项
android·ios·小程序·https·uni-app·iphone·webview
s***353010 小时前
【MySQL】MySQL用户管理
android·mysql·adb
QING61810 小时前
kotlin 协程: GlobalScope 和 Application Scope 选择和使用 —— 新手指南
android·kotlin·android jetpack