Remove duplicate search result in Mobile network setting.

Remove enabled_networks button from Settings' search result because
enabled_networks button and preferred_network_mode button share the
same title "Preferred network type"and are mutual exclusive. Thus
we remove one from search result to avoid duplicate search result.

Bug: 74120374
Test: manual
Change-Id: Ie392303ada0a401b134e920161083ad7e2893b00
Merged-In: Ie392303ada0a401b134e920161083ad7e2893b00
(cherry picked from commit c9e1753861964ee6613b80181db2b0c1e2a750db)
diff --git a/src/com/android/phone/PhoneSearchIndexablesProvider.java b/src/com/android/phone/PhoneSearchIndexablesProvider.java
index b7f6738..ee79f92 100644
--- a/src/com/android/phone/PhoneSearchIndexablesProvider.java
+++ b/src/com/android/phone/PhoneSearchIndexablesProvider.java
@@ -103,8 +103,7 @@
 
             if (!mUserManager.isAdminUser()) {
                 final String[] values = new String[]{"preferred_network_mode_key",
-                        "button_roaming_key",
-                        "cdma_lte_data_service_key", "enabled_networks_key", "enhanced_4g_lte",
+                        "button_roaming_key", "cdma_lte_data_service_key", "enhanced_4g_lte",
                         "button_apn_key", "button_carrier_sel_key", "carrier_settings_key",
                         "cdma_system_select_key", "esim_list_profile", "mobile_data_enable",
                         "data_usage_summary", "wifi_calling_key", "video_calling_key"};
@@ -119,6 +118,12 @@
                     cursor.addRow(createNonIndexableRow("enhanced_4g_lte" /* key */));
                 }
             }
+
+            // enabled_networks button and preferred_network_mode button share the same title
+            // "Preferred network type"and are mutual exclusive. Thus we remove one from search
+            // result to avoid duplicate search result.
+            // TODO: b/63381516 all hidden buttons should dynamically be removed from search result.
+            cursor.addRow(createNonIndexableRow("enabled_networks_key" /* key */));
             cursor.addRow(createNonIndexableRow("carrier_settings_euicc_key" /* key */));
             cursor.addRow(createNonIndexableRow("advanced_options" /* key */));
             return cursor;
diff --git a/tests/src/com/android/phone/PhoneSearchIndexablesProviderTest.java b/tests/src/com/android/phone/PhoneSearchIndexablesProviderTest.java
index 2176d6b..6b7f825 100644
--- a/tests/src/com/android/phone/PhoneSearchIndexablesProviderTest.java
+++ b/tests/src/com/android/phone/PhoneSearchIndexablesProviderTest.java
@@ -124,16 +124,16 @@
         when(mUserManager.isAdminUser()).thenReturn(true);
         Cursor cursor2 = mProvider
                 .queryNonIndexableKeys(SearchIndexablesContract.NON_INDEXABLES_KEYS_COLUMNS);
-        assertThat(cursor2.getCount()).isEqualTo(2);
+        assertThat(cursor2.getCount()).isEqualTo(3);
 
         mProvider.setIsEuiccSettingsHidden(true /* isEuiccSettingsHidden */);
         Cursor cursor3 = mProvider
                 .queryNonIndexableKeys(SearchIndexablesContract.NON_INDEXABLES_KEYS_COLUMNS);
-        assertThat(cursor3.getCount()).isEqualTo(3);
+        assertThat(cursor3.getCount()).isEqualTo(4);
 
         mProvider.setIsEnhanced4gLteHidden(true /* isEnhanced4gLteHidden */);
         Cursor cursor4 = mProvider
                 .queryNonIndexableKeys(SearchIndexablesContract.NON_INDEXABLES_KEYS_COLUMNS);
-        assertThat(cursor4.getCount()).isEqualTo(4);
+        assertThat(cursor4.getCount()).isEqualTo(5);
     }
 }