Implement UpdateAttempterAndroid::CleanupSuccessfulUpdate
am: 4f61156337

Change-Id: I77e7ef772e852d6d53877444e9f2f7381dc04766
diff --git a/update_attempter_android.cc b/update_attempter_android.cc
index 034b4ea..680bbaf 100644
--- a/update_attempter_android.cc
+++ b/update_attempter_android.cc
@@ -933,9 +933,15 @@
 
 int32_t UpdateAttempterAndroid::CleanupSuccessfulUpdate(
     brillo::ErrorPtr* error) {
-  // TODO(elsk): implement b/138808328
-  LogAndSetError(error, FROM_HERE, "Not implemented.");
-  return static_cast<int32_t>(ErrorCode::kError);
+  ErrorCode error_code =
+      boot_control_->GetDynamicPartitionControl()->CleanupSuccessfulUpdate();
+  if (error_code == ErrorCode::kSuccess) {
+    LOG(INFO) << "Previous update is merged and cleaned up successfully.";
+  } else {
+    LOG(ERROR) << "CleanupSuccessfulUpdate failed with "
+               << utils::ErrorCodeToString(error_code);
+  }
+  return static_cast<int32_t>(error_code);
 }
 
 }  // namespace chromeos_update_engine