【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不一样,修改待定
相关推荐
ZePingPingZe17 小时前
DriverManager、DataSource、数据库驱动以及数据库连接池的关系
android·数据库·adb
2501_9151063217 小时前
H5 混合应用加密实践,从明文资源到安全 IPA 的多层防护体系
android·安全·ios·小程序·uni-app·iphone·webview
Jerry17 小时前
Compose 提升状态的场景
android
qq_7174100117 小时前
关闭相机-闪光灯功能
android
TeleostNaCl17 小时前
如何在 Android debug 的时候使用 adb install 命令降级安装应用
android·经验分享·adb·android runtime
微学AI17 小时前
生成式AI应用平台架构设计:ModelEngine核心能力与工程化实践路径
android·人工智能·rxjava
kkk_皮蛋18 小时前
从零开始:用 Android Studio 开发一个 AI 智能日记 App
android·ide·android studio
2501_9160074718 小时前
在 CICD 中实践 Fastlane + Appuploader 命令行,构建可复制的 iOS 自动化发布流程
android·运维·ios·小程序·uni-app·自动化·iphone
煤球王子18 小时前
简单了解:Android14中的Input event
android
2501_9159214318 小时前
从 HBuilder 到 App Store,uni-app 与 HBuilder 项目的 iOS 上架流程实战解析
android·ios·小程序·https·uni-app·iphone·webview