【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不一样,修改待定
相关推荐
Flywith248 小时前
【每日一技】Raycast 实现 scrcpy 的快捷显示隐藏
android·前端
没有了遇见9 小时前
Android(Coil,Glide)大量图片加载缓存清理问题(二 Coil处理)
android
城东米粉儿9 小时前
Android Dagger2笔记
android
没有了遇见9 小时前
Android(Coil,Glide)大量图片加载缓存清理问题(一)
android
恋猫de小郭9 小时前
谷歌 Genkit Dart 正式发布:现在可以使用 Dart 和 Flutter 构建全栈 AI 应用
android·前端·flutter
曾经我也有梦想11 小时前
Day4 Kotlin 高级特性
android
simplepeng11 小时前
Compose Multiplatform 中的 Navigation 3
android
Kapaseker17 小时前
一杯美式讲完 Sealed Class
android·kotlin
冬奇Lab1 天前
PowerManagerService(下):Doze模式与电池优化
android·源码阅读
砖厂小工1 天前
Compose 中函数引用 vs Lambda:到底该用哪个?
android