Commit 82a78873 authored by sandromaggi's avatar sandromaggi Committed by Commit Bot

Add a setting for Assistant voice search to Assistant Settings

mocks: https://www.figma.com/file/b1CT6jM3mj0MdBvgQicy4b
dd: https://docs.google.com/document/d/1ZnmJUYFBEiIx8TjQPxD18e7NAeJa6yIBamAJyR-ggOk

TBR=wylieb@chromium.org

Bug: 1117271
Change-Id: I618b07e4698721443df44b08a4f080bd7b8d76b4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2520172Reviewed-by: default avatarClemens Arbesser <arbesser@google.com>
Reviewed-by: default avatarTed Choc <tedchoc@chromium.org>
Reviewed-by: default avatarNatalie Chouinard <chouinard@chromium.org>
Commit-Queue: Clemens Arbesser <arbesser@google.com>
Auto-Submit: Brandon Wylie <wylieb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#826259}
parent 0bc745fd
......@@ -29,4 +29,15 @@
app:allowDividerBelow="false" />
</PreferenceCategory>
<PreferenceCategory
android:key="voice_assistance"
android:title="@string/avs_setting_category_title"
app:allowDividerBelow="false">
<org.chromium.components.browser_ui.settings.ChromeSwitchPreference
android:key="voice_assistance_enabled"
android:title="@string/avs_setting_enabled_title"
android:summary="@string/avs_setting_enabled_description"
android:persistent="false" />
</PreferenceCategory>
</PreferenceScreen>
......@@ -30,13 +30,19 @@ import org.chromium.ui.text.SpanApplier;
* Settings fragment for Autofill Assistant.
*/
public class AutofillAssistantPreferenceFragment extends PreferenceFragmentCompat {
private static final String PREF_WEB_ASSISTANCE_CATEGORY = "web_assistance";
@VisibleForTesting
public static final String PREF_WEB_ASSISTANCE_CATEGORY = "web_assistance";
@VisibleForTesting
public static final String PREF_AUTOFILL_ASSISTANT = "autofill_assistant_switch";
@VisibleForTesting
public static final String PREF_ASSISTANT_PROACTIVE_HELP_SWITCH = "proactive_help_switch";
@VisibleForTesting
public static final String PREF_GOOGLE_SERVICES_SETTINGS_LINK = "google_services_settings_link";
@VisibleForTesting
public static final String PREF_ASSISTANT_VOICE_SEARCH_CATEGORY = "voice_assistance";
@VisibleForTesting
public static final String PREF_ASSISTANT_VOICE_SEARCH_ENABLED_SWTICH =
"voice_assistance_enabled";
private final SharedPreferencesManager mSharedPreferencesManager =
SharedPreferencesManager.getInstance();
......@@ -44,6 +50,7 @@ public class AutofillAssistantPreferenceFragment extends PreferenceFragmentCompa
private PreferenceCategory mWebAssistanceCategory;
private ChromeSwitchPreference mAutofillAssistantPreference;
private ChromeSwitchPreference mProactiveHelpPreference;
private ChromeSwitchPreference mAssistantVoiceSearchEnabledPref;
private Preference mGoogleServicesSettingsLink;
@Override
......@@ -52,6 +59,9 @@ public class AutofillAssistantPreferenceFragment extends PreferenceFragmentCompa
getActivity().setTitle(R.string.prefs_autofill_assistant_title);
mWebAssistanceCategory = (PreferenceCategory) findPreference(PREF_WEB_ASSISTANCE_CATEGORY);
if (!shouldShowWebAssistanceCategory()) {
mWebAssistanceCategory.setVisible(false);
}
mAutofillAssistantPreference =
(ChromeSwitchPreference) findPreference(PREF_AUTOFILL_ASSISTANT);
......@@ -68,12 +78,16 @@ public class AutofillAssistantPreferenceFragment extends PreferenceFragmentCompa
mProactiveHelpPreference =
(ChromeSwitchPreference) findPreference(PREF_ASSISTANT_PROACTIVE_HELP_SWITCH);
mProactiveHelpPreference.setOnPreferenceChangeListener((preference, newValue) -> {
mSharedPreferencesManager.writeBoolean(
ChromePreferenceKeys.AUTOFILL_ASSISTANT_PROACTIVE_HELP, (boolean) newValue);
updatePreferencesState();
return true;
});
if (shouldShowAutofillAssistantProactiveHelpPreference()) {
mProactiveHelpPreference.setOnPreferenceChangeListener((preference, newValue) -> {
mSharedPreferencesManager.writeBoolean(
ChromePreferenceKeys.AUTOFILL_ASSISTANT_PROACTIVE_HELP, (boolean) newValue);
updatePreferencesState();
return true;
});
} else {
mProactiveHelpPreference.setVisible(false);
}
mGoogleServicesSettingsLink = findPreference(PREF_GOOGLE_SERVICES_SETTINGS_LINK);
NoUnderlineClickableSpan linkSpan = new NoUnderlineClickableSpan(getResources(), view -> {
......@@ -91,6 +105,23 @@ public class AutofillAssistantPreferenceFragment extends PreferenceFragmentCompa
SpanApplier.applySpans(getString(R.string.prefs_proactive_help_sync_link),
new SpanApplier.SpanInfo("<link>", "</link>", linkSpan)));
PreferenceCategory assistantVoiceSearchCategory =
findPreference(PREF_ASSISTANT_VOICE_SEARCH_CATEGORY);
mAssistantVoiceSearchEnabledPref =
(ChromeSwitchPreference) findPreference(PREF_ASSISTANT_VOICE_SEARCH_ENABLED_SWTICH);
if (ChromeFeatureList.isEnabled(ChromeFeatureList.OMNIBOX_ASSISTANT_VOICE_SEARCH)) {
mAssistantVoiceSearchEnabledPref.setOnPreferenceChangeListener((preference,
newValue) -> {
SharedPreferencesManager.getInstance().writeBoolean(
ChromePreferenceKeys.ASSISTANT_VOICE_SEARCH_ENABLED, (boolean) newValue);
return true;
});
} else {
assistantVoiceSearchCategory.setVisible(false);
mAssistantVoiceSearchEnabledPref.setVisible(false);
}
updatePreferencesState();
}
......@@ -106,6 +137,15 @@ public class AutofillAssistantPreferenceFragment extends PreferenceFragmentCompa
ChromePreferenceKeys.AUTOFILL_ASSISTANT_ENABLED);
}
private boolean shouldShowAutofillAssistantProactiveHelpPreference() {
return ChromeFeatureList.isEnabled(ChromeFeatureList.AUTOFILL_ASSISTANT_PROACTIVE_HELP);
}
private boolean shouldShowWebAssistanceCategory() {
return shouldShowAutofillAssistantProactiveHelpPreference()
|| shouldShowAutofillAssistantPreference();
}
private void updatePreferencesState() {
boolean autofill_assistant_enabled = SharedPreferencesManager.getInstance().readBoolean(
ChromePreferenceKeys.AUTOFILL_ASSISTANT_ENABLED, true);
......@@ -127,5 +167,8 @@ public class AutofillAssistantPreferenceFragment extends PreferenceFragmentCompa
boolean show_disclaimer =
!url_keyed_anonymized_data_collection_enabled && assistant_switch_on_or_missing;
mGoogleServicesSettingsLink.setVisible(show_disclaimer);
mAssistantVoiceSearchEnabledPref.setChecked(mSharedPreferencesManager.readBoolean(
ChromePreferenceKeys.ASSISTANT_VOICE_SEARCH_ENABLED, /* default= */ false));
}
}
......@@ -162,7 +162,10 @@ public class GoogleServicesSettings
mAutofillAssistant = (ChromeSwitchPreference) findPreference(PREF_AUTOFILL_ASSISTANT);
Preference autofillAssistantSubsection = findPreference(PREF_AUTOFILL_ASSISTANT_SUBSECTION);
if (ChromeFeatureList.isEnabled(ChromeFeatureList.AUTOFILL_ASSISTANT_PROACTIVE_HELP)) {
// Assistant autofill/voicesearch both live in the sub-section. If either one of them is
// enabled, then the subsection should show.
if (ChromeFeatureList.isEnabled(ChromeFeatureList.AUTOFILL_ASSISTANT_PROACTIVE_HELP)
|| ChromeFeatureList.isEnabled(ChromeFeatureList.OMNIBOX_ASSISTANT_VOICE_SEARCH)) {
removePreference(getPreferenceScreen(), mAutofillAssistant);
mAutofillAssistant = null;
autofillAssistantSubsection.setVisible(true);
......
......@@ -261,7 +261,10 @@ public class SyncAndServicesSettings extends PreferenceFragmentCompat
mAutofillAssistant = (ChromeSwitchPreference) findPreference(PREF_AUTOFILL_ASSISTANT);
Preference autofillAssistantSubsection = findPreference(PREF_AUTOFILL_ASSISTANT_SUBSECTION);
if (ChromeFeatureList.isEnabled(ChromeFeatureList.AUTOFILL_ASSISTANT_PROACTIVE_HELP)) {
// Assistant autofill/voicesearch both live in the sub-section. If either one of them is
// enabled, then the subsection should show.
if (ChromeFeatureList.isEnabled(ChromeFeatureList.AUTOFILL_ASSISTANT_PROACTIVE_HELP)
|| ChromeFeatureList.isEnabled(ChromeFeatureList.OMNIBOX_ASSISTANT_VOICE_SEARCH)) {
removePreference(servicesCategory, mAutofillAssistant);
mAutofillAssistant = null;
autofillAssistantSubsection.setVisible(true);
......
......@@ -9,6 +9,7 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import androidx.preference.Preference;
import androidx.preference.PreferenceCategory;
import androidx.test.filters.LargeTest;
import org.junit.Test;
......@@ -173,6 +174,85 @@ public class AutofillAssistantPreferenceFragmentTest {
});
}
@Test
@LargeTest
@Feature({"Sync"})
@DisableFeatures(ChromeFeatureList.AUTOFILL_ASSISTANT_PROACTIVE_HELP)
public void testProactiveHelpInvisibleIfProactiveHelpDisabled() {
final AutofillAssistantPreferenceFragment prefs =
startAutofillAssistantPreferenceFragment();
TestThreadUtils.runOnUiThreadBlocking(() -> {
ChromeSwitchPreference proactiveHelpSwitch =
(ChromeSwitchPreference) prefs.findPreference(
AutofillAssistantPreferenceFragment
.PREF_ASSISTANT_PROACTIVE_HELP_SWITCH);
assertFalse(proactiveHelpSwitch.isVisible());
});
}
@Test
@LargeTest
@Feature({"Sync"})
@DisableFeatures({ChromeFeatureList.AUTOFILL_ASSISTANT,
ChromeFeatureList.AUTOFILL_ASSISTANT_PROACTIVE_HELP})
public void
testWebAssistanceInvisibleIfAutofillAssistantCompletelyDisabled() {
final AutofillAssistantPreferenceFragment prefs =
startAutofillAssistantPreferenceFragment();
TestThreadUtils.runOnUiThreadBlocking(() -> {
PreferenceCategory webAssistanceCateogory = prefs.findPreference(
AutofillAssistantPreferenceFragment.PREF_WEB_ASSISTANCE_CATEGORY);
assertFalse(webAssistanceCateogory.isVisible());
});
}
@Test
@LargeTest
@Feature({"AssistantVoiceSearch"})
@EnableFeatures(ChromeFeatureList.OMNIBOX_ASSISTANT_VOICE_SEARCH)
public void testEnhancedVoiceSearch_Enabled() {
final AutofillAssistantPreferenceFragment prefs =
startAutofillAssistantPreferenceFragment();
TestThreadUtils.runOnUiThreadBlocking(() -> {
PreferenceCategory assistantVoiceSearchCategory = prefs.findPreference(
AutofillAssistantPreferenceFragment.PREF_ASSISTANT_VOICE_SEARCH_CATEGORY);
assertTrue(assistantVoiceSearchCategory.isVisible());
ChromeSwitchPreference assistantVoiceSearchEnabledSwitch =
(ChromeSwitchPreference) prefs.findPreference(
AutofillAssistantPreferenceFragment
.PREF_ASSISTANT_VOICE_SEARCH_ENABLED_SWTICH);
assertTrue(assistantVoiceSearchEnabledSwitch.isVisible());
assistantVoiceSearchEnabledSwitch.performClick();
assertTrue(mSharedPreferencesManager.readBoolean(
ChromePreferenceKeys.ASSISTANT_VOICE_SEARCH_ENABLED, /* default= */ false));
});
}
@Test
@LargeTest
@Feature({"AssistantVoiceSearch"})
@DisableFeatures(ChromeFeatureList.OMNIBOX_ASSISTANT_VOICE_SEARCH)
public void testEnhancedVoiceSearch_Disabled() {
final AutofillAssistantPreferenceFragment prefs =
startAutofillAssistantPreferenceFragment();
TestThreadUtils.runOnUiThreadBlocking(() -> {
PreferenceCategory assistantVoiceSearchCategory = prefs.findPreference(
AutofillAssistantPreferenceFragment.PREF_ASSISTANT_VOICE_SEARCH_CATEGORY);
assertFalse(assistantVoiceSearchCategory.isVisible());
ChromeSwitchPreference assistantVoiceSearchEnabledSwitch =
(ChromeSwitchPreference) prefs.findPreference(
AutofillAssistantPreferenceFragment
.PREF_ASSISTANT_VOICE_SEARCH_ENABLED_SWTICH);
assertFalse(assistantVoiceSearchEnabledSwitch.isVisible());
});
}
private void setAutofillAssistantSwitchValue(boolean newValue) {
SharedPreferencesManager.getInstance().writeBoolean(
ChromePreferenceKeys.AUTOFILL_ASSISTANT_ENABLED, newValue);
......
......@@ -130,15 +130,20 @@ public class GoogleServicesSettingsTest {
/**
* Test: if the onboarding was never shown, the AA chrome preference should not exist.
*
* Note: presence of the {@link GoogleServicesSettings.PREF_AUTOFILL_ASSISTANT}
* shared preference indicates whether onboarding was shown or not.
* Note:
* - Presence of the {@link GoogleServicesSettings.PREF_AUTOFILL_ASSISTANT}
* shared preference indicates whether onboarding was shown or not.
* - There's a separate settings screen added if either AUTOFILL_ASSISTANT_PROACTIVE_HELP or
* OMNIBOX_ASSISTANT_VOICE_SEARCH is enabled.
*/
@Test
@LargeTest
@Feature({"Sync"})
@EnableFeatures(ChromeFeatureList.AUTOFILL_ASSISTANT)
@DisableFeatures(ChromeFeatureList.AUTOFILL_ASSISTANT_PROACTIVE_HELP)
public void testAutofillAssistantNoPreferenceIfOnboardingNeverShown() {
@DisableFeatures({ChromeFeatureList.AUTOFILL_ASSISTANT_PROACTIVE_HELP,
ChromeFeatureList.OMNIBOX_ASSISTANT_VOICE_SEARCH})
public void
testAutofillAssistantNoPreferenceIfOnboardingNeverShown() {
final GoogleServicesSettings googleServicesSettings = startGoogleServicesSettings();
TestThreadUtils.runOnUiThreadBlocking(() -> {
Assert.assertNull(googleServicesSettings.findPreference(
......@@ -149,15 +154,20 @@ public class GoogleServicesSettingsTest {
/**
* Test: if the onboarding was shown at least once, the AA chrome preference should also exist.
*
* Note: presence of the {@link GoogleServicesSettings.PREF_AUTOFILL_ASSISTANT}
* shared preference indicates whether onboarding was shown or not.
* Note:
* - Presence of the {@link GoogleServicesSettings.PREF_AUTOFILL_ASSISTANT}
* shared preference indicates whether onboarding was shown or not.
* - There's a separate settings screen added if either AUTOFILL_ASSISTANT_PROACTIVE_HELP or
* OMNIBOX_ASSISTANT_VOICE_SEARCH is enabled.
*/
@Test
@LargeTest
@Feature({"Sync"})
@EnableFeatures(ChromeFeatureList.AUTOFILL_ASSISTANT)
@DisableFeatures(ChromeFeatureList.AUTOFILL_ASSISTANT_PROACTIVE_HELP)
public void testAutofillAssistantPreferenceShownIfOnboardingShown() {
@DisableFeatures({ChromeFeatureList.AUTOFILL_ASSISTANT_PROACTIVE_HELP,
ChromeFeatureList.OMNIBOX_ASSISTANT_VOICE_SEARCH})
public void
testAutofillAssistantPreferenceShownIfOnboardingShown() {
setAutofillAssistantSwitchValue(true);
final GoogleServicesSettings googleServicesSettings = startGoogleServicesSettings();
TestThreadUtils.runOnUiThreadBlocking(() -> {
......@@ -173,7 +183,8 @@ public class GoogleServicesSettingsTest {
@LargeTest
@Feature({"Sync"})
@DisableFeatures({ChromeFeatureList.AUTOFILL_ASSISTANT,
ChromeFeatureList.AUTOFILL_ASSISTANT_PROACTIVE_HELP})
ChromeFeatureList.AUTOFILL_ASSISTANT_PROACTIVE_HELP,
ChromeFeatureList.OMNIBOX_ASSISTANT_VOICE_SEARCH})
public void
testAutofillAssistantNoPreferenceIfFeatureDisabled() {
setAutofillAssistantSwitchValue(true);
......@@ -191,8 +202,10 @@ public class GoogleServicesSettingsTest {
@LargeTest
@Feature({"Sync"})
@EnableFeatures(ChromeFeatureList.AUTOFILL_ASSISTANT)
@DisableFeatures(ChromeFeatureList.AUTOFILL_ASSISTANT_PROACTIVE_HELP)
public void testAutofillAssistantSwitchOn() {
@DisableFeatures({ChromeFeatureList.AUTOFILL_ASSISTANT_PROACTIVE_HELP,
ChromeFeatureList.OMNIBOX_ASSISTANT_VOICE_SEARCH})
public void
testAutofillAssistantSwitchOn() {
TestThreadUtils.runOnUiThreadBlocking(() -> { setAutofillAssistantSwitchValue(true); });
final GoogleServicesSettings googleServicesSettings = startGoogleServicesSettings();
......@@ -213,8 +226,10 @@ public class GoogleServicesSettingsTest {
@LargeTest
@Feature({"Sync"})
@EnableFeatures(ChromeFeatureList.AUTOFILL_ASSISTANT)
@DisableFeatures(ChromeFeatureList.AUTOFILL_ASSISTANT_PROACTIVE_HELP)
public void testAutofillAssistantSwitchOff() {
@DisableFeatures({ChromeFeatureList.AUTOFILL_ASSISTANT_PROACTIVE_HELP,
ChromeFeatureList.OMNIBOX_ASSISTANT_VOICE_SEARCH})
public void
testAutofillAssistantSwitchOff() {
TestThreadUtils.runOnUiThreadBlocking(() -> { setAutofillAssistantSwitchValue(false); });
final GoogleServicesSettings googleServicesSettings = startGoogleServicesSettings();
......@@ -230,6 +245,7 @@ public class GoogleServicesSettingsTest {
@LargeTest
@Feature({"Sync"})
@EnableFeatures(ChromeFeatureList.AUTOFILL_ASSISTANT_PROACTIVE_HELP)
@DisableFeatures(ChromeFeatureList.OMNIBOX_ASSISTANT_VOICE_SEARCH)
public void testAutofillAssistantProactiveHelp() {
final GoogleServicesSettings googleServicesSettings = startGoogleServicesSettings();
......@@ -245,6 +261,26 @@ public class GoogleServicesSettingsTest {
});
}
@Test
@LargeTest
@Feature({"AssistantVoiceSearch"})
@EnableFeatures(ChromeFeatureList.OMNIBOX_ASSISTANT_VOICE_SEARCH)
@DisableFeatures(ChromeFeatureList.AUTOFILL_ASSISTANT_PROACTIVE_HELP)
public void testAutofillAssistantSubsection_AssistantVoiceSeach() {
final GoogleServicesSettings googleServicesSettings = startGoogleServicesSettings();
TestThreadUtils.runOnUiThreadBlocking(() -> {
Assert.assertNull(googleServicesSettings.findPreference(
GoogleServicesSettings.PREF_AUTOFILL_ASSISTANT));
Assert.assertTrue(
googleServicesSettings
.findPreference(
GoogleServicesSettings.PREF_AUTOFILL_ASSISTANT_SUBSECTION)
.isVisible());
});
}
@Test
@LargeTest
@Feature({"Preference"})
......
......@@ -250,15 +250,20 @@ public class SyncAndServicesSettingsTest {
/**
* Test: if the onboarding was never shown, the AA chrome preference should not exist.
*
* Note: presence of the {@link SyncAndServicesSettings.PREF_AUTOFILL_ASSISTANT}
* shared preference indicates whether onboarding was shown or not.
* Note:
* - Presence of the {@link GoogleServicesSettings.PREF_AUTOFILL_ASSISTANT}
* shared preference indicates whether onboarding was shown or not.
* - There's a separate settings screen added if either AUTOFILL_ASSISTANT_PROACTIVE_HELP or
* OMNIBOX_ASSISTANT_VOICE_SEARCH is enabled.
*/
@Test
@LargeTest
@Feature({"Sync"})
@EnableFeatures(ChromeFeatureList.AUTOFILL_ASSISTANT)
@DisableFeatures(ChromeFeatureList.AUTOFILL_ASSISTANT_PROACTIVE_HELP)
public void testAutofillAssistantNoPreferenceIfOnboardingNeverShown() {
@DisableFeatures({ChromeFeatureList.AUTOFILL_ASSISTANT_PROACTIVE_HELP,
ChromeFeatureList.OMNIBOX_ASSISTANT_VOICE_SEARCH})
public void
testAutofillAssistantNoPreferenceIfOnboardingNeverShown() {
final SyncAndServicesSettings syncPrefs = startSyncAndServicesPreferences();
TestThreadUtils.runOnUiThreadBlocking(() -> {
Assert.assertNull(
......@@ -269,15 +274,20 @@ public class SyncAndServicesSettingsTest {
/**
* Test: if the onboarding was shown at least once, the AA chrome preference should also exist.
*
* Note: presence of the {@link SyncAndServicesSettings.PREF_AUTOFILL_ASSISTANT}
* shared preference indicates whether onboarding was shown or not.
* Note:
* - Presence of the {@link GoogleServicesSettings.PREF_AUTOFILL_ASSISTANT}
* shared preference indicates whether onboarding was shown or not.
* - There's a separate settings screen added if either AUTOFILL_ASSISTANT_PROACTIVE_HELP or
* OMNIBOX_ASSISTANT_VOICE_SEARCH is enabled.
*/
@Test
@LargeTest
@Feature({"Sync"})
@EnableFeatures(ChromeFeatureList.AUTOFILL_ASSISTANT)
@DisableFeatures(ChromeFeatureList.AUTOFILL_ASSISTANT_PROACTIVE_HELP)
public void testAutofillAssistantPreferenceShownIfOnboardingShown() {
@DisableFeatures({ChromeFeatureList.AUTOFILL_ASSISTANT_PROACTIVE_HELP,
ChromeFeatureList.OMNIBOX_ASSISTANT_VOICE_SEARCH})
public void
testAutofillAssistantPreferenceShownIfOnboardingShown() {
setAutofillAssistantSwitchValue(true);
final SyncAndServicesSettings syncPrefs = startSyncAndServicesPreferences();
TestThreadUtils.runOnUiThreadBlocking(() -> {
......@@ -293,7 +303,8 @@ public class SyncAndServicesSettingsTest {
@LargeTest
@Feature({"Sync"})
@DisableFeatures({ChromeFeatureList.AUTOFILL_ASSISTANT,
ChromeFeatureList.AUTOFILL_ASSISTANT_PROACTIVE_HELP})
ChromeFeatureList.AUTOFILL_ASSISTANT_PROACTIVE_HELP,
ChromeFeatureList.OMNIBOX_ASSISTANT_VOICE_SEARCH})
public void
testAutofillAssistantNoPreferenceIfFeatureDisabled() {
setAutofillAssistantSwitchValue(true);
......@@ -311,8 +322,10 @@ public class SyncAndServicesSettingsTest {
@LargeTest
@Feature({"Sync"})
@EnableFeatures(ChromeFeatureList.AUTOFILL_ASSISTANT)
@DisableFeatures(ChromeFeatureList.AUTOFILL_ASSISTANT_PROACTIVE_HELP)
public void testAutofillAssistantSwitchOn() {
@DisableFeatures({ChromeFeatureList.AUTOFILL_ASSISTANT_PROACTIVE_HELP,
ChromeFeatureList.OMNIBOX_ASSISTANT_VOICE_SEARCH})
public void
testAutofillAssistantSwitchOn() {
TestThreadUtils.runOnUiThreadBlocking(() -> { setAutofillAssistantSwitchValue(true); });
final SyncAndServicesSettings syncAndServicesSettings = startSyncAndServicesPreferences();
......@@ -333,8 +346,10 @@ public class SyncAndServicesSettingsTest {
@LargeTest
@Feature({"Sync"})
@EnableFeatures(ChromeFeatureList.AUTOFILL_ASSISTANT)
@DisableFeatures(ChromeFeatureList.AUTOFILL_ASSISTANT_PROACTIVE_HELP)
public void testAutofillAssistantSwitchOff() {
@DisableFeatures({ChromeFeatureList.AUTOFILL_ASSISTANT_PROACTIVE_HELP,
ChromeFeatureList.OMNIBOX_ASSISTANT_VOICE_SEARCH})
public void
testAutofillAssistantSwitchOff() {
TestThreadUtils.runOnUiThreadBlocking(() -> { setAutofillAssistantSwitchValue(false); });
final SyncAndServicesSettings syncAndServicesSettings = startSyncAndServicesPreferences();
......@@ -350,7 +365,28 @@ public class SyncAndServicesSettingsTest {
@LargeTest
@Feature({"Sync"})
@EnableFeatures(ChromeFeatureList.AUTOFILL_ASSISTANT_PROACTIVE_HELP)
public void testAutofillAssistantProactiveHelp() {
@DisableFeatures(ChromeFeatureList.OMNIBOX_ASSISTANT_VOICE_SEARCH)
public void testAutofillAssistantSubsection_ProactiveHelp() {
final SyncAndServicesSettings syncAndServicesSettings = startSyncAndServicesPreferences();
TestThreadUtils.runOnUiThreadBlocking(() -> {
Assert.assertNull(syncAndServicesSettings.findPreference(
SyncAndServicesSettings.PREF_AUTOFILL_ASSISTANT));
Assert.assertTrue(
syncAndServicesSettings
.findPreference(
SyncAndServicesSettings.PREF_AUTOFILL_ASSISTANT_SUBSECTION)
.isVisible());
});
}
@Test
@LargeTest
@Feature({"AssistantVoiceSearch"})
@EnableFeatures(ChromeFeatureList.OMNIBOX_ASSISTANT_VOICE_SEARCH)
@DisableFeatures(ChromeFeatureList.AUTOFILL_ASSISTANT_PROACTIVE_HELP)
public void testAutofillAssistantSubsection_AssistantVoiceSeach() {
final SyncAndServicesSettings syncAndServicesSettings = startSyncAndServicesPreferences();
TestThreadUtils.runOnUiThreadBlocking(() -> {
......
......@@ -57,8 +57,8 @@ public final class ChromePreferenceKeys {
/** Assistant voice search keys. */
public static final String ASSISTANT_LAST_VERSION = "Chrome.Assistant.LastVersion";
public static final String ASSISTANT_VOICE_SEARCH_SUPPORTED =
"Chrome.Assistant.Supported";
public static final String ASSISTANT_VOICE_SEARCH_SUPPORTED = "Chrome.Assistant.Supported";
public static final String ASSISTANT_VOICE_SEARCH_ENABLED = "Chrome.Assistant.Enabled";
/** Whether Autofill Assistant is enabled */
public static final String AUTOFILL_ASSISTANT_ENABLED = "autofill_assistant_switch";
......@@ -797,6 +797,7 @@ public final class ChromePreferenceKeys {
// clang-format off
return Arrays.asList(
ASSISTANT_LAST_VERSION,
ASSISTANT_VOICE_SEARCH_ENABLED,
ASSISTANT_VOICE_SEARCH_SUPPORTED,
AUTOFILL_ASSISTANT_FIRST_TIME_LITE_SCRIPT_USER,
AUTOFILL_ASSISTANT_NUMBER_OF_LITE_SCRIPTS_CANCELED,
......
......@@ -3959,6 +3959,7 @@ Data from your Incognito session will only be cleared from Chrome when you <ph n
</message>
<!-- Autofill Assistant preferences -->
<!-- TODO(b/168178344): Move to Assistant settings strings section below. -->
<message name="IDS_PREFS_AUTOFILL_ASSISTANT_TITLE" desc="Title for the Autofill Assistant preferences screen. [CHAR-LIMIT=32]">
Google Assistant in Chrome
</message>
......@@ -4345,6 +4346,17 @@ Data from your Incognito session will only be cleared from Chrome when you <ph n
<message name="IDS_AVS_CONSENT_UI_CLOSED_DESCRIPTION" desc="Enable button text for a dialog asking the user's permission to use Assistant for voice search.">
Assistant voice search consent ui closed
</message>
<!-- Assistant settings strings-->
<message name="IDS_AVS_SETTING_CATEGORY_TITLE" desc="Title of the Assistant voice search setting category.">
Voice assistance
</message>
<message name="IDS_AVS_SETTING_ENABLED_TITLE" desc="Title of the Assistant voice search setting.">
Enhanced voice search
</message>
<message name="IDS_AVS_SETTING_ENABLED_DESCRIPTION" desc="Description of the Assistant voice search setting.">
Google Assistant provides a better voice experience for searching the web and engaging with sites you have open. Google Assistant will receive the URL and contents of sites you use with it.
</message>
</messages>
</release>
</grit>
8f7ccf964bb3809660c26c298d36c5e9b47737e6
\ No newline at end of file
8f7ccf964bb3809660c26c298d36c5e9b47737e6
\ No newline at end of file
8f7ccf964bb3809660c26c298d36c5e9b47737e6
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment