Support changing from non-canary to canary channel in update engine.

Now that we have added support in lsb-release for both the board appid
and canary app id to be specified, we should use the appropriate appid
according to the channel from which we want to download the new payload.

This change in update engine will enable the change from non-canary to
canary channels. This feature when be lit up end to end when the UI for
this scenario is ready.

BUG=chromium:225866
TEST=Unit tests pass. Tested all channel changes on my ZGB.

Change-Id: Ia9c37c72f53f6c69436f0a96e35d2584d84653c8
Reviewed-on: https://gerrit.chromium.org/gerrit/47181
Commit-Queue: Jay Srinivasan <jaysri@chromium.org>
Reviewed-by: Jay Srinivasan <jaysri@chromium.org>
Tested-by: Jay Srinivasan <jaysri@chromium.org>
diff --git a/omaha_request_params.cc b/omaha_request_params.cc
index bd94b2d..591a6f6 100644
--- a/omaha_request_params.cc
+++ b/omaha_request_params.cc
@@ -63,14 +63,18 @@
                           "",
                           NULL,
                           stateful_override);
-  app_id_ = GetLsbValue("CHROMEOS_RELEASE_APPID",
-                        OmahaRequestParams::kAppId,
-                        NULL,
-                        stateful_override);
+  string release_app_id = GetLsbValue("CHROMEOS_RELEASE_APPID",
+                                      OmahaRequestParams::kAppId,
+                                      NULL,
+                                      stateful_override);
   board_app_id_ = GetLsbValue("CHROMEOS_BOARD_APPID",
-                              app_id_,
+                              release_app_id,
                               NULL,
                               stateful_override);
+  canary_app_id_ = GetLsbValue("CHROMEOS_CANARY_APPID",
+                               release_app_id,
+                               NULL,
+                               stateful_override);
   app_lang_ = "en-US";
   hwid_ = utils::GetHardwareClass();
 
@@ -277,4 +281,8 @@
   return download_channel_index > current_channel_index;
 }
 
+string OmahaRequestParams::GetAppId() const {
+  return download_channel_ == "canary-channel" ? canary_app_id_ : board_app_id_;
+}
+
 }  // namespace chromeos_update_engine