Misc clean up in search

- Remove updateFromClassNameResource() because it's just a no-op method.
- Simplify SearchIndexResources
- Update some pref pages to have unique keys.

Change-Id: I51e542d9947aafd046861ce7be0b4c7213fcd01d
Fixes: 64951285
Test: UniquePreferenceKeyTest
Test: robotest
Bug: 67852637
diff --git a/res/xml/accessibility_settings.xml b/res/xml/accessibility_settings.xml
index 02b9949..36cb62e 100644
--- a/res/xml/accessibility_settings.xml
+++ b/res/xml/accessibility_settings.xml
@@ -15,6 +15,7 @@
 -->
 
 <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
+        android:key="accessibility_settings_screen"
         android:title="@string/accessibility_settings"
         android:persistent="true">
 
diff --git a/res/xml/ambient_display_settings.xml b/res/xml/ambient_display_settings.xml
index 47fed8a..a8ded0d 100644
--- a/res/xml/ambient_display_settings.xml
+++ b/res/xml/ambient_display_settings.xml
@@ -16,11 +16,13 @@
   -->
 
 <PreferenceScreen
-        xmlns:android="http://schemas.android.com/apk/res/android"
-        android:title="@string/ambient_display_screen_title">
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:key="ambient_display_preference_screen"
+    android:title="@string/ambient_display_screen_title">
 
     <PreferenceCategory
-            android:title="@string/ambient_display_category_triggers">
+        android:key="ambient_display_category_when_to_show"
+        android:title="@string/ambient_display_category_triggers">
 
         <SwitchPreference
             android:key="ambient_display_always_on"
@@ -39,7 +41,8 @@
 
     </PreferenceCategory>
 
-    <PreferenceCategory>
+    <PreferenceCategory
+        android:key="ambient_display_category_notification">
 
         <SwitchPreference
             android:key="ambient_display_notification"
diff --git a/res/xml/app_and_notification.xml b/res/xml/app_and_notification.xml
index 15048c7..2930c83 100644
--- a/res/xml/app_and_notification.xml
+++ b/res/xml/app_and_notification.xml
@@ -18,6 +18,7 @@
 <PreferenceScreen
     xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
+    android:key="apps_and_notification_screen"
     android:title="@string/app_and_notification_dashboard_title">
 
     <PreferenceCategory
diff --git a/res/xml/app_default_settings.xml b/res/xml/app_default_settings.xml
index d2a1644..3a8c997 100644
--- a/res/xml/app_default_settings.xml
+++ b/res/xml/app_default_settings.xml
@@ -18,6 +18,7 @@
 <PreferenceScreen
     xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
+    android:key="app_default_settings_screen"
     android:title="@string/app_default_dashboard_title">
 
     <Preference
diff --git a/res/xml/connected_devices.xml b/res/xml/connected_devices.xml
index 1099672..3eb62ea 100644
--- a/res/xml/connected_devices.xml
+++ b/res/xml/connected_devices.xml
@@ -16,6 +16,7 @@
 
 <PreferenceScreen
     xmlns:android="http://schemas.android.com/apk/res/android"
+    android:key="connected_devices_screen"
     android:title="@string/connected_devices_dashboard_title">
 
     <com.android.settings.widget.MasterSwitchPreference
diff --git a/res/xml/data_usage.xml b/res/xml/data_usage.xml
index f7c66bc..5bc8087 100644
--- a/res/xml/data_usage.xml
+++ b/res/xml/data_usage.xml
@@ -14,11 +14,14 @@
      limitations under the License.
 -->
 
-<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
+<PreferenceScreen
+    xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:settings="http://schemas.android.com/apk/res-auto"
+    android:key="data_usage_screen"
     android:title="@string/data_usage_summary_title">
 
     <PreferenceCategory
+        android:key="data_usage_category"
         android:title="@string/usage">
 
         <com.android.settings.SummaryPreference
diff --git a/res/xml/data_usage_cellular.xml b/res/xml/data_usage_cellular.xml
index a5aa316..0c1e014 100644
--- a/res/xml/data_usage_cellular.xml
+++ b/res/xml/data_usage_cellular.xml
@@ -16,6 +16,7 @@
 
 <PreferenceScreen
     xmlns:android="http://schemas.android.com/apk/res/android"
+    android:key="data_usage_cellular_screen"
     android:title="@string/data_usage_summary_title">
 
     <com.android.settings.datausage.TemplatePreferenceCategory
diff --git a/res/xml/data_usage_wifi.xml b/res/xml/data_usage_wifi.xml
index ceb5fc8..607cee1 100644
--- a/res/xml/data_usage_wifi.xml
+++ b/res/xml/data_usage_wifi.xml
@@ -16,6 +16,7 @@
 
 <PreferenceScreen
     xmlns:android="http://schemas.android.com/apk/res/android"
+    android:key="data_usage_wifi_screen"
     android:title="@string/data_usage_summary_title">
 
     <com.android.settings.datausage.TemplatePreferenceCategory
diff --git a/res/xml/date_time_prefs.xml b/res/xml/date_time_prefs.xml
index ddc685c..a26136f 100644
--- a/res/xml/date_time_prefs.xml
+++ b/res/xml/date_time_prefs.xml
@@ -17,6 +17,7 @@
 <PreferenceScreen
     xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
+    android:key="date_time_settings_screen"
     android:title="@string/date_and_time"
     settings:keywords="@string/keywords_date_and_time">
 
diff --git a/res/xml/device_info_settings.xml b/res/xml/device_info_settings.xml
index 1771799..cb02540 100644
--- a/res/xml/device_info_settings.xml
+++ b/res/xml/device_info_settings.xml
@@ -15,6 +15,7 @@
 -->
 
 <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
+        android:key="device_info_pref_screen"
         android:title="@string/about_settings">
 
         <!-- System update settings - launches activity -->
diff --git a/res/xml/device_info_status.xml b/res/xml/device_info_status.xml
index 07bbc4e..a784ed9 100644
--- a/res/xml/device_info_status.xml
+++ b/res/xml/device_info_status.xml
@@ -16,6 +16,7 @@
 
 <PreferenceScreen
     xmlns:android="http://schemas.android.com/apk/res/android"
+    android:key="device_status_screen"
     android:title="@string/device_status_activity_title">
 
     <Preference
diff --git a/res/xml/display_settings.xml b/res/xml/display_settings.xml
index 87d3e5e..aa03bc7 100644
--- a/res/xml/display_settings.xml
+++ b/res/xml/display_settings.xml
@@ -17,6 +17,7 @@
 <PreferenceScreen
     xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
+    android:key="display_settings_screen"
     android:title="@string/display_settings"
     settings:keywords="@string/keywords_display">
 
diff --git a/res/xml/double_tap_power_settings.xml b/res/xml/double_tap_power_settings.xml
index 4d89de6..26d0415 100644
--- a/res/xml/double_tap_power_settings.xml
+++ b/res/xml/double_tap_power_settings.xml
@@ -15,9 +15,11 @@
   limitations under the License.
   -->
 
-<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
-                  xmlns:app="http://schemas.android.com/apk/res-auto"
-                  android:title="@string/double_tap_power_for_camera_title">
+<PreferenceScreen
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    android:key="gesture_double_tap_power_screen"
+    android:title="@string/double_tap_power_for_camera_title">
 
     <com.android.settings.widget.VideoPreference
         android:key="gesture_double_tap_power_video"
diff --git a/res/xml/double_tap_screen_settings.xml b/res/xml/double_tap_screen_settings.xml
index 1601aae..d40602e 100644
--- a/res/xml/double_tap_screen_settings.xml
+++ b/res/xml/double_tap_screen_settings.xml
@@ -15,19 +15,21 @@
   limitations under the License.
   -->
 
-<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
-                  xmlns:app="http://schemas.android.com/apk/res-auto"
-                  android:title="@string/ambient_display_title">
+<PreferenceScreen
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    android:key="gesture_double_tap_screen_screen"
+    android:title="@string/ambient_display_title">
 
     <com.android.settings.widget.VideoPreference
         android:key="gesture_double_tap_screen_video"
         app:animation="@raw/gesture_ambient_tap"
-        app:preview="@drawable/gesture_ambient_tap"/>
+        app:preview="@drawable/gesture_ambient_tap" />
 
     <SwitchPreference
         android:key="gesture_double_tap_screen"
         android:title="@string/ambient_display_title"
         android:summary="@string/ambient_display_summary"
-        app:keywords="@string/keywords_gesture"/>
+        app:keywords="@string/keywords_gesture" />
 
 </PreferenceScreen>
\ No newline at end of file
diff --git a/res/xml/double_twist_gesture_settings.xml b/res/xml/double_twist_gesture_settings.xml
index 94d9782..a2af1e4 100644
--- a/res/xml/double_twist_gesture_settings.xml
+++ b/res/xml/double_twist_gesture_settings.xml
@@ -15,19 +15,21 @@
   limitations under the License.
   -->
 
-<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
-                  xmlns:app="http://schemas.android.com/apk/res-auto"
-                  android:title="@string/double_twist_for_camera_mode_title">
+<PreferenceScreen
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    android:key="gesture_double_twist_screen"
+    android:title="@string/double_twist_for_camera_mode_title">
 
     <com.android.settings.widget.VideoPreference
         android:key="gesture_double_twist_video"
         app:animation="@raw/gesture_twist"
-        app:preview="@drawable/gesture_twist"/>
+        app:preview="@drawable/gesture_twist" />
 
     <SwitchPreference
         android:key="gesture_double_twist"
         android:title="@string/double_twist_for_camera_mode_title"
         android:summary="@string/double_twist_for_camera_mode_summary"
-        app:keywords="@string/keywords_gesture"/>
+        app:keywords="@string/keywords_gesture" />
 
 </PreferenceScreen>
\ No newline at end of file
diff --git a/res/xml/dream_fragment_overview.xml b/res/xml/dream_fragment_overview.xml
index d27a6e3..ba689c7 100644
--- a/res/xml/dream_fragment_overview.xml
+++ b/res/xml/dream_fragment_overview.xml
@@ -16,7 +16,7 @@
 
 <PreferenceScreen
     xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
+    android:key="dream_overview_screen"
     android:title="@string/screensaver_settings_title" >
 
     <com.android.settings.widget.GearPreference
@@ -31,7 +31,8 @@
 
 
     <!-- Layout preference doesn't obey allowDividerAbove, so put it in a PreferenceCategory -->
-    <PreferenceCategory>
+    <PreferenceCategory
+        android:key="dream_start_now_category">
         <com.android.settings.applications.LayoutPreference
             android:key="dream_start_now_button_container"
             android:selectable="false"
diff --git a/res/xml/gestures.xml b/res/xml/gestures.xml
index 7f8df1b..f136ec7 100644
--- a/res/xml/gestures.xml
+++ b/res/xml/gestures.xml
@@ -17,6 +17,7 @@
 
 <PreferenceScreen
     xmlns:android="http://schemas.android.com/apk/res/android"
+    android:key="gesture_settings_screen"
     android:title="@string/gesture_preference_title" >
 
     <Preference
diff --git a/res/xml/language_and_input.xml b/res/xml/language_and_input.xml
index e9c9737..d3c8dc5 100644
--- a/res/xml/language_and_input.xml
+++ b/res/xml/language_and_input.xml
@@ -18,6 +18,7 @@
 <PreferenceScreen
     xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
+    android:key="language_and_input_settings_screen"
     android:title="@string/language_settings" >
 
     <Preference
@@ -27,6 +28,7 @@
         android:fragment="com.android.settings.localepicker.LocaleListEditor"/>
 
     <PreferenceCategory
+        android:key="keyboards_category"
         android:title="@string/keyboard_and_input_methods_category">
         <Preference
             android:key="virtual_keyboard_pref"
@@ -40,6 +42,7 @@
     </PreferenceCategory>
 
     <PreferenceCategory
+        android:key="input_assistance_category"
         android:title="@string/input_assistance">
         <!-- Spell checker preference title, summary and fragment will be set programmatically. -->
         <!-- Note: Mark this as persistent="false" to remove unnecessarily saved shared preference.
@@ -62,7 +65,8 @@
             android:title="@string/user_dict_settings_title"/>
     </PreferenceCategory>
 
-    <PreferenceCategory>
+    <PreferenceCategory
+        android:key="pointer_and_tts_category">
 
         <com.android.settings.PointerSpeedPreference
             android:key="pointer_speed"
diff --git a/res/xml/language_and_input_new_advance_button.xml b/res/xml/language_and_input_new_advance_button.xml
index e5ae674..108f334 100644
--- a/res/xml/language_and_input_new_advance_button.xml
+++ b/res/xml/language_and_input_new_advance_button.xml
@@ -29,6 +29,7 @@
         android:fragment="com.android.settings.localepicker.LocaleListEditor"/>
 
     <PreferenceCategory
+        android:key="keyboards_category"
         android:title="@string/keyboard_and_input_methods_category">
         <Preference
             android:key="virtual_keyboard_pref"
@@ -42,6 +43,7 @@
     </PreferenceCategory>
 
     <PreferenceCategory
+        android:key="input_assistance_category"
         android:title="@string/input_assistance">
         <!-- Spell checker preference title, summary and fragment will be set programmatically. -->
         <!-- Note: Mark this as persistent="false" to remove unnecessarily saved shared preference.
@@ -64,7 +66,8 @@
             android:title="@string/user_dict_settings_title"/>
     </PreferenceCategory>
 
-    <PreferenceCategory>
+    <PreferenceCategory
+        android:key="pointer_and_tts_category">
 
         <com.android.settings.PointerSpeedPreference
             android:key="pointer_speed"
diff --git a/res/xml/manage_assist.xml b/res/xml/manage_assist.xml
index 120309a..047f1ca 100644
--- a/res/xml/manage_assist.xml
+++ b/res/xml/manage_assist.xml
@@ -17,6 +17,7 @@
 
 <PreferenceScreen
     xmlns:android="http://schemas.android.com/apk/res/android"
+    android:key="manage_assist_screen"
     android:title="@string/assist_and_voice_input_title">
 
     <com.android.settings.widget.GearPreference
diff --git a/res/xml/network_and_internet.xml b/res/xml/network_and_internet.xml
index ee25bee..6dfd06b 100644
--- a/res/xml/network_and_internet.xml
+++ b/res/xml/network_and_internet.xml
@@ -17,6 +17,7 @@
 <PreferenceScreen
     xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
+    android:key="network_and_internet_screen"
     android:title="@string/network_dashboard_title">
 
     <com.android.settings.widget.MasterSwitchPreference
@@ -28,7 +29,7 @@
         android:order="-30">
         <intent
             android:action="android.settings.WIFI_SETTINGS"
-            android:targetClass="Settings$WifiSettingsActivity"/>
+            android:targetClass="Settings$WifiSettingsActivity" />
     </com.android.settings.widget.MasterSwitchPreference>
 
     <com.android.settingslib.RestrictedPreference
@@ -44,7 +45,7 @@
         <intent
             android:action="android.intent.action.MAIN"
             android:targetPackage="com.android.phone"
-            android:targetClass="com.android.phone.MobileNetworkSettings"/>
+            android:targetClass="com.android.phone.MobileNetworkSettings" />
     </com.android.settingslib.RestrictedPreference>
 
     <com.android.settingslib.RestrictedPreference
@@ -55,7 +56,7 @@
         android:order="-5"
         android:summary="@string/summary_placeholder"
         settings:userRestriction="no_config_tethering"
-        settings:useAdminDisabledSummary="true"/>
+        settings:useAdminDisabledSummary="true" />
 
     <com.android.settingslib.RestrictedPreference
         android:fragment="com.android.settings.vpn2.VpnSettings"
@@ -65,25 +66,25 @@
         android:order="0"
         android:summary="@string/summary_placeholder"
         settings:userRestriction="no_config_vpn"
-        settings:useAdminDisabledSummary="true"/>
+        settings:useAdminDisabledSummary="true" />
 
     <com.android.settingslib.RestrictedPreference
         android:key="manage_mobile_plan"
         android:title="@string/manage_mobile_plan_title"
         android:persistent="false"
         settings:userRestriction="no_config_mobile_networks"
-        settings:useAdminDisabledSummary="true"/>
+        settings:useAdminDisabledSummary="true" />
 
     <SwitchPreference
         android:key="toggle_airplane"
         android:title="@string/airplane_mode"
         android:icon="@drawable/ic_airplanemode_active"
         android:disableDependentsState="true"
-        android:order="5"/>
+        android:order="5" />
 
     <Preference
         android:fragment="com.android.settings.ProxySelector"
         android:key="proxy_settings"
-        android:title="@string/proxy_settings_title"/>
+        android:title="@string/proxy_settings_title" />
 
 </PreferenceScreen>
\ No newline at end of file
diff --git a/res/xml/physical_keyboard_settings.xml b/res/xml/physical_keyboard_settings.xml
index 974ba98..a2d9a6b 100644
--- a/res/xml/physical_keyboard_settings.xml
+++ b/res/xml/physical_keyboard_settings.xml
@@ -13,7 +13,9 @@
      See the License for the specific language governing permissions and
      limitations under the License.
 -->
-<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
+<PreferenceScreen
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:key="physical_keyboard_screen"
     android:title="@string/physical_keyboard_title">
     <!-- Additional preference screens are inserted here programmatically
          with low order values to set the key map of each attached keyboard. -->
diff --git a/res/xml/power_usage_advanced.xml b/res/xml/power_usage_advanced.xml
index 3deec09..67c7857 100644
--- a/res/xml/power_usage_advanced.xml
+++ b/res/xml/power_usage_advanced.xml
@@ -17,6 +17,7 @@
 <PreferenceScreen
     xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
+    android:key="power_usage_advanced_screen"
     android:title="@string/advanced_battery_title"
     settings:keywords="@string/keywords_battery">
 
diff --git a/res/xml/power_usage_summary.xml b/res/xml/power_usage_summary.xml
index efdae92..57195f9 100644
--- a/res/xml/power_usage_summary.xml
+++ b/res/xml/power_usage_summary.xml
@@ -17,6 +17,7 @@
 <PreferenceScreen
     xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
+    android:key="power_usage_summary_screen"
     android:title="@string/power_usage_summary_title"
     settings:keywords="@string/keywords_battery">
 
diff --git a/res/xml/print_settings.xml b/res/xml/print_settings.xml
index 3a00f71..fe8cac1 100644
--- a/res/xml/print_settings.xml
+++ b/res/xml/print_settings.xml
@@ -14,21 +14,21 @@
      limitations under the License.
 -->
 
-<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
-                  xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
+<PreferenceScreen
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
+    android:key="print_settings_screen"
+    android:title="@string/print_settings_title"
+    settings:keywords="@string/keywords_printing">
+
+    <PreferenceCategory
+        android:key="print_jobs_category"
+        android:title="@string/print_print_jobs"
+        android:order="0" />
+
+    <PreferenceCategory
+        android:key="print_services_category"
         android:title="@string/print_settings_title"
-        settings:keywords="@string/keywords_printing">
-
-    <PreferenceCategory
-            android:key="print_jobs_category"
-            android:title="@string/print_print_jobs"
-            android:order="0">
-    </PreferenceCategory>
-
-    <PreferenceCategory
-            android:key="print_services_category"
-            android:title="@string/print_settings_title"
-            android:order="1">
-    </PreferenceCategory>
+        android:order="1" />
 
 </PreferenceScreen>
diff --git a/res/xml/security_lockscreen_settings.xml b/res/xml/security_lockscreen_settings.xml
index d10440e..fd54ca7 100644
--- a/res/xml/security_lockscreen_settings.xml
+++ b/res/xml/security_lockscreen_settings.xml
@@ -16,6 +16,7 @@
 
 <PreferenceScreen
     xmlns:android="http://schemas.android.com/apk/res/android"
+    android:key="security_lockscreen_settings_screen"
     android:title="@string/lockscreen_settings_title">
 
     <com.android.settings.notification.RestrictedDropDownPreference
diff --git a/res/xml/security_settings_chooser.xml b/res/xml/security_settings_chooser.xml
index 067ebab..772057a 100644
--- a/res/xml/security_settings_chooser.xml
+++ b/res/xml/security_settings_chooser.xml
@@ -16,6 +16,7 @@
 
 <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
                   xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
+                  android:key="security_settings_chooser_screen"
                   android:title="@string/security_settings_title">
 
     <PreferenceCategory
diff --git a/res/xml/security_settings_encrypted.xml b/res/xml/security_settings_encrypted.xml
index 0d3fe76..fd7cbce 100644
--- a/res/xml/security_settings_encrypted.xml
+++ b/res/xml/security_settings_encrypted.xml
@@ -15,6 +15,7 @@
 -->
 
 <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
+                  android:key="security_settings_encrypted_screen"
                   android:title="@string/security_settings_title">
 
     <PreferenceCategory
diff --git a/res/xml/security_settings_lockscreen.xml b/res/xml/security_settings_lockscreen.xml
index c141fb7..0d2e3e8 100644
--- a/res/xml/security_settings_lockscreen.xml
+++ b/res/xml/security_settings_lockscreen.xml
@@ -16,6 +16,7 @@
 
 <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
                   xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
+                  android:key="security_settings_lockscreen_screen"
                   android:title="@string/security_settings_title">
 
     <PreferenceCategory
diff --git a/res/xml/security_settings_lockscreen_profile.xml b/res/xml/security_settings_lockscreen_profile.xml
index e027c6b..34e6653 100644
--- a/res/xml/security_settings_lockscreen_profile.xml
+++ b/res/xml/security_settings_lockscreen_profile.xml
@@ -16,6 +16,7 @@
 
 <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
                   xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
+                  android:key="security_settings_lockscreen_profile_screen"
                   android:title="@string/security_settings_title">
 
     <com.android.settingslib.RestrictedPreference
diff --git a/res/xml/security_settings_misc.xml b/res/xml/security_settings_misc.xml
index 94a4fea..c63ad2c 100644
--- a/res/xml/security_settings_misc.xml
+++ b/res/xml/security_settings_misc.xml
@@ -15,10 +15,12 @@
 -->
 
 <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
+                  android:key="security_settings_misc_screen"
         android:title="@string/security_settings_title">
 
-    <PreferenceCategory android:title="@string/security_passwords_title"
-            android:persistent="false">
+    <PreferenceCategory
+        android:key="security_settings_misc_category"
+        android:title="@string/security_passwords_title">
 
         <Preference
             android:key="location"
@@ -33,7 +35,8 @@
 
     </PreferenceCategory>
 
-    <PreferenceCategory>
+    <PreferenceCategory
+        android:key="security_settings_device_admin_category">
 
         <Preference android:key="manage_device_admin"
                 android:title="@string/manage_device_admin"
diff --git a/res/xml/security_settings_password.xml b/res/xml/security_settings_password.xml
index 7de65f7..e9e3bde 100644
--- a/res/xml/security_settings_password.xml
+++ b/res/xml/security_settings_password.xml
@@ -16,6 +16,7 @@
 
 <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
                   xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
+                  android:key="security_settings_password_screen"
                   android:title="@string/lock_settings_picker_title">
 
     <PreferenceCategory
diff --git a/res/xml/security_settings_password_profile.xml b/res/xml/security_settings_password_profile.xml
index 84e1678..3e5701d 100644
--- a/res/xml/security_settings_password_profile.xml
+++ b/res/xml/security_settings_password_profile.xml
@@ -16,6 +16,7 @@
 
 <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
                   xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
+                  android:key="security_settings_password_profile_screen"
                   android:title="@string/security_settings_title">
 
     <com.android.settingslib.RestrictedPreference
diff --git a/res/xml/security_settings_password_sub.xml b/res/xml/security_settings_password_sub.xml
index c0287c0..d9e6111c 100644
--- a/res/xml/security_settings_password_sub.xml
+++ b/res/xml/security_settings_password_sub.xml
@@ -17,6 +17,7 @@
 
 <PreferenceScreen
     xmlns:android="http://schemas.android.com/apk/res/android"
+    android:key="security_settings_password_sub_screen"
     android:title="@string/settings_label">
 
     <com.android.settings.TimeoutListPreference
diff --git a/res/xml/security_settings_pattern.xml b/res/xml/security_settings_pattern.xml
index 1585f01..d55d6b8 100644
--- a/res/xml/security_settings_pattern.xml
+++ b/res/xml/security_settings_pattern.xml
@@ -16,6 +16,7 @@
 
 <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
                   xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
+                  android:key="security_settings_pattern_screen"
                   android:title="@string/lock_settings_picker_title">
 
     <PreferenceCategory
diff --git a/res/xml/security_settings_pattern_profile.xml b/res/xml/security_settings_pattern_profile.xml
index b660e4a..7387743 100644
--- a/res/xml/security_settings_pattern_profile.xml
+++ b/res/xml/security_settings_pattern_profile.xml
@@ -16,6 +16,7 @@
 
 <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
                   xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
+                  android:key="security_settings_pattern_profile_screen"
                   android:title="@string/security_settings_title">
 
     <com.android.settingslib.RestrictedPreference
diff --git a/res/xml/security_settings_pattern_sub.xml b/res/xml/security_settings_pattern_sub.xml
index 7de2ba2..c898d6f 100644
--- a/res/xml/security_settings_pattern_sub.xml
+++ b/res/xml/security_settings_pattern_sub.xml
@@ -17,6 +17,7 @@
 
 <PreferenceScreen
     xmlns:android="http://schemas.android.com/apk/res/android"
+    android:key="security_settings_pattern_sub_screen"
     android:title="@string/settings_label">
 
     <SwitchPreference
diff --git a/res/xml/security_settings_pin_profile.xml b/res/xml/security_settings_pin_profile.xml
index 481a087..ae32535 100644
--- a/res/xml/security_settings_pin_profile.xml
+++ b/res/xml/security_settings_pin_profile.xml
@@ -16,6 +16,7 @@
 
 <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
                   xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
+                  android:key="security_settings_pin_profile_screen"
                   android:title="@string/security_settings_title">
 
     <com.android.settingslib.RestrictedPreference
diff --git a/res/xml/security_settings_pin_sub.xml b/res/xml/security_settings_pin_sub.xml
index c0287c0..f98ccbc 100644
--- a/res/xml/security_settings_pin_sub.xml
+++ b/res/xml/security_settings_pin_sub.xml
@@ -17,6 +17,7 @@
 
 <PreferenceScreen
     xmlns:android="http://schemas.android.com/apk/res/android"
+    android:key="security_settings_pin_sub_screen"
     android:title="@string/settings_label">
 
     <com.android.settings.TimeoutListPreference
diff --git a/res/xml/security_settings_slide_sub.xml b/res/xml/security_settings_slide_sub.xml
index 88eba8b..126b8af 100644
--- a/res/xml/security_settings_slide_sub.xml
+++ b/res/xml/security_settings_slide_sub.xml
@@ -17,6 +17,7 @@
 
 <PreferenceScreen
     xmlns:android="http://schemas.android.com/apk/res/android"
+    android:key="security_settings_slide_sub_screen"
     android:title="@string/settings_label">
 
     <com.android.settingslib.RestrictedPreference
diff --git a/res/xml/security_settings_unencrypted.xml b/res/xml/security_settings_unencrypted.xml
index 27dbe96..4b51376 100644
--- a/res/xml/security_settings_unencrypted.xml
+++ b/res/xml/security_settings_unencrypted.xml
@@ -15,6 +15,7 @@
 -->
 
 <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
+                  android:key="security_settings_unencrypted_screen"
                   android:title="@string/crypt_keeper_settings_title">
 
     <PreferenceCategory
diff --git a/res/xml/sound_settings.xml b/res/xml/sound_settings.xml
index 4d19099..578edf6 100644
--- a/res/xml/sound_settings.xml
+++ b/res/xml/sound_settings.xml
@@ -22,6 +22,7 @@
     settings:keywords="@string/keywords_sounds">
 
     <PreferenceCategory
+        android:key="sound_settings_primary_items_category"
         android:order="-100">
         <!-- Media volume -->
         <com.android.settings.notification.VolumeSeekBarPreference
@@ -93,6 +94,7 @@
 
     <!-- Other sounds -->
     <PreferenceCategory
+          android:key="other_sounds_and_vibrations_category"
           android:title="@string/other_sound_category_preference_title"
           android:order="-50">
 
diff --git a/res/xml/special_access.xml b/res/xml/special_access.xml
index 32dcf8e..1198fcc 100644
--- a/res/xml/special_access.xml
+++ b/res/xml/special_access.xml
@@ -17,6 +17,7 @@
 <PreferenceScreen
         xmlns:android="http://schemas.android.com/apk/res/android"
         xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
+        android:key="special_app_access_screen"
         android:title="@string/special_access">
 
     <Preference
diff --git a/res/xml/storage_dashboard_fragment.xml b/res/xml/storage_dashboard_fragment.xml
index 54699d3..3ed9c37 100644
--- a/res/xml/storage_dashboard_fragment.xml
+++ b/res/xml/storage_dashboard_fragment.xml
@@ -17,6 +17,7 @@
 <PreferenceScreen
     xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
+    android:key="storage_dashboard_screen"
     android:title="@string/storage_settings"
     android:orderingFromXml="false">
     <com.android.settings.deviceinfo.storage.StorageSummaryDonutPreference
diff --git a/res/xml/swipe_to_notification_settings.xml b/res/xml/swipe_to_notification_settings.xml
index 505383b..5b53c10 100644
--- a/res/xml/swipe_to_notification_settings.xml
+++ b/res/xml/swipe_to_notification_settings.xml
@@ -17,6 +17,7 @@
 
 <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
                   xmlns:app="http://schemas.android.com/apk/res-auto"
+                  android:key="gesture_swipe_down_fingerprint_screen"
                   android:title="@string/fingerprint_gesture_screen_title">
 
     <com.android.settings.widget.VideoPreference
diff --git a/res/xml/system_dashboard_fragment.xml b/res/xml/system_dashboard_fragment.xml
index a71c7585..b4ad3a3 100644
--- a/res/xml/system_dashboard_fragment.xml
+++ b/res/xml/system_dashboard_fragment.xml
@@ -16,6 +16,7 @@
 
 <PreferenceScreen
     xmlns:android="http://schemas.android.com/apk/res/android"
+    android:key="system_dashboard_screen"
     android:title="@string/header_category_system">
 
     <Preference
diff --git a/res/xml/tts_settings.xml b/res/xml/tts_settings.xml
index dc50e20..be34b28 100644
--- a/res/xml/tts_settings.xml
+++ b/res/xml/tts_settings.xml
@@ -16,6 +16,7 @@
 
 <PreferenceScreen
     xmlns:android="http://schemas.android.com/apk/res/android"
+    android:key="tts_settings_screen"
     android:title="@string/tts_settings_title">
 
     <PreferenceCategory android:key="tts_engine_section">
diff --git a/res/xml/user_and_accounts_settings.xml b/res/xml/user_and_accounts_settings.xml
index a62b839..71c8367 100644
--- a/res/xml/user_and_accounts_settings.xml
+++ b/res/xml/user_and_accounts_settings.xml
@@ -17,6 +17,7 @@
 <PreferenceScreen
     xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
+    android:key="user_and_account_settings_screen"
     android:title="@string/account_dashboard_title"
     settings:keywords="@string/keywords_accounts">
 
diff --git a/res/xml/virtual_keyboard_settings.xml b/res/xml/virtual_keyboard_settings.xml
index d5f0496..93445f4 100644
--- a/res/xml/virtual_keyboard_settings.xml
+++ b/res/xml/virtual_keyboard_settings.xml
@@ -13,7 +13,9 @@
      See the License for the specific language governing permissions and
      limitations under the License.
 -->
-<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
+<PreferenceScreen
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:key="virtual_keyboard_category"
     android:title="@string/virtual_keyboard_category">
     <!-- Enabled input method list will be populated programmatically here. -->
     <Preference
diff --git a/res/xml/wifi_configure_settings.xml b/res/xml/wifi_configure_settings.xml
index 1747b63..322e2a5 100644
--- a/res/xml/wifi_configure_settings.xml
+++ b/res/xml/wifi_configure_settings.xml
@@ -17,6 +17,7 @@
 <PreferenceScreen
         xmlns:android="http://schemas.android.com/apk/res/android"
         xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
+        android:key="wifi_configure_settings_screen"
         android:title="@string/wifi_configure_settings_preference_title">
 
     <SwitchPreference
diff --git a/src/com/android/settings/SecuritySettings.java b/src/com/android/settings/SecuritySettings.java
index 26a9ecb..d3a7a51 100644
--- a/src/com/android/settings/SecuritySettings.java
+++ b/src/com/android/settings/SecuritySettings.java
@@ -17,7 +17,6 @@
 package com.android.settings;
 
 import static android.provider.Settings.System.SCREEN_OFF_TIMEOUT;
-
 import static com.android.settingslib.RestrictedLockUtils.EnforcedAdmin;
 
 import android.app.Activity;
@@ -382,14 +381,6 @@
         // Advanced Security features
         initTrustAgentPreference(root, numberOfTrustAgent);
 
-        // The above preferences come and go based on security state, so we need to update
-        // the index. This call is expected to be fairly cheap, but we may want to do something
-        // smarter in the future.
-        final Activity activity = getActivity();
-        FeatureFactory.getFactory(activity).getSearchFeatureProvider().getIndexingManager(activity)
-                .updateFromClassNameResource(SecuritySettings.class.getName(),
-                        true /* includeInSearchResults */);
-
         PreferenceGroup securityStatusPreferenceGroup =
                 (PreferenceGroup) root.findPreference(KEY_SECURITY_STATUS);
         final List<Preference> tilePrefs = mDashboardFeatureProvider.getPreferencesForCategory(
diff --git a/src/com/android/settings/accounts/AccountPreferenceController.java b/src/com/android/settings/accounts/AccountPreferenceController.java
index 246baff..cc8c984 100644
--- a/src/com/android/settings/accounts/AccountPreferenceController.java
+++ b/src/com/android/settings/accounts/AccountPreferenceController.java
@@ -54,7 +54,6 @@
 import com.android.settings.core.PreferenceControllerMixin;
 import com.android.settings.core.instrumentation.MetricsFeatureProvider;
 import com.android.settings.overlay.FeatureFactory;
-import com.android.settings.search.SearchFeatureProviderImpl;
 import com.android.settings.search.SearchIndexableRaw;
 import com.android.settingslib.RestrictedPreference;
 import com.android.settingslib.accounts.AuthenticatorHelper;
@@ -346,8 +345,6 @@
                 DISALLOW_MODIFY_ACCOUNTS, userInfo.id);
         }
         mProfiles.put(userInfo.id, profileData);
-        new SearchFeatureProviderImpl().getIndexingManager(mContext).updateFromClassNameResource(
-                UserAndAccountDashboardFragment.class.getName(), true /* includeInSearchResults */);
     }
 
     private DimmableIconPreference newAddAccountPreference(Context context) {
diff --git a/src/com/android/settings/accounts/UserAndAccountDashboardFragment.java b/src/com/android/settings/accounts/UserAndAccountDashboardFragment.java
index f375cf8..e116fd1 100644
--- a/src/com/android/settings/accounts/UserAndAccountDashboardFragment.java
+++ b/src/com/android/settings/accounts/UserAndAccountDashboardFragment.java
@@ -20,7 +20,6 @@
 import android.app.Activity;
 import android.content.Context;
 import android.content.pm.UserInfo;
-import android.os.Bundle;
 import android.os.UserHandle;
 import android.os.UserManager;
 import android.provider.SearchIndexableResource;
@@ -31,7 +30,6 @@
 import com.android.settings.dashboard.SummaryLoader;
 import com.android.settings.search.BaseSearchIndexProvider;
 import com.android.settingslib.core.AbstractPreferenceController;
-import com.android.settingslib.drawer.Tile;
 
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -40,7 +38,6 @@
 public class UserAndAccountDashboardFragment extends DashboardFragment {
 
     private static final String TAG = "UserAndAccountDashboard";
-    private static final String METADATA_IA_ACCOUNT = "com.android.settings.ia.account";
 
     @Override
     public int getMetricsCategory() {
diff --git a/src/com/android/settings/search/DatabaseIndexingManager.java b/src/com/android/settings/search/DatabaseIndexingManager.java
index 5d6fe3b..fa1981f 100644
--- a/src/com/android/settings/search/DatabaseIndexingManager.java
+++ b/src/com/android/settings/search/DatabaseIndexingManager.java
@@ -18,20 +18,18 @@
 package com.android.settings.search;
 
 import static com.android.settings.search.DatabaseResultLoader.COLUMN_INDEX_ID;
-import static com.android.settings.search.DatabaseResultLoader
-        .COLUMN_INDEX_INTENT_ACTION_TARGET_PACKAGE;
+import static com.android.settings.search.DatabaseResultLoader.COLUMN_INDEX_INTENT_ACTION_TARGET_PACKAGE;
 import static com.android.settings.search.DatabaseResultLoader.COLUMN_INDEX_KEY;
 import static com.android.settings.search.DatabaseResultLoader.SELECT_COLUMNS;
-import static com.android.settings.search.IndexDatabaseHelper.IndexColumns.DOCID;
 import static com.android.settings.search.IndexDatabaseHelper.IndexColumns.CLASS_NAME;
 import static com.android.settings.search.IndexDatabaseHelper.IndexColumns.DATA_ENTRIES;
 import static com.android.settings.search.IndexDatabaseHelper.IndexColumns.DATA_KEYWORDS;
 import static com.android.settings.search.IndexDatabaseHelper.IndexColumns.DATA_KEY_REF;
 import static com.android.settings.search.IndexDatabaseHelper.IndexColumns.DATA_SUMMARY_ON;
-import static com.android.settings.search.IndexDatabaseHelper.IndexColumns
-        .DATA_SUMMARY_ON_NORMALIZED;
+import static com.android.settings.search.IndexDatabaseHelper.IndexColumns.DATA_SUMMARY_ON_NORMALIZED;
 import static com.android.settings.search.IndexDatabaseHelper.IndexColumns.DATA_TITLE;
 import static com.android.settings.search.IndexDatabaseHelper.IndexColumns.DATA_TITLE_NORMALIZED;
+import static com.android.settings.search.IndexDatabaseHelper.IndexColumns.DOCID;
 import static com.android.settings.search.IndexDatabaseHelper.IndexColumns.ENABLED;
 import static com.android.settings.search.IndexDatabaseHelper.IndexColumns.ICON;
 import static com.android.settings.search.IndexDatabaseHelper.IndexColumns.INTENT_ACTION;
@@ -53,14 +51,12 @@
 import android.database.sqlite.SQLiteException;
 import android.os.AsyncTask;
 import android.os.Build;
-import android.provider.SearchIndexableResource;
 import android.provider.SearchIndexablesContract;
 import android.support.annotation.VisibleForTesting;
 import android.text.TextUtils;
 import android.util.Log;
 
 import com.android.settings.overlay.FeatureFactory;
-
 import com.android.settings.search.indexing.IndexData;
 import com.android.settings.search.indexing.IndexDataConverter;
 import com.android.settings.search.indexing.PreIndexData;
@@ -365,36 +361,6 @@
         disabledResults.close();
     }
 
-    /**
-     * TODO (b/64951285): Deprecate this method
-     *
-     * Update the Index for a specific class name resources
-     *
-     * @param className              the class name (typically a fragment name).
-     * @param includeInSearchResults true means that you want the bit "enabled" set so that the
-     *                               data will be seen included into the search results
-     */
-    public void updateFromClassNameResource(String className, boolean includeInSearchResults) {
-        if (className == null) {
-            throw new IllegalArgumentException("class name cannot be null!");
-        }
-        final SearchIndexableResource res = SearchIndexableResources.getResourceByName(className);
-        if (res == null) {
-            Log.e(LOG_TAG, "Cannot find SearchIndexableResources for class name: " + className);
-            return;
-        }
-        res.context = mContext;
-        res.enabled = includeInSearchResults;
-        AsyncTask.execute(new Runnable() {
-            @Override
-            public void run() {
-//                addIndexableData(res);
-//                updateDatabase(false, Locale.getDefault().toString());
-//                res.enabled = false;
-            }
-        });
-    }
-
     private SQLiteDatabase getWritableDatabase() {
         try {
             return IndexDatabaseHelper.getInstance(mContext).getWritableDatabase();
diff --git a/src/com/android/settings/search/SearchIndexableResources.java b/src/com/android/settings/search/SearchIndexableResources.java
index 89924bb..02d9920 100644
--- a/src/com/android/settings/search/SearchIndexableResources.java
+++ b/src/com/android/settings/search/SearchIndexableResources.java
@@ -19,7 +19,6 @@
 import android.provider.SearchIndexableResource;
 import android.support.annotation.VisibleForTesting;
 import android.support.annotation.XmlRes;
-import android.text.TextUtils;
 
 import com.android.settings.DateTimeSettings;
 import com.android.settings.DeviceInfoSettings;
@@ -92,13 +91,6 @@
 import java.util.HashMap;
 
 public final class SearchIndexableResources {
-
-    /**
-     * Identifies subsettings which have an {@link SearchIndexableResource#intentAction} but
-     * whose intents should still be treated as subsettings inside of Settings.
-     */
-    public static final String SUBSETTING_TARGET_PACKAGE = "subsetting_target_package";
-
     @XmlRes
     public static final int NO_RES_ID = 0;
 
@@ -107,20 +99,10 @@
 
     @VisibleForTesting
     static void addIndex(Class<?> indexClass) {
-        addIndex(indexClass, null /* targetAction */);
-    }
-
-    @VisibleForTesting
-    static void addIndex(Class<?> indexClass, String targetAction) {
         String className = indexClass.getName();
         SearchIndexableResource resource = new SearchIndexableResource(
                 0 /* rank */, NO_RES_ID, className, NO_RES_ID);
 
-        if (!TextUtils.isEmpty(targetAction)) {
-            resource.intentAction = targetAction;
-            resource.intentTargetPackage = SUBSETTING_TARGET_PACKAGE;
-        }
-
         sResMap.put(className, resource);
     }
 
@@ -133,11 +115,11 @@
         addIndex(DataUsageSummary.class);
         addIndex(DataUsageMeteredSettings.class);
         addIndex(ScreenZoomSettings.class);
-        addIndex(DisplaySettings.class, "android.settings.DISPLAY_SETTINGS");
+        addIndex(DisplaySettings.class);
         addIndex(AmbientDisplaySettings.class);
         addIndex(WallpaperTypeSettings.class);
         addIndex(AppAndNotificationDashboardFragment.class);
-        addIndex(SoundSettings.class, "android.settings.SOUND_SETTINGS");
+        addIndex(SoundSettings.class);
         addIndex(ZenModeSettings.class);
         addIndex(StorageSettings.class);
         addIndex(PowerUsageAdvanced.class);
diff --git a/src/com/android/settings/search/indexing/IndexData.java b/src/com/android/settings/search/indexing/IndexData.java
index 9dad3fe..1e83976 100644
--- a/src/com/android/settings/search/indexing/IndexData.java
+++ b/src/com/android/settings/search/indexing/IndexData.java
@@ -26,7 +26,6 @@
 import com.android.settings.search.DatabaseIndexingUtils;
 import com.android.settings.search.ResultPayload;
 import com.android.settings.search.ResultPayloadUtils;
-import com.android.settings.search.SearchIndexableResources;
 
 import java.text.Normalizer;
 import java.util.Objects;
@@ -269,12 +268,10 @@
 
             boolean isEmptyIntentAction = TextUtils.isEmpty(mIntentAction);
             // No intent action is set, or the intent action is for a subsetting.
-            if (isEmptyIntentAction
-                    || TextUtils.equals(mIntentTargetPackage,
-                    SearchIndexableResources.SUBSETTING_TARGET_PACKAGE)) {
+            if (isEmptyIntentAction) {
                 // Action is null, we will launch it as a sub-setting
-                intent = DatabaseIndexingUtils.buildSearchResultPageIntent(context, mClassName, mKey,
-                        mScreenTitle);
+                intent = DatabaseIndexingUtils.buildSearchResultPageIntent(context, mClassName,
+                        mKey, mScreenTitle);
             } else {
                 intent = new Intent(mIntentAction);
                 final String targetClass = mIntentTargetClass;
diff --git a/tests/robotests/src/com/android/settings/search/XmlParserUtilTest.java b/tests/robotests/src/com/android/settings/search/XmlParserUtilTest.java
index b2ce3a7..6050b32 100644
--- a/tests/robotests/src/com/android/settings/search/XmlParserUtilTest.java
+++ b/tests/robotests/src/com/android/settings/search/XmlParserUtilTest.java
@@ -120,6 +120,7 @@
 
     // Null checks
     @Test
+    @Config(qualifiers = "mcc999")
     public void testDataKeyInvalid_ReturnsNull() {
         XmlResourceParser parser = getParentPrimedParser(R.xml.display_settings);
         final AttributeSet attrs = Xml.asAttributeSet(parser);