【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不一样,修改待定
相关推荐
CYRUS_STUDIO1 小时前
使用 AndroidNativeEmu 调用 JNI 函数
android·逆向·汇编语言
梦否1 小时前
【Android】类加载器&热修复-随记
android
徒步青云2 小时前
Java内存模型
android
今阳2 小时前
鸿蒙开发笔记-6-装饰器之@Require装饰器,@Reusable装饰器
android·app·harmonyos
-优势在我7 小时前
Android TabLayout 实现随意控制item之间的间距
android·java·ui
hedalei7 小时前
android13修改系统Launcher不跟随重力感应旋转
android·launcher
Indoraptor8 小时前
Android Fence 同步框架
android
峥嵘life9 小时前
DeepSeek本地搭建 和 Android
android
叶羽西9 小时前
Android14 Camera框架中Jpeg流buffer大小的计算
android·安卓
jiasting9 小时前
Android 中 如何监控 某个磁盘有哪些进程或线程在持续的读写
android