【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不一样,修改待定
相关推荐
HEJOO91 小时前
MySQL 日期时间类型怎么选:DATE、DATETIME、TIMESTAMP、TIME、YEAR 全解析
android·数据库·mysql
风早爽太2 小时前
Android 开发笔记:封装 Fragment 的管理工具类
android·kotlin
峥嵘life2 小时前
Android 17 具体代码新特性总结
android·开发语言·网络
王者鳜錸4 小时前
Android 接入 AIKit 轻量版语音合成实战
android·交互·多语种·离线合成·多种发音人
『 时光荏苒 』5 小时前
SQL 中常用的查询条件分类汇总,每个都配有“大白话注释”和示例,方便你对照学习
android·java·开发语言
智购科技自动贩卖机5 小时前
自动售货机SaaS多租户数据库实战:分库分表与租户隔离~YH
android·java·linux·开发语言·javascript·网络
遥不可及zzz6 小时前
Android 接入 Helpshift SDK 详细教程(Java 实战):客服聊天、FAQ、用户登录及消息推送
android·helpshift
Digitally6 小时前
通过蓝牙将文件从 iPhone 传输到 Android
android
程序猿老A6 小时前
轻量应用服务器怎么配置mysql
android·mysql·adb
weixin_3947580315 小时前
CRMEB Pro 优惠券:下单怎么核销,取消/退款怎么返券
android