Merge "Fix fail to search by input "4G Calling""
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 29f89c5..94eb5bf 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -7437,6 +7437,9 @@
     <!-- Battery Saver: Search terms for battery saver schedule preference. Feel free to add additional terms when translating if appropriate [CHAR_LIMIT=NONE] -->
     <string name="keywords_battery_saver_schedule">routine, schedule, battery saver, power saver, battery, automatic, percent</string>
 
+    <!-- List of synonyms for the enhance 4G LTE titles, used to match in settings search [CHAR LIMIT=NONE] -->
+    <string name="keywords_enhance_4g_lte">volte, advanced calling, 4g calling</string>
+
     <!-- Option title for the default sound, context based on screen -->
     <string name="default_sound">Default sound</string>
 
diff --git a/res/xml/mobile_network_settings.xml b/res/xml/mobile_network_settings.xml
index 488761f..ae7c903 100644
--- a/res/xml/mobile_network_settings.xml
+++ b/res/xml/mobile_network_settings.xml
@@ -50,6 +50,7 @@
         android:title="@string/enhanced_4g_lte_mode_title"
         android:persistent="false"
         android:summary="@string/enhanced_4g_lte_mode_summary"
+        settings:keywords="@string/keywords_enhance_4g_lte"
         settings:controller="com.android.settings.network.telephony.Enhanced4gLtePreferenceController"/>
 
     <ListPreference
diff --git a/res/xml/mobile_network_settings_v2.xml b/res/xml/mobile_network_settings_v2.xml
index e77bf2d..a22826f 100644
--- a/res/xml/mobile_network_settings_v2.xml
+++ b/res/xml/mobile_network_settings_v2.xml
@@ -21,6 +21,7 @@
 
     <com.android.settingslib.widget.LayoutPreference
         android:key="use_sim_switch"
+        android:title="@string/summary_placeholder"
         android:layout="@layout/styled_switch_bar"
         settings:controller="com.android.settings.network.telephony.MobileNetworkSwitchController"/>
 
@@ -96,6 +97,7 @@
             android:title="@string/enhanced_4g_lte_mode_title"
             android:persistent="false"
             android:summary="@string/enhanced_4g_lte_mode_summary"
+            settings:keywords="@string/keywords_enhance_4g_lte"
             settings:controller="com.android.settings.network.telephony.Enhanced4gLtePreferenceController"/>
 
         <ListPreference
diff --git a/src/com/android/settings/network/telephony/Enhanced4gLtePreferenceController.java b/src/com/android/settings/network/telephony/Enhanced4gLtePreferenceController.java
index ca45a32..9069c35 100644
--- a/src/com/android/settings/network/telephony/Enhanced4gLtePreferenceController.java
+++ b/src/com/android/settings/network/telephony/Enhanced4gLtePreferenceController.java
@@ -72,6 +72,7 @@
 
     @Override
     public int getAvailabilityStatus(int subId) {
+        init(subId);
         final PersistableBundle carrierConfig = mCarrierConfigManager.getConfigForSubId(subId);
         final boolean isVisible = subId != SubscriptionManager.INVALID_SUBSCRIPTION_ID
                 && mImsManager != null && carrierConfig != null
@@ -105,9 +106,9 @@
         super.updateState(preference);
         final SwitchPreference switchPreference = (SwitchPreference) preference;
         final boolean show4GForLTE = mCarrierConfig.getBoolean(
-            CarrierConfigManager.KEY_SHOW_4G_FOR_LTE_DATA_ICON_BOOL);
+                CarrierConfigManager.KEY_SHOW_4G_FOR_LTE_DATA_ICON_BOOL);
         int variant4glteTitleIndex = mCarrierConfig.getInt(
-            CarrierConfigManager.KEY_ENHANCED_4G_LTE_TITLE_VARIANT_INT);
+                CarrierConfigManager.KEY_ENHANCED_4G_LTE_TITLE_VARIANT_INT);
 
         if (variant4glteTitleIndex != VARIANT_TITLE_ADVANCED_CALL) {
             variant4glteTitleIndex = show4GForLTE ? VARIANT_TITLE_4G_CALLING : VARIANT_TITLE_VOLTE;
@@ -135,6 +136,9 @@
     }
 
     public Enhanced4gLtePreferenceController init(int subId) {
+        if (mSubId == subId) {
+            return this;
+        }
         mSubId = subId;
         mTelephonyManager = TelephonyManager.from(mContext).createForSubscriptionId(mSubId);
         mCarrierConfig = mCarrierConfigManager.getConfigForSubId(mSubId);
diff --git a/src/com/android/settings/network/telephony/MobileNetworkSettings.java b/src/com/android/settings/network/telephony/MobileNetworkSettings.java
index 8d83ef2..0a63e73 100644
--- a/src/com/android/settings/network/telephony/MobileNetworkSettings.java
+++ b/src/com/android/settings/network/telephony/MobileNetworkSettings.java
@@ -119,7 +119,7 @@
                 MobileNetworkUtils.getSearchableSubscriptionId(context));
 
         if (FeatureFlagPersistent.isEnabled(getContext(), FeatureFlags.NETWORK_INTERNET_V2) &&
-            mSubId != SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
+                mSubId != SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
             return Arrays.asList(
                     new DataUsageSummaryPreferenceController(getActivity(), getSettingsLifecycle(),
                             this, mSubId));
@@ -275,7 +275,10 @@
                     final ArrayList<SearchIndexableResource> result = new ArrayList<>();
 
                     final SearchIndexableResource sir = new SearchIndexableResource(context);
-                    sir.xmlResId = R.xml.mobile_network_settings;
+                    sir.xmlResId = FeatureFlagPersistent.isEnabled(context,
+                            FeatureFlags.NETWORK_INTERNET_V2)
+                            ? R.xml.mobile_network_settings_v2
+                            : R.xml.mobile_network_settings;
                     result.add(sir);
                     return result;
                 }