Commit d192d24c authored by David Black's avatar David Black Committed by Commit Bot

Only cancel voice interactions on modality change.

Previously we cancelled any active interaction because we couldn't tell
if the active interaction was from a voice or a text query. Now that
AssistantQuery has been subclassed into AssistantTextQuery and
AssistantVoiceQuery, we can tell if the current query is voice
or text.

Bug: b:79756284
Change-Id: I90f5599ac51c3aad72b029f4de7cd253387a5b6a
Reviewed-on: https://chromium-review.googlesource.com/1060337Reviewed-by: default avatarXiaohui Chen <xiaohuic@chromium.org>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Commit-Queue: David Black <dmblack@google.com>
Cr-Commit-Position: refs/heads/master@{#558865}
parent df16d780
...@@ -139,13 +139,16 @@ void AssistantController::OnInputModalityChanged(InputModality input_modality) { ...@@ -139,13 +139,16 @@ void AssistantController::OnInputModalityChanged(InputModality input_modality) {
return; return;
// When switching to a non-voice input modality we instruct the underlying // When switching to a non-voice input modality we instruct the underlying
// service to terminate any listening, speaking, or in flight query. We do not // service to terminate any listening, speaking, or in flight voice query. We
// do this when switching to voice input modality because initiation of a // do not do this when switching to voice input modality because initiation of
// voice interaction will automatically interrupt any pre-existing activity. // a voice interaction will automatically interrupt any pre-existing activity.
// Stopping the active interaction here for voice input modality would // Stopping the active interaction here for voice input modality would
// actually have the undesired effect of stopping the voice interaction. // actually have the undesired effect of stopping the voice interaction.
DCHECK(assistant_); if (assistant_interaction_model_.query().type() ==
assistant_->StopActiveInteraction(); AssistantQueryType::kVoice) {
DCHECK(assistant_);
assistant_->StopActiveInteraction();
}
} }
void AssistantController::OnInteractionStarted() { void AssistantController::OnInteractionStarted() {
...@@ -267,6 +270,8 @@ void AssistantController::OnSpeechRecognitionStarted() { ...@@ -267,6 +270,8 @@ void AssistantController::OnSpeechRecognitionStarted() {
assistant_interaction_model_.ClearInteraction(); assistant_interaction_model_.ClearInteraction();
assistant_interaction_model_.SetInputModality(InputModality::kVoice); assistant_interaction_model_.SetInputModality(InputModality::kVoice);
assistant_interaction_model_.SetMicState(MicState::kOpen); assistant_interaction_model_.SetMicState(MicState::kOpen);
assistant_interaction_model_.SetQuery(
std::make_unique<AssistantVoiceQuery>());
} }
void AssistantController::OnSpeechRecognitionIntermediateResult( void AssistantController::OnSpeechRecognitionIntermediateResult(
......
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