update_engine: Query dlcservice to avoid stale DLC module IDs

Within |UpdateAttempter|, the possibility of using stale DLC module IDs
existed. This should never happen. The fix is to go through |DlcService|
to recieve the list of fresh and current DLC module IDs. This change now
will handle both interactive and non-interactive update cases.

This is only for updates.

BUG=chromium:978525
TEST=FEATURES="test" emerge-${BOARD} update_engine

Change-Id: Iffa75f60f367b2a110c559654fa3df9c48c714b1
diff --git a/update_attempter.cc b/update_attempter.cc
index 9573c43..b06807d 100644
--- a/update_attempter.cc
+++ b/update_attempter.cc
@@ -425,7 +425,14 @@
     // target channel.
     omaha_request_params_->UpdateDownloadChannel();
   }
-  // Set the DLC module ID list.
+
+  // Set the |dlc_module_ids_| only for an update. This is required to get the
+  // currently installed DLC(s).
+  if (!is_install_ &&
+      !system_state_->dlcservice()->GetInstalled(&dlc_module_ids_)) {
+    LOG(INFO) << "Failed to retrieve DLC module IDs from dlcservice. Check the "
+                 "state of dlcservice, will not update DLC modules.";
+  }
   omaha_request_params_->set_dlc_module_ids(dlc_module_ids_);
   omaha_request_params_->set_is_install(is_install_);
 
@@ -838,7 +845,6 @@
   }
 
   bool interactive = !(flags & UpdateAttemptFlags::kFlagNonInteractive);
-  dlc_module_ids_.clear();
   is_install_ = false;
 
   LOG(INFO) << "Forced update check requested.";
@@ -903,9 +909,9 @@
   if (IsAnyUpdateSourceAllowed()) {
     forced_omaha_url_ = omaha_url;
   }
-  if (omaha_url == kScheduledAUTestURLRequest) {
-    forced_omaha_url_ = constants::kOmahaDefaultAUTestURL;
-  } else if (omaha_url == kAUTestURLRequest) {
+
+  if (omaha_url == kScheduledAUTestURLRequest ||
+      omaha_url == kAUTestURLRequest) {
     forced_omaha_url_ = constants::kOmahaDefaultAUTestURL;
   }