AndroidRom定制删除Settings某些菜单选项
AndroidRom定制删除Settings某些菜单选项

1.前言.
最近在Rom开发中需要隐藏设置中的某些菜单,launcher3中的定制开发,这个属于很基本的定制需求,和隐藏google搜素栏一样简单,这里我就不展开了,直接上代码.
2.隐藏网络和互联网:
源码路径:package/apps/settings/src/com/android/settings/network/TopLevelNetworkEntryPreferenceController
/** Copyright (C) 2018 The Android Open Source Project** Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at** http://www.apache.org/licenses/LICENSE-2.0** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.* See the License for the specific language governing permissions and* limitations under the License.*/package com.android.settings.network;import android.content.Context;
import android.icu.text.ListFormatter;
import android.text.BidiFormatter;
import android.text.TextUtils;import com.android.settings.R;
import com.android.settings.Utils;
import com.android.settings.core.BasePreferenceController;
import com.android.settings.wifi.WifiMasterSwitchPreferenceController;import java.util.ArrayList;
import java.util.List;public class TopLevelNetworkEntryPreferenceController extends BasePreferenceController {private final WifiMasterSwitchPreferenceController mWifiPreferenceController;private final MobileNetworkPreferenceController mMobileNetworkPreferenceController;private final TetherPreferenceController mTetherPreferenceController;public TopLevelNetworkEntryPreferenceController(Context context, String preferenceKey) {super(context, preferenceKey);mMobileNetworkPreferenceController = new MobileNetworkPreferenceController(mContext);mTetherPreferenceController = new TetherPreferenceController(mContext, null /* lifecycle */);mWifiPreferenceController = new WifiMasterSwitchPreferenceController(mContext, null /* metrics */);}@Overridepublic int getAvailabilityStatus() {return Utils.isDemoUser(mContext) ? UNSUPPORTED_ON_DEVICE : AVAILABLE;}@Overridepublic CharSequence getSummary() {final String wifiSummary = BidiFormatter.getInstance().unicodeWrap(mContext.getString(R.string.wifi_settings_title));final String mobileSummary = mContext.getString(R.string.network_dashboard_summary_mobile);final String dataUsageSummary = mContext.getString(R.string.network_dashboard_summary_data_usage);final String hotspotSummary = mContext.getString(R.string.network_dashboard_summary_hotspot);final List<String> summaries = new ArrayList<>();if (mWifiPreferenceController.isAvailable()&& !TextUtils.isEmpty(wifiSummary)) {summaries.add(wifiSummary);}if (mMobileNetworkPreferenceController.isAvailable() && !TextUtils.isEmpty(mobileSummary)) {summaries.add(mobileSummary);}if (!TextUtils.isEmpty(dataUsageSummary)) {summaries.add(dataUsageSummary);}if (mTetherPreferenceController.isAvailable()&& !TextUtils.isEmpty(hotspotSummary)) {summaries.add(hotspotSummary);}return ListFormatter.getInstance().format(summaries);}
}
关键修改如下:
2种方式:
2.1.修改getAvailabilityStatus()方法
@Override
public int getAvailabilityStatus() {return true ? UNSUPPORTED_ON_DEVICE : AVAILABLE;
}
2.2.直接注释掉xml中互联网相关:
源码路径:package/apps/settings/res/xml/top_level_settings…xml
<?xml version="1.0" encoding="utf-8"?>
<!--Copyright (C) 2018 The Android Open Source ProjectLicensed under the Apache License, Version 2.0 (the "License");you may not use this file except in compliance with the License.You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, softwaredistributed under the License is distributed on an "AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.See the License for the specific language governing permissions andlimitations under the License.--><PreferenceScreenxmlns:android="http://schemas.android.com/apk/res/android"xmlns:settings="http://schemas.android.com/apk/res-auto"android:key="top_level_settings"><Preferenceandroid:key="top_level_network"android:title="@string/network_dashboard_title"android:summary="@string/summary_placeholder"android:icon="@drawable/ic_homepage_network"android:order="-120"android:fragment="com.android.settings.network.NetworkDashboardFragment"settings:controller="com.android.settings.network.TopLevelNetworkEntryPreferenceController"/><Preferenceandroid:key="top_level_connected_devices"android:title="@string/connected_devices_dashboard_title"android:summary="@string/summary_placeholder"android:icon="@drawable/ic_homepage_connected_device"android:order="-110"android:fragment="com.android.settings.connecteddevice.ConnectedDeviceDashboardFragment"settings:controller="com.android.settings.connecteddevice.TopLevelConnectedDevicesPreferenceController"/><Preferenceandroid:key="top_level_apps_and_notifs"android:title="@string/app_and_notification_dashboard_title"android:summary="@string/app_and_notification_dashboard_summary"android:icon="@drawable/ic_homepage_apps"android:order="-100"android:fragment="com.android.settings.applications.AppAndNotificationDashboardFragment"/><Preferenceandroid:key="top_level_display"android:title="@string/display_settings"android:summary="@string/summary_placeholder"android:icon="@drawable/ic_homepage_display"android:order="-80"android:fragment="com.android.settings.DisplaySettings"settings:controller="com.android.settings.display.TopLevelDisplayPreferenceController"/><Preferenceandroid:key="top_level_sound"android:title="@string/sound_settings"android:summary="@string/sound_dashboard_summary"android:icon="@drawable/ic_homepage_sound"android:order="-70"android:fragment="com.android.settings.notification.SoundSettings"/><!-- <Preferenceandroid:key="top_level_storage"android:title="@string/storage_settings"android:summary="@string/summary_placeholder"android:icon="@drawable/ic_homepage_storage"android:order="-60"android:fragment="com.android.settings.deviceinfo.StorageSettings"settings:controller="com.android.settings.deviceinfo.TopLevelStoragePreferenceController"/>--><Preferenceandroid:key="top_level_privacy"android:title="@string/privacy_dashboard_title"android:summary="@string/privacy_dashboard_summary"android:icon="@drawable/ic_homepage_privacy"android:order="-55"android:fragment="com.android.settings.privacy.PrivacyDashboardFragment"/><Preferenceandroid:key="top_level_location"android:title="@string/location_settings_title"android:summary="@string/location_settings_loading_app_permission_stats"android:icon="@drawable/ic_homepage_location"android:order="-50"android:fragment="com.android.settings.location.LocationSettings"settings:controller="com.android.settings.location.TopLevelLocationPreferenceController"/><Preferenceandroid:key="top_level_security"android:title="@string/security_settings_title"android:summary="@string/summary_placeholder"android:icon="@drawable/ic_homepage_security"android:order="-40"android:fragment="com.android.settings.security.SecuritySettings"settings:controller="com.android.settings.security.TopLevelSecurityEntryPreferenceController"/><Preferenceandroid:key="top_level_accounts"android:title="@string/account_dashboard_title"android:summary="@string/summary_placeholder"android:icon="@drawable/ic_homepage_accounts"android:order="-30"android:fragment="com.android.settings.accounts.AccountDashboardFragment"settings:controller="com.android.settings.accounts.TopLevelAccountEntryPreferenceController"/><Preferenceandroid:key="top_level_accessibility"android:title="@string/accessibility_settings"android:summary="@string/accessibility_settings_summary"android:icon="@drawable/ic_homepage_accessibility"android:order="-20"android:fragment="com.android.settings.accessibility.AccessibilitySettings"settings:controller="com.android.settings.accessibility.TopLevelAccessibilityPreferenceController"/><Preferenceandroid:key="top_level_system"android:title="@string/header_category_system"android:summary="@string/system_dashboard_summary"android:icon="@drawable/ic_homepage_system_dashboard"android:order="10"android:fragment="com.android.settings.system.SystemDashboardFragment"/><Preferenceandroid:key="top_level_about_device"android:title="@string/about_settings"android:summary="@string/summary_placeholder"android:icon="@drawable/ic_homepage_about"android:order="20"android:fragment="com.android.settings.deviceinfo.aboutphone.MyDeviceInfoFragment"settings:controller="com.android.settings.deviceinfo.aboutphone.TopLevelAboutDevicePreferenceController"/><Preferenceandroid:key="top_level_support"android:summary="@string/support_summary"android:title="@string/page_tab_title_support"android:icon="@drawable/ic_homepage_support"android:order="100"settings:controller="com.android.settings.support.SupportPreferenceController"/></PreferenceScreen>

3.隐藏已连接的设备:
源码路径:/packages/apps/settings/res/values.xml
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2007 The Android Open Source ProjectLicensed under the Apache License, Version 2.0 (the "License");you may not use this file except in compliance with the License.You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, softwaredistributed under the License is distributed on an "AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.See the License for the specific language governing permissions andlimitations under the License.
--><resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"><!-- If false, MIN is displayed. If true, MSID is displayed. --><bool name="config_msid_enable" translatable="false">false</bool><string name="additional_system_update" translatable="false"></string><string name="additional_system_update_menu" translatable="false"></string><!-- TODO: This is purely enforced by the interface, and does not affect whatstrings may be inserted into the actual content provider.With the addition of shortcuts, it seems more likely that users willfind this limiting; it would be good to have the interface work withvery long strings too. --><integer name="maximum_user_dictionary_word_length" translatable="false">48</integer><!-- Dashboard number of columns --><integer name="dashboard_num_columns">1</integer><!-- Carrier_enabled editable --><bool name="config_allow_edit_carrier_enabled" translatable="false">false</bool><!-- When true enable color temperature setting. --><bool name="config_enableColorTemperature">false</bool><!-- Whether to show Camera laser sensor switch in Developer Options --><bool name="config_show_camera_laser_sensor">false</bool><!-- Fully-qualified class name for the implementation of the FeatureFactory to be instantiated. --><string name="config_featureFactory" translatable="false">com.android.settings.overlay.FeatureFactoryImpl</string><!-- Package name and fully-qualified class name for the wallpaper picker activity. --><string name="config_wallpaper_picker_package" translatable="false">com.android.settings</string><string name="config_wallpaper_picker_class" translatable="false">com.android.settings.Settings$WallpaperSettingsActivity</string><!-- Fully-qualified class name for the styles & wallpaper picker activity. --><string name="config_styles_and_wallpaper_picker_class" translatable="false"></string><!-- Manufacturer backup settings to launch --><string name="config_backup_settings_intent" translatable="false"></string><!-- Manufacturer backup settings label --><string name="config_backup_settings_label" translatable="true"></string><!-- Double twist sensor name and vendor used by gesture setting --><string name="gesture_double_twist_sensor_name" translatable="false"></string><string name="gesture_double_twist_sensor_vendor" translatable="false"></string><!-- When true enable gesture setting. --><bool name="config_gesture_settings_enabled">false</bool><!-- If the Storage Manager settings are enabled. --><bool name="config_storage_manager_settings_enabled">false</bool><!-- If the support features are enabled. --><bool name="config_support_enabled">false</bool><!-- Whether to enable "show operator name in the status bar" setting --><bool name="config_showOperatorNameInStatusBar">false</bool><!-- List containing the component names of pre-installed screen reader services. --><string-array name="config_preinstalled_screen_reader_services" translatable="false"><!--<item>com.example.package.first/com.example.class.FirstService</item><item>com.example.package.second/com.example.class.SecondService</item>--></string-array><!-- List containing the component names of pre-installed audio and captioning services. --><string-array name="config_preinstalled_audio_and_caption_services" translatable="false"><!--<item>com.example.package.first/com.example.class.FirstService</item><item>com.example.package.second/com.example.class.SecondService</item>--></string-array><!-- List containing the component names of pre-installed display services. --><string-array name="config_preinstalled_display_services" translatable="false"><!--<item>com.example.package.first/com.example.class.FirstService</item><item>com.example.package.second/com.example.class.SecondService</item>--></string-array><!-- List containing the component names of pre-installed interaction control services. --><string-array name="config_preinstalled_interaction_control_services" translatable="false"><!--<item>com.example.package.first/com.example.class.FirstService</item><item>com.example.package.second/com.example.class.SecondService</item>--></string-array><!-- List containing the order of services in screen reader category by componentname.All componentnames in a category need to be specified to guarantee correct behavior.--><string-array name="config_order_screen_reader_services" translatable="false"><!--<item>com.example.package.first/com.example.class.FirstService</item><item>com.example.package.second/com.example.class.SecondService</item>--></string-array><!-- List containing the order of services in audio and caption category by preference keyor componentname. All preference keys in a category need to be specified to guaranteecorrect behavior.--><string-array name="config_order_audio_and_caption_services" translatable="false"><!--<item>com.example.package.first/com.example.class.FirstService</item><item>com.example.package.second/com.example.class.SecondService</item><item>toggle_master_mono</item><item>seekbar_master_balance</item><item>...</item>--></string-array><!-- List containing the order of services in display category by preference keyor componentname. All preference keys in a category need to be specified to guaranteecorrect behavior.--><string-array name="config_order_display_services" translatable="false"><!--<item>com.example.package.first/com.example.class.FirstService</item><item>com.example.package.second/com.example.class.SecondService</item><item>font_size_preference_screen</item><item>dark_ui_mode_accessibility</item><item>...</item>--></string-array><!-- List containing the order of services in interaction control category by preference keyor componentname. All preference keys in a category need to be specified to guaranteecorrect behavior.--><string-array name="config_order_interaction_control_services" translatable="false"><!--<item>com.example.package.first/com.example.class.FirstService</item><item>com.example.package.second/com.example.class.SecondService</item><item>autoclick_preference</item><item>toggle_power_button_ends_call_preference</item><item>...</item>--></string-array><!-- List of packages that should be whitelisted for slice uri access. Do not translate --><string-array name="slice_whitelist_package_names" translatable="false"/><!-- Whether or not App & Notification screen should display recently used apps --><bool name="config_display_recent_apps">true</bool><!-- Package name for the storage manager to use from Settings search. --><string name="config_deletion_helper_package" translatable="false">com.android.storagemanager</string><!-- Class name for the storage manager's deletion helper class. --><string name="config_deletion_helper_class" translatable="false">com.android.storagemanager.deletionhelper.DeletionHelperActivity</string><!-- Whether to use a UI variant that minimizes the number of UI elements on screen. This istypically used when there is not enough space to display everything, because pattern viewdoesn't interact well with scroll view --><bool name="config_lock_pattern_minimal_ui">true</bool><!-- List of a11y components on the device allowed to be enabled by Settings Slices --><string-array name="config_settings_slices_accessibility_components" translatable="false"/><!-- Whether or not to show the night light suggestion. --><bool name="config_night_light_suggestion_enabled">true</bool><!-- Whether or not the device is capable of multiple levels of vibration intensity.Note that this is different from whether it can control the vibration amplitude as somedevices will be able to vary their amplitude but do not possess enough dynamic range tohave distinct intensity levels --><bool name="config_vibration_supports_multiple_intensities">false</bool><!--Whether or not the homepage should be powered by legacy suggestion (versus contextual cards)Default to true as not all devices support contextual cards.--><bool name="config_use_legacy_suggestion">true</bool><!-- Whether or not homepage should display user's account avatar --><bool name="config_show_avatar_in_homepage">false</bool><!-- Whether or not emergency info tile should display in device info page --><bool name="config_show_emergency_info_in_device_info">true</bool><!-- Whether or not branded account info tile should display in device info page --><bool name="config_show_branded_account_in_device_info">true</bool><!-- Whether or not device header widget tile should display in device info page --><bool name="config_show_device_header_in_device_info">true</bool><!-- Whether or not TopLevelSettings should force rounded icon for injected tiles --><bool name="config_force_rounded_icon_TopLevelSettings">true</bool><!-- Whether dismissal timestamp should be kept before deletion --><bool name="config_keep_contextual_card_dismissal_timestamp">false</bool><!-- Settings intelligence package name --><string name="config_settingsintelligence_package_name" translatable="false">com.android.settings.intelligence</string><!-- Whether the confirmation for sim deletion is defaulted to be on or off--><bool name="config_sim_deletion_confirmation_default_on">false</bool><!-- Package Installer package name --><string name="config_package_installer_package_name" translatable="false">com.android.packageinstaller</string><!-- Settings intelligence interaction log intent action --><string name="config_settingsintelligence_log_action" translatable="false"></string><!-- AOSP Emergency app package name --><string name="config_aosp_emergency_package_name" translatable="false">com.android.emergency</string><!-- AOSP Emergency app intent action --><string name="config_aosp_emergency_intent_action" translatable="false">android.settings.EDIT_EMERGENCY_INFO</string><!-- Emergency app package name --><string name="config_emergency_package_name" translatable="false">com.android.emergency</string><!-- Emergency app intent action --><string name="config_emergency_intent_action" translatable="false">android.settings.EDIT_EMERGENCY_INFO</string><!-- Email address for the homepage contextual cards feedback --><string name="config_contextual_card_feedback_email" translatable="false"></string><!-- ComponentName to launch a vendor-specific enrollment activity if available --><string name="config_face_enroll" translatable="false"></string><!-- App intent --><string name="config_account_intent_uri" translatable="false"></string><!-- Whether or not the dock settings are to be displayed for this device when docked --><bool name="has_dock_settings">false</bool><!-- Whether there is a boot sounds checkbox --><bool name="has_boot_sounds">false</bool><!-- Whether there is a silent mode checkbox --><bool name="has_silent_mode">true</bool><!-- Display additional System Update menu if true --><bool name="config_additional_system_update_setting_enable">false</bool><!-- Whether the bluetooth activation confirmation dialogs should be auto dismissed.Can be overridden for specific product builds. --><bool name="auto_confirm_bluetooth_activation_dialog">false</bool><!-- Whether the device name is shown in About device or not --><bool name="config_show_device_name">true</bool><!-- Whether to show a preference item for the manual in About phone --><bool name="config_show_manual">false</bool><!-- Whether to show a preference item for regulatory information in About phone --><bool name="config_show_regulatory_info">false</bool><!-- Whether to show a preference item for mobile plan --><bool name="config_show_mobile_plan">true</bool><!-- Whether none security option is hide or not (country specific). --><bool name="config_hide_none_security_option">false</bool><!-- Whether swipe security option is hidden or not --><bool name="config_hide_swipe_security_option">false</bool><!--Whether help links are defined. --><bool name="config_has_help">false</bool><!-- Whether Wi-Fi settings should be shown or not.This also controls whether Wi-fi related sub-settings (e.g. Wi-Fi preferences) willsurface in search results or not.--><bool name="config_show_wifi_settings">true</bool><!-- Whether toggle_airplane is available or not. --><bool name="config_show_toggle_airplane">true</bool><!-- Whether private_dns_settings is available or not. --><bool name="config_show_private_dns_settings">true</bool><!-- Whether memory from app_info_settings is available or not. --><bool name="config_show_app_info_settings_memory">false</bool><!-- Whether battery from app_info_settings is available or not. --><bool name="config_show_app_info_settings_battery">true</bool><!-- Whether location mode is available or not. --><bool name="config_location_mode_available">true</bool><!-- Whether location scanning is available or not. --><bool name="config_show_location_scanning">true</bool><!-- Whether high_power_apps should be shown or not. --><bool name="config_show_high_power_apps">true</bool><!-- Whether media_volume should be shown or not. --><bool name="config_show_media_volume">true</bool><!-- Whether alarm_volume should be shown or not. --><bool name="config_show_alarm_volume">true</bool><!-- Whether call_volume should be shown or not. --><bool name="config_show_call_volume">true</bool><!-- Whether notification_volume should be shown or not. --><bool name="config_show_notification_volume">true</bool><!-- Whether notification_ringtone should be shown or not. --><bool name="config_show_notification_ringtone">true</bool><!-- Whether screen_locking_sounds should be shown or not. --><bool name="config_show_screen_locking_sounds">true</bool><!-- Whether charging_sounds should be shown or not. --><bool name="config_show_charging_sounds">true</bool><!-- Whether touch_sounds should be shown or not. --><bool name="config_show_touch_sounds">true</bool><!-- Whether encryption_and_credentials_encryption_status should be shown or not. --><bool name="config_show_encryption_and_credentials_encryption_status">true</bool><!-- Whether premium_sms should be shown or not. --><bool name="config_show_premium_sms">true</bool><!-- Whether data_saver should be shown or not. --><bool name="config_show_data_saver">true</bool><!-- Whether enabled_vr_listeners should be shown or not. --><bool name="config_show_enabled_vr_listeners">true</bool><!-- Whether phone_language should be shown or not. --><bool name="config_show_phone_language">true</bool><!-- Whether virtual_keyboard_pref should be shown or not. --><bool name="config_show_virtual_keyboard_pref">true</bool><!-- Whether physical_keyboard_pref should be shown or not. --><bool name="config_show_physical_keyboard_pref">true</bool><!-- Whether spellcheckers_settings should be shown or not. --><bool name="config_show_spellcheckers_settings">true</bool><!-- Whether tts_settings_summary should be shown or not. --><bool name="config_show_tts_settings_summary">true</bool><!-- Whether pointer_speed should be shown or not. --><bool name="config_show_pointer_speed">true</bool><!-- Whether vibrate_input_devices should be shown or not. --><bool name="config_show_vibrate_input_devices">true</bool><!-- Whether manage_device_admin should be shown or not. --><bool name="config_show_manage_device_admin">true</bool><!-- Whether unlock_set_or_change should be shown or not. --><bool name="config_show_unlock_set_or_change">true</bool><!-- Whether screen_pinning_settings should be shown or not. --><bool name="config_show_screen_pinning_settings">true</bool><!-- Whether manage_trust_agents should be shown or not. --><bool name="config_show_manage_trust_agents">true</bool><!-- Whether show_password should be shown or not. --><bool name="config_show_show_password">true</bool><!-- Whether trust_agent_click_intent should be shown or not. --><bool name="config_show_trust_agent_click_intent">true</bool><!-- Whether wallpaper attribution should be shown or not. --><bool name="config_show_wallpaper_attribution">true</bool><!-- Whether assist_and_voice_input should be shown or not. --><bool name="config_show_assist_and_voice_input">true</bool><!-- Whether reset_dashboard should be shown or not. --><bool name="config_show_reset_dashboard">true</bool><!-- Whether system_update_settings should be shown or not. --><bool name="config_show_system_update_settings">true</bool><!-- Whether device_model should be shown or not. --><bool name="config_show_device_model">true</bool><!-- Whether top_level_accessibility should be shown or not. --><bool name="config_show_top_level_accessibility">true</bool><!-- Whether top_level_battery should be shown or not. --><bool name="config_show_top_level_battery">true</bool><!-- Whether top_level_connected_devices should be shown or not. --><bool name="config_show_top_level_connected_devices">true</bool><!-- Whether top_level_display should be shown or not. --><bool name="config_show_top_level_display">true</bool><!-- Whether wifi_ip_address should be shown or not. --><bool name="config_show_wifi_ip_address">true</bool><!-- Whether wifi_mac_address should be shown or not. --><bool name="config_show_wifi_mac_address">true</bool><!-- Whether to disable "Uninstall Updates" menu item for System apps or not. --><bool name="config_disable_uninstall_update">false</bool><!-- Whether or not extra preview panels should be used for screen zoom setting. --><bool name="config_enable_extra_screen_zoom_preview">true</bool><!-- Slice Uri to query nearby devices. --><string name="config_nearby_devices_slice_uri" translatable="false">content://com.google.android.gms.nearby.fastpair/device_status_list_item</string><!-- Grayscale settings intent --><string name="config_grayscale_settings_intent" translatable="false"></string><!-- List containing the injected tile keys which are suppressed. --><string-array name="config_suppress_injected_tile_keys" translatable="false"/><!-- Reset application package name --><string-array name="config_skip_reset_apps_package_name" translatable="false"><item>android</item><item>com.android.providers.downloads</item><item>com.android.systemui</item><item>com.android.vending</item></string-array><!-- Settings panel keeps observe this uri --><string-array name="config_panel_keep_observe_uri" translatable="false"><item>content://com.android.settings.slices/intent/media_output_indicator</item></string-array><!-- Uri to query non-public Slice Uris. --><string name="config_non_public_slice_query_uri" translatable="false"></string><!-- RTT setting intent action --><string name="config_rtt_setting_intent_action" translatable="false"></string><!-- Package name of dialer supports RTT setting--><string name="config_rtt_setting_package_name" translatable="false"></string><!-- Whether nfc detection point preview image is available or not. --><bool name="config_nfc_detection_point">false</bool><!-- Whether to show Smooth Display feature in Settings Options --><bool name="config_show_smooth_display">false</bool><!-- Whether to show the Preference for Adaptive connectivity --><bool name="config_show_adaptive_connectivity">false</bool>
</resources>
关键修改如下:
把config_show_top_level_connected_devices修改为false
<!-- Whether top_level_connected_devices should be shown or not. -->
<bool name="config_show_top_level_connected_devices">false</bool>

4.隐藏存储菜单:
源码路径:package/apps/settings/res/xml/app_info_settings.xml
<?xml version="1.0" encoding="utf-8"?>
<!--Copyright (C) 2017 The Android Open Source ProjectLicensed under the Apache License, Version 2.0 (the "License");you may not use this file except in compliance with the License.You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, softwaredistributed under the License is distributed on an "AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.See the License for the specific language governing permissions andlimitations under the License.--><PreferenceScreenxmlns:android="http://schemas.android.com/apk/res/android"xmlns:settings="http://schemas.android.com/apk/res-auto"android:key="installed_app_detail_settings_screen"settings:initialExpandedChildrenCount="6"><com.android.settingslib.widget.LayoutPreferenceandroid:key="header_view"android:layout="@layout/settings_entity_header"android:selectable="false"android:order="-10000"settings:allowDividerBelow="true"/><com.android.settingslib.widget.LayoutPreferenceandroid:key="instant_app_buttons"android:layout="@layout/instant_app_buttons"android:selectable="false"android:order="-9999"settings:allowDividerAbove="true"settings:allowDividerBelow="true"/><com.android.settingslib.widget.ActionButtonsPreferenceandroid:key="action_buttons"android:order="-9998" /><Preferenceandroid:key="notification_settings"android:title="@string/notifications_label"settings:controller="com.android.settings.applications.appinfo.AppNotificationPreferenceController"settings:allowDividerAbove="true"/><com.android.settings.widget.FixedLineSummaryPreferenceandroid:key="permission_settings"android:title="@string/permissions_label"android:summary="@string/summary_placeholder"settings:summaryLineCount="1"settings:controller="com.android.settings.applications.appinfo.AppPermissionPreferenceController" /><Preferenceandroid:key="storage_settings"android:title="@string/storage_settings_for_app"android:summary="@string/summary_placeholder"settings:controller="com.android.settings.applications.appinfo.AppStoragePreferenceController" /><com.android.settings.applications.AppDomainsPreferenceandroid:key="instant_app_launch_supported_domain_urls"android:title="@string/app_launch_supported_domain_urls_title"android:selectable="true"settings:controller="com.android.settings.applications.appinfo.InstantAppDomainsPreferenceController" /><Preferenceandroid:key="data_settings"android:title="@string/data_usage_app_summary_title"android:summary="@string/summary_placeholder"settings:controller="com.android.settings.applications.appinfo.AppDataUsagePreferenceController" /><Preferenceandroid:key="time_spent_in_app"android:title="@string/time_spent_in_app_pref_title"settings:controller="com.android.settings.applications.appinfo.TimeSpentInAppPreferenceController" /><Preferenceandroid:key="battery"android:title="@string/power_usage_summary_title"android:summary="@string/summary_placeholder" /><Preferenceandroid:key="preferred_settings"android:title="@string/launch_by_default"android:summary="@string/summary_placeholder"android:selectable="true"settings:controller="com.android.settings.applications.appinfo.AppOpenByDefaultPreferenceController" /><Preferenceandroid:key="memory"android:title="@string/memory_settings_title"android:summary="@string/summary_placeholder"android:enabled="false" /><!-- Default apps shortcuts --><Preferenceandroid:key="default_home"android:title="@string/home_app"android:summary="@string/summary_placeholder" /><Preferenceandroid:key="default_browser"android:title="@string/default_browser_title"android:summary="@string/summary_placeholder" /><Preferenceandroid:key="default_phone_app"android:title="@string/default_phone_title"android:summary="@string/default_phone_title" /><Preferenceandroid:key="default_emergency_app"android:title="@string/default_emergency_app"android:summary="@string/summary_placeholder" /><Preferenceandroid:key="default_sms_app"android:title="@string/sms_application_title"android:summary="@string/summary_placeholder" /><!-- Advanced apps settings --><PreferenceCategoryandroid:key="advanced_app_info"android:title="@string/advanced_apps"settings:controller="com.android.settings.applications.appinfo.AdvancedAppInfoPreferenceCategoryController"><Preferenceandroid:key="system_alert_window"android:title="@string/draw_overlay"android:summary="@string/summary_placeholder"settings:controller="com.android.settings.applications.appinfo.DrawOverlayDetailPreferenceController" /><Preferenceandroid:key="write_settings_apps"android:title="@string/write_settings"android:summary="@string/summary_placeholder"settings:controller="com.android.settings.applications.appinfo.WriteSystemSettingsPreferenceController" /><Preferenceandroid:key="picture_in_picture"android:title="@string/picture_in_picture_app_detail_title"android:summary="@string/summary_placeholder"settings:controller="com.android.settings.applications.specialaccess.pictureinpicture.PictureInPictureDetailPreferenceController" /><Preferenceandroid:key="install_other_apps"android:title="@string/install_other_apps"android:summary="@string/summary_placeholder"settings:controller="com.android.settings.applications.appinfo.ExternalSourceDetailPreferenceController" /><Preferenceandroid:key="interact_across_profiles"android:title="@string/interact_across_profiles_title"android:summary="@string/summary_placeholder"settings:controller="com.android.settings.applications.specialaccess.interactacrossprofiles.InteractAcrossProfilesDetailsPreferenceController" /></PreferenceCategory><!-- App installer info --><PreferenceCategoryandroid:key="app_installer"android:title="@string/app_install_details_group_title"settings:controller="com.android.settings.applications.appinfo.AppInstallerPreferenceCategoryController"><Preferenceandroid:key="app_info_store"android:title="@string/app_install_details_title"settings:controller="com.android.settings.applications.appinfo.AppInstallerInfoPreferenceController" /></PreferenceCategory><Preferenceandroid:key="app_settings_link"android:title="@string/app_settings_link"settings:controller="com.android.settings.applications.appinfo.AppSettingPreferenceController"settings:allowDividerAbove="true" /><Preferenceandroid:key="app_version"android:selectable="false"android:order="9999"settings:controller="com.android.settings.applications.appinfo.AppVersionPreferenceController"settings:allowDividerAbove="true"settings:enableCopying="true"/></PreferenceScreen>
关键修改如下:
注释掉AppStoragePreferenceController
<!-- <Preferenceandroid:key="storage_settings"android:title="@string/storage_settings_for_app"android:summary="@string/summary_placeholder"settings:controller="com.android.settings.applications.appinfo.AppStoragePreferenceController" />-->

5.实现的效果如下:
默认没有隐藏时效果:

隐藏互联网和已连接的设备:

3个菜单都隐藏效果:

6.总结:
- 隐藏系统设置中的一级菜单很简单,有2种方式,可以根据需要进行实现。
- 隐藏菜单选项找到对应的源码路径,按照上面的2种方式修改即可.
- 如果发现调试过程中不生效可以打印日志查看报错,仔细阅读源码。
- 大家如果感兴趣可以下载源码进行编译调试查看最终效果。
7.源码如下:
可以参考AOSP12中Launcher3的源码,源码下载地址如下:
https://mirrors.tuna.tsinghua.edu.cn/help/AOSP/
相关文章:
AndroidRom定制删除Settings某些菜单选项
AndroidRom定制删除Settings某些菜单选项 1.前言. 最近在Rom开发中需要隐藏设置中的某些菜单,launcher3中的定制开发,这个属于很基本的定制需求,和隐藏google搜素栏一样简单,这里我就不展开了,直接上代码. 2.隐藏网络…...
Mysql相关知识2:Mysql隔离级别、MVCC、锁
文章目录 MySQL的隔离级别可重复读的实现原理Mysql锁按锁的粒度分类按锁的使用方式分类按锁的状态分类 MySQL的隔离级别 在 MySQL 中,隔离级别定义了事务之间相互隔离的程度,用于控制一个事务对数据的修改在何时以及如何被其他事务可见。MySQL 支持四种…...
Python爬虫实战:获取海口最近2周天气数据,为出行做参考
一、引言 天气状况对人们的出行计划影响重大。获取准确的天气信息并进行分析,能助力用户更好地规划出行。天气网虽提供丰富的天气数据,但因网站存在反爬机制,直接获取数据存在一定难度。本研究借助 Python 的 Scrapy 框架,结合多种技术手段,实现对海口最近两周天气数据的…...
并发设计模式之双缓冲系统
双缓冲的本质是 通过空间换时间,通过冗余的缓冲区解决生产者和消费者的速度差异问题,同时提升系统的并发性和稳定性。 双缓冲的核心优势 优势具体表现解耦生产与消费生产者和消费者可以独立工作,无需直接同步。提高并发性生产者和消…...
linux sysfs的使用
在Linux内核驱动开发中,device_create_file 和 device_remove_file 用于动态创建/删除设备的 sysfs 属性文件,常用于暴露设备信息或控制参数。以下是完整示例及详细说明: 1. 头文件引入 #include <linux/module.h> #include <linux/…...
【数据结构和算法】3. 排序算法
本文根据 数据结构和算法入门 视频记录 文章目录 1. 排序算法2. 插入排序 Insertion Sort2.1 概念2.2 具体步骤2.3 Java 实现2.4 复杂度分析 3. 快排 QuickSort3.1 概念3.2 具体步骤3.3 Java实现3.4 复杂度分析 4. 归并排序 MergeSort4.1 概念4.2 递归具体步骤4.3 Java实现4.4…...
LintCode第192题-通配符匹配
描述 给定一个字符串 s 和一个字符模式 p ,实现一个支持 ? 和 * 的通配符匹配。匹配规则如下: ? 可以匹配任何单个字符。* 可以匹配任意字符串(包括空字符串)。 两个串完全匹配才算匹配成功。 样例 样例1 输入: "aa&q…...
redis常用的五种数据类型
redis常用的五种数据类型 文档 redis单机安装redis数据类型-位图bitmap 说明 官网操作命令指南页面:https://redis.io/docs/latest/commands/?nameget&groupstring 常用命令 keys *:查看所有键exists k1 k2:键存在个数type k1&…...
Linux 进程与线程间通信方式及应用分析
Linux 进程与线程间通信方式及应用分析 文章目录 Linux 进程与线程间通信方式及应用分析 1. 管道(Pipe)1.1 匿名管道(Anonymous Pipe)示例代码:结果: 1.2 命名管道(FIFO)示例代码&am…...
AI日报 - 2024年04月22日
🌟 今日概览(60秒速览) ▎🤖 模型进展 | Google发布Gemini 2.5 Flash,强调低延迟与成本效益;Kling AI 2.0展示多轴运动视频生成;研究揭示SLM在知识图谱上优于LLM,RLHF在推理提升上存局限。 ▎💼…...
FreeRTos学习记录--2.内存管理
后续的章节涉及这些内核对象:task、queue、semaphores和event group等。为了让FreeRTOS更容易使用,这些内核对象一般都是动态分配:用到时分配,不使用时释放。使用内存的动态管理功能,简化了程序设计:不再需…...
HAL库(STM32CubeMX)——高级ADC学习、HRTIM(STM32G474RBT6)
系列文章目录 文章目录 系列文章目录前言存在的问题HRTIMcubemx配置前言 对cubemx的ADC的设置进行补充 ADCs_Common_Settings Mode:ADC 模式 Independent mod 独立 ADC 模式,当使用一个 ADC 时是独立模式,使用两个 ADC 时是双模式,在双模式下还有很多细分模式可选 ADC_Se…...
单例模式(线程安全)
1.什么是单例模式 单例模式(Singleton Pattern)是一种创建型设计模式,旨在确保一个类只有一个实例,并提供一个全局访问点来访问该实例。这种模式涉及到一个单一的类,该类负责创建自己的对象,同时确保只有单…...
FreeRTos学习记录--1.工程创建与源码概述
1.工程创建与源码概述 1.1 工程创建 使用STM32CubeMX,可以手工添加任务、队列、信号量、互斥锁、定时器等等。但是本课程不想严重依赖STM32CubeMX,所以不会使用STM32CubeMX来添加这些对象,而是手写代码来使用这些对象。 使用STM32CubeMX时&…...
基于大模型的血栓性外痔全流程风险预测与治疗管理研究报告
目录 一、引言 1.1 研究背景与目的 1.2 研究意义 二、血栓性外痔概述 2.1 定义与发病机制 2.2 临床表现与诊断方法 2.3 现有治疗手段综述 三、大模型在血栓性外痔预测中的应用原理 3.1 大模型技术简介 3.2 模型构建与训练数据来源 3.3 模型预测血栓性外痔的工作流程…...
进程控制(linux+C/C++)
目录 进程创建 写时拷贝 fork 进程终止 退出码 进程退出三种情况对应退出信号 :退出码: 进程退出方法 进程等待 两种方式 阻塞等待和非阻塞等待 小知识 进程创建 1.在未创建子进程时,父进程页表对于数据权限为读写,对于…...
C++如何处理多线程环境下的异常?如何确保资源在异常情况下也能正确释放
多线程编程的基本概念与挑战 多线程编程的核心思想是将程序的执行划分为多个并行运行的线程,每个线程可以独立处理任务,从而充分利用多核处理器的性能优势。在C中,开发者可以通过std::thread创建线程,并使用同步原语如std::mutex、…...
TensorBoard如何在同一图表中绘制多个线条
1. 使用不同的日志目录 TensorBoard 会根据日志文件所在的目录来区分不同的运行。可以为每次运行指定一个独立的日志目录,TensorBoard 会自动将这些目录中的数据加载并显示为不同的运行。 示例(TensorFlow): import tensorflow…...
微软Entra新安全功能引发大规模账户锁定事件
误报触发大规模锁定 多家机构的Windows管理员报告称,微软Entra ID新推出的"MACE"(泄露凭证检测应用)功能在部署过程中产生大量误报,导致用户账户被大规模锁定。这些警报和锁定始于昨夜,部分管理员认为属于误…...
基于FPGA的一维时间序列idct变换verilog实现,包含testbench和matlab辅助验证程序
目录 1.算法运行效果图预览 2.算法运行软件版本 3.部分核心程序 4.算法理论概述 4.1 DCT离散余弦变换 4.2 IDCT逆离散余弦变换 4.3 树结构实现1024点IDCT的原理 5.算法完整程序工程 1.算法运行效果图预览 (完整程序运行后无水印) matlab仿真结果 FPGA仿真结果 由于FP…...
Linux进程5-进程通信常见的几种方式、信号概述及分类、kill函数及命令、语法介绍
目录 1.进程间通信概述 1.1进程通信的主要方式 1.2进程通信的核心对比 2.信号 2.1 信号的概述 2.1.1 信号的概念 2.2信号的核心特性 2.3信号的产生来源 2.4信号的处理流程 2.5关键系统调用与函数 2.6常见信号的分类及说明 2.6.1. 标准信号(Standard Sig…...
[架构之美]一键服务管理大师:Ubuntu智能服务停止与清理脚本深度解析
[架构之美]一键服务管理大师:Ubuntu智能服务停止与清理脚本深度解析 服务展示: 运行脚本: 剩余服务: 一、脚本设计背景与核心价值 在Linux服务器运维中,服务管理是日常操作的重要环节。本文介绍的智能服务管理脚本&a…...
C++算法(10):二叉树的高度与深度,(C++代码实战)
引言 在二叉树的相关算法中,高度(Height)和深度(Depth)是两个容易混淆的概念。本文通过示例和代码实现,帮助读者清晰区分二者的区别。 定义与区别 属性定义计算方式深度从根节点到该节点的边数根节点深度…...
k8s 基础入门篇之开启 firewalld
前面在部署k8s时,都是直接关闭的防火墙。由于生产环境需要开启防火墙,只能放行一些特定的端口, 简单记录一下过程。 1. firewall 与 iptables 的关系 1.1 防火墙(Firewall) 定义: 防火墙是网络安全系统&…...
Psychology 101 期末测验(附答案)
欢呼 啦啦啦~啦啦啦~♪(^∇^*) 终于考过啦~ 开心(*^▽^*) 撒花✿✿ヽ(▽)ノ✿ |必须晒下证书: 判卷 记录下判卷,还是错了几道,填空题2道压根填不上。惭愧~ 答案我隐藏了,实在想不出答案的朋友可以留言,不定时回复。 建议还是认认真真的学习~认认真真的考试~,知识就…...
安全协议分析概述
一、概念 安全协议(security protocol),又称密码协议。是以密码学为基础的消息交换协议,在网络中提供各种安全服务。(为解决网络中的现实问题、满足安全需求) 1.1 一些名词 那什么是协议呢? …...
基础学习:(7)nanoGPT 剩下的细节
文章目录 前言3 继续巴拉结构3.1 encode 和 embedding3.2 全局layernorm3.3 lm_head(language modeling) 和 softmax3.4 softmax 和 linear 之间的 temperature和topk3.5 weight tying 前言 在 基础学习:(6)中, 在运行和训练代码基础上,向代…...
【HDFS】verifyEC命令校验EC数据正确性
verifyEC命令是HDFS里用于验证EC文件正确性的一个工具。这是一个非常实用的工具,能帮助我们确定EC的数据内容是否正确,并且如果不正确的话,还有可能会触发reportBadBlock给NN,让NN进行块的重构。 本文先介绍一下verifyEC命令的使用方法,再描述其实现原理细节。 一、命令…...
YOLO11改进,尺度动态损失函数Scale-based Dynamic Loss,减少标签不准确对损失函数稳定性的影响
在目标检测领域,标签噪声与尺度敏感问题始终是制约模型性能提升的"阿喀琉斯之踵"。2025年CVPR最佳论文提出的尺度动态损失函数(Scale-based Dynamic Loss, SDL),通过构建自适应损失调节机制,不仅实现了对YOLOv11检测精度的指数级提升,更重新定义了损失函数的设…...
Spark-SQL连接Hive总结及实验
一、核心模式与配置要点 1. 内嵌Hive 无需额外配置,直接使用,但生产环境中几乎不使用。 2. 外部Hive(spark-shell连接) 配置文件:将hive-site.xml(修改数据库连接为node01)、core-site.xml、…...
