Merge "Hide TTS search results if no TTS engine is available" am: 993f582fca am: 7b4a3ada12 am: ebfd790f38

Original change: https://android-review.googlesource.com/c/platform/packages/apps/Settings/+/2493859

Change-Id: Ib5248f616a93ecc8b734291e80fd2160288f2c1f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/src/com/android/settings/tts/TextToSpeechSettings.java b/src/com/android/settings/tts/TextToSpeechSettings.java
index 621b222..9f1d2f3 100644
--- a/src/com/android/settings/tts/TextToSpeechSettings.java
+++ b/src/com/android/settings/tts/TextToSpeechSettings.java
@@ -811,6 +811,14 @@
     }
 
     public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
-            new BaseSearchIndexProvider(R.xml.tts_settings);
+            new BaseSearchIndexProvider(R.xml.tts_settings) {
+                @Override
+                protected boolean isPageSearchEnabled(Context context) {
+                    TtsEngines ttsEngines = new TtsEngines(context);
+                    return !ttsEngines.getEngines().isEmpty() &&
+                            context.getResources().getBoolean(
+                                    R.bool.config_show_tts_settings_summary);
+                }
+            };
 
 }