diff options
56 files changed, 52 insertions, 386 deletions
diff --git a/res/xml/accessibility_magnification_settings.xml b/res/xml/accessibility_magnification_settings.xml index 74156440e4..bb40394810 100644 --- a/res/xml/accessibility_magnification_settings.xml +++ b/res/xml/accessibility_magnification_settings.xml @@ -17,7 +17,8 @@ xmlns:android="http://schemas.android.com/apk/res/android" xmlns:settings="http://schemas.android.com/apk/res-auto" android:key="magnification_preference_screen_title" - android:title="@string/accessibility_screen_magnification_title"> + android:title="@string/accessibility_screen_magnification_title" + settings:searchable="false"> <Preference android:fragment="com.android.settings.accessibility.ToggleScreenMagnificationPreferenceFragment" android:key="screen_magnification_gestures_preference_screen" diff --git a/res/xml/accessibility_notification_vibration_settings.xml b/res/xml/accessibility_notification_vibration_settings.xml index b6bc08cf45..b37d3636db 100644 --- a/res/xml/accessibility_notification_vibration_settings.xml +++ b/res/xml/accessibility_notification_vibration_settings.xml @@ -17,5 +17,4 @@ <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" - android:key="accessibility_notification_vibration_screen" android:title="@string/accessibility_notification_vibration_title" /> diff --git a/res/xml/accessibility_ring_vibration_settings.xml b/res/xml/accessibility_ring_vibration_settings.xml index 121eb89a71..078f76c2ce 100644 --- a/res/xml/accessibility_ring_vibration_settings.xml +++ b/res/xml/accessibility_ring_vibration_settings.xml @@ -17,5 +17,4 @@ <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" - android:key="accessibility_ring_vibration_screen" android:title="@string/accessibility_ring_vibration_title" /> diff --git a/res/xml/accessibility_shortcut_service_settings.xml b/res/xml/accessibility_shortcut_service_settings.xml index b2f13273c2..573939a21b 100644 --- a/res/xml/accessibility_shortcut_service_settings.xml +++ b/res/xml/accessibility_shortcut_service_settings.xml @@ -17,5 +17,4 @@ <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" - android:key="accessibility_shortcut_service_screen" android:title="@string/accessibility_shortcut_service_title" /> diff --git a/res/xml/accessibility_shortcut_settings.xml b/res/xml/accessibility_shortcut_settings.xml index 9e1d26f58f..f431dec1e5 100644 --- a/res/xml/accessibility_shortcut_settings.xml +++ b/res/xml/accessibility_shortcut_settings.xml @@ -15,7 +15,6 @@ --> <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" xmlns:settings="http://schemas.android.com/apk/res-auto" - android:key="accessibility_shortcut_settings_screen" android:title="@string/accessibility_global_gesture_preference_title" > <Preference diff --git a/res/xml/accessibility_touch_vibration_settings.xml b/res/xml/accessibility_touch_vibration_settings.xml index 4f0f7617e9..ed8f550a8b 100644 --- a/res/xml/accessibility_touch_vibration_settings.xml +++ b/res/xml/accessibility_touch_vibration_settings.xml @@ -17,5 +17,4 @@ <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" - android:key="accessibility_touch_vibration_screen" android:title="@string/accessibility_touch_vibration_title" /> diff --git a/res/xml/app_and_notification.xml b/res/xml/app_and_notification.xml index 9256f50fbb..f75bd8629a 100644 --- a/res/xml/app_and_notification.xml +++ b/res/xml/app_and_notification.xml @@ -79,7 +79,6 @@ android:key="app_and_notif_cell_broadcast_settings" android:title="@string/cell_broadcast_settings" android:order="15" - settings:searchable="false" settings:useAdminDisabledSummary="true"> <intent android:action="android.intent.action.MAIN" diff --git a/res/xml/automatic_storage_management_settings.xml b/res/xml/automatic_storage_management_settings.xml index 08d41853ad..1428741e8c 100644 --- a/res/xml/automatic_storage_management_settings.xml +++ b/res/xml/automatic_storage_management_settings.xml @@ -16,7 +16,6 @@ <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" xmlns:settings="http://schemas.android.com/apk/res-auto" - android:key="automatic_storage_manager_screen" android:title="@string/automatic_storage_manager_settings" > <DropDownPreference diff --git a/res/xml/battery_saver_schedule_settings.xml b/res/xml/battery_saver_schedule_settings.xml index 98f39e3ba8..f91e4ca25d 100644 --- a/res/xml/battery_saver_schedule_settings.xml +++ b/res/xml/battery_saver_schedule_settings.xml @@ -18,7 +18,6 @@ <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" xmlns:settings="http://schemas.android.com/apk/res-auto" - android:key="battery_saver_schedule_screen" android:title="@string/battery_saver_schedule_settings_title" settings:staticPreferenceLocation="append"> </PreferenceScreen > diff --git a/res/xml/bluetooth_pairing_detail.xml b/res/xml/bluetooth_pairing_detail.xml index cd9c32457e..86fb9e43d4 100644 --- a/res/xml/bluetooth_pairing_detail.xml +++ b/res/xml/bluetooth_pairing_detail.xml @@ -17,7 +17,6 @@ <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" xmlns:settings="http://schemas.android.com/apk/res-auto" - android:key="bluetooth_pairing_detail_screen" android:title="@string/bluetooth_pairing_pref_title"> <Preference diff --git a/res/xml/bug_report_handler_settings.xml b/res/xml/bug_report_handler_settings.xml index 7d5068c825..41e8f08d89 100644 --- a/res/xml/bug_report_handler_settings.xml +++ b/res/xml/bug_report_handler_settings.xml @@ -18,7 +18,6 @@ <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" xmlns:settings="http://schemas.android.com/apk/res-auto" - android:key="bug_report_handler_screen" android:title="@string/bug_report_handler_title" settings:staticPreferenceLocation="append" > </PreferenceScreen>
\ No newline at end of file diff --git a/res/xml/current_dream_settings.xml b/res/xml/current_dream_settings.xml index b3f3f9fb1a..d95e830f52 100644 --- a/res/xml/current_dream_settings.xml +++ b/res/xml/current_dream_settings.xml @@ -17,5 +17,4 @@ <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" - android:key="current_screensaver_screen" android:title="@string/screensaver_settings_current" /> diff --git a/res/xml/default_voice_settings.xml b/res/xml/default_voice_settings.xml index 511294c72c..f75b5ed427 100644 --- a/res/xml/default_voice_settings.xml +++ b/res/xml/default_voice_settings.xml @@ -17,5 +17,4 @@ <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" - android:key="voice_input_settings_screen" android:title="@string/voice_input_settings_title" /> diff --git a/res/xml/enterprise_set_default_apps_settings.xml b/res/xml/enterprise_set_default_apps_settings.xml index 12eca8a10c..474a5c9276 100644 --- a/res/xml/enterprise_set_default_apps_settings.xml +++ b/res/xml/enterprise_set_default_apps_settings.xml @@ -17,8 +17,7 @@ <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" xmlns:settings="http://schemas.android.com/apk/res-auto" - android:key="enterprise_set_default_apps_settings" - android:title="@string/enterprise_privacy_enterprise_set_default_apps"> + android:key="enterprise_set_default_apps_settings"> <PreferenceCategory android:key="dashboard_tile_placeholder"/> </PreferenceScreen> diff --git a/res/xml/network_scorer_picker_prefs.xml b/res/xml/network_scorer_picker_prefs.xml index 7d1fe462c2..fab69e76f8 100644 --- a/res/xml/network_scorer_picker_prefs.xml +++ b/res/xml/network_scorer_picker_prefs.xml @@ -17,6 +17,5 @@ <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" - android:key="network_scorer_picker_screen" android:title="@string/network_scorer_picker_title"> </PreferenceScreen>
\ No newline at end of file diff --git a/res/xml/spellchecker_prefs.xml b/res/xml/spellchecker_prefs.xml index 26476f4663..666b0a9b0c 100644 --- a/res/xml/spellchecker_prefs.xml +++ b/res/xml/spellchecker_prefs.xml @@ -16,7 +16,6 @@ <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" - android:key="spellcheckers_screen" android:title="@string/spellcheckers_settings_title"> <Preference android:key="spellchecker_language" diff --git a/res/xml/tether_prefs.xml b/res/xml/tether_prefs.xml index cf6dd4d6aa..54c49e8f1c 100644 --- a/res/xml/tether_prefs.xml +++ b/res/xml/tether_prefs.xml @@ -18,7 +18,6 @@ xmlns:android="http://schemas.android.com/apk/res/android" xmlns:settings="http://schemas.android.com/apk/res-auto" android:key="tether_prefs_screen" - settings:keywords="@string/keywords_hotspot_tethering" android:title="@string/tether_settings_title_all"> <com.android.settings.widget.FixedLineSummaryPreference diff --git a/res/xml/usb_default_fragment.xml b/res/xml/usb_default_fragment.xml index f08c9f4bb3..b8d5e53b37 100644 --- a/res/xml/usb_default_fragment.xml +++ b/res/xml/usb_default_fragment.xml @@ -16,6 +16,6 @@ --> <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" - android:title="@string/usb_default_label" + android:title="@string/usb_pref" android:key="usb_default_fragment"> </PreferenceScreen> diff --git a/res/xml/vr_display_settings.xml b/res/xml/vr_display_settings.xml index 9522af5b74..d04435ac81 100644 --- a/res/xml/vr_display_settings.xml +++ b/res/xml/vr_display_settings.xml @@ -17,5 +17,4 @@ <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" - android:key="display_vr_pref_screen" android:title="@string/display_vr_pref_title" /> diff --git a/res/xml/webview_app_settings.xml b/res/xml/webview_app_settings.xml index 51e472dc10..c7a611ace8 100644 --- a/res/xml/webview_app_settings.xml +++ b/res/xml/webview_app_settings.xml @@ -17,5 +17,4 @@ <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" - android:key="select_webview_provider_screen" android:title="@string/select_webview_provider_title" /> diff --git a/res/xml/when_to_dream_settings.xml b/res/xml/when_to_dream_settings.xml index 13f5ae49f2..7b91a34b32 100644 --- a/res/xml/when_to_dream_settings.xml +++ b/res/xml/when_to_dream_settings.xml @@ -17,5 +17,4 @@ <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" - android:key="screensaver_when_to_dream_screen" android:title="@string/screensaver_settings_when_to_dream" /> diff --git a/res/xml/wifi_p2p_settings.xml b/res/xml/wifi_p2p_settings.xml index f59479736e..405d0810c8 100644 --- a/res/xml/wifi_p2p_settings.xml +++ b/res/xml/wifi_p2p_settings.xml @@ -16,7 +16,6 @@ <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" - android:key="wifi_p2p_settings_screen" android:title="@string/wifi_p2p_settings_title"> <Preference android:key="p2p_this_device" diff --git a/res/xml/wifi_tether_settings.xml b/res/xml/wifi_tether_settings.xml index c521675b35..3a3bdc4ba4 100644 --- a/res/xml/wifi_tether_settings.xml +++ b/res/xml/wifi_tether_settings.xml @@ -19,7 +19,8 @@ xmlns:android="http://schemas.android.com/apk/res/android" xmlns:settings="http://schemas.android.com/apk/res-auto" android:key="wifi_tether_settings_screen" - android:title="@string/wifi_hotspot_checkbox_text"> + android:title="@string/wifi_hotspot_checkbox_text" + settings:searchable="false"> <com.android.settings.wifi.tether.WifiTetherSsidPreference android:key="wifi_tether_network_name" diff --git a/src/com/android/settings/accessibility/AccessibilityShortcutPreferenceFragment.java b/src/com/android/settings/accessibility/AccessibilityShortcutPreferenceFragment.java index 3ff32171dd..d6c2a094f3 100644 --- a/src/com/android/settings/accessibility/AccessibilityShortcutPreferenceFragment.java +++ b/src/com/android/settings/accessibility/AccessibilityShortcutPreferenceFragment.java @@ -201,5 +201,11 @@ public class AccessibilityShortcutPreferenceFragment extends ToggleFeaturePrefer } public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER = - new BaseSearchIndexProvider(R.xml.accessibility_shortcut_settings); + new BaseSearchIndexProvider() { + // This fragment is for details of the shortcut. Only the shortcut itself needs + // to be indexed. + protected boolean isPageSearchEnabled(Context context) { + return false; + } + }; } diff --git a/src/com/android/settings/accessibility/NotificationVibrationPreferenceFragment.java b/src/com/android/settings/accessibility/NotificationVibrationPreferenceFragment.java index c4d00ca9f9..3ca197ffb1 100644 --- a/src/com/android/settings/accessibility/NotificationVibrationPreferenceFragment.java +++ b/src/com/android/settings/accessibility/NotificationVibrationPreferenceFragment.java @@ -21,13 +21,10 @@ import android.os.Vibrator; import android.provider.Settings; import com.android.settings.R; -import com.android.settings.search.BaseSearchIndexProvider; -import com.android.settingslib.search.SearchIndexable; /** * Fragment for picking accessibility shortcut service */ -@SearchIndexable public class NotificationVibrationPreferenceFragment extends VibrationPreferenceFragment { @Override public int getMetricsCategory() { @@ -62,7 +59,4 @@ public class NotificationVibrationPreferenceFragment extends VibrationPreference Vibrator vibrator = getContext().getSystemService(Vibrator.class); return vibrator.getDefaultNotificationVibrationIntensity(); } - - public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER = - new BaseSearchIndexProvider(R.xml.accessibility_notification_vibration_settings); } diff --git a/src/com/android/settings/accessibility/RingVibrationPreferenceFragment.java b/src/com/android/settings/accessibility/RingVibrationPreferenceFragment.java index f1b872708c..babfb9a200 100644 --- a/src/com/android/settings/accessibility/RingVibrationPreferenceFragment.java +++ b/src/com/android/settings/accessibility/RingVibrationPreferenceFragment.java @@ -21,13 +21,10 @@ import android.os.Vibrator; import android.provider.Settings; import com.android.settings.R; -import com.android.settings.search.BaseSearchIndexProvider; -import com.android.settingslib.search.SearchIndexable; /** * Fragment for picking accessibility shortcut service */ -@SearchIndexable public class RingVibrationPreferenceFragment extends VibrationPreferenceFragment { @Override public int getMetricsCategory() { @@ -66,7 +63,4 @@ public class RingVibrationPreferenceFragment extends VibrationPreferenceFragment Vibrator vibrator = getContext().getSystemService(Vibrator.class); return vibrator.getDefaultRingVibrationIntensity(); } - - public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER = - new BaseSearchIndexProvider(R.xml.accessibility_ring_vibration_settings); } diff --git a/src/com/android/settings/accessibility/ShortcutServicePickerFragment.java b/src/com/android/settings/accessibility/ShortcutServicePickerFragment.java index 93e6d92087..82e83357d1 100644 --- a/src/com/android/settings/accessibility/ShortcutServicePickerFragment.java +++ b/src/com/android/settings/accessibility/ShortcutServicePickerFragment.java @@ -43,10 +43,8 @@ import com.android.internal.accessibility.AccessibilityShortcutController; import com.android.internal.accessibility.AccessibilityShortcutController.ToggleableFrameworkFeatureInfo; import com.android.settings.R; import com.android.settings.core.instrumentation.InstrumentedDialogFragment; -import com.android.settings.search.BaseSearchIndexProvider; import com.android.settings.widget.RadioButtonPickerFragment; import com.android.settingslib.accessibility.AccessibilityUtils; -import com.android.settingslib.search.SearchIndexable; import com.android.settingslib.widget.CandidateInfo; import com.android.settingslib.widget.RadioButtonPreference; @@ -57,7 +55,6 @@ import java.util.Map; /** * Fragment for picking accessibility shortcut service */ -@SearchIndexable public class ShortcutServicePickerFragment extends RadioButtonPickerFragment { @Override @@ -267,7 +264,4 @@ public class ShortcutServicePickerFragment extends RadioButtonPickerFragment { return mServiceInfo.getComponentName().flattenToString(); } } - - public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER = - new BaseSearchIndexProvider(R.xml.accessibility_shortcut_service_settings); } diff --git a/src/com/android/settings/accessibility/TouchVibrationPreferenceFragment.java b/src/com/android/settings/accessibility/TouchVibrationPreferenceFragment.java index 701830facf..f6bbbf3f12 100644 --- a/src/com/android/settings/accessibility/TouchVibrationPreferenceFragment.java +++ b/src/com/android/settings/accessibility/TouchVibrationPreferenceFragment.java @@ -21,13 +21,10 @@ import android.os.Vibrator; import android.provider.Settings; import com.android.settings.R; -import com.android.settings.search.BaseSearchIndexProvider; -import com.android.settingslib.search.SearchIndexable; /** * Fragment for picking accessibility shortcut service */ -@SearchIndexable public class TouchVibrationPreferenceFragment extends VibrationPreferenceFragment { @Override public int getMetricsCategory() { @@ -62,7 +59,4 @@ public class TouchVibrationPreferenceFragment extends VibrationPreferenceFragmen protected int getPreviewVibrationAudioAttributesUsage() { return AudioAttributes.USAGE_ASSISTANCE_SONIFICATION; } - - public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER = - new BaseSearchIndexProvider(R.xml.accessibility_touch_vibration_settings); } diff --git a/src/com/android/settings/applications/ProcessStatsSummary.java b/src/com/android/settings/applications/ProcessStatsSummary.java index e188996f16..a9f4ade704 100644 --- a/src/com/android/settings/applications/ProcessStatsSummary.java +++ b/src/com/android/settings/applications/ProcessStatsSummary.java @@ -29,13 +29,7 @@ import com.android.settings.SummaryPreference; import com.android.settings.Utils; import com.android.settings.applications.ProcStatsData.MemInfo; import com.android.settings.core.SubSettingLauncher; -import com.android.settings.search.BaseSearchIndexProvider; -import com.android.settingslib.search.SearchIndexable; -/** - * Settings screen to provide memory stats summary - */ -@SearchIndexable public class ProcessStatsSummary extends ProcessStatsBase implements OnPreferenceClickListener { private static final String KEY_STATUS_HEADER = "status_header"; @@ -131,7 +125,4 @@ public class ProcessStatsSummary extends ProcessStatsBase implements OnPreferenc } return false; } - - public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER = - new BaseSearchIndexProvider(R.xml.process_stats_summary); } diff --git a/src/com/android/settings/applications/assist/DefaultVoiceInputPicker.java b/src/com/android/settings/applications/assist/DefaultVoiceInputPicker.java index 3a9bf0a78f..e5953dbe72 100644 --- a/src/com/android/settings/applications/assist/DefaultVoiceInputPicker.java +++ b/src/com/android/settings/applications/assist/DefaultVoiceInputPicker.java @@ -27,17 +27,11 @@ import android.text.TextUtils; import com.android.internal.app.AssistUtils; import com.android.settings.R; import com.android.settings.applications.defaultapps.DefaultAppPickerFragment; -import com.android.settings.search.BaseSearchIndexProvider; import com.android.settingslib.applications.DefaultAppInfo; -import com.android.settingslib.search.SearchIndexable; import java.util.ArrayList; import java.util.List; -/** - * Fragment for picking assistant voice input - */ -@SearchIndexable public class DefaultVoiceInputPicker extends DefaultAppPickerFragment { private VoiceInputHelper mHelper; @@ -172,7 +166,4 @@ public class DefaultVoiceInputPicker extends DefaultAppPickerFragment { return new Intent(Intent.ACTION_MAIN).setComponent(mInfo.settings); } } - - public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER = - new BaseSearchIndexProvider(R.xml.default_voice_settings); } diff --git a/src/com/android/settings/applications/assist/ManageAssist.java b/src/com/android/settings/applications/assist/ManageAssist.java index 3e88d9c71a..c96f43fd01 100644 --- a/src/com/android/settings/applications/assist/ManageAssist.java +++ b/src/com/android/settings/applications/assist/ManageAssist.java @@ -37,6 +37,7 @@ import java.util.List; public class ManageAssist extends DashboardFragment { private static final String TAG = "ManageAssist"; + private static final String KEY_ASSIST = "gesture_assist_application"; @Override protected String getLogTag() { @@ -84,5 +85,12 @@ public class ManageAssist extends DashboardFragment { Context context) { return buildPreferenceControllers(context, null /* lifecycle */); } + + @Override + public List<String> getNonIndexableKeys(Context context) { + List<String> keys = super.getNonIndexableKeys(context); + keys.add(KEY_ASSIST); + return keys; + } }; } diff --git a/src/com/android/settings/bluetooth/BluetoothPairingDetail.java b/src/com/android/settings/bluetooth/BluetoothPairingDetail.java index f220b8b1da..2e0e9b5c2f 100644 --- a/src/com/android/settings/bluetooth/BluetoothPairingDetail.java +++ b/src/com/android/settings/bluetooth/BluetoothPairingDetail.java @@ -29,17 +29,14 @@ import android.widget.Toast; import androidx.annotation.VisibleForTesting; import com.android.settings.R; -import com.android.settings.search.BaseSearchIndexProvider; import com.android.settingslib.bluetooth.BluetoothDeviceFilter; import com.android.settingslib.bluetooth.CachedBluetoothDevice; import com.android.settingslib.search.Indexable; -import com.android.settingslib.search.SearchIndexable; import com.android.settingslib.widget.FooterPreference; /** * BluetoothPairingDetail is a page to scan bluetooth devices and pair them. */ -@SearchIndexable public class BluetoothPairingDetail extends DeviceListPreferenceFragment implements Indexable { private static final String TAG = "BluetoothPairingDetail"; @@ -236,7 +233,4 @@ public class BluetoothPairingDetail extends DeviceListPreferenceFragment impleme Toast.makeText(getContext(), R.string.connected_device_bluetooth_turned_on_toast, Toast.LENGTH_SHORT).show(); } - - public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER = - new BaseSearchIndexProvider(R.xml.bluetooth_pairing_detail); } diff --git a/src/com/android/settings/bugreporthandler/BugReportHandlerPicker.java b/src/com/android/settings/bugreporthandler/BugReportHandlerPicker.java index 5839e3c084..b813f1dbd2 100644 --- a/src/com/android/settings/bugreporthandler/BugReportHandlerPicker.java +++ b/src/com/android/settings/bugreporthandler/BugReportHandlerPicker.java @@ -35,10 +35,8 @@ import androidx.preference.PreferenceScreen; import com.android.settings.R; import com.android.settings.Utils; import com.android.settings.applications.defaultapps.DefaultAppPickerFragment; -import com.android.settings.search.BaseSearchIndexProvider; import com.android.settingslib.applications.DefaultAppInfo; import com.android.settingslib.development.DevelopmentSettingsEnabler; -import com.android.settingslib.search.SearchIndexable; import com.android.settingslib.widget.FooterPreference; import java.util.ArrayList; @@ -47,7 +45,6 @@ import java.util.List; /** * Picker for BugReportHandler. */ -@SearchIndexable public class BugReportHandlerPicker extends DefaultAppPickerFragment { private static final String TAG = "BugReportHandlerPicker"; @@ -214,7 +211,4 @@ public class BugReportHandlerPicker extends DefaultAppPickerFragment { return super.loadLabel(); } } - - public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER = - new BaseSearchIndexProvider(R.xml.bug_report_handler_settings); } diff --git a/src/com/android/settings/connecteddevice/usb/UsbDefaultFragment.java b/src/com/android/settings/connecteddevice/usb/UsbDefaultFragment.java index 2d6a098f9b..12e978ff34 100644 --- a/src/com/android/settings/connecteddevice/usb/UsbDefaultFragment.java +++ b/src/com/android/settings/connecteddevice/usb/UsbDefaultFragment.java @@ -30,9 +30,7 @@ import androidx.preference.PreferenceScreen; import com.android.settings.R; import com.android.settings.Utils; -import com.android.settings.search.BaseSearchIndexProvider; import com.android.settings.widget.RadioButtonPickerFragment; -import com.android.settingslib.search.SearchIndexable; import com.android.settingslib.widget.CandidateInfo; import com.android.settingslib.widget.FooterPreference; import com.android.settingslib.widget.RadioButtonPreference; @@ -44,7 +42,6 @@ import java.util.List; /** * Provides options for selecting the default USB mode. */ -@SearchIndexable public class UsbDefaultFragment extends RadioButtonPickerFragment { @VisibleForTesting UsbBackend mUsbBackend; @@ -195,7 +192,4 @@ public class UsbDefaultFragment extends RadioButtonPickerFragment { } } } - - public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER = - new BaseSearchIndexProvider(R.xml.usb_default_fragment); }
\ No newline at end of file diff --git a/src/com/android/settings/core/PreferenceXmlParserUtils.java b/src/com/android/settings/core/PreferenceXmlParserUtils.java index 35f7ebbefe..240426d69d 100644 --- a/src/com/android/settings/core/PreferenceXmlParserUtils.java +++ b/src/com/android/settings/core/PreferenceXmlParserUtils.java @@ -89,7 +89,6 @@ public class PreferenceXmlParserUtils { int FLAG_NEED_PREF_APPEND = 1 << 10; int FLAG_UNAVAILABLE_SLICE_SUBTITLE = 1 << 11; int FLAG_FOR_WORK = 1 << 12; - int FLAG_NEED_FRAGMENT = 1 << 13; } public static final String METADATA_PREF_TYPE = "type"; @@ -103,7 +102,6 @@ public class PreferenceXmlParserUtils { public static final String METADATA_APPEND = "staticPreferenceLocation"; public static final String METADATA_UNAVAILABLE_SLICE_SUBTITLE = "unavailable_slice_subtitle"; public static final String METADATA_FOR_WORK = "for_work"; - public static final String METADATA_FRAGMENT = "fragment"; private static final String ENTRIES_SEPARATOR = "|"; @@ -252,10 +250,6 @@ public class PreferenceXmlParserUtils { preferenceMetadata.putBoolean(METADATA_FOR_WORK, isForWork(preferenceAttributes)); } - if (hasFlag(flags, MetadataFlag.FLAG_NEED_FRAGMENT)) { - preferenceMetadata.putString(METADATA_FRAGMENT, - getFragment(preferenceAttributes)); - } metadata.add(preferenceMetadata); preferenceAttributes.recycle(); @@ -346,9 +340,4 @@ public class PreferenceXmlParserUtils { return styledAttributes.getBoolean( R.styleable.Preference_forWork, false); } - - private static String getFragment(TypedArray styledAttributes) { - return styledAttributes.getString( - com.android.internal.R.styleable.Preference_fragment); - } }
\ No newline at end of file diff --git a/src/com/android/settings/deletionhelper/AutomaticStorageManagerSettings.java b/src/com/android/settings/deletionhelper/AutomaticStorageManagerSettings.java index c04b51c6bd..0de9f67be3 100644 --- a/src/com/android/settings/deletionhelper/AutomaticStorageManagerSettings.java +++ b/src/com/android/settings/deletionhelper/AutomaticStorageManagerSettings.java @@ -163,7 +163,7 @@ public class AutomaticStorageManagerSettings extends DashboardFragment /** For Search. */ public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER = - new BaseSearchIndexProvider(R.xml.automatic_storage_management_settings) { + new BaseSearchIndexProvider() { @Override protected boolean isPageSearchEnabled(Context context) { return false; diff --git a/src/com/android/settings/development/compat/PlatformCompatDashboard.java b/src/com/android/settings/development/compat/PlatformCompatDashboard.java index ffa5c2945e..db9050009e 100644 --- a/src/com/android/settings/development/compat/PlatformCompatDashboard.java +++ b/src/com/android/settings/development/compat/PlatformCompatDashboard.java @@ -16,9 +16,8 @@ package com.android.settings.development.compat; -import static com.android.settings.development.AppPicker.EXTRA_DEBUGGABLE; -import static com.android.settings.development.DevelopmentOptionsActivityRequestCodes.REQUEST_COMPAT_CHANGE_APP; import static com.android.internal.compat.OverrideAllowedState.ALLOWED; +import static com.android.settings.development.DevelopmentOptionsActivityRequestCodes.REQUEST_COMPAT_CHANGE_APP; import android.app.Activity; import android.app.settings.SettingsEnums; @@ -27,9 +26,7 @@ import android.content.Context; import android.content.Intent; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; -import android.content.pm.PackageManager.NameNotFoundException; import android.graphics.drawable.Drawable; -import android.os.Build; import android.os.Bundle; import android.os.RemoteException; import android.os.ServiceManager; @@ -45,13 +42,9 @@ import com.android.internal.compat.AndroidBuildClassifier; import com.android.internal.compat.CompatibilityChangeConfig; import com.android.internal.compat.CompatibilityChangeInfo; import com.android.internal.compat.IPlatformCompat; -import com.android.internal.compat.IOverrideValidator; -import com.android.internal.compat.OverrideAllowedState; import com.android.settings.R; import com.android.settings.dashboard.DashboardFragment; import com.android.settings.development.AppPicker; -import com.android.settings.search.BaseSearchIndexProvider; -import com.android.settingslib.search.SearchIndexable; import java.util.ArrayList; import java.util.List; @@ -62,7 +55,6 @@ import java.util.TreeMap; /** * Dashboard for Platform Compat preferences. */ -@SearchIndexable public class PlatformCompatDashboard extends DashboardFragment { private static final String TAG = "PlatformCompatDashboard"; private static final String COMPAT_APP = "compat_app"; @@ -299,7 +291,4 @@ public class PlatformCompatDashboard extends DashboardFragment { return true; } } - - public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER = - new BaseSearchIndexProvider(R.xml.platform_compat_settings); } diff --git a/src/com/android/settings/deviceinfo/legal/ModuleLicensesDashboard.java b/src/com/android/settings/deviceinfo/legal/ModuleLicensesDashboard.java index 150dfff4d4..f74b68f923 100644 --- a/src/com/android/settings/deviceinfo/legal/ModuleLicensesDashboard.java +++ b/src/com/android/settings/deviceinfo/legal/ModuleLicensesDashboard.java @@ -20,13 +20,7 @@ import android.app.settings.SettingsEnums; import com.android.settings.R; import com.android.settings.dashboard.DashboardFragment; -import com.android.settings.search.BaseSearchIndexProvider; -import com.android.settingslib.search.SearchIndexable; -/** - * Settings screen for mainline module licenses - */ -@SearchIndexable public class ModuleLicensesDashboard extends DashboardFragment { private static final String TAG = "ModuleLicensesDashboard"; @@ -49,7 +43,4 @@ public class ModuleLicensesDashboard extends DashboardFragment { public int getHelpResource() { return 0; } - - public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER = - new BaseSearchIndexProvider(R.xml.module_licenses); } diff --git a/src/com/android/settings/display/VrDisplayPreferencePicker.java b/src/com/android/settings/display/VrDisplayPreferencePicker.java index 24102b07eb..4612779ba5 100644 --- a/src/com/android/settings/display/VrDisplayPreferencePicker.java +++ b/src/com/android/settings/display/VrDisplayPreferencePicker.java @@ -23,18 +23,12 @@ import android.provider.Settings; import android.text.TextUtils; import com.android.settings.R; -import com.android.settings.search.BaseSearchIndexProvider; import com.android.settings.widget.RadioButtonPickerFragment; -import com.android.settingslib.search.SearchIndexable; import com.android.settingslib.widget.CandidateInfo; import java.util.ArrayList; import java.util.List; -/** - * Settings picker screen to what display preferences are applied when device is in VR mode - */ -@SearchIndexable public class VrDisplayPreferencePicker extends RadioButtonPickerFragment { static final String PREF_KEY_PREFIX = "vr_display_pref_"; @@ -108,7 +102,4 @@ public class VrDisplayPreferencePicker extends RadioButtonPickerFragment { return PREF_KEY_PREFIX + value; } } - - public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER = - new BaseSearchIndexProvider(R.xml.vr_display_settings); } diff --git a/src/com/android/settings/dream/CurrentDreamPicker.java b/src/com/android/settings/dream/CurrentDreamPicker.java index 0ff7ee9638..3134e79ffd 100644 --- a/src/com/android/settings/dream/CurrentDreamPicker.java +++ b/src/com/android/settings/dream/CurrentDreamPicker.java @@ -22,11 +22,9 @@ import android.content.Context; import android.graphics.drawable.Drawable; import com.android.settings.R; -import com.android.settings.search.BaseSearchIndexProvider; import com.android.settings.widget.RadioButtonPickerFragment; import com.android.settingslib.dream.DreamBackend; import com.android.settingslib.dream.DreamBackend.DreamInfo; -import com.android.settingslib.search.SearchIndexable; import com.android.settingslib.widget.CandidateInfo; import java.util.HashMap; @@ -34,10 +32,6 @@ import java.util.List; import java.util.Map; import java.util.stream.Collectors; -/** - * Settings picker screen for current screen saver - */ -@SearchIndexable public final class CurrentDreamPicker extends RadioButtonPickerFragment { private DreamBackend mBackend; @@ -128,7 +122,4 @@ public final class CurrentDreamPicker extends RadioButtonPickerFragment { return key; } } - - public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER = - new BaseSearchIndexProvider(R.xml.current_dream_settings); } diff --git a/src/com/android/settings/dream/WhenToDreamPicker.java b/src/com/android/settings/dream/WhenToDreamPicker.java index 7208154a44..1c5e25ebac 100644 --- a/src/com/android/settings/dream/WhenToDreamPicker.java +++ b/src/com/android/settings/dream/WhenToDreamPicker.java @@ -21,19 +21,13 @@ import android.content.Context; import android.graphics.drawable.Drawable; import com.android.settings.R; -import com.android.settings.search.BaseSearchIndexProvider; import com.android.settings.widget.RadioButtonPickerFragment; import com.android.settingslib.dream.DreamBackend; -import com.android.settingslib.search.SearchIndexable; import com.android.settingslib.widget.CandidateInfo; import java.util.ArrayList; import java.util.List; -/** - * Settings screen for decide when to start screen saver - */ -@SearchIndexable public class WhenToDreamPicker extends RadioButtonPickerFragment { private static final String TAG = "WhenToDreamPicker"; @@ -126,7 +120,4 @@ public class WhenToDreamPicker extends RadioButtonPickerFragment { return key; } } - - public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER = - new BaseSearchIndexProvider(R.xml.when_to_dream_settings); } diff --git a/src/com/android/settings/enterprise/EnterpriseSetDefaultAppsListFragment.java b/src/com/android/settings/enterprise/EnterpriseSetDefaultAppsListFragment.java index 9ccbcef3df..67bf68786a 100644 --- a/src/com/android/settings/enterprise/EnterpriseSetDefaultAppsListFragment.java +++ b/src/com/android/settings/enterprise/EnterpriseSetDefaultAppsListFragment.java @@ -21,9 +21,7 @@ import android.content.Context; import com.android.settings.R; import com.android.settings.dashboard.DashboardFragment; -import com.android.settings.search.BaseSearchIndexProvider; import com.android.settingslib.core.AbstractPreferenceController; -import com.android.settingslib.search.SearchIndexable; import java.util.ArrayList; import java.util.List; @@ -31,7 +29,6 @@ import java.util.List; /** * Fragment for displaying a list of default applications set by profile or device admin. */ -@SearchIndexable public class EnterpriseSetDefaultAppsListFragment extends DashboardFragment { static final String TAG = "EnterprisePrivacySettings"; @@ -59,7 +56,4 @@ public class EnterpriseSetDefaultAppsListFragment extends DashboardFragment { controllers.add(controller); return controllers; } - - public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER = - new BaseSearchIndexProvider(R.xml.enterprise_set_default_apps_settings); } diff --git a/src/com/android/settings/fuelgauge/batterysaver/BatterySaverScheduleSettings.java b/src/com/android/settings/fuelgauge/batterysaver/BatterySaverScheduleSettings.java index cc870c71cf..507c36949d 100644 --- a/src/com/android/settings/fuelgauge/batterysaver/BatterySaverScheduleSettings.java +++ b/src/com/android/settings/fuelgauge/batterysaver/BatterySaverScheduleSettings.java @@ -34,10 +34,8 @@ import androidx.annotation.VisibleForTesting; import androidx.preference.PreferenceScreen; import com.android.settings.R; -import com.android.settings.search.BaseSearchIndexProvider; import com.android.settings.widget.RadioButtonPickerFragment; import com.android.settingslib.fuelgauge.BatterySaverUtils; -import com.android.settingslib.search.SearchIndexable; import com.android.settingslib.widget.CandidateInfo; import com.android.settingslib.widget.RadioButtonPreference; @@ -55,7 +53,6 @@ import java.util.List; * {@link BatterySaverScheduleSeekBarController} for the controller that manages user * interactions in this screen. */ -@SearchIndexable public class BatterySaverScheduleSettings extends RadioButtonPickerFragment { public BatterySaverScheduleRadioButtonsController mRadioButtonController; @@ -210,7 +207,4 @@ public class BatterySaverScheduleSettings extends RadioButtonPickerFragment { return mSummary; } } - - public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER = - new BaseSearchIndexProvider(R.xml.battery_saver_schedule_settings); }
\ No newline at end of file diff --git a/src/com/android/settings/gestures/GestureSettings.java b/src/com/android/settings/gestures/GestureSettings.java index 412a92a25b..763efaf9f1 100644 --- a/src/com/android/settings/gestures/GestureSettings.java +++ b/src/com/android/settings/gestures/GestureSettings.java @@ -75,5 +75,12 @@ public class GestureSettings extends DashboardFragment { sir.xmlResId = R.xml.gestures; return Arrays.asList(sir); } + + @Override + protected boolean isPageSearchEnabled(Context context) { + // All rows in this screen can lead to a different page, so suppress everything + // from this page to remove duplicates. + return false; + } }; } diff --git a/src/com/android/settings/inputmethod/SpellCheckersSettings.java b/src/com/android/settings/inputmethod/SpellCheckersSettings.java index 1f10e4f7f9..974f2c41ea 100644 --- a/src/com/android/settings/inputmethod/SpellCheckersSettings.java +++ b/src/com/android/settings/inputmethod/SpellCheckersSettings.java @@ -37,15 +37,9 @@ import androidx.preference.PreferenceScreen; import com.android.settings.R; import com.android.settings.SettingsActivity; import com.android.settings.SettingsPreferenceFragment; -import com.android.settings.search.BaseSearchIndexProvider; import com.android.settings.widget.SwitchBar; import com.android.settings.widget.SwitchBar.OnSwitchChangeListener; -import com.android.settingslib.search.SearchIndexable; -/** - * Settings screen for spell checker - */ -@SearchIndexable public class SpellCheckersSettings extends SettingsPreferenceFragment implements OnSwitchChangeListener, OnPreferenceClickListener, OnPreferenceChangeListener { private static final String TAG = SpellCheckersSettings.class.getSimpleName(); @@ -280,7 +274,4 @@ public class SpellCheckersSettings extends SettingsPreferenceFragment } updatePreferenceScreen(); } - - public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER = - new BaseSearchIndexProvider(R.xml.spellchecker_prefs); } diff --git a/src/com/android/settings/network/NetworkScorerPicker.java b/src/com/android/settings/network/NetworkScorerPicker.java index effa38ab96..9ecab3bfb6 100644 --- a/src/com/android/settings/network/NetworkScorerPicker.java +++ b/src/com/android/settings/network/NetworkScorerPicker.java @@ -31,8 +31,6 @@ import androidx.preference.PreferenceScreen; import com.android.settings.R; import com.android.settings.core.InstrumentedPreferenceFragment; -import com.android.settings.search.BaseSearchIndexProvider; -import com.android.settingslib.search.SearchIndexable; import com.android.settingslib.widget.RadioButtonPreference; import java.util.List; @@ -40,7 +38,6 @@ import java.util.List; /** * Fragment for choosing default network scorer. */ -@SearchIndexable public class NetworkScorerPicker extends InstrumentedPreferenceFragment implements RadioButtonPreference.OnClickListener { @@ -145,7 +142,4 @@ public class NetworkScorerPicker extends InstrumentedPreferenceFragment implemen NetworkScoreManager createNetworkScorerManager(Context context) { return (NetworkScoreManager) context.getSystemService(Context.NETWORK_SCORE_SERVICE); } - - public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER = - new BaseSearchIndexProvider(R.xml.network_scorer_picker_prefs); } diff --git a/src/com/android/settings/security/LockscreenDashboardFragment.java b/src/com/android/settings/security/LockscreenDashboardFragment.java index 8098b803f9..29b114a318 100644 --- a/src/com/android/settings/security/LockscreenDashboardFragment.java +++ b/src/com/android/settings/security/LockscreenDashboardFragment.java @@ -57,6 +57,9 @@ public class LockscreenDashboardFragment extends DashboardFragment @VisibleForTesting static final String KEY_LOCK_SCREEN_NOTIFICATON_WORK_PROFILE = "security_setting_lock_screen_notif_work"; + @VisibleForTesting + static final String KEY_ADD_USER_FROM_LOCK_SCREEN = + "security_lockscreen_add_users_when_locked"; private AmbientDisplayConfiguration mConfig; @@ -139,6 +142,13 @@ public class LockscreenDashboardFragment extends DashboardFragment } @Override + public List<String> getNonIndexableKeys(Context context) { + final List<String> niks = super.getNonIndexableKeys(context); + niks.add(KEY_ADD_USER_FROM_LOCK_SCREEN); + return niks; + } + + @Override protected boolean isPageSearchEnabled(Context context) { return new LockScreenPreferenceController(context, "anykey") .isAvailable(); diff --git a/src/com/android/settings/webview/WebViewAppPicker.java b/src/com/android/settings/webview/WebViewAppPicker.java index e7d7ea3be1..b1dfd1454f 100644 --- a/src/com/android/settings/webview/WebViewAppPicker.java +++ b/src/com/android/settings/webview/WebViewAppPicker.java @@ -33,17 +33,11 @@ import androidx.annotation.VisibleForTesting; import com.android.settings.R; import com.android.settings.applications.defaultapps.DefaultAppPickerFragment; -import com.android.settings.search.BaseSearchIndexProvider; import com.android.settingslib.applications.DefaultAppInfo; -import com.android.settingslib.search.SearchIndexable; import java.util.ArrayList; import java.util.List; -/** - * Settings picker screen to handle Web implementation - */ -@SearchIndexable public class WebViewAppPicker extends DefaultAppPickerFragment { private WebViewUpdateServiceWrapper mWebViewUpdateServiceWrapper; @@ -170,7 +164,4 @@ public class WebViewAppPicker extends DefaultAppPickerFragment { } return null; } - - public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER = - new BaseSearchIndexProvider(R.xml.webview_app_settings); } diff --git a/src/com/android/settings/wifi/p2p/WifiP2pSettings.java b/src/com/android/settings/wifi/p2p/WifiP2pSettings.java index f965e208c7..8544a53cdb 100644 --- a/src/com/android/settings/wifi/p2p/WifiP2pSettings.java +++ b/src/com/android/settings/wifi/p2p/WifiP2pSettings.java @@ -56,17 +56,14 @@ import androidx.preference.PreferenceScreen; import com.android.settings.R; import com.android.settings.dashboard.DashboardFragment; -import com.android.settings.search.BaseSearchIndexProvider; import com.android.settingslib.core.AbstractPreferenceController; -import com.android.settingslib.search.SearchIndexable; import java.util.ArrayList; import java.util.List; -/** +/* * Displays Wi-fi p2p settings UI */ -@SearchIndexable public class WifiP2pSettings extends DashboardFragment implements PersistentGroupInfoListener, PeerListListener, DeviceInfoListener { @@ -634,7 +631,4 @@ public class WifiP2pSettings extends DashboardFragment }); } } - - public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER = - new BaseSearchIndexProvider(R.xml.wifi_p2p_settings); } diff --git a/src/com/android/settings/wifi/savedaccesspoints/SavedAccessPointsWifiSettings.java b/src/com/android/settings/wifi/savedaccesspoints/SavedAccessPointsWifiSettings.java index ab2aada639..863e87a268 100644 --- a/src/com/android/settings/wifi/savedaccesspoints/SavedAccessPointsWifiSettings.java +++ b/src/com/android/settings/wifi/savedaccesspoints/SavedAccessPointsWifiSettings.java @@ -27,17 +27,14 @@ import androidx.preference.PreferenceScreen; import com.android.settings.R; import com.android.settings.core.SubSettingLauncher; import com.android.settings.dashboard.DashboardFragment; -import com.android.settings.search.BaseSearchIndexProvider; import com.android.settings.wifi.WifiSettings; import com.android.settings.wifi.details.WifiNetworkDetailsFragment; -import com.android.settingslib.search.SearchIndexable; import com.android.settingslib.wifi.AccessPoint; import com.android.settingslib.wifi.AccessPointPreference; /** * UI to manage saved networks/access points. */ -@SearchIndexable public class SavedAccessPointsWifiSettings extends DashboardFragment { private static final String TAG = "SavedAccessPoints"; @@ -133,7 +130,4 @@ public class SavedAccessPointsWifiSettings extends DashboardFragment { outState.putBundle(SAVE_DIALOG_ACCESS_POINT_STATE, mAccessPointSavedState); } } - - public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER = - new BaseSearchIndexProvider(R.xml.wifi_display_saved_access_points); } diff --git a/src/com/android/settings/wifi/savedaccesspoints2/SavedAccessPointsWifiSettings2.java b/src/com/android/settings/wifi/savedaccesspoints2/SavedAccessPointsWifiSettings2.java index 16bb2ccd23..0145bb48d3 100644 --- a/src/com/android/settings/wifi/savedaccesspoints2/SavedAccessPointsWifiSettings2.java +++ b/src/com/android/settings/wifi/savedaccesspoints2/SavedAccessPointsWifiSettings2.java @@ -37,10 +37,8 @@ import androidx.preference.PreferenceScreen; import com.android.settings.R; import com.android.settings.core.SubSettingLauncher; import com.android.settings.dashboard.DashboardFragment; -import com.android.settings.search.BaseSearchIndexProvider; import com.android.settings.wifi.WifiSettings; import com.android.settings.wifi.details2.WifiNetworkDetailsFragment2; -import com.android.settingslib.search.SearchIndexable; import com.android.wifitrackerlib.SavedNetworkTracker; import java.time.Clock; @@ -49,7 +47,6 @@ import java.time.ZoneOffset; /** * UI to manage saved networks/access points. */ -@SearchIndexable public class SavedAccessPointsWifiSettings2 extends DashboardFragment implements SavedNetworkTracker.SavedNetworkTrackerCallback { @@ -167,7 +164,4 @@ public class SavedAccessPointsWifiSettings2 extends DashboardFragment use(SubscribedAccessPointsPreferenceController2.class) .displayPreference(screen, mSavedNetworkTracker.getSubscriptionWifiEntries()); } - - public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER = - new BaseSearchIndexProvider(R.xml.wifi_display_saved_access_points2); } diff --git a/tests/robotests/assets/grandfather_fragment_not_searchable b/tests/robotests/assets/grandfather_fragment_not_searchable deleted file mode 100644 index 7488d5f152..0000000000 --- a/tests/robotests/assets/grandfather_fragment_not_searchable +++ /dev/null @@ -1,20 +0,0 @@ -com.android.settings.backup.ToggleBackupSettingFragment -com.android.settings.applications.RunningServices -com.android.settings.applications.ConvertToFbe -com.android.settings.applications.appops.BackgroundCheckSummary -com.android.settings.fuelgauge.InactiveApps -com.android.settings.ResetNetwork -com.android.settings.MasterClear -com.android.settings.applications.manageapplications.ManageApplications -com.android.settings.enterprise.ApplicationListFragment$EnterpriseInstalledPackages -com.android.settings.enterprise.ApplicationListFragment$AdminGrantedPermissionLocation -com.android.settings.enterprise.ApplicationListFragment$AdminGrantedPermissionMicrophone -com.android.settings.enterprise.ApplicationListFragment$AdminGrantedPermissionCamera -com.android.settings.vpn2.VpnSettings -com.android.settings.security.CryptKeeperSettings -com.android.settings.TrustedCredentialsSettings -com.android.settings.UserCredentialsSettings -com.android.settings.applications.defaultapps.DefaultAutofillPicker -com.android.phone.NetworkSelectSetting -com.android.settings.accessibility.ToggleScreenMagnificationPreferenceFragment -com.android.settings.nfc.AndroidBeam
\ No newline at end of file diff --git a/tests/robotests/assets/grandfather_not_implementing_index_provider b/tests/robotests/assets/grandfather_not_implementing_index_provider index 8aa1288955..80e179a1cc 100644 --- a/tests/robotests/assets/grandfather_not_implementing_index_provider +++ b/tests/robotests/assets/grandfather_not_implementing_index_provider @@ -17,6 +17,7 @@ com.android.settings.applications.AppLaunchSettings com.android.settings.applications.AppStorageSettings com.android.settings.applications.ConfirmConvertToFbe com.android.settings.applications.ProcessStatsDetail +com.android.settings.applications.ProcessStatsSummary com.android.settings.applications.ProcessStatsUi com.android.settings.applications.RunningServices com.android.settings.applications.specialaccess.pictureinpicture.PictureInPictureDetails @@ -25,6 +26,7 @@ com.android.settings.applications.UsageAccessDetails com.android.settings.backup.ToggleBackupSettingFragment com.android.settings.biometrics.fingerprint.FingerprintSettings$FingerprintSettingsFragment com.android.settings.bluetooth.BluetoothDeviceDetailsFragment +com.android.settings.bluetooth.BluetoothPairingDetail com.android.settings.bluetooth.DevicePickerFragment com.android.settings.dashboard.profileselector.ProfileSelectAccountFragment com.android.settings.dashboard.profileselector.ProfileSelectManageApplications @@ -32,19 +34,24 @@ com.android.settings.dashboard.profileselector.ProfileSelectLocationFragment com.android.settings.datausage.AppDataUsage com.android.settings.datausage.DataUsageList com.android.settings.datausage.DataUsageSummary +com.android.settings.datetime.timezone.TimeZoneSettings +com.android.settings.development.compat.PlatformCompatDashboard com.android.settings.deviceinfo.PrivateVolumeSettings com.android.settings.deviceinfo.PublicVolumeSettings com.android.settings.deviceinfo.StorageProfileFragment +com.android.settings.deviceinfo.legal.ModuleLicensesDashboard com.android.settings.enterprise.ApplicationListFragment$AdminGrantedPermissionCamera com.android.settings.enterprise.ApplicationListFragment$AdminGrantedPermissionLocation com.android.settings.enterprise.ApplicationListFragment$AdminGrantedPermissionMicrophone com.android.settings.enterprise.ApplicationListFragment$EnterpriseInstalledPackages +com.android.settings.enterprise.EnterpriseSetDefaultAppsListFragment com.android.settings.fuelgauge.AdvancedPowerUsageDetail com.android.settings.fuelgauge.InactiveApps com.android.settings.fuelgauge.RestrictedAppDetails com.android.settings.IccLockSettings com.android.settings.inputmethod.InputMethodAndSubtypeEnabler com.android.settings.inputmethod.KeyboardLayoutPickerFragment +com.android.settings.inputmethod.SpellCheckersSettings com.android.settings.location.LocationPersonalSettings com.android.settings.location.LocationWorkProfileSettings com.android.settings.network.ApnEditor @@ -81,7 +88,10 @@ com.android.settings.wifi.ChangeWifiStateDetails com.android.settings.wifi.calling.WifiCallingSettingsForSub com.android.settings.wifi.details.WifiNetworkDetailsFragment com.android.settings.wifi.dpp.WifiNetworkListFragment +com.android.settings.wifi.p2p.WifiP2pSettings +com.android.settings.wifi.savedaccesspoints.SavedAccessPointsWifiSettings com.android.settings.wifi.WifiInfo com.android.settings.applications.specialaccess.notificationaccess.NotificationAccessDetails com.android.settings.wifi.details2.WifiNetworkDetailsFragment2 +com.android.settings.wifi.savedaccesspoints2.SavedAccessPointsWifiSettings2 com.android.settings.dashboard.profileselector.ProfileSelectRecentLocationRequestFragment diff --git a/tests/robotests/src/com/android/settings/connecteddevice/ConnectedDeviceDashboardFragmentTest.java b/tests/robotests/src/com/android/settings/connecteddevice/ConnectedDeviceDashboardFragmentTest.java index 4a6816ff39..778bb79c5b 100644 --- a/tests/robotests/src/com/android/settings/connecteddevice/ConnectedDeviceDashboardFragmentTest.java +++ b/tests/robotests/src/com/android/settings/connecteddevice/ConnectedDeviceDashboardFragmentTest.java @@ -81,7 +81,7 @@ public class ConnectedDeviceDashboardFragmentTest { final List<String> niks = ConnectedDeviceDashboardFragment.SEARCH_INDEX_DATA_PROVIDER .getNonIndexableKeys(mContext); - assertThat(niks).containsAllOf(KEY_CONNECTED_DEVICES, KEY_AVAILABLE_DEVICES, + assertThat(niks).containsExactly(KEY_CONNECTED_DEVICES, KEY_AVAILABLE_DEVICES, KEY_NEARBY_DEVICES, KEY_DISCOVERABLE_FOOTER); } diff --git a/tests/robotests/src/com/android/settings/core/codeinspection/CodeInspectionTest.java b/tests/robotests/src/com/android/settings/core/codeinspection/CodeInspectionTest.java index bbbeeb800e..44b0187e47 100644 --- a/tests/robotests/src/com/android/settings/core/codeinspection/CodeInspectionTest.java +++ b/tests/robotests/src/com/android/settings/core/codeinspection/CodeInspectionTest.java @@ -20,7 +20,6 @@ import static com.google.common.truth.Truth.assertThat; import com.android.settings.core.BasePreferenceControllerSignatureInspector; import com.android.settings.core.instrumentation.InstrumentableFragmentCodeInspector; -import com.android.settings.search.FragmentSearchIndexableCodeInspector; import com.android.settings.search.SearchIndexProviderCodeInspector; import com.android.settings.slices.SliceControllerInXmlCodeInspector; @@ -72,9 +71,4 @@ public class CodeInspectionTest { public void runLifecycleObserverInspection() { new LifecycleObserverCodeInspector(mClasses).run(); } - - @Test - public void runFragmentIndexableInspection() throws Exception { - new FragmentSearchIndexableCodeInspector(mClasses).run(); - } } diff --git a/tests/robotests/src/com/android/settings/search/FragmentSearchIndexableCodeInspector.java b/tests/robotests/src/com/android/settings/search/FragmentSearchIndexableCodeInspector.java deleted file mode 100644 index a24a64359d..0000000000 --- a/tests/robotests/src/com/android/settings/search/FragmentSearchIndexableCodeInspector.java +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Copyright (C) 2019 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.search; - -import static com.android.settings.core.PreferenceXmlParserUtils.METADATA_FRAGMENT; - -import static com.google.common.truth.Truth.assertThat; -import static com.google.common.truth.Truth.assertWithMessage; - -import android.content.Context; -import android.os.Bundle; -import android.provider.SearchIndexableResource; -import android.text.TextUtils; - -import com.android.settings.core.InstrumentedPreferenceFragment; -import com.android.settings.core.PreferenceXmlParserUtils; -import com.android.settings.core.codeinspection.CodeInspector; -import com.android.settings.overlay.FeatureFactory; -import com.android.settingslib.search.Indexable; -import com.android.settingslib.search.SearchIndexable; -import com.android.settingslib.search.SearchIndexableData; - -import org.robolectric.RuntimeEnvironment; -import org.xmlpull.v1.XmlPullParserException; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -/** - * {@link CodeInspector} to ensure preferences with fragments implement search components correctly. - */ -public class FragmentSearchIndexableCodeInspector extends CodeInspector { - - private final String mErrorNonIndexFragments = - "The following fragments were used by 'android:fragment=Fragment_Class_Name' in " - + "corresponding caller preference Xml. This preference won't be searchable, " - + "the fragment should implement SearchIndexable for Settings Search. If it " - + "should not be searchable, add the fragment's classname to " - + "grandfather_fragment_not_searchable. Fragments:\n"; - - private final Context mContext; - private final List<String> mXmlDeclaredFragments = new ArrayList<>(); - private final List<String> mGrandfatherNotSearchIndesable = new ArrayList<>(); - - public FragmentSearchIndexableCodeInspector(List<Class<?>> classes) throws Exception { - super(classes); - mContext = RuntimeEnvironment.application; - - initDeclaredFragments(); - initializeGrandfatherList(mGrandfatherNotSearchIndesable, - "grandfather_fragment_not_searchable"); - } - - @Override - public void run() { - for (Class<?> clazz : mClasses) { - if (!isConcreteSettingsClass(clazz)) { - // Only care about non-abstract classes. - continue; - } - if (!InstrumentedPreferenceFragment.class.isAssignableFrom(clazz)) { - // Only care about InstrumentedPreferenceFragment - continue; - } - - try { - clazz.getField("SEARCH_INDEX_DATA_PROVIDER"); - mXmlDeclaredFragments.remove(clazz.getName()); - continue; - } catch (NoSuchFieldException e) { - } - - if (SearchIndexable.class.isAssignableFrom(clazz)) { - mXmlDeclaredFragments.remove(clazz.getName()); - continue; - } - } - - mXmlDeclaredFragments.removeAll(mGrandfatherNotSearchIndesable); - - final String missingFragmentError = - buildErrorMessage(mErrorNonIndexFragments, mXmlDeclaredFragments); - - assertWithMessage(missingFragmentError).that(mXmlDeclaredFragments).isEmpty(); - } - - private String buildErrorMessage(String errorSummary, List<String> errorClasses) { - final StringBuilder error = new StringBuilder(errorSummary); - for (String c : errorClasses) { - error.append(c).append("\n"); - } - return error.toString(); - } - - private void initDeclaredFragments() throws IOException, XmlPullParserException { - final List<Integer> xmlResources = getIndexableXml(); - for (int xmlResId : xmlResources) { - final List<Bundle> metadata = PreferenceXmlParserUtils.extractMetadata(mContext, - xmlResId, PreferenceXmlParserUtils.MetadataFlag.FLAG_NEED_FRAGMENT); - for (Bundle bundle : metadata) { - final String fragmentClassName = bundle.getString(METADATA_FRAGMENT); - if (TextUtils.isEmpty(fragmentClassName)) { - continue; - } - if (!mXmlDeclaredFragments.contains(fragmentClassName)) { - mXmlDeclaredFragments.add(fragmentClassName); - } - } - } - // We definitely have some fragments in xml, so assert not-empty here as a proxy to - // make sure the parser didn't fail - assertThat(mXmlDeclaredFragments).isNotEmpty(); - } - - private List<Integer> getIndexableXml() { - final List<Integer> xmlResSet = new ArrayList<>(); - - final Collection<SearchIndexableData> bundles = FeatureFactory.getFactory( - mContext).getSearchFeatureProvider().getSearchIndexableResources() - .getProviderValues(); - - for (SearchIndexableData bundle : bundles) { - Indexable.SearchIndexProvider provider = bundle.getSearchIndexProvider(); - - if (provider == null) { - continue; - } - - List<SearchIndexableResource> resources = provider.getXmlResourcesToIndex(mContext, - true); - - if (resources == null) { - continue; - } - - for (SearchIndexableResource resource : resources) { - // Add '0's anyway. It won't break the test. - xmlResSet.add(resource.xmlResId); - } - } - return xmlResSet; - } -} |