Implement UpdateAttempterAndroid::CleanupSuccessfulUpdate

Calls DynamicPartitionControlInterface::CleanupSuccessfulUpdate.

Test: manual with update_engine_client
Bug: 138808328

Change-Id: Ia18d52dc354a5a0f9b29cfb908fbec77616c05e7
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