【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不一样,修改待定
相关推荐
z92098102314 小时前
ZTE 中兴 高通 安卓手机 一键改串 一键新机 IMEI MEID 写号 硬改 手机修改参数 视频教程演示
android·智能手机
idealzouhu14 小时前
【Android Framework】Intent 运行机制
android
2501_9462338915 小时前
Flutter与OpenHarmony Tab切换组件开发详解
android·javascript·flutter
2501_9462338915 小时前
Flutter与OpenHarmony订单详情页面实现
android·javascript·flutter
2501_9444460015 小时前
Flutter&OpenHarmony拖拽排序功能实现
android·javascript·flutter
2501_9444460015 小时前
Flutter&OpenHarmony应用生命周期管理
android·javascript·flutter
驱动探索者15 小时前
[缩略语大全]之[安卓]篇
android
张拭心15 小时前
"氛围编程"程序员被解雇了
android·前端·人工智能
方白羽15 小时前
Android和HarmonyOS 设置透明度
android·app·harmonyos
恋猫de小郭16 小时前
Flutter 小技巧之帮网友理解 SliverConstraints overlap
android·前端·flutter