Commit 1e6cec68 authored by Anqing Zhao's avatar Anqing Zhao Committed by Commit Bot

Set device settings from ReportDeviceCrashReportInfo policy

Add decode logic to extract the settings from policy and set the value
into device settings. Besides, make sure the setting will be reloaded
whenever the policy updates.

Bug: 1040078
Change-Id: Idd6ef1966ded2b430ac05c63f0e026bcef3b47c5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2012033Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Reviewed-by: default avatarSergey Poromov <poromov@chromium.org>
Commit-Queue: Anqing Zhao <anqing@google.com>
Cr-Commit-Position: refs/heads/master@{#735150}
parent f0f54006
......@@ -656,6 +656,7 @@ void OwnerSettingsServiceChromeOS::UpdateDeviceSettings(
// kReportDeviceStorageStatus
// kReportDeviceSessionStatus
// kReportDeviceGraphicsStatus
// kReportDeviceCrashReportInfoStatus
// kReportDeviceVersionInfo
// kReportDeviceUsers
// kServiceAccountIdentity
......
......@@ -679,6 +679,13 @@ void DecodeReportingPolicies(const em::ChromeDeviceSettingsProto& policy,
std::make_unique<base::Value>(container.report_graphics_status()),
nullptr);
}
if (container.has_report_crash_report_info()) {
policies->Set(
key::kReportDeviceCrashReportInfo, POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_MACHINE, POLICY_SOURCE_CLOUD,
std::make_unique<base::Value>(container.report_crash_report_info()),
nullptr);
}
if (container.has_report_power_status()) {
policies->Set(
key::kReportDevicePowerStatus, POLICY_LEVEL_MANDATORY,
......
......@@ -112,6 +112,7 @@ const char* const kKnownSettings[] = {
kReportDeviceActivityTimes,
kReportDeviceBoardStatus,
kReportDeviceBootMode,
kReportDeviceCrashReportInfo,
kReportDeviceCpuInfo,
kReportDeviceHardwareStatus,
kReportDeviceLocation,
......@@ -511,6 +512,10 @@ void DecodeReportingPolicies(const em::ChromeDeviceSettingsProto& policy,
new_values_cache->SetBoolean(kReportDeviceBootMode,
reporting_policy.report_boot_mode());
}
if (reporting_policy.has_report_crash_report_info()) {
new_values_cache->SetBoolean(kReportDeviceCrashReportInfo,
reporting_policy.report_crash_report_info());
}
if (reporting_policy.has_report_network_interfaces()) {
new_values_cache->SetBoolean(
kReportDeviceNetworkInterfaces,
......
......@@ -94,6 +94,7 @@ class DeviceSettingsProviderTest : public DeviceSettingsTestBase {
proto->set_report_hardware_status(enable_reporting);
proto->set_report_session_status(enable_reporting);
proto->set_report_graphics_status(enable_reporting);
proto->set_report_crash_report_info(enable_reporting);
proto->set_report_os_update_status(enable_reporting);
proto->set_report_running_kiosk_app(enable_reporting);
proto->set_report_power_status(enable_reporting);
......@@ -160,15 +161,23 @@ class DeviceSettingsProviderTest : public DeviceSettingsTestBase {
void VerifyReportingSettings(bool expected_enable_state,
int expected_frequency) {
const char* reporting_settings[] = {
kReportDeviceVersionInfo, kReportDeviceActivityTimes,
kReportDeviceBoardStatus, kReportDeviceBootMode,
kReportDeviceVersionInfo,
kReportDeviceActivityTimes,
kReportDeviceBoardStatus,
kReportDeviceBootMode,
// Device location reporting is not currently supported.
// kReportDeviceLocation,
kReportDeviceNetworkInterfaces, kReportDeviceUsers,
kReportDeviceHardwareStatus, kReportDevicePowerStatus,
kReportDeviceStorageStatus, kReportDeviceSessionStatus,
kReportDeviceGraphicsStatus, kReportOsUpdateStatus,
kReportRunningKioskApp};
kReportDeviceNetworkInterfaces,
kReportDeviceUsers,
kReportDeviceHardwareStatus,
kReportDevicePowerStatus,
kReportDeviceStorageStatus,
kReportDeviceSessionStatus,
kReportDeviceGraphicsStatus,
kReportDeviceCrashReportInfo,
kReportOsUpdateStatus,
kReportRunningKioskApp,
};
const base::Value expected_enable_value(expected_enable_state);
for (auto* setting : reporting_settings) {
......
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