【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不一样,修改待定
相关推荐
星光一影1 分钟前
合成植物大战僵尸 安卓原生APP Cocos游戏 支持Sigmob
android·游戏·php·html5·web app
2501_915918413 分钟前
iOS 项目中证书管理常见的协作问题
android·ios·小程序·https·uni-app·iphone·webview
allk558 分钟前
Android ANR 深度起底:从系统埋雷机制到全链路治理体系
android
满天星83035779 分钟前
【Linux】信号(下)
android·linux·运维·服务器·开发语言·性能优化
2501_9159184110 分钟前
提升 iOS 应用安全审核通过率的一种思路,把容易被拒的点先处理
android·安全·ios·小程序·uni-app·iphone·webview
Kapaseker11 分钟前
一万四千字重温 Android 四大组件
android·kotlin
00后程序员张20 分钟前
APP如何快速上架Apple Store:完整上架流程与常见问题解析
android·小程序·https·uni-app·iphone·webview
傻啦嘿哟24 分钟前
Appium实现Android应用数据爬取:从环境搭建到实战优化
android·appium
jian1105844 分钟前
android java转kotlin,kotlin转java
android·java·kotlin
俩个逗号。。44 分钟前
android 后台应用申请音频焦点失败
android·音视频