Commit c5230a93 authored by Yue Li's avatar Yue Li Committed by Commit Bot

Update activity control pref usage

The activity control boolean pref has been replaced with a enum flag.
Update the usage in Assistant settings.

Bug: b/124934418
Test: Manual Test
Change-Id: I648128163e701fcea9dc38e73e8734511c0f863a
Reviewed-on: https://chromium-review.googlesource.com/c/1480817
Commit-Queue: Yue Li <updowndota@chromium.org>
Reviewed-by: default avatarXiaohui Chen <xiaohuic@chromium.org>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#634754}
parent 1ecc5fff
......@@ -12,6 +12,28 @@ const DspHotwordState = {
OFF: 2,
};
/**
* Indicates user's activity control consent status.
*
* Note: This should be kept in sync with ash::mojom::ConsentStatus in
* ash/public/interfaces/voice_interaction_controller.mojom
* @enum {number}
*/
const ConsentStatus = {
// The status is unknown.
kUnknown: 0,
// The user accepted activity control access.
kActivityControlAccepted: 1,
// The user is not authorized to give consent.
kUnauthorized: 2,
// The user's consent information is not found. This is typically the case
// when consent from the user has never been requested.
kNotFound: 3,
};
/**
* @fileoverview 'settings-google-assistant-page' is the settings page
* containing Google Assistant settings.
......@@ -83,6 +105,8 @@ Polymer({
observers: [
'onPrefsChanged_(prefs.settings.voice_interaction.hotword.enabled.value)',
'onPrefsChanged_(prefs.settings.voice_interaction.hotword.always_on.value)',
`onPrefsChanged_(
prefs.settings.voice_interaction.activity_control.consent_status.value)`,
],
/** @private {?settings.GoogleAssistantBrowserProxy} */
......@@ -153,8 +177,9 @@ Polymer({
this.shouldShowVoiceMatchSettings_ =
loadTimeData.getBoolean('voiceMatchEnabled') &&
this.getPref('settings.voice_interaction.hotword.enabled.value') &&
this.getPref(
'settings.voice_interaction.activity_control.accepted.value');
(this.getPref(
'settings.voice_interaction.activity_control.consent_status.value') ==
ConsentStatus.kActivityControlAccepted);
},
/** @private */
......
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