use FlashingPlan sparse_limit for testing
Have get_sparse_limit() return FlashingPlan's sparse limit if set. Used
for testing to compare task lists
Test: fastboot_test
Change-Id: I7ac1eb4dc83a53b3d7aa59aa668a780b4b550664
diff --git a/fastboot/task.cpp b/fastboot/task.cpp
index 96b952c..c1b9a31 100644
--- a/fastboot/task.cpp
+++ b/fastboot/task.cpp
@@ -98,18 +98,20 @@
FlashSuperLayoutTask::FlashSuperLayoutTask(const std::string& super_name,
std::unique_ptr<SuperFlashHelper> helper,
- SparsePtr sparse_layout, uint64_t super_size)
+ SparsePtr sparse_layout, uint64_t super_size,
+ const FlashingPlan* fp)
: super_name_(super_name),
helper_(std::move(helper)),
sparse_layout_(std::move(sparse_layout)),
- super_size_(super_size) {}
+ super_size_(super_size),
+ fp_(fp) {}
void FlashSuperLayoutTask::Run() {
// Use the reported super partition size as the upper limit, rather than
// sparse_file_len, which (1) can fail and (2) is kind of expensive, since
// it will map in all of the embedded fds.
std::vector<SparsePtr> files;
- if (int limit = get_sparse_limit(super_size_)) {
+ if (int limit = get_sparse_limit(super_size_, fp_)) {
files = resparse_file(sparse_layout_.get(), limit);
} else {
files.emplace_back(std::move(sparse_layout_));
@@ -187,7 +189,7 @@
os_images.erase(std::remove_if(os_images.begin(), os_images.end(), remove_if_callback),
os_images.end());
return std::make_unique<FlashSuperLayoutTask>(super_name, std::move(helper), std::move(s),
- partition_size);
+ partition_size, fp);
}
std::unique_ptr<FlashSuperLayoutTask> FlashSuperLayoutTask::InitializeFromTasks(
@@ -260,7 +262,7 @@
tasks.erase(std::remove_if(tasks.begin(), tasks.end(), remove_if_callback), tasks.end());
return std::make_unique<FlashSuperLayoutTask>(super_name, std::move(helper), std::move(s),
- partition_size);
+ partition_size, fp);
}
UpdateSuperTask::UpdateSuperTask(const FlashingPlan* fp) : fp_(fp) {}
@@ -330,7 +332,7 @@
LOG(ERROR) << "wipe task erase failed with partition: " << pname_;
return;
}
- fb_perform_format(pname_, 1, partition_type, "", fp_->fs_options);
+ fb_perform_format(pname_, 1, partition_type, "", fp_->fs_options, fp_);
}
std::string WipeTask::ToString() {