Merge "Always hide ability to change languages for TTS in CarSettings." into pi-car-dev am: 91f0b65eeb
Change-Id: I369606d48381553bce15dbc7f184ce0a06bf76ca
diff --git a/res/xml/text_to_speech_output_fragment.xml b/res/xml/text_to_speech_output_fragment.xml
index 90ab5b0..14b1c92 100644
--- a/res/xml/text_to_speech_output_fragment.xml
+++ b/res/xml/text_to_speech_output_fragment.xml
@@ -26,6 +26,7 @@
<com.android.car.settings.common.LogicalPreferenceGroup
android:key="@string/pk_tts_playback_group"
settings:controller="com.android.car.settings.tts.TtsPlaybackPreferenceController">
+ <!-- Currently disabled in TtsPlaybackPreferenceController -->
<ListPreference
android:key="@string/pk_tts_default_language"
android:persistent="false"
diff --git a/src/com/android/car/settings/tts/TtsPlaybackPreferenceController.java b/src/com/android/car/settings/tts/TtsPlaybackPreferenceController.java
index 00c8ca8..1e2109f 100644
--- a/src/com/android/car/settings/tts/TtsPlaybackPreferenceController.java
+++ b/src/com/android/car/settings/tts/TtsPlaybackPreferenceController.java
@@ -128,6 +128,9 @@
protected void updateState(PreferenceGroup preference) {
boolean isValid = isDefaultLocaleValid();
mDefaultLanguagePreference.setEnabled(isValid);
+ // Always hide default language preference for now.
+ // TODO: Unhide once product requirements are clarified.
+ mDefaultLanguagePreference.setVisible(false);
mSpeechRatePreference.setEnabled(isValid);
mVoicePitchPreference.setEnabled(isValid);
mResetPreference.setEnabled(isValid);
diff --git a/tests/robotests/src/com/android/car/settings/tts/TtsPlaybackPreferenceControllerTest.java b/tests/robotests/src/com/android/car/settings/tts/TtsPlaybackPreferenceControllerTest.java
index f5f1df8..673a0bd 100644
--- a/tests/robotests/src/com/android/car/settings/tts/TtsPlaybackPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/car/settings/tts/TtsPlaybackPreferenceControllerTest.java
@@ -372,6 +372,8 @@
mController.refreshUi();
assertThat(mDefaultLanguagePreference.isEnabled()).isFalse();
+ // Default language preference is always hidden
+ assertThat(mDefaultLanguagePreference.isVisible()).isFalse();
assertThat(mSpeechRatePreference.isEnabled()).isFalse();
assertThat(mVoicePitchPreference.isEnabled()).isFalse();
assertThat(mResetPreference.isEnabled()).isFalse();
@@ -387,6 +389,8 @@
mController.refreshUi();
assertThat(mDefaultLanguagePreference.isEnabled()).isFalse();
+ // Default language preference is always hidden
+ assertThat(mDefaultLanguagePreference.isVisible()).isFalse();
assertThat(mSpeechRatePreference.isEnabled()).isFalse();
assertThat(mVoicePitchPreference.isEnabled()).isFalse();
assertThat(mResetPreference.isEnabled()).isFalse();
@@ -410,6 +414,8 @@
mController.refreshUi();
assertThat(mDefaultLanguagePreference.isEnabled()).isTrue();
+ // Default language preference is always hidden
+ assertThat(mDefaultLanguagePreference.isVisible()).isFalse();
assertThat(mSpeechRatePreference.isEnabled()).isFalse();
assertThat(mVoicePitchPreference.isEnabled()).isFalse();
assertThat(mResetPreference.isEnabled()).isFalse();
@@ -434,6 +440,8 @@
assertThat(mPreferenceGroup.isEnabled()).isTrue();
assertThat(mDefaultLanguagePreference.isEnabled()).isTrue();
+ // Default language preference is always hidden
+ assertThat(mDefaultLanguagePreference.isVisible()).isFalse();
assertThat(mSpeechRatePreference.isEnabled()).isTrue();
assertThat(mVoicePitchPreference.isEnabled()).isTrue();
assertThat(mResetPreference.isEnabled()).isTrue();