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

Commit 9f5aa032 authored by Paul Crowley's avatar Paul Crowley Committed by android-build-merger
Browse files

Merge "Wipe metadata when we wipe userdata and cache."

am: f88905d2

Change-Id: I92163caab6e2e65565d80bcf7f3661eec757afb1
parents 58729795 f88905d2
Loading
Loading
Loading
Loading
+14 −14
Original line number Original line Diff line number Diff line
@@ -1644,20 +1644,20 @@ int FastBoot::Main(int argc, char* argv[]) {
    }
    }


    if (wants_wipe) {
    if (wants_wipe) {
        fb_queue_erase("userdata");
        std::vector<std::string> partitions = { "userdata", "cache", "metadata" };
        if (set_fbe_marker) {
        for (const auto& partition : partitions) {
            std::string partition_type;
            if (!fb_getvar(transport, std::string{"partition-type:"} + partition, &partition_type)) continue;
            if (partition_type.empty()) continue;
            fb_queue_erase(partition);
            if (partition == "userdata" && set_fbe_marker) {
                fprintf(stderr, "setting FBE marker on initial userdata...\n");
                fprintf(stderr, "setting FBE marker on initial userdata...\n");
                std::string initial_userdata_dir = create_fbemarker_tmpdir();
                std::string initial_userdata_dir = create_fbemarker_tmpdir();
            fb_perform_format(transport, "userdata", 1, "", "", initial_userdata_dir);
                fb_perform_format(transport, partition, 1, "", "", initial_userdata_dir);
                delete_fbemarker_tmpdir(initial_userdata_dir);
                delete_fbemarker_tmpdir(initial_userdata_dir);
            } else {
            } else {
            fb_perform_format(transport, "userdata", 1, "", "", "");
                fb_perform_format(transport, partition, 1, "", "", "");
            }
            }

        std::string cache_type;
        if (fb_getvar(transport, "partition-type:cache", &cache_type) && !cache_type.empty()) {
            fb_queue_erase("cache");
            fb_perform_format(transport, "cache", 1, "", "", "");
        }
        }
    }
    }
    if (wants_set_active) {
    if (wants_set_active) {