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

Commit 4537abda authored by Daniel Zheng's avatar Daniel Zheng Committed by Automerger Merge Worker
Browse files

Merge "Removing is_retrofit code path" into main am: ad1ee13c am: 2d7242c3...

Merge "Removing is_retrofit code path" into main am: ad1ee13c am: 2d7242c3 am: 94483ea6 am: 295b6833 am: 13113929

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



Change-Id: Ic6c55e6a4487486b0b9b81089616c96d60e8e76a
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 88bd554f 13113929
Loading
Loading
Loading
Loading
+0 −28
Original line number Original line Diff line number Diff line
@@ -1414,21 +1414,6 @@ void do_for_partitions(const std::string& part, const std::string& slot,
    }
    }
}
}


bool is_retrofit_device(const ImageSource* source) {
    // Does this device use dynamic partitions at all?
    std::vector<char> contents;
    if (!source->ReadFile("super_empty.img", &contents)) {
        return false;
    }
    auto metadata = android::fs_mgr::ReadFromImageBlob(contents.data(), contents.size());
    for (const auto& partition : metadata->partitions) {
        if (partition.attributes & LP_PARTITION_ATTR_SLOT_SUFFIXED) {
            return true;
        }
    }
    return false;
}

// Fetch a partition from the device to a given fd. This is a wrapper over FetchToFd to fetch
// Fetch a partition from the device to a given fd. This is a wrapper over FetchToFd to fetch
// the full image.
// the full image.
static uint64_t fetch_partition(const std::string& partition, borrowed_fd fd,
static uint64_t fetch_partition(const std::string& partition, borrowed_fd fd,
@@ -1880,19 +1865,6 @@ std::vector<std::unique_ptr<Task>> FlashAllTool::CollectTasksFromImageList() {


    // Sync the super partition. This will reboot to userspace fastboot if needed.
    // Sync the super partition. This will reboot to userspace fastboot if needed.
    tasks.emplace_back(std::make_unique<UpdateSuperTask>(fp_));
    tasks.emplace_back(std::make_unique<UpdateSuperTask>(fp_));
    for (const auto& [image, slot] : os_images_) {
        // Retrofit devices have two super partitions, named super_a and super_b.
        // On these devices, secondary slots must be flashed as physical
        // 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_->source.get())) {
            std::string partition_name = image->part_name + "_" + slot;
            if (image->IsSecondary() &&
                should_flash_in_userspace(fp_->source.get(), partition_name)) {
                tasks.emplace_back(std::make_unique<DeleteTask>(fp_, partition_name));
            }
        }
    }


    AddFlashTasks(os_images_, tasks);
    AddFlashTasks(os_images_, tasks);


+0 −1
Original line number Original line Diff line number Diff line
@@ -188,7 +188,6 @@ int64_t get_sparse_limit(int64_t size, const FlashingPlan* fp);
std::vector<SparsePtr> resparse_file(sparse_file* s, int64_t max_size);
std::vector<SparsePtr> resparse_file(sparse_file* s, int64_t max_size);


bool supports_AB(fastboot::IFastBootDriver* fb);
bool supports_AB(fastboot::IFastBootDriver* fb);
bool is_retrofit_device(const ImageSource* source);
bool is_logical(const std::string& partition);
bool is_logical(const std::string& partition);
void fb_perform_format(const std::string& partition, int skip_if_not_supported,
void fb_perform_format(const std::string& partition, int skip_if_not_supported,
                       const std::string& type_override, const std::string& size_override,
                       const std::string& type_override, const std::string& size_override,