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

Move query commit logic.

Now that we have indication in the OnInteractionStarted event if we
are handling a voice interaction or not, we can move the commit
logic in the case of a non-voice interaction.

Doing so allows us to properly clear the stage whenever a new
interaction is started. This fixes a bug in which notifications
failed to clear the stage.

Bug: 111396118
Change-Id: I288ee685f9e8fa8c385c0dbb0896c03838c53a4e
Reviewed-on: https://chromium-review.googlesource.com/1144429Reviewed-by: default avatarTao Wu <wutao@chromium.org>
Reviewed-by: default avatarXiaohui Chen <xiaohuic@chromium.org>
Commit-Queue: David Black <dmblack@google.com>
Cr-Commit-Position: refs/heads/master@{#576744}
parent e216c197
...@@ -136,6 +136,9 @@ void AssistantInteractionController::OnInteractionStarted( ...@@ -136,6 +136,9 @@ void AssistantInteractionController::OnInteractionStarted(
assistant_interaction_model_.SetInputModality(InputModality::kVoice); assistant_interaction_model_.SetInputModality(InputModality::kVoice);
assistant_interaction_model_.SetMicState(MicState::kOpen); assistant_interaction_model_.SetMicState(MicState::kOpen);
} else { } else {
// In the case of a non-voice interaction, we commit the pending query.
// This will trigger a clearing of the interaction which wipes the stage.
assistant_interaction_model_.CommitPendingQuery();
assistant_interaction_model_.SetMicState(MicState::kClosed); assistant_interaction_model_.SetMicState(MicState::kClosed);
} }
} }
...@@ -268,7 +271,6 @@ void AssistantInteractionController::StartTextInteraction( ...@@ -268,7 +271,6 @@ void AssistantInteractionController::StartTextInteraction(
assistant_interaction_model_.SetPendingQuery( assistant_interaction_model_.SetPendingQuery(
std::make_unique<AssistantTextQuery>(text)); std::make_unique<AssistantTextQuery>(text));
assistant_interaction_model_.CommitPendingQuery();
assistant_->SendTextQuery(text); assistant_->SendTextQuery(text);
} }
......
...@@ -112,9 +112,9 @@ void AssistantUiController::OnInteractionStateChanged( ...@@ -112,9 +112,9 @@ void AssistantUiController::OnInteractionStateChanged(
return; return;
// If there is an active interaction, we need to show Assistant UI if it is // If there is an active interaction, we need to show Assistant UI if it is
// not already showing. An interaction can only be started when the Assistant // not already showing. We don't have enough information here to know what
// UI is hidden if the entry point is hotword. // the interaction source is, but at the moment we have no need to know.
ShowUi(AssistantSource::kHotword); ShowUi(AssistantSource::kUnspecified);
} }
void AssistantUiController::OnMicStateChanged(MicState mic_state) { void AssistantUiController::OnMicStateChanged(MicState mic_state) {
......
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