Adding in wipe tasks before other tasks run.

if we call -w and a reboot task runs beforehand, we don't actually wipe
the given partitions. We want the wipe to occur before reboots.

Test: fastboot flashall -w
Change-Id: If327c5de0858e222cf5fc14531bc20fb741c2960
This commit is contained in:
Daniel Zheng 2023-06-05 10:30:44 -07:00
parent 507c5f9476
commit 303fb49cc0

View file

@ -2583,10 +2583,13 @@ int FastBootTool::Main(int argc, char* argv[]) {
if (fp->force_flash) {
CancelSnapshotIfNeeded();
}
std::vector<std::unique_ptr<Task>> wipe_tasks;
std::vector<std::string> partitions = {"userdata", "cache", "metadata"};
for (const auto& partition : partitions) {
tasks.emplace_back(std::make_unique<WipeTask>(fp.get(), partition));
wipe_tasks.emplace_back(std::make_unique<WipeTask>(fp.get(), partition));
}
tasks.insert(tasks.begin(), std::make_move_iterator(wipe_tasks.begin()),
std::make_move_iterator(wipe_tasks.end()));
}
if (fp->wants_set_active) {
fb->SetActive(next_active);