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[] = { ...@@ -43,6 +43,11 @@ const char* const kReportingFlags[] = {
// Strings used to generate the serial number part of the version string. // Strings used to generate the serial number part of the version string.
const char kSerialNumberPrefix[] = "SN:"; 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. // Strings used to generate the bluetooth device name.
const char kBluetoothDeviceNamePrefix[] = "Bluetooth device name: "; const char kBluetoothDeviceNamePrefix[] = "Bluetooth device name: ";
...@@ -126,13 +131,11 @@ void VersionInfoUpdater::UpdateVersionLabel() { ...@@ -126,13 +131,11 @@ void VersionInfoUpdater::UpdateVersionLabel() {
if (version_text_.empty()) if (version_text_.empty())
return; return;
UpdateSerialNumberInfo();
std::string label_text = l10n_util::GetStringFUTF8( std::string label_text = l10n_util::GetStringFUTF8(
IDS_LOGIN_VERSION_LABEL_FORMAT, IDS_LOGIN_VERSION_LABEL_FORMAT,
l10n_util::GetStringUTF16(IDS_PRODUCT_NAME), l10n_util::GetStringUTF16(IDS_PRODUCT_NAME),
base::UTF8ToUTF16(version_info::GetVersionNumber()), base::UTF8ToUTF16(version_info::GetVersionNumber()),
base::UTF8ToUTF16(version_text_), base::UTF8ToUTF16(serial_number_text_)); base::UTF8ToUTF16(version_text_), base::UTF8ToUTF16(GetDeviceIdsLabel()));
if (delegate_) if (delegate_)
delegate_->OnOSVersionLabelTextUpdated(label_text); delegate_->OnOSVersionLabelTextUpdated(label_text);
...@@ -158,15 +161,35 @@ void VersionInfoUpdater::SetEnterpriseInfo( ...@@ -158,15 +161,35 @@ void VersionInfoUpdater::SetEnterpriseInfo(
} }
} }
void VersionInfoUpdater::UpdateSerialNumberInfo() { std::string VersionInfoUpdater::GetDeviceIdsLabel() {
std::string serial = 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(); system::StatisticsProvider::GetInstance()->GetEnterpriseMachineID();
if (!serial.empty()) { if (!serial_number.empty()) {
serial_number_text_ = kSerialNumberPrefix; if (!device_ids_text.empty())
serial_number_text_.append(serial); 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) { void VersionInfoUpdater::OnVersion(const std::string& version) {
version_text_ = version; version_text_ = version;
UpdateVersionLabel(); UpdateVersionLabel();
......
...@@ -74,8 +74,8 @@ class VersionInfoUpdater : public policy::CloudPolicyStore::Observer { ...@@ -74,8 +74,8 @@ class VersionInfoUpdater : public policy::CloudPolicyStore::Observer {
void SetEnterpriseInfo(const std::string& enterprise_display_domain, void SetEnterpriseInfo(const std::string& enterprise_display_domain,
const std::string& asset_id); const std::string& asset_id);
// Creates a serial number string. // Produce a label with device identifiers.
void UpdateSerialNumberInfo(); std::string GetDeviceIdsLabel();
// Callback from chromeos::VersionLoader giving the version. // Callback from chromeos::VersionLoader giving the version.
void OnVersion(const std::string& version); void OnVersion(const std::string& version);
...@@ -88,12 +88,8 @@ class VersionInfoUpdater : public policy::CloudPolicyStore::Observer { ...@@ -88,12 +88,8 @@ class VersionInfoUpdater : public policy::CloudPolicyStore::Observer {
SessionManagerClient::AdbSideloadResponseCode response_code, SessionManagerClient::AdbSideloadResponseCode response_code,
bool enabled); bool enabled);
// Information pieces for version label. // Text obtained from OnVersion.
std::string version_text_; 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>> std::vector<std::unique_ptr<CrosSettings::ObserverSubscription>>
subscriptions_; 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