0

Reland "oobe assistant flow: Disable Voice Match based on new policy."

This is a reland of c3ed952a6b
Was reverted:
https://chromium-review.googlesource.com/c/chromium/src/+/3067356
Because of wrong OS in test cases json.

Original change's description:
> oobe assistant flow: Disable Voice Match based on new policy.
>
> Add AssistantVoiceMatchEnabled policy which could enable or disable
> Voice Match flow during OOBE. It will be set to Disabled for EDU users
> on the server side.
>
> Bug: 1230908
> Change-Id: I09ff1b05dc92acf916b4b97ff9fec734d60670fd
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3041392
> Commit-Queue: Roman Aleksandrov <raleksandrov@google.com>
> Reviewed-by: Kyle Horimoto <khorimoto@chromium.org>
> Reviewed-by: Yue Li <updowndota@chromium.org>
> Reviewed-by: Roman Sorokin [CET] <rsorokin@chromium.org>
> Reviewed-by: Jeffrey Young <cowmoo@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#907950}

Bug: 1230908
Change-Id: I548ab53bc04fd1ec9eae55506f953e95a5012835
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3069142
Reviewed-by: Kyle Horimoto <khorimoto@chromium.org>
Reviewed-by: Denis Kuznetsov [CET] <antrim@chromium.org>
Reviewed-by: Alexander Hendrich <hendrich@chromium.org>
Reviewed-by: Yue Li <updowndota@chromium.org>
Commit-Queue: Roman Aleksandrov <raleksandrov@google.com>
Cr-Commit-Position: refs/heads/master@{#908119}
This commit is contained in:
Roman Aleksandrov
2021-08-03 21:19:45 +00:00
committed by Chromium LUCI CQ
parent 81781edde0
commit a72a106086
10 changed files with 99 additions and 11 deletions
chrome
chromeos/services/assistant/public/cpp
components/policy/resources
tools/metrics/histograms

@ -608,6 +608,9 @@ const PrefsUtil::TypedPrefMap& PrefsUtil::GetAllowlistedKeys() {
settings_api::PrefType::PREF_TYPE_BOOLEAN;
(*s_allowlist)[chromeos::assistant::prefs::kAssistantHotwordEnabled] =
settings_api::PrefType::PREF_TYPE_BOOLEAN;
(*s_allowlist)
[chromeos::assistant::prefs::kAssistantVoiceMatchEnabledDuringOobe] =
settings_api::PrefType::PREF_TYPE_BOOLEAN;
(*s_allowlist)[chromeos::assistant::prefs::kAssistantLaunchWithMicOpen] =
settings_api::PrefType::PREF_TYPE_BOOLEAN;
(*s_allowlist)[chromeos::assistant::prefs::kAssistantNotificationEnabled] =

@ -1080,6 +1080,9 @@ const PolicyToPreferenceMapEntry kSimplePolicyMap[] = {
{ key::kAssistantOnboardingMode,
chromeos::assistant::prefs::kAssistantOnboardingMode,
base::Value::Type::STRING },
{ key::kAssistantVoiceMatchEnabledDuringOobe,
chromeos::assistant::prefs::kAssistantVoiceMatchEnabledDuringOobe,
base::Value::Type::BOOLEAN },
{ key::kVoiceInteractionContextEnabled,
chromeos::assistant::prefs::kAssistantContextEnabled,
base::Value::Type::BOOLEAN },

@ -260,12 +260,22 @@ bool IsHotwordDspAvailable() {
return chromeos::CrasAudioHandler::Get()->HasHotwordDevice();
}
bool IsVoiceMatchEnforcedOff(const PrefService* prefs) {
// If the hotword preference is managed to always disabled, then we should not
// show Voice Match flow.
return prefs->IsManagedPreference(
assistant::prefs::kAssistantHotwordEnabled) &&
!prefs->GetBoolean(assistant::prefs::kAssistantHotwordEnabled);
bool IsVoiceMatchEnforcedOff(const PrefService* prefs,
bool is_oobe_in_progress) {
// If the hotword preference is managed to always disabled Voice Match flow is
// hidden.
if (prefs->IsManagedPreference(assistant::prefs::kAssistantHotwordEnabled) &&
!prefs->GetBoolean(assistant::prefs::kAssistantHotwordEnabled)) {
return true;
}
// If Voice Match is disabled by policy during OOBE, then Voice Match flow is
// hidden.
if (is_oobe_in_progress &&
!prefs->GetBoolean(
assistant::prefs::kAssistantVoiceMatchEnabledDuringOobe)) {
return true;
}
return false;
}
AssistantActivityControlConsent::SettingType

@ -87,7 +87,8 @@ void RecordActivityControlConsent(
bool IsHotwordDspAvailable();
bool IsVoiceMatchEnforcedOff(const PrefService* prefs);
bool IsVoiceMatchEnforcedOff(const PrefService* prefs,
bool is_oobe_in_progress);
sync_pb::UserConsentTypes::AssistantActivityControlConsent::SettingType
GetActivityControlConsentSettingType(const SettingZippyList& setting_zippys);

@ -26,6 +26,7 @@
#include "chromeos/services/assistant/public/proto/settings_ui.pb.h"
#include "components/login/localized_values_builder.h"
#include "components/prefs/pref_service.h"
#include "components/session_manager/core/session_manager.h"
#include "components/user_manager/user_manager.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/chromeos/devicetype_utils.h"
@ -559,12 +560,16 @@ void AssistantOptInFlowScreenHandler::OnGetSettingsResponse(
return;
}
const bool is_oobe_in_progress =
session_manager::SessionManager::Get()->session_state() !=
session_manager::SessionState::ACTIVE;
// Pass string constants dictionary.
auto dictionary = GetSettingsUiStrings(settings_ui, activity_control_needed_,
equal_weight_buttons);
PrefService* prefs = ProfileManager::GetActiveUserProfile()->GetPrefs();
dictionary.SetKey("voiceMatchEnforcedOff",
base::Value(IsVoiceMatchEnforcedOff(prefs)));
dictionary.SetKey(
"voiceMatchEnforcedOff",
base::Value(IsVoiceMatchEnforcedOff(prefs, is_oobe_in_progress)));
dictionary.SetKey("childName", base::Value(GetGivenNameIfIsChild()));
ReloadContent(dictionary);
@ -583,7 +588,7 @@ void AssistantOptInFlowScreenHandler::OnGetSettingsResponse(
// If voice match is enabled, the screen that follows third party disclosure
// is the "voice match" screen, not "get more" screen.
if (skip_get_more && IsVoiceMatchEnforcedOff(prefs))
if (skip_get_more && IsVoiceMatchEnforcedOff(prefs, is_oobe_in_progress))
ShowNextScreen();
}

@ -12512,6 +12512,34 @@
}
]
},
"AssistantVoiceMatchEnabledDuringOobe": {
"os": [
"chromeos_ash"
],
"policy_pref_mapping_tests": [
{
"note": "Checking default value (no policies set)",
"policies": {},
"prefs": {
"settings.voice_interaction.oobe_voice_match.enabled": {
"default_value": true
}
}
},
{
"policies": {
"AssistantVoiceMatchEnabledDuringOobe": false
},
"prefs": {
"settings.voice_interaction.oobe_voice_match.enabled": {
"value": false
}
}
}
]
},
"VoiceInteractionContextEnabled": {
"os": [
"chromeos_ash"

@ -55,6 +55,10 @@ const char kAssistantNotificationEnabled[] =
// A preference that indicates the mode of the Assistant onboarding experience.
// This preference should only be changed via policy.
const char kAssistantOnboardingMode[] = "settings.assistant.onboarding_mode";
// A preference that indicates whether Voice Match is enabled during OOBE.
// This preference should only be changed via policy.
const char kAssistantVoiceMatchEnabledDuringOobe[] =
"settings.voice_interaction.oobe_voice_match.enabled";
void RegisterProfilePrefs(PrefRegistrySimple* registry) {
registry->RegisterIntegerPref(kAssistantConsentStatus,
@ -66,6 +70,7 @@ void RegisterProfilePrefs(PrefRegistrySimple* registry) {
registry->RegisterBooleanPref(kAssistantHotwordEnabled, false);
registry->RegisterBooleanPref(kAssistantLaunchWithMicOpen, false);
registry->RegisterBooleanPref(kAssistantNotificationEnabled, true);
registry->RegisterBooleanPref(kAssistantVoiceMatchEnabledDuringOobe, true);
registry->RegisterStringPref(kAssistantOnboardingMode,
kAssistantOnboardingModeDefault);
}

@ -65,6 +65,8 @@ COMPONENT_EXPORT(ASSISTANT_SERVICE_PUBLIC)
extern const char kAssistantNotificationEnabled[];
COMPONENT_EXPORT(ASSISTANT_SERVICE_PUBLIC)
extern const char kAssistantOnboardingMode[];
COMPONENT_EXPORT(ASSISTANT_SERVICE_PUBLIC)
extern const char kAssistantVoiceMatchEnabledDuringOobe[];
// Registers Assistant specific profile preferences for browser prefs.
COMPONENT_EXPORT(ASSISTANT_SERVICE_PUBLIC)

@ -1183,6 +1183,7 @@
'AssistantOnboardingMode',
'VoiceInteractionContextEnabled',
'VoiceInteractionHotwordEnabled',
'AssistantVoiceMatchEnabledDuringOobe',
'VoiceInteractionQuickAnswersEnabled',
]
},
@ -21546,6 +21547,35 @@
Leaving the policy unset lets users decide to turn this feature on or off.''',
},
{
'name': 'AssistantVoiceMatchEnabledDuringOobe',
'owners': ['raleksandrov@google.com', 'cros-oac@google.com'],
'type': 'main',
'schema': { 'type': 'boolean' },
'supported_on': ['chrome_os:93-'],
'tags' : [],
'features': {
'dynamic_refresh': True,
'per_profile': False,
},
'items': [
{
'value': True,
'caption': 'Show Google Assistant voice match flow during initial setup',
},
{
'value': False,
'caption': 'Do not show Google Assistant voice match flow during initial setup',
},
],
'example_value': True,
'default': True,
'id': 885,
'caption': '''Enable Google Assistant voice match flow''',
'desc': '''Setting the policy to Enabled lets show Google Assistant voice match flow during initial setup. Setting the policy to Disabled keeps Google Assistant from showing voice match flow during initial setup.
Leaving the policy unset means it is Enabled.''',
},
{
'name': 'VoiceInteractionQuickAnswersEnabled',
'owners': ['llin@google.com'],
@ -27798,6 +27828,6 @@ The recommended way to configure policy on Windows is via GPO, although provisio
'placeholders': [],
'deleted_policy_ids': [114, 115, 204, 205, 206, 412, 476, 544, 546, 562, 569, 578, 583, 585, 586, 587, 588, 589, 590, 591, 600, 668, 669],
'deleted_atomic_policy_group_ids': [19],
'highest_id_currently_used': 884,
'highest_id_currently_used': 885,
'highest_atomic_group_id_currently_used': 41
}

@ -25929,6 +25929,7 @@ Called by update_document_policy_enum.py.-->
<int value="882" label="WindowCaptureAllowedByOrigins"/>
<int value="883" label="TabCaptureAllowedByOrigins"/>
<int value="884" label="SameOriginTabCaptureAllowedByOrigins"/>
<int value="885" label="AssistantVoiceMatchEnabledDuringOobe"/>
</enum>
<enum name="EnterprisePolicyDeviceIdValidity">