Index: chrome/browser/resources/hotword/state_manager.js |
diff --git a/chrome/browser/resources/hotword/state_manager.js b/chrome/browser/resources/hotword/state_manager.js |
index 67d4f41923f35fc1513a8493551b64db3e371e81..b55dc3dbef6f1296cbc033562ae000ff3e4a5c5c 100644 |
--- a/chrome/browser/resources/hotword/state_manager.js |
+++ b/chrome/browser/resources/hotword/state_manager.js |
@@ -140,11 +140,15 @@ cr.define('hotword', function() { |
}, |
/** |
- * @return {boolean} True if hotwording is enabled. |
+ * @return {boolean} True if google.com/NTP/launcher hotwording is enabled. |
*/ |
- isEnabled: function() { |
- assert(this.hotwordStatus_, 'No hotwording status (isEnabled)'); |
- return this.hotwordStatus_.enabled; |
+ isSometimesOnEnabled: function() { |
+ assert(this.hotwordStatus_, |
+ 'No hotwording status (isSometimesOnEnabled)'); |
+ // Although the two settings are supposed to be mutually exclusive, it's |
+ // possible for both to be set. In that case, always-on takes precedence. |
+ return this.hotwordStatus_.enabled && |
+ !this.hotwordStatus_.alwaysOnEnabled; |
}, |
/** |
@@ -152,8 +156,7 @@ cr.define('hotword', function() { |
*/ |
isAlwaysOnEnabled: function() { |
assert(this.hotwordStatus_, 'No hotword status (isAlwaysOnEnabled)'); |
- return this.hotwordStatus_.enabled && |
- this.hotwordStatus_.alwaysOnEnabled; |
+ return this.hotwordStatus_.alwaysOnEnabled; |
}, |
/** |
@@ -178,7 +181,7 @@ cr.define('hotword', function() { |
if (!this.hotwordStatus_) |
return; |
- if (this.hotwordStatus_.enabled) { |
+ if (this.hotwordStatus_.enabled || this.hotwordStatus_.alwaysOnEnabled) { |
// Start the detector if there's a session, and shut it down if there |
// isn't. |
// NOTE(amistry): With always-on, we want a different behaviour with |