diff options
author | Amin Hassani <ahassani@chromium.org> | 2020-10-27 15:44:33 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-10-29 00:30:43 +0000 |
commit | 5d56c1eef7fd730a164c44a742ef2cb0afcfca8d (patch) | |
tree | 572f28ad39889ff2aac8883db17562120517465c | |
parent | e8153631e85189ab578aa04b556801ee80d6d686 (diff) |
update_engine: Remove ec_version and fw_version
It seems like these values were set for devices like parrot that have
been AUE'ed long time ago. The server side doesn't use this values and
it doesn't seem we need them anywhere. So its better to not send them
anymore since currently we're just sending empty values for them.
BUG=b:171829801
TEST=FEATURES=test emerge-reef update_engine
Change-Id: I2d2cd5f9d079ce5c87fc8167e30f91d1ffe1c87a
Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/2504454
Tested-by: Amin Hassani <ahassani@chromium.org>
Reviewed-by: Jae Hoon Kim <kimjae@chromium.org>
Reviewed-by: Tianjie Xu <xunchang@google.com>
Commit-Queue: Amin Hassani <ahassani@chromium.org>
-rw-r--r-- | common/fake_hardware.h | 12 | ||||
-rw-r--r-- | common/hardware_interface.h | 8 | ||||
-rw-r--r-- | common/mock_hardware.h | 7 | ||||
-rw-r--r-- | common/utils.cc | 21 | ||||
-rw-r--r-- | common/utils.h | 4 | ||||
-rw-r--r-- | common/utils_unittest.cc | 13 | ||||
-rw-r--r-- | hardware_android.cc | 10 | ||||
-rw-r--r-- | hardware_android.h | 2 | ||||
-rw-r--r-- | hardware_chromeos.cc | 19 | ||||
-rw-r--r-- | hardware_chromeos.h | 2 | ||||
-rw-r--r-- | omaha_request_action_unittest.cc | 4 | ||||
-rw-r--r-- | omaha_request_builder_xml.cc | 2 | ||||
-rw-r--r-- | omaha_request_builder_xml_unittest.cc | 4 | ||||
-rw-r--r-- | omaha_request_params.cc | 12 | ||||
-rw-r--r-- | omaha_request_params.h | 15 | ||||
-rw-r--r-- | omaha_request_params_unittest.cc | 8 |
16 files changed, 0 insertions, 143 deletions
diff --git a/common/fake_hardware.h b/common/fake_hardware.h index 82382ffd..00a212e3 100644 --- a/common/fake_hardware.h +++ b/common/fake_hardware.h @@ -76,10 +76,6 @@ class FakeHardware : public HardwareInterface { std::string GetHardwareClass() const override { return hardware_class_; } - std::string GetFirmwareVersion() const override { return firmware_version_; } - - std::string GetECVersion() const override { return ec_version_; } - std::string GetDeviceRequisition() const override { return device_requisition_; } @@ -176,12 +172,6 @@ class FakeHardware : public HardwareInterface { hardware_class_ = hardware_class; } - void SetFirmwareVersion(const std::string& firmware_version) { - firmware_version_ = firmware_version; - } - - void SetECVersion(const std::string& ec_version) { ec_version_ = ec_version; } - void SetDeviceRequisition(const std::string& requisition) { device_requisition_ = requisition; } @@ -233,8 +223,6 @@ class FakeHardware : public HardwareInterface { // Jan 20, 2007 base::Time oobe_timestamp_{base::Time::FromTimeT(1169280000)}; std::string hardware_class_{"Fake HWID BLAH-1234"}; - std::string firmware_version_{"Fake Firmware v1.0.1"}; - std::string ec_version_{"Fake EC v1.0a"}; std::string device_requisition_{"fake_requisition"}; int min_kernel_key_version_{kMinKernelKeyVersion}; int min_firmware_key_version_{kMinFirmwareKeyVersion}; diff --git a/common/hardware_interface.h b/common/hardware_interface.h index b37b0074..cad32fc5 100644 --- a/common/hardware_interface.h +++ b/common/hardware_interface.h @@ -64,14 +64,6 @@ class HardwareInterface { // Returns the HWID or an empty string on error. virtual std::string GetHardwareClass() const = 0; - // Returns the firmware version or an empty string if the system is - // not running chrome os firmware. - virtual std::string GetFirmwareVersion() const = 0; - - // Returns the ec version or an empty string if the system is not - // running a custom chrome os ec. - virtual std::string GetECVersion() const = 0; - // Returns the OEM device requisition or an empty string if the system does // not have a requisition, or if not running Chrome OS. virtual std::string GetDeviceRequisition() const = 0; diff --git a/common/mock_hardware.h b/common/mock_hardware.h index 84c0c5ba..071906b5 100644 --- a/common/mock_hardware.h +++ b/common/mock_hardware.h @@ -45,11 +45,6 @@ class MockHardware : public HardwareInterface { ON_CALL(*this, GetHardwareClass()) .WillByDefault( testing::Invoke(&fake_, &FakeHardware::GetHardwareClass)); - ON_CALL(*this, GetFirmwareVersion()) - .WillByDefault( - testing::Invoke(&fake_, &FakeHardware::GetFirmwareVersion)); - ON_CALL(*this, GetECVersion()) - .WillByDefault(testing::Invoke(&fake_, &FakeHardware::GetECVersion)); ON_CALL(*this, GetMinKernelKeyVersion()) .WillByDefault( testing::Invoke(&fake_, &FakeHardware::GetMinKernelKeyVersion)); @@ -90,8 +85,6 @@ class MockHardware : public HardwareInterface { MOCK_CONST_METHOD0(IsOOBEEnabled, bool()); MOCK_CONST_METHOD1(IsOOBEComplete, bool(base::Time* out_time_of_oobe)); MOCK_CONST_METHOD0(GetHardwareClass, std::string()); - MOCK_CONST_METHOD0(GetFirmwareVersion, std::string()); - MOCK_CONST_METHOD0(GetECVersion, std::string()); MOCK_CONST_METHOD0(GetMinKernelKeyVersion, int()); MOCK_CONST_METHOD0(GetMinFirmwareKeyVersion, int()); MOCK_CONST_METHOD0(GetMaxFirmwareKeyRollforward, int()); diff --git a/common/utils.cc b/common/utils.cc index 9e1e6c58..c8924b1e 100644 --- a/common/utils.cc +++ b/common/utils.cc @@ -112,27 +112,6 @@ bool GetTempName(const string& path, base::FilePath* template_path) { namespace utils { -string ParseECVersion(string input_line) { - base::TrimWhitespaceASCII(input_line, base::TRIM_ALL, &input_line); - - // At this point we want to convert the format key=value pair from mosys to - // a vector of key value pairs. - vector<pair<string, string>> kv_pairs; - if (base::SplitStringIntoKeyValuePairs(input_line, '=', ' ', &kv_pairs)) { - for (const pair<string, string>& kv_pair : kv_pairs) { - // Finally match against the fw_verion which may have quotes. - if (kv_pair.first == "fw_version") { - string output; - // Trim any quotes. - base::TrimString(kv_pair.second, "\"", &output); - return output; - } - } - } - LOG(ERROR) << "Unable to parse fwid from ec info."; - return ""; -} - bool WriteFile(const char* path, const void* data, size_t data_len) { int fd = HANDLE_EINTR(open(path, O_WRONLY | O_CREAT | O_TRUNC, 0600)); TEST_AND_RETURN_FALSE_ERRNO(fd >= 0); diff --git a/common/utils.h b/common/utils.h index bcaed318..f364bfdb 100644 --- a/common/utils.h +++ b/common/utils.h @@ -53,10 +53,6 @@ std::string StringVectorToString(const std::vector<std::string>& vec_str); std::string CalculateP2PFileId(const brillo::Blob& payload_hash, size_t payload_size); -// Parse the firmware version from one line of output from the -// "mosys" command. -std::string ParseECVersion(std::string input_line); - // Writes the data passed to path. The file at path will be overwritten if it // exists. Returns true on success, false otherwise. bool WriteFile(const char* path, const void* data, size_t data_len); diff --git a/common/utils_unittest.cc b/common/utils_unittest.cc index d73b3da7..bc5c3b05 100644 --- a/common/utils_unittest.cc +++ b/common/utils_unittest.cc @@ -41,19 +41,6 @@ namespace chromeos_update_engine { class UtilsTest : public ::testing::Test {}; -TEST(UtilsTest, CanParseECVersion) { - // Should be able to parse and valid key value line. - EXPECT_EQ("12345", utils::ParseECVersion("fw_version=12345")); - EXPECT_EQ("123456", - utils::ParseECVersion("b=1231a fw_version=123456 a=fasd2")); - EXPECT_EQ("12345", utils::ParseECVersion("fw_version=12345")); - EXPECT_EQ("00VFA616", - utils::ParseECVersion("vendor=\"sam\" fw_version=\"00VFA616\"")); - - // For invalid entries, should return the empty string. - EXPECT_EQ("", utils::ParseECVersion("b=1231a fw_version a=fasd2")); -} - TEST(UtilsTest, WriteFileOpenFailure) { EXPECT_FALSE(utils::WriteFile("/this/doesn't/exist", "hello", 5)); } diff --git a/hardware_android.cc b/hardware_android.cc index 48945224..8d1fdfdd 100644 --- a/hardware_android.cc +++ b/hardware_android.cc @@ -49,8 +49,6 @@ namespace { // Android properties that identify the hardware and potentially non-updatable // parts of the bootloader (such as the bootloader version and the baseband // version). -const char kPropBootBootloader[] = "ro.boot.bootloader"; -const char kPropBootBaseband[] = "ro.boot.baseband"; const char kPropProductManufacturer[] = "ro.product.manufacturer"; const char kPropBootHardwareSKU[] = "ro.boot.hardware.sku"; const char kPropBootRevision[] = "ro.boot.revision"; @@ -128,14 +126,6 @@ string HardwareAndroid::GetHardwareClass() const { return manufacturer + ":" + sku + ":" + revision; } -string HardwareAndroid::GetFirmwareVersion() const { - return GetProperty(kPropBootBootloader, ""); -} - -string HardwareAndroid::GetECVersion() const { - return GetProperty(kPropBootBaseband, ""); -} - string HardwareAndroid::GetDeviceRequisition() const { LOG(WARNING) << "STUB: Getting requisition is not supported."; return ""; diff --git a/hardware_android.h b/hardware_android.h index b6704477..d7e39f3b 100644 --- a/hardware_android.h +++ b/hardware_android.h @@ -43,8 +43,6 @@ class HardwareAndroid : public HardwareInterface { bool IsOOBEEnabled() const override; bool IsOOBEComplete(base::Time* out_time_of_oobe) const override; std::string GetHardwareClass() const override; - std::string GetFirmwareVersion() const override; - std::string GetECVersion() const override; std::string GetDeviceRequisition() const override; int GetMinKernelKeyVersion() const override; int GetMinFirmwareKeyVersion() const override; diff --git a/hardware_chromeos.cc b/hardware_chromeos.cc index cce5e842..dbb99dba 100644 --- a/hardware_chromeos.cc +++ b/hardware_chromeos.cc @@ -175,25 +175,6 @@ string HardwareChromeOS::GetHardwareClass() const { return ReadValueFromCrosSystem("hwid"); } -string HardwareChromeOS::GetFirmwareVersion() const { - return ReadValueFromCrosSystem("fwid"); -} - -string HardwareChromeOS::GetECVersion() const { - string input_line, error; - int exit_code = 0; - vector<string> cmd = {"/usr/sbin/mosys", "-k", "ec", "info"}; - - if (!Subprocess::SynchronousExec(cmd, &exit_code, &input_line, &error) || - exit_code != 0) { - LOG(ERROR) << "Unable to read EC info from mosys with exit code: " - << exit_code << " and error: " << error; - return ""; - } - - return utils::ParseECVersion(input_line); -} - string HardwareChromeOS::GetDeviceRequisition() const { #if USE_CFM const char* kLocalStatePath = "/home/chronos/Local State"; diff --git a/hardware_chromeos.h b/hardware_chromeos.h index bbfe2739..9ee62f68 100644 --- a/hardware_chromeos.h +++ b/hardware_chromeos.h @@ -46,8 +46,6 @@ class HardwareChromeOS final : public HardwareInterface { bool IsOOBEEnabled() const override; bool IsOOBEComplete(base::Time* out_time_of_oobe) const override; std::string GetHardwareClass() const override; - std::string GetFirmwareVersion() const override; - std::string GetECVersion() const override; std::string GetDeviceRequisition() const override; int GetMinKernelKeyVersion() const override; int GetMinFirmwareKeyVersion() const override; diff --git a/omaha_request_action_unittest.cc b/omaha_request_action_unittest.cc index adb95dff..61e988bb 100644 --- a/omaha_request_action_unittest.cc +++ b/omaha_request_action_unittest.cc @@ -365,8 +365,6 @@ class OmahaRequestActionTest : public ::testing::Test { request_params_.set_current_channel("unittest"); request_params_.set_target_channel("unittest"); request_params_.set_hwid("OEM MODEL 09235 7471"); - request_params_.set_fw_version("ChromeOSFirmware.1.0"); - request_params_.set_ec_version("0X0A1"); request_params_.set_delta_okay(true); request_params_.set_interactive(false); request_params_.set_update_url("http://url"); @@ -1604,8 +1602,6 @@ TEST_F(OmahaRequestActionTest, FormatUpdateCheckOutputTest) { string::npos); EXPECT_NE(post_str.find("hardware_class=\"OEM MODEL 09235 7471\""), string::npos); - EXPECT_NE(post_str.find("fw_version=\"ChromeOSFirmware.1.0\""), string::npos); - EXPECT_NE(post_str.find("ec_version=\"0X0A1\""), string::npos); // No <event> tag should be sent if we didn't reboot to an update. EXPECT_EQ(post_str.find("<event"), string::npos); } diff --git a/omaha_request_builder_xml.cc b/omaha_request_builder_xml.cc index 690a4eff..6660afb4 100644 --- a/omaha_request_builder_xml.cc +++ b/omaha_request_builder_xml.cc @@ -368,8 +368,6 @@ string OmahaRequestBuilderXml::GetApp(const OmahaAppData& app_data) const { // DLC excluded for installs and updates. (app_data.is_dlc ? "" : "lang=\"" + XmlEncodeWithDefault(params_->app_lang(), "en-US") + "\" " + - "fw_version=\"" + XmlEncodeWithDefault(params_->fw_version()) + "\" " + - "ec_version=\"" + XmlEncodeWithDefault(params_->ec_version()) + "\" " + requisition_arg) + ">\n" + diff --git a/omaha_request_builder_xml_unittest.cc b/omaha_request_builder_xml_unittest.cc index a8044205..042d9919 100644 --- a/omaha_request_builder_xml_unittest.cc +++ b/omaha_request_builder_xml_unittest.cc @@ -108,8 +108,6 @@ TEST_F(OmahaRequestBuilderXmlTest, PlatformGetAppTest) { // in fact present in the <app ...></app>. const string app = omaha_request.GetApp(dlc_app_data); EXPECT_NE(string::npos, app.find("lang=")); - EXPECT_NE(string::npos, app.find("fw_version=")); - EXPECT_NE(string::npos, app.find("ec_version=")); EXPECT_NE(string::npos, app.find("requisition=")); } @@ -132,8 +130,6 @@ TEST_F(OmahaRequestBuilderXmlTest, DlcGetAppTest) { // fact not present in the <app ...></app>. const string app = omaha_request.GetApp(dlc_app_data); EXPECT_EQ(string::npos, app.find("lang=")); - EXPECT_EQ(string::npos, app.find("fw_version=")); - EXPECT_EQ(string::npos, app.find("ec_version=")); EXPECT_EQ(string::npos, app.find("requisition=")); } diff --git a/omaha_request_params.cc b/omaha_request_params.cc index 79d19e8f..5a487207 100644 --- a/omaha_request_params.cc +++ b/omaha_request_params.cc @@ -92,10 +92,6 @@ bool OmahaRequestParams::Init(const string& app_version, os_sp_ = image_props_.version + "_" + GetMachineType(); app_lang_ = "en-US"; hwid_ = system_state_->hardware()->GetHardwareClass(); - if (CollectECFWVersions()) { - fw_version_ = system_state_->hardware()->GetFirmwareVersion(); - ec_version_ = system_state_->hardware()->GetECVersion(); - } device_requisition_ = system_state_->hardware()->GetDeviceRequisition(); if (image_props_.current_channel == mutable_image_props_.target_channel) { @@ -170,14 +166,6 @@ bool OmahaRequestParams::IsUpdateUrlOfficial() const { update_url_ == image_props_.omaha_url); } -bool OmahaRequestParams::CollectECFWVersions() const { - return base::StartsWith( - hwid_, string("PARROT"), base::CompareCase::SENSITIVE) || - base::StartsWith( - hwid_, string("SPRING"), base::CompareCase::SENSITIVE) || - base::StartsWith(hwid_, string("SNOW"), base::CompareCase::SENSITIVE); -} - bool OmahaRequestParams::SetTargetChannel(const string& new_target_channel, bool is_powerwash_allowed, string* error_message) { diff --git a/omaha_request_params.h b/omaha_request_params.h index 7e192620..ed3cc80e 100644 --- a/omaha_request_params.h +++ b/omaha_request_params.h @@ -104,8 +104,6 @@ class OmahaRequestParams { } inline std::string app_lang() const { return app_lang_; } inline std::string hwid() const { return hwid_; } - inline std::string fw_version() const { return fw_version_; } - inline std::string ec_version() const { return ec_version_; } inline std::string device_requisition() const { return device_requisition_; } inline void set_app_version(const std::string& version) { @@ -294,12 +292,6 @@ class OmahaRequestParams { } void set_app_lang(const std::string& app_lang) { app_lang_ = app_lang; } void set_hwid(const std::string& hwid) { hwid_ = hwid; } - void set_fw_version(const std::string& fw_version) { - fw_version_ = fw_version; - } - void set_ec_version(const std::string& ec_version) { - ec_version_ = ec_version; - } void set_is_powerwash_allowed(bool powerwash_allowed) { mutable_image_props_.is_powerwash_allowed = powerwash_allowed; } @@ -313,7 +305,6 @@ class OmahaRequestParams { private: FRIEND_TEST(OmahaRequestParamsTest, ChannelIndexTest); - FRIEND_TEST(OmahaRequestParamsTest, CollectECFWVersionsTest); FRIEND_TEST(OmahaRequestParamsTest, IsValidChannelTest); FRIEND_TEST(OmahaRequestParamsTest, SetIsPowerwashAllowedTest); FRIEND_TEST(OmahaRequestParamsTest, SetTargetChannelInvalidTest); @@ -336,10 +327,6 @@ class OmahaRequestParams { // i.e. index(target_channel) > index(current_channel). bool ToMoreStableChannel() const; - // Returns True if we should store the fw/ec versions based on our hwid_. - // Compares hwid to a set of prefixes in the allowlist. - bool CollectECFWVersions() const; - // Gets the machine type (e.g. "i686"). std::string GetMachineType() const; @@ -380,8 +367,6 @@ class OmahaRequestParams { std::string lts_tag_; std::string hwid_; // Hardware Qualification ID of the client - std::string fw_version_; // Chrome OS Firmware Version. - std::string ec_version_; // Chrome OS EC Version. // TODO(b:133324571) tracks removal of this field once it is no longer // needed in AU requests. Remove by October 1st 2019. std::string device_requisition_; // Chrome OS Requisition type. diff --git a/omaha_request_params_unittest.cc b/omaha_request_params_unittest.cc index 140cad3c..fcf80625 100644 --- a/omaha_request_params_unittest.cc +++ b/omaha_request_params_unittest.cc @@ -257,14 +257,6 @@ TEST_F(OmahaRequestParamsTest, ShouldPowerwashTest) { EXPECT_TRUE(params_.ShouldPowerwash()); } -TEST_F(OmahaRequestParamsTest, CollectECFWVersionsTest) { - params_.hwid_ = string("STUMPY ALEX 12345"); - EXPECT_FALSE(params_.CollectECFWVersions()); - - params_.hwid_ = string("SNOW 12345"); - EXPECT_TRUE(params_.CollectECFWVersions()); -} - TEST_F(OmahaRequestParamsTest, RequisitionIsSetTest) { EXPECT_TRUE(params_.Init("", "", {})); EXPECT_EQ("fake_requisition", params_.device_requisition()); |