Commit 5b83cb9f authored by Yves Arrouye's avatar Yves Arrouye Committed by Commit Bot

Add zero-touch enrollment information screens where Alt+V works

This CL inserts the info discussed in go/zt-alt+v-id in the "version"
string which already contains the serial number, while preserving the
existing placement of the OS version on the left and the serial number
on the right.

See screenshots in bug. This CL shows the ZTE indication and always
includes the ADID even when it is the same as the SN).

Bug: chromium:1124875
Test: Build Chrome, deploy and restart UI, see ZTE info if warranted
Change-Id: I2a70098546472b2a237ff6f9a0f82f375ab3f3fb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2404689
Commit-Queue: Yves Arrouye <drcrash@chromium.org>
Reviewed-by: default avatarRoman Sorokin [CET] <rsorokin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#808915}
parent 1855c4ee
......@@ -43,6 +43,11 @@ const char* const kReportingFlags[] = {
// Strings used to generate the serial number part of the version string.
const char kSerialNumberPrefix[] = "SN:";
// Strings used to generate the ZTE info string. The mark after "ZTE" indicates
// that the device is ready for zero-touch enrollment as far as it can tell.
const char kZteReady[] = "ZTE\xF0\x9F\x97\xB9";
const char kAttestedDeviceIdPrefix[] = "ADID:";
// Strings used to generate the bluetooth device name.
const char kBluetoothDeviceNamePrefix[] = "Bluetooth device name: ";
......@@ -126,13 +131,11 @@ void VersionInfoUpdater::UpdateVersionLabel() {
if (version_text_.empty())
return;
UpdateSerialNumberInfo();
std::string label_text = l10n_util::GetStringFUTF8(
IDS_LOGIN_VERSION_LABEL_FORMAT,
l10n_util::GetStringUTF16(IDS_PRODUCT_NAME),
base::UTF8ToUTF16(version_info::GetVersionNumber()),
base::UTF8ToUTF16(version_text_), base::UTF8ToUTF16(serial_number_text_));
base::UTF8ToUTF16(version_text_), base::UTF8ToUTF16(GetDeviceIdsLabel()));
if (delegate_)
delegate_->OnOSVersionLabelTextUpdated(label_text);
......@@ -158,15 +161,35 @@ void VersionInfoUpdater::SetEnterpriseInfo(
}
}
void VersionInfoUpdater::UpdateSerialNumberInfo() {
std::string serial =
std::string VersionInfoUpdater::GetDeviceIdsLabel() {
std::string device_ids_text;
// Get the attested device ID and add the ZTE indication and the ID if needed.
std::string attested_device_id;
system::StatisticsProvider::GetInstance()->GetMachineStatistic(
chromeos::system::kAttestedDeviceIdKey, &attested_device_id);
// Start with the ZTE indication and the attested device ID if it exists.
if (!attested_device_id.empty()) {
device_ids_text.append(kZteReady);
// Always append the attested device ID.
device_ids_text.append(" ");
device_ids_text.append(kAttestedDeviceIdPrefix);
device_ids_text.append(attested_device_id);
}
// Get the serial number and add it.
std::string serial_number =
system::StatisticsProvider::GetInstance()->GetEnterpriseMachineID();
if (!serial.empty()) {
serial_number_text_ = kSerialNumberPrefix;
serial_number_text_.append(serial);
if (!serial_number.empty()) {
if (!device_ids_text.empty())
device_ids_text.append(" ");
// Append the serial number.
device_ids_text.append(kSerialNumberPrefix);
device_ids_text.append(serial_number);
}
}
return device_ids_text;
}
void VersionInfoUpdater::OnVersion(const std::string& version) {
version_text_ = version;
UpdateVersionLabel();
......
......@@ -74,8 +74,8 @@ class VersionInfoUpdater : public policy::CloudPolicyStore::Observer {
void SetEnterpriseInfo(const std::string& enterprise_display_domain,
const std::string& asset_id);
// Creates a serial number string.
void UpdateSerialNumberInfo();
// Produce a label with device identifiers.
std::string GetDeviceIdsLabel();
// Callback from chromeos::VersionLoader giving the version.
void OnVersion(const std::string& version);
......@@ -88,12 +88,8 @@ class VersionInfoUpdater : public policy::CloudPolicyStore::Observer {
SessionManagerClient::AdbSideloadResponseCode response_code,
bool enabled);
// Information pieces for version label.
// Text obtained from OnVersion.
std::string version_text_;
std::string serial_number_text_;
// Full text for the OS version label.
std::string os_version_label_text_;
std::vector<std::unique_ptr<CrosSettings::ObserverSubscription>>
subscriptions_;
......
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