Added support for Wipe Task

Test: tested wipe on Raven
Bug: 194686221
Change-Id: I582800a279cbe8a3e733a1e75447e5b5142d4120
diff --git a/fastboot/task.cpp b/fastboot/task.cpp
index 6233c90..c70139b 100644
--- a/fastboot/task.cpp
+++ b/fastboot/task.cpp
@@ -143,8 +143,7 @@
     return std::make_unique<FlashSuperLayoutTask>(super_name, std::move(helper), std::move(s));
 }
 
-UpdateSuperTask::UpdateSuperTask(FlashingPlan* fp)
-    : fp_(fp) {}
+UpdateSuperTask::UpdateSuperTask(FlashingPlan* fp) : fp_(fp) {}
 
 void UpdateSuperTask::Run() {
     unique_fd fd = fp_->source->OpenFile("super_empty.img");
@@ -185,4 +184,16 @@
 
 void DeleteTask::Run() {
     fp_->fb->DeletePartition(pname_);
-}
\ No newline at end of file
+}
+
+WipeTask::WipeTask(FlashingPlan* fp, const std::string& pname) : fp_(fp), pname_(pname){};
+
+void WipeTask::Run() {
+    std::string partition_type;
+    if (fp_->fb->GetVar("partition-type:" + pname_, &partition_type) != fastboot::SUCCESS) {
+        return;
+    }
+    if (partition_type.empty()) return;
+    fp_->fb->Erase(pname_);
+    fb_perform_format(pname_, 1, partition_type, "", fp_->fs_options);
+}