【Android】隐藏settings中的二级菜单
需求:隐藏安全性和位置信息下的安全更新二级条目
系统:Android8.1
代码地址:MtkSettings/src/com/android/settings/SecuritySettings.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不一样,修改待定