Read ProductId, ProductVersion and Channel setting in Brillo.

The ProductId, ProductVersion and current/target channels are specified
in a very different way in Brillo compared to Chrome OS. This patch
moves the logic to read and parse /etc/lsb-release in Chrome OS to a
new image_properties module and implements the equivalent module in
Brillo.

This new module replaces some of the logic previously in the
OmahaRequestParams class, both for parsing the read-only properties
from the rootfs and parsing and storing the target channel in the
stateful partition. The Chrome OS version of the new module keeps the
same behavior, except that it falls back to "stable-channel" if the
the current channel is missing in the rootfs (unlikely in Chrome OS).

On the other hand, the new Brillo implementation reads these settings
from the /etc/osrelease file and /etc/osrelease.d directory and doesn't
allow to override those setting during development. The persisted
target_channel and powerwash_allowed settings are stored in Prefs
as many other settings. Finally, since Brillo images don't contain
a channel name baked in the image, we store the channel name where we
got the image from at the time of the update. The first boot after
provisioning will default to "stable-channel".

Bug: 25013069
Test: unittest in Chrome OS; `mm` and tested on a Brillo device.

Change-Id: Icc114b8098af3edaaba715c9c2e3ebe9f417c876
diff --git a/omaha_response_handler_action.cc b/omaha_response_handler_action.cc
index 9ad73d6..a58ccfc 100644
--- a/omaha_response_handler_action.cc
+++ b/omaha_response_handler_action.cc
@@ -109,6 +109,15 @@
   install_plan_.source_slot = system_state_->boot_control()->GetCurrentSlot();
   install_plan_.target_slot = install_plan_.source_slot == 0 ? 1 : 0;
 
+  // The Omaha response doesn't include the channel name for this image, so we
+  // use the download_channel we used during the request to tag the target slot.
+  // This will be used in the next boot to know the channel the image was
+  // downloaded from.
+  string current_channel_key =
+      kPrefsChannelOnSlotPrefix + std::to_string(install_plan_.target_slot);
+  system_state_->prefs()->SetString(current_channel_key,
+                                    params->download_channel());
+
   if (params->to_more_stable_channel() && params->is_powerwash_allowed())
     install_plan_.powerwash_required = true;