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

Fix issue in which Assistant query text was dropped.

This CL makes use of the new |metadata| parameter of the
|OnInteractionStarted| event to make sure that pending query text is
not dropped due to overlapping Assistant interactions.

This CL does not fully address the issue of overlapping Assistant
interactions as calls to set the pending query text still occur outside
of the interaction lifecycle. That will be addressed as part of
b/140565663.

Bug: 973680, 941259
Change-Id: I6868387bee2b744a7573b9ed98e47077da011d04
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1787867Reviewed-by: default avatarXiaohui Chen <xiaohuic@chromium.org>
Reviewed-by: default avatarTao Wu <wutao@chromium.org>
Commit-Queue: David Black <dmblack@google.com>
Cr-Commit-Position: refs/heads/master@{#693944}
parent 28b2c4af
......@@ -364,7 +364,7 @@ void AssistantInteractionController::OnCommittedQueryChanged(
assistant::util::RecordAssistantQuerySource(assistant_query.source());
}
// TODO(dmblack): Set pending query from |metadata| and remove calls to set
// TODO(b/140565663): Set pending query from |metadata| and remove calls to set
// pending query that occur outside of this method.
void AssistantInteractionController::OnInteractionStarted(
AssistantInteractionMetadataPtr metadata) {
......@@ -401,15 +401,13 @@ void AssistantInteractionController::OnInteractionStarted(
model_.SetPendingQuery(std::make_unique<AssistantVoiceQuery>());
}
} else {
// TODO(b/112000321): It should not be possible to reach this code without
// having previously pended a query. It does currently happen, however, in
// the case of notifications and device action queries which bypass the
// AssistantInteractionController when beginning an interaction. To address
// this, we temporarily pend an empty text query to commit until we can do
// development to expose something more meaningful.
if (model_.pending_query().type() == AssistantQueryType::kNull)
model_.SetPendingQuery(std::make_unique<AssistantTextQuery>());
// Once b/140565663 has been addressed to remove all calls which currently
// set the pending query from outside of the interaction lifecycle, the
// pending query type will always be |kNull| here.
if (model_.pending_query().type() == AssistantQueryType::kNull) {
model_.SetPendingQuery(
std::make_unique<AssistantTextQuery>(metadata->query));
}
model_.CommitPendingQuery();
model_.SetMicState(MicState::kClosed);
}
......
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