Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3d0d8e4b authored by Daniel Zheng's avatar Daniel Zheng Committed by Gerrit Code Review
Browse files

Merge changes I343272f4,I5481893a into main

* changes:
  Removing headers + using string
  Removing double delete from flashall
parents 532a608f 8aba6d02
Loading
Loading
Loading
Loading
+5 −12
Original line number Diff line number Diff line
@@ -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::ReadFully;
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 @@ Result<NetworkSerial, FastbootError> ParseNetworkSerial(const std::string& seria
//
// 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,13 +1877,12 @@ std::vector<std::unique_ptr<Task>> FlashAllTool::CollectTasksFromImageList() {
        // 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));
            }
        }
    }

    AddFlashTasks(os_images_, tasks);

@@ -2136,7 +2129,7 @@ static bool wipe_super(const android::fs_mgr::LpMetadata& metadata, const std::s
    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 @@ static bool wipe_super(const android::fs_mgr::LpMetadata& metadata, const std::s
            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);
        };