Commit 8ea87ee5 authored by Yue Li's avatar Yue Li Committed by Commit Bot

Add flag to disable voice match for ART tests

ART tests does not support voice match, this cl introduces a new feature
flag to disable voice match so that the ART tests could use hotword
without VM.

Bug: b/142060062
Test: Manual Test
Change-Id: Iccc22ca6dc1536d85041a4178c021a7c3f7e5a45
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1846471
Commit-Queue: Yue Li <updowndota@chromium.org>
Reviewed-by: default avatarXiaohui Chen <xiaohuic@chromium.org>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#703935}
parent b2f86997
...@@ -82,6 +82,7 @@ Polymer({ ...@@ -82,6 +82,7 @@ Polymer({
*/ */
reloadContent: function(data) { reloadContent: function(data) {
this.voiceMatchEnforcedOff = data['voiceMatchEnforcedOff']; this.voiceMatchEnforcedOff = data['voiceMatchEnforcedOff'];
this.voiceMatchDisabled = loadTimeData.getBoolean('voiceMatchDisabled');
data['flowType'] = this.flowType; data['flowType'] = this.flowType;
this.$['value-prop'].reloadContent(data); this.$['value-prop'].reloadContent(data);
this.$['third-party'].reloadContent(data); this.$['third-party'].reloadContent(data);
...@@ -118,7 +119,7 @@ Polymer({ ...@@ -118,7 +119,7 @@ Polymer({
this.showScreen(this.$['third-party']); this.showScreen(this.$['third-party']);
break; break;
case this.$['third-party']: case this.$['third-party']:
if (this.voiceMatchEnforcedOff) { if (this.voiceMatchEnforcedOff || this.voiceMatchDisabled) {
this.showScreen(this.$['get-more']); this.showScreen(this.$['get-more']);
} else { } else {
this.showScreen(this.$['voice-match']); this.showScreen(this.$['voice-match']);
......
...@@ -196,6 +196,7 @@ Polymer({ ...@@ -196,6 +196,7 @@ Polymer({
this.refreshDspHotwordState_(); this.refreshDspHotwordState_();
this.shouldShowVoiceMatchSettings_ = this.shouldShowVoiceMatchSettings_ =
!loadTimeData.getBoolean('voiceMatchDisabled') &&
this.getPref('settings.voice_interaction.hotword.enabled.value') && this.getPref('settings.voice_interaction.hotword.enabled.value') &&
(this.getPref( (this.getPref(
'settings.voice_interaction.activity_control.consent_status.value') == 'settings.voice_interaction.activity_control.consent_status.value') ==
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "chrome/grit/browser_resources.h" #include "chrome/grit/browser_resources.h"
#include "chromeos/assistant/buildflags.h" #include "chromeos/assistant/buildflags.h"
#include "chromeos/services/assistant/public/cpp/assistant_prefs.h" #include "chromeos/services/assistant/public/cpp/assistant_prefs.h"
#include "chromeos/services/assistant/public/features.h"
#include "components/prefs/pref_service.h" #include "components/prefs/pref_service.h"
#include "components/session_manager/core/session_manager.h" #include "components/session_manager/core/session_manager.h"
#include "content/public/browser/host_zoom_map.h" #include "content/public/browser/host_zoom_map.h"
...@@ -81,7 +82,6 @@ AssistantOptInUI::AssistantOptInUI(content::WebUI* web_ui) ...@@ -81,7 +82,6 @@ AssistantOptInUI::AssistantOptInUI(content::WebUI* web_ui)
source->UseStringsJs(); source->UseStringsJs();
source->AddResourcePath("assistant_optin.js", IDR_ASSISTANT_OPTIN_JS); source->AddResourcePath("assistant_optin.js", IDR_ASSISTANT_OPTIN_JS);
source->AddResourcePath("assistant_logo.png", IDR_ASSISTANT_LOGO_PNG); source->AddResourcePath("assistant_logo.png", IDR_ASSISTANT_LOGO_PNG);
source->AddBoolean("hotwordDspAvailable", chromeos::IsHotwordDspAvailable());
source->SetDefaultResource(IDR_ASSISTANT_OPTIN_HTML); source->SetDefaultResource(IDR_ASSISTANT_OPTIN_HTML);
source->AddResourcePath("voice_match_animation.json", source->AddResourcePath("voice_match_animation.json",
IDR_ASSISTANT_VOICE_MATCH_ANIMATION); IDR_ASSISTANT_VOICE_MATCH_ANIMATION);
......
...@@ -144,6 +144,14 @@ void AssistantOptInFlowScreenHandler::RegisterMessages() { ...@@ -144,6 +144,14 @@ void AssistantOptInFlowScreenHandler::RegisterMessages() {
&AssistantOptInFlowScreenHandler::HandleFlowInitialized); &AssistantOptInFlowScreenHandler::HandleFlowInitialized);
} }
void AssistantOptInFlowScreenHandler::GetAdditionalParameters(
base::DictionaryValue* dict) {
dict->SetBoolean("hotwordDspAvailable", chromeos::IsHotwordDspAvailable());
dict->SetBoolean("voiceMatchDisabled",
chromeos::assistant::features::IsVoiceMatchDisabled());
BaseScreenHandler::GetAdditionalParameters(dict);
}
void AssistantOptInFlowScreenHandler::Bind(AssistantOptInFlowScreen* screen) { void AssistantOptInFlowScreenHandler::Bind(AssistantOptInFlowScreen* screen) {
BaseScreenHandler::SetBaseScreen(screen); BaseScreenHandler::SetBaseScreen(screen);
screen_ = screen; screen_ = screen;
......
...@@ -63,6 +63,7 @@ class AssistantOptInFlowScreenHandler ...@@ -63,6 +63,7 @@ class AssistantOptInFlowScreenHandler
void DeclareLocalizedValues( void DeclareLocalizedValues(
::login::LocalizedValuesBuilder* builder) override; ::login::LocalizedValuesBuilder* builder) override;
void RegisterMessages() override; void RegisterMessages() override;
void GetAdditionalParameters(base::DictionaryValue* dict) override;
// AssistantOptInFlowScreenView: // AssistantOptInFlowScreenView:
void Bind(AssistantOptInFlowScreen* screen) override; void Bind(AssistantOptInFlowScreen* screen) override;
......
...@@ -2710,6 +2710,9 @@ void AddGoogleAssistantStrings(content::WebUIDataSource* html_source, ...@@ -2710,6 +2710,9 @@ void AddGoogleAssistantStrings(content::WebUIDataSource* html_source,
html_source->AddBoolean("hotwordDspAvailable", html_source->AddBoolean("hotwordDspAvailable",
chromeos::IsHotwordDspAvailable()); chromeos::IsHotwordDspAvailable());
html_source->AddBoolean(
"voiceMatchDisabled",
chromeos::assistant::features::IsVoiceMatchDisabled());
} }
#endif #endif
......
...@@ -1198,7 +1198,8 @@ void AssistantManagerServiceImpl::UpdateInternalOptions( ...@@ -1198,7 +1198,8 @@ void AssistantManagerServiceImpl::UpdateInternalOptions(
assistant_client::InternalOptions::UserCredentialMode::SIGNED_OUT); assistant_client::InternalOptions::UserCredentialMode::SIGNED_OUT);
} }
internal_options->EnableRequireVoiceMatchVerification(); if (!features::IsVoiceMatchDisabled())
internal_options->EnableRequireVoiceMatchVerification();
assistant_manager_internal->SetOptions(*internal_options, [](bool success) { assistant_manager_internal->SetOptions(*internal_options, [](bool success) {
DVLOG(2) << "set options: " << success; DVLOG(2) << "set options: " << success;
......
...@@ -176,7 +176,8 @@ void AssistantSettingsManagerImpl::SyncSpeakerIdEnrollmentStatus() { ...@@ -176,7 +176,8 @@ void AssistantSettingsManagerImpl::SyncSpeakerIdEnrollmentStatus() {
DCHECK(main_task_runner()->RunsTasksInCurrentSequence()); DCHECK(main_task_runner()->RunsTasksInCurrentSequence());
if (assistant_state()->allowed_state() != if (assistant_state()->allowed_state() !=
ash::mojom::AssistantAllowedState::ALLOWED) { ash::mojom::AssistantAllowedState::ALLOWED ||
features::IsVoiceMatchDisabled()) {
return; return;
} }
......
...@@ -72,6 +72,10 @@ const base::Feature kEnableMediaSessionIntegration{ ...@@ -72,6 +72,10 @@ const base::Feature kEnableMediaSessionIntegration{
"AssistantEnableMediaSessionIntegration", "AssistantEnableMediaSessionIntegration",
base::FEATURE_DISABLED_BY_DEFAULT}; base::FEATURE_DISABLED_BY_DEFAULT};
// Disable voice match for test purpose.
const base::Feature kDisableVoiceMatch{"DisableVoiceMatch",
base::FEATURE_DISABLED_BY_DEFAULT};
int GetProactiveSuggestionsMaxWidth() { int GetProactiveSuggestionsMaxWidth() {
return kAssistantProactiveSuggestionsMaxWidth.Get(); return kAssistantProactiveSuggestionsMaxWidth.Get();
} }
...@@ -144,6 +148,10 @@ bool IsWarmerWelcomeEnabled() { ...@@ -144,6 +148,10 @@ bool IsWarmerWelcomeEnabled() {
return base::FeatureList::IsEnabled(kAssistantWarmerWelcomeFeature); return base::FeatureList::IsEnabled(kAssistantWarmerWelcomeFeature);
} }
bool IsVoiceMatchDisabled() {
return base::FeatureList::IsEnabled(kDisableVoiceMatch);
}
} // namespace features } // namespace features
} // namespace assistant } // namespace assistant
} // namespace chromeos } // namespace chromeos
...@@ -127,6 +127,9 @@ COMPONENT_EXPORT(ASSISTANT_SERVICE_PUBLIC) bool IsStereoAudioInputEnabled(); ...@@ -127,6 +127,9 @@ COMPONENT_EXPORT(ASSISTANT_SERVICE_PUBLIC) bool IsStereoAudioInputEnabled();
COMPONENT_EXPORT(ASSISTANT_SERVICE_PUBLIC) bool IsWarmerWelcomeEnabled(); COMPONENT_EXPORT(ASSISTANT_SERVICE_PUBLIC) bool IsWarmerWelcomeEnabled();
COMPONENT_EXPORT(ASSISTANT_SERVICE_PUBLIC)
bool IsVoiceMatchDisabled();
} // namespace features } // namespace features
} // namespace assistant } // namespace assistant
} // namespace chromeos } // namespace chromeos
......
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