Send both system id and product id to Omaha.

The request will have two <app> with different app_id and version.

Test: observe request in the log
Change-Id: I51b0dcf3c0affc81fe152ff24ce0ccc9a36e6385
(cherry picked from commit 573919d54a8421f1b2147d801ae4104adebf5cd7)
diff --git a/image_properties.h b/image_properties.h
index ba6ce44..ac6d474 100644
--- a/image_properties.h
+++ b/image_properties.h
@@ -33,9 +33,13 @@
   std::string product_id;
   // The canary-channel product id.
   std::string canary_product_id;
+  // The system id for the Android Things SoM, empty for Chrome OS.
+  std::string system_id;
 
   // The product version of this image.
   std::string version;
+  // The system version of this image.
+  std::string system_version;
 
   // A unique string that identifies this build. Normally a combination of the
   // the version, signing keys and build target.
diff --git a/image_properties_android.cc b/image_properties_android.cc
index e3b7616..0e6385d 100644
--- a/image_properties_android.cc
+++ b/image_properties_android.cc
@@ -32,9 +32,10 @@
 
 namespace {
 
-// Build time properties name used in Brillo.
+// Build time properties name used in Android Things.
 const char kProductId[] = "product_id";
 const char kProductVersion[] = "product_version";
+const char kSystemId[] = "system_id";
 const char kSystemVersion[] = "system_version";
 
 // Prefs used to store the target channel and powerwash settings.
@@ -67,14 +68,17 @@
 
   brillo::OsReleaseReader osrelease;
   osrelease.Load();
-  result.product_id = GetStringWithDefault(
-      osrelease, kProductId, "developer-boards:brillo-starter-board");
+  result.product_id =
+      GetStringWithDefault(osrelease, kProductId, "invalid-product");
+  result.system_id = GetStringWithDefault(
+      osrelease, kSystemId, "developer-boards:brillo-starter-board");
   result.canary_product_id = result.product_id;
   std::string system_version =
-      GetStringWithDefault(osrelease, kSystemVersion, "0.0.0");
+      GetStringWithDefault(osrelease, kSystemVersion, "0.0.0.0");
   std::string product_version =
-      GetStringWithDefault(osrelease, kProductVersion, "0");
-  result.version = system_version + "." + product_version;
+      GetStringWithDefault(osrelease, kProductVersion, "0.0.0.0");
+  result.version = product_version;
+  result.system_version = system_version;
 
   char prop[PROPERTY_VALUE_MAX];
   property_get(kPropProductName, prop, "brillo");
diff --git a/omaha_request_action.cc b/omaha_request_action.cc
index cf37a9e..f3948ce 100644
--- a/omaha_request_action.cc
+++ b/omaha_request_action.cc
@@ -204,10 +204,16 @@
                             arg_name.c_str(), escaped_xml_value.c_str());
 }
 
+struct OmahaAppData {
+  string id;
+  string version;
+};
+
 // Returns an XML that corresponds to the entire <app> node of the Omaha
 // request based on the given parameters.
 string GetAppXml(const OmahaEvent* event,
                  OmahaRequestParams* params,
+                 const OmahaAppData& app_data,
                  bool ping_only,
                  bool include_ping,
                  int ping_active_days,
@@ -226,10 +232,10 @@
     LOG(INFO) << "Passing OS version as 0.0.0.0 as we are set to powerwash "
               << "on downgrading to the version in the more stable channel";
     app_versions = "version=\"0.0.0.0\" from_version=\"" +
-        XmlEncodeWithDefault(params->app_version(), "0.0.0.0") + "\" ";
+                   XmlEncodeWithDefault(app_data.version, "0.0.0.0") + "\" ";
   } else {
     app_versions = "version=\"" +
-        XmlEncodeWithDefault(params->app_version(), "0.0.0.0") + "\" ";
+                   XmlEncodeWithDefault(app_data.version, "0.0.0.0") + "\" ";
   }
 
   string download_channel = params->download_channel();
@@ -265,7 +271,7 @@
   }
 
   string app_xml = "    <app "
-      "appid=\"" + XmlEncodeWithDefault(params->GetAppId(), "") + "\" " +
+      "appid=\"" + XmlEncodeWithDefault(app_data.id, "") + "\" " +
       app_cohort_args +
       app_versions +
       app_channels +
@@ -306,9 +312,30 @@
                      int install_date_in_days,
                      SystemState* system_state) {
   string os_xml = GetOsXml(params);
-  string app_xml = GetAppXml(event, params, ping_only, include_ping,
-                             ping_active_days, ping_roll_call_days,
-                             install_date_in_days, system_state);
+  OmahaAppData product_app = {.id = params->GetAppId(),
+                              .version = params->app_version()};
+  string app_xml = GetAppXml(event,
+                             params,
+                             product_app,
+                             ping_only,
+                             include_ping,
+                             ping_active_days,
+                             ping_roll_call_days,
+                             install_date_in_days,
+                             system_state);
+  if (!params->system_app_id().empty()) {
+    OmahaAppData system_app = {.id = params->system_app_id(),
+                               .version = params->system_version()};
+    app_xml += GetAppXml(event,
+                         params,
+                         system_app,
+                         ping_only,
+                         include_ping,
+                         ping_active_days,
+                         ping_roll_call_days,
+                         install_date_in_days,
+                         system_state);
+  }
 
   string install_source = base::StringPrintf("installsource=\"%s\" ",
       (params->interactive() ? "ondemandupdate" : "scheduler"));
diff --git a/omaha_request_params.h b/omaha_request_params.h
index 3a28ed1..cdc5f38 100644
--- a/omaha_request_params.h
+++ b/omaha_request_params.h
@@ -109,6 +109,7 @@
   inline std::string canary_app_id() const {
     return image_props_.canary_product_id;
   }
+  inline std::string system_app_id() const { return image_props_.system_id; }
   inline void set_app_id(const std::string& app_id) {
     image_props_.product_id = app_id;
     image_props_.canary_product_id = app_id;
@@ -122,6 +123,9 @@
     image_props_.version = version;
   }
   inline std::string app_version() const { return image_props_.version; }
+  inline std::string system_version() const {
+    return image_props_.system_version;
+  }
 
   inline std::string current_channel() const {
     return image_props_.current_channel;