Commit c275cc7d authored by Eyor Alemayehu's avatar Eyor Alemayehu Committed by Commit Bot

Prevent an empty AssistantBundle from being sent

Currently, we send an empty AssistantBundle if we don't have the
assistant extra and the assistant tree. Made a change to prevent
that from happening.

Bug: b:113528361
Change-Id: I37d8cef85cd0631e61a756ed4e6683d274b0a877
Reviewed-on: https://chromium-review.googlesource.com/1195925
Commit-Queue: Eyor Alemayehu <eyor@google.com>
Reviewed-by: default avatarXiaohui Chen <xiaohuic@chromium.org>
Cr-Commit-Position: refs/heads/master@{#587952}
parent 99c1351b
......@@ -82,6 +82,8 @@ void AssistantFooterView::InitLayout() {
const bool setup_completed =
Shell::Get()->voice_interaction_controller()->setup_completed();
LOG(ERROR) << "eyor: setup_completed: " << setup_completed;
// Suggestion container.
suggestion_container_ = new SuggestionContainerView(assistant_controller_);
suggestion_container_->set_can_process_events_within_subtree(setup_completed);
......@@ -113,6 +115,8 @@ void AssistantFooterView::OnVoiceInteractionSetupCompleted(bool completed) {
using assistant::util::CreateOpacityElement;
using assistant::util::StartLayerAnimationSequence;
LOG(ERROR) << "eyor: completed: " << completed;
// When the consent state changes, we need to hide/show the appropriate views.
views::View* hide_view =
completed ? static_cast<views::View*>(opt_in_view_)
......
......@@ -963,10 +963,19 @@ void AssistantManagerServiceImpl::SendScreenContextRequest(
ax::mojom::AssistantExtraPtr assistant_extra,
std::unique_ptr<ui::AssistantTree> assistant_tree,
const std::vector<uint8_t>& assistant_screenshot) {
assistant_manager_internal_->SendScreenContextRequest(
{CreateContextProto(AssistantBundle{std::move(assistant_extra),
std::move(assistant_tree)}),
CreateContextProto(assistant_screenshot)});
std::vector<std::string> context_protos;
// Screen context can have the assistant_extra and assistant_tree set to
// nullptr. This happens in the case where the screen context is coming from
// the metalayer. For this scenario, we don't create a context proto for the
// AssistantBundle that consists of the assistant_extra and assistant_tree.
if (assistant_extra && assistant_tree) {
context_protos.emplace_back(CreateContextProto(AssistantBundle{
std::move(assistant_extra), std::move(assistant_tree)}));
}
context_protos.emplace_back(CreateContextProto(assistant_screenshot));
assistant_manager_internal_->SendScreenContextRequest(context_protos);
assistant_screenshot_.clear();
}
......
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