【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不一样,修改待定
相关推荐
alexhilton1 小时前
Jetpack Compose中的阴影艺术
android·kotlin·android jetpack
百***61874 小时前
Spring的构造注入
android·java·spring
Tom4i4 小时前
Kotlin 中的 inline 和 reified 关键字
android·开发语言·kotlin
yi诺千金5 小时前
Android U 自由窗口(浮窗)——启动流程(system_server侧流程)
android
清空mega7 小时前
第11章 网络编程
android·网络
自动化BUG制造器7 小时前
Android UI 线程不一定是主线程
android
无知的前端7 小时前
一文读懂-Jetpack与AndroidX
android·kotlin·android jetpack
河铃旅鹿9 小时前
Android开发-java版:SQLite数据库
android·数据库·笔记·学习·sqlite
旋律逍遥9 小时前
《Framework 开发》3、开发工具及命令行知识装备
android
啦啦9117149 小时前
安卓手机/平板/TV版 Rotation强制横屏显示工具!免ROOT可用!再推荐突破手机限制的3款神器
android·智能手机·电脑