Commit 0b2d3330 authored by Xiaohui Chen's avatar Xiaohui Chen Committed by Commit Bot

assistant: disable reading voice query result

Disable screen reader reading voice query result because Assistant
is going to respond with voice anyway.

Bug: b:113734839
Test: locally build and test
Change-Id: Ifa1079a6c551e8682857b8ab8e8afe0dd05218a7
Reviewed-on: https://chromium-review.googlesource.com/c/1232883Reviewed-by: default avatarMuyuan Li <muyuanli@chromium.org>
Commit-Queue: Xiaohui Chen <xiaohuic@chromium.org>
Cr-Commit-Position: refs/heads/master@{#597326}
parent e8ec10c2
...@@ -4,6 +4,9 @@ ...@@ -4,6 +4,9 @@
#include "ash/assistant/assistant_interaction_controller.h" #include "ash/assistant/assistant_interaction_controller.h"
#include <map>
#include <utility>
#include "ash/assistant/assistant_controller.h" #include "ash/assistant/assistant_controller.h"
#include "ash/assistant/assistant_screen_context_controller.h" #include "ash/assistant/assistant_screen_context_controller.h"
#include "ash/assistant/assistant_ui_controller.h" #include "ash/assistant/assistant_ui_controller.h"
...@@ -85,7 +88,8 @@ void AssistantInteractionController::OnAssistantControllerDestroying() { ...@@ -85,7 +88,8 @@ void AssistantInteractionController::OnAssistantControllerDestroying() {
void AssistantInteractionController::OnDeepLinkReceived( void AssistantInteractionController::OnDeepLinkReceived(
assistant::util::DeepLinkType type, assistant::util::DeepLinkType type,
const std::map<std::string, std::string>& params) { const std::map<std::string, std::string>& params) {
using namespace assistant::util; using assistant::util::DeepLinkType;
using assistant::util::DeepLinkParam;
if (type == DeepLinkType::kWhatsOnMyScreen) { if (type == DeepLinkType::kWhatsOnMyScreen) {
StartScreenContextInteraction(); StartScreenContextInteraction();
...@@ -426,6 +430,7 @@ void AssistantInteractionController::OnTtsStarted(bool due_to_error) { ...@@ -426,6 +430,7 @@ void AssistantInteractionController::OnTtsStarted(bool due_to_error) {
l10n_util::GetStringUTF8(IDS_ASH_ASSISTANT_ERROR_GENERIC))); l10n_util::GetStringUTF8(IDS_ASH_ASSISTANT_ERROR_GENERIC)));
} }
model_.pending_response()->set_has_tts(true);
// We have an agreement with the server that TTS will always be the last part // We have an agreement with the server that TTS will always be the last part
// of an interaction to be processed. To be timely in updating UI, we use // of an interaction to be processed. To be timely in updating UI, we use
// this as an opportunity to finalize the Assistant response and update the // this as an opportunity to finalize the Assistant response and update the
......
...@@ -43,9 +43,15 @@ class AssistantResponse { ...@@ -43,9 +43,15 @@ class AssistantResponse {
// Returns all suggestions belongs to the response, mapped to a unique id. // Returns all suggestions belongs to the response, mapped to a unique id.
std::map<int, const AssistantSuggestion*> GetSuggestions() const; std::map<int, const AssistantSuggestion*> GetSuggestions() const;
// Get/Set if the current server response has TTS. This can only be reliably
// checked after the response is finalized for obvious reasons.
bool has_tts() const { return has_tts_; }
void set_has_tts(bool has_tts) { has_tts_ = has_tts; }
private: private:
std::vector<std::unique_ptr<AssistantUiElement>> ui_elements_; std::vector<std::unique_ptr<AssistantUiElement>> ui_elements_;
std::vector<AssistantSuggestionPtr> suggestions_; std::vector<AssistantSuggestionPtr> suggestions_;
bool has_tts_ = false;
DISALLOW_COPY_AND_ASSIGN(AssistantResponse); DISALLOW_COPY_AND_ASSIGN(AssistantResponse);
}; };
......
...@@ -414,8 +414,12 @@ void UiElementContainerView::OnAllUiElementsAdded() { ...@@ -414,8 +414,12 @@ void UiElementContainerView::OnAllUiElementsAdded() {
// Let screen reader read the query result. // Let screen reader read the query result.
// NOTE: this won't read webview result, which will be triggered with HTML // NOTE: this won't read webview result, which will be triggered with HTML
// ARIA. // ARIA. Also we don't read when there is a TTS response already to avoid
NotifyAccessibilityEvent(ax::mojom::Event::kAlert, true); // speaking over the server response.
const AssistantResponse* response =
assistant_controller_->interaction_controller()->model()->response();
if (!response->has_tts())
NotifyAccessibilityEvent(ax::mojom::Event::kAlert, true);
} }
bool UiElementContainerView::OnAllUiElementsExitAnimationEnded( bool UiElementContainerView::OnAllUiElementsExitAnimationEnded(
......
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