【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不一样,修改待定
相关推荐
野生的码农14 分钟前
码农的妇产科实习记录
android·java·人工智能
王正南28 分钟前
kali-linux 虚拟机连接安卓模拟器
android·linux·运维·虚拟机连接模拟器·安卓模拟器,linux虚拟机
撩得Android一次心动40 分钟前
Android Jetpack 概述
android·android jetpack
JinBeen42 分钟前
sourcetree下码云gitee的ssh经常失效问题
android·gitee·ssh
帅得不敢出门1 小时前
Android各芯片平台日志打开及获取
android
极客小云2 小时前
【Android Gradle 构建常见报错及解决方法大全】
android·运维开发
Just_Paranoid2 小时前
【TaskbarDelegate】屏蔽上滑返回桌面手势功能
android·systemui·navigation·launcher·gesture
赛恩斯3 小时前
asfp 如何导入并使用aosp13
android
诸神黄昏EX3 小时前
Android Safety 系列专题【篇三:Secure Boot机制】
android
李坤林3 小时前
Android Binder 详解(4) Binder 线程池
android·java·binder