Merge changes I343272f4,I5481893a into main am: 3d0d8e4b8f am: f9098ffba4 am: 1ed9fa5522 am: 33042d88c9

Original change: https://android-review.googlesource.com/c/platform/system/core/+/2755691

Change-Id: Ica37860acd6d042d752170ffa9127bd4f7d7033b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/fastboot/fastboot.cpp b/fastboot/fastboot.cpp
index 21df729..080ad42 100644
--- a/fastboot/fastboot.cpp
+++ b/fastboot/fastboot.cpp
@@ -28,7 +28,6 @@
 
 #include "fastboot.h"
 
-#include <ctype.h>
 #include <errno.h>
 #include <fcntl.h>
 #include <getopt.h>
@@ -44,12 +43,10 @@
 #include <unistd.h>
 
 #include <chrono>
-#include <fstream>
 #include <functional>
 #include <iostream>
 #include <memory>
 #include <regex>
-#include <sstream>
 #include <string>
 #include <thread>
 #include <utility>
@@ -79,7 +76,6 @@
 #include "fastboot_driver_interface.h"
 #include "fs.h"
 #include "storage.h"
-#include "super_flash_helper.h"
 #include "task.h"
 #include "tcp.h"
 #include "transport.h"
@@ -93,7 +89,6 @@
 using android::base::Split;
 using android::base::Trim;
 using android::base::unique_fd;
-using namespace std::string_literals;
 using namespace std::placeholders;
 
 #define FASTBOOT_INFO_VERSION 1
@@ -350,8 +345,7 @@
 //
 // The returned Transport is a singleton, so multiple calls to this function will return the same
 // object, and the caller should not attempt to delete the returned Transport.
-static std::unique_ptr<Transport> open_device(const char* local_serial,
-                                              bool wait_for_device = true,
+static std::unique_ptr<Transport> open_device(const char* local_serial, bool wait_for_device = true,
                                               bool announce = true) {
     const Result<NetworkSerial, FastbootError> network_serial = ParseNetworkSerial(local_serial);
 
@@ -1883,11 +1877,10 @@
         // partitions (otherwise they would not mount on first boot). To enforce
         // this, we delete any logical partitions for the "other" slot.
         if (is_retrofit_device(fp_->fb)) {
-            std::string partition_name = image->part_name + "_"s + slot;
+            std::string partition_name = image->part_name + "_" + slot;
             if (image->IsSecondary() && should_flash_in_userspace(partition_name)) {
-                fp_->fb->DeletePartition(partition_name);
+                tasks.emplace_back(std::make_unique<DeleteTask>(fp_, partition_name));
             }
-            tasks.emplace_back(std::make_unique<DeleteTask>(fp_, partition_name));
         }
     }
 
@@ -2136,7 +2129,7 @@
     if (metadata.block_devices.size() > 1) {
         ok = WriteSplitImageFiles(temp_dir.path, metadata, block_size, {}, true);
     } else {
-        auto image_path = temp_dir.path + "/"s + super_bdev_name + ".img";
+        auto image_path = std::string(temp_dir.path) + "/" + std::string(super_bdev_name) + ".img";
         ok = WriteToImageFile(image_path, metadata, block_size, {}, true);
     }
     if (!ok) {
@@ -2155,7 +2148,7 @@
             image_name = partition + ".img";
         }
 
-        auto image_path = temp_dir.path + "/"s + image_name;
+        auto image_path = std::string(temp_dir.path) + "/" + image_name;
         auto flash = [&](const std::string& partition_name) {
             do_flash(partition_name.c_str(), image_path.c_str(), false, fp);
         };