[go: up one dir, main page]

Hotword: Don't show Voice & Audio Activity status if hotword hardware is not enabled

BUG=458312

Review URL: https://codereview.chromium.org/926493002

Cr-Commit-Position: refs/heads/master@{#316420}
(cherry picked from commit 363844ca52c23914c79b60d4496ae0ba7368a4cf)

Review URL: https://codereview.chromium.org/933043003

Cr-Commit-Position: refs/branch-heads/2272@{#323}
Cr-Branched-From: 827a380cfdb31aa54c8d56e63ce2c3fd8c3ba4d4-refs/heads/master@{#310958}
diff --git a/chrome/browser/resources/options/browser_options.js b/chrome/browser/resources/options/browser_options.js
index cb1f3521..c3c10a35 100644
--- a/chrome/browser/resources/options/browser_options.js
+++ b/chrome/browser/resources/options/browser_options.js
@@ -1169,7 +1169,7 @@
     },
 
     /**
-     * Activates the Audio History and Always-On Hotword sections from the
+     * Activates the Always-On Hotword sections from the
      * System settings page.
      * @param {string=} opt_error The error message to display.
      * @private
@@ -1228,14 +1228,12 @@
     /**
      * Activates the Audio History section of the Settings page.
      * @param {boolean} visible Whether the audio history section is visible.
-     * @param {boolean} alwaysOn Whether always-on hotwording is available.
      * @param {string} labelText Text describing current audio history state.
      * @private
      */
-    setAudioHistorySectionVisible_: function(visible, alwaysOn, labelText) {
+    setAudioHistorySectionVisible_: function(visible, labelText) {
       $('audio-history').hidden = !visible;
       $('audio-history-label').textContent = labelText;
-      $('audio-history-always-on-description').hidden = !alwaysOn;
     },
 
     /**
diff --git a/chrome/browser/ui/webui/options/browser_options_handler.cc b/chrome/browser/ui/webui/options/browser_options_handler.cc
index df880ed..2b023ef4 100644
--- a/chrome/browser/ui/webui/options/browser_options_handler.cc
+++ b/chrome/browser/ui/webui/options/browser_options_handler.cc
@@ -1675,13 +1675,12 @@
 #endif
 
 void BrowserOptionsHandler::SetHotwordAudioHistorySectionVisible(
-    bool always_on, const base::string16& audio_history_state,
+    const base::string16& audio_history_state,
     bool success, bool logging_enabled) {
   bool visible = logging_enabled && success;
   web_ui()->CallJavascriptFunction(
       "BrowserOptions.setAudioHistorySectionVisible",
       base::FundamentalValue(visible),
-      base::FundamentalValue(always_on),
       base::StringValue(audio_history_state));
 }
 
@@ -1751,10 +1750,10 @@
 
     // Audio history should be displayed if it's enabled regardless of the
     // hotword error state if the user is signed in. If the user is not signed
-    // in, audio history is meaningless. An additional message is displayed if
-    // always-on hotwording is enabled.
+    // in, audio history is meaningless. This is only displayed if always-on
+    // hotwording is available.
     if (HotwordService::IsExperimentalHotwordingEnabled() &&
-        authenticated) {
+        authenticated && always_on) {
       std::string user_display_name = signin->GetAuthenticatedUsername();
       DCHECK(!user_display_name.empty());
       base::string16 audio_history_state =
@@ -1767,7 +1766,7 @@
             base::Bind(
                 &BrowserOptionsHandler::SetHotwordAudioHistorySectionVisible,
                 weak_ptr_factory_.GetWeakPtr(),
-                always_on, audio_history_state));
+                audio_history_state));
       }
     }
 
diff --git a/chrome/browser/ui/webui/options/browser_options_handler.h b/chrome/browser/ui/webui/options/browser_options_handler.h
index d6c99e5..8d49d98 100644
--- a/chrome/browser/ui/webui/options/browser_options_handler.h
+++ b/chrome/browser/ui/webui/options/browser_options_handler.h
@@ -288,7 +288,6 @@
   // Callback that updates the visibility of the audio history upon completion
   // of a call to the server to the get the current value.
   void SetHotwordAudioHistorySectionVisible(
-      bool always_on,
       const base::string16& audio_history_state,
       bool success,
       bool logging_enabled);