Add EC and Firmware Versions to the Omaha Response.
This CL adds 2 additional utils methods to get the version for both the
fw and ec versions. I've added a unittest to verify these work and piped
in the values into the omaha response.
BUG=chromium:219871
TEST=Unittests + on device
Change-Id: Iadf70fff858988f52797d94bcdb062bb2482bbf3
Reviewed-on: https://gerrit.chromium.org/gerrit/49713
Commit-Queue: Chris Sosa <sosa@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Tested-by: Chris Sosa <sosa@chromium.org>
diff --git a/omaha_request_params.cc b/omaha_request_params.cc
index f30e771..38262a9 100644
--- a/omaha_request_params.cc
+++ b/omaha_request_params.cc
@@ -13,6 +13,7 @@
#include <vector>
#include <base/file_util.h>
+#include <base/string_util.h>
#include <policy/device_policy.h>
#include "update_engine/constants.h"
@@ -78,6 +79,10 @@
stateful_override);
app_lang_ = "en-US";
hwid_ = utils::GetHardwareClass();
+ if (CollectECFWVersions()) {
+ fw_version_ = utils::GetFirmwareVersion();
+ ec_version_ = utils::GetECVersion(NULL);
+ }
if (current_channel_ == target_channel_) {
// deltas are only okay if the /.nodelta file does not exist. if we don't
@@ -107,6 +112,17 @@
return true;
}
+bool OmahaRequestParams::CollectECFWVersions() const {
+ return (
+ StartsWithASCII(hwid_, string("SAMS ALEX"), true) ||
+ StartsWithASCII(hwid_, string("BUTTERFLY"), true) ||
+ StartsWithASCII(hwid_, string("LUMPY"), true) ||
+ StartsWithASCII(hwid_, string("PARROT"), true) ||
+ StartsWithASCII(hwid_, string("SPRING"), true) ||
+ StartsWithASCII(hwid_, string("SNOW"), true)
+ );
+}
+
bool OmahaRequestParams::SetTargetChannel(const std::string& new_target_channel,
bool is_powerwash_allowed) {
LOG(INFO) << "SetTargetChannel called with " << new_target_channel