Changing name of flash super layout
OptimizedFlashSuper makes more sense and is more consistent with
should-optimize-super
Test: m fastboot
Change-Id: I6ceb31144dce591e0a53faec68b932112d9cd360
diff --git a/fastboot/fastboot.cpp b/fastboot/fastboot.cpp
index 30eb7b5..29980af 100644
--- a/fastboot/fastboot.cpp
+++ b/fastboot/fastboot.cpp
@@ -1747,7 +1747,7 @@
}
tasks.emplace_back(std::move(task));
}
- if (auto flash_super_task = FlashSuperLayoutTask::InitializeFromTasks(fp, tasks)) {
+ if (auto flash_super_task = OptimizedFlashSuperTask::InitializeFromTasks(fp, tasks)) {
auto it = tasks.begin();
for (size_t i = 0; i < tasks.size(); i++) {
if (auto flash_task = tasks[i]->AsFlashTask()) {
@@ -1849,7 +1849,7 @@
std::vector<std::unique_ptr<Task>> tasks;
AddFlashTasks(boot_images_, tasks);
- if (auto flash_super_task = FlashSuperLayoutTask::Initialize(fp_, os_images_)) {
+ if (auto flash_super_task = OptimizedFlashSuperTask::Initialize(fp_, os_images_)) {
tasks.emplace_back(std::move(flash_super_task));
} else {
// Sync the super partition. This will reboot to userspace fastboot if needed.
@@ -2205,8 +2205,9 @@
{0, 0, 0, 0}};
serial = getenv("FASTBOOT_DEVICE");
- if (!serial)
+ if (!serial) {
serial = getenv("ANDROID_SERIAL");
+ }
int c;
while ((c = getopt_long(argc, argv, "a::hls:S:vw", longopts, &longindex)) != -1) {
diff --git a/fastboot/task.cpp b/fastboot/task.cpp
index c1b9a31..bf64f0e 100644
--- a/fastboot/task.cpp
+++ b/fastboot/task.cpp
@@ -96,17 +96,17 @@
return "reboot " + reboot_target_;
}
-FlashSuperLayoutTask::FlashSuperLayoutTask(const std::string& super_name,
- std::unique_ptr<SuperFlashHelper> helper,
- SparsePtr sparse_layout, uint64_t super_size,
- const FlashingPlan* fp)
+OptimizedFlashSuperTask::OptimizedFlashSuperTask(const std::string& super_name,
+ std::unique_ptr<SuperFlashHelper> helper,
+ 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),
fp_(fp) {}
-void FlashSuperLayoutTask::Run() {
+void OptimizedFlashSuperTask::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.
@@ -120,11 +120,11 @@
// Send the data to the device.
flash_partition_files(super_name_, files);
}
-std::string FlashSuperLayoutTask::ToString() {
+std::string OptimizedFlashSuperTask::ToString() {
return "optimized-flash-super";
}
-std::unique_ptr<FlashSuperLayoutTask> FlashSuperLayoutTask::Initialize(
+std::unique_ptr<OptimizedFlashSuperTask> OptimizedFlashSuperTask::Initialize(
const FlashingPlan* fp, std::vector<ImageEntry>& os_images) {
if (!fp->should_optimize_flash_super) {
LOG(INFO) << "super optimization is disabled";
@@ -188,11 +188,11 @@
};
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, fp);
+ return std::make_unique<OptimizedFlashSuperTask>(super_name, std::move(helper), std::move(s),
+ partition_size, fp);
}
-std::unique_ptr<FlashSuperLayoutTask> FlashSuperLayoutTask::InitializeFromTasks(
+std::unique_ptr<OptimizedFlashSuperTask> OptimizedFlashSuperTask::InitializeFromTasks(
const FlashingPlan* fp, std::vector<std::unique_ptr<Task>>& tasks) {
if (!fp->should_optimize_flash_super) {
LOG(INFO) << "super optimization is disabled";
@@ -261,8 +261,8 @@
};
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, fp);
+ return std::make_unique<OptimizedFlashSuperTask>(super_name, std::move(helper), std::move(s),
+ partition_size, fp);
}
UpdateSuperTask::UpdateSuperTask(const FlashingPlan* fp) : fp_(fp) {}
diff --git a/fastboot/task.h b/fastboot/task.h
index 858f43a..f7c8801 100644
--- a/fastboot/task.h
+++ b/fastboot/task.h
@@ -79,13 +79,13 @@
const FlashingPlan* fp_;
};
-class FlashSuperLayoutTask : public Task {
+class OptimizedFlashSuperTask : public Task {
public:
- FlashSuperLayoutTask(const std::string& super_name, std::unique_ptr<SuperFlashHelper> helper,
- SparsePtr sparse_layout, uint64_t super_size, const FlashingPlan* fp);
- static std::unique_ptr<FlashSuperLayoutTask> Initialize(const FlashingPlan* fp,
- std::vector<ImageEntry>& os_images);
- static std::unique_ptr<FlashSuperLayoutTask> InitializeFromTasks(
+ OptimizedFlashSuperTask(const std::string& super_name, std::unique_ptr<SuperFlashHelper> helper,
+ SparsePtr sparse_layout, uint64_t super_size, const FlashingPlan* fp);
+ static std::unique_ptr<OptimizedFlashSuperTask> Initialize(const FlashingPlan* fp,
+ std::vector<ImageEntry>& os_images);
+ static std::unique_ptr<OptimizedFlashSuperTask> InitializeFromTasks(
const FlashingPlan* fp, std::vector<std::unique_ptr<Task>>& tasks);
using ImageEntry = std::pair<const Image*, std::string>;
void Run() override;