update_engine: Call dlcservice's Install/Update Completion DBus APIs

When an Install/Update completes, update_engine will now let dlcservice
know all the DLCs that were installed/updated + verified.

Update_engine will also track during install/update for DLCs which did
not install/update so dlcservice receives the correct list of DLC IDs.

BUG=chromium:1059126
TEST=FEATURES=test emerge-$B update_engine update_engine-client

Cq-Depend: chromium:2141191
Change-Id: Id57f66c7c6957d34870d27119d9a6482fe902503
Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/2146104
Tested-by: Jae Hoon Kim <kimjae@chromium.org>
Commit-Queue: Jae Hoon Kim <kimjae@chromium.org>
Reviewed-by: Amin Hassani <ahassani@chromium.org>
Reviewed-by: Andrew Lassalle <andrewlassalle@chromium.org>
Auto-Submit: Jae Hoon Kim <kimjae@chromium.org>
diff --git a/update_attempter.cc b/update_attempter.cc
index 29d256c..c45fe4f 100644
--- a/update_attempter.cc
+++ b/update_attempter.cc
@@ -1219,8 +1219,18 @@
   }
 }
 
+vector<string> UpdateAttempter::GetSuccessfulDlcIds() {
+  vector<string> dlc_ids;
+  for (const auto& pr : omaha_request_params_->dlc_apps_params())
+    if (pr.second.updated)
+      dlc_ids.push_back(pr.second.name);
+  return dlc_ids;
+}
+
 void UpdateAttempter::ProcessingDoneInstall(const ActionProcessor* processor,
                                             ErrorCode code) {
+  if (!system_state_->dlcservice()->InstallCompleted(GetSuccessfulDlcIds()))
+    LOG(WARNING) << "dlcservice didn't successfully handle install completion.";
   SetStatusAndNotify(UpdateStatus::IDLE);
   ScheduleUpdates();
   LOG(INFO) << "DLC successfully installed, no reboot needed.";
@@ -1230,6 +1240,8 @@
                                            ErrorCode code) {
   WriteUpdateCompletedMarker();
 
+  if (!system_state_->dlcservice()->UpdateCompleted(GetSuccessfulDlcIds()))
+    LOG(WARNING) << "dlcservice didn't successfully handle update completion.";
   SetStatusAndNotify(UpdateStatus::UPDATED_NEED_REBOOT);
   ScheduleUpdates();
   LOG(INFO) << "Update successfully applied, waiting to reboot.";