Adding GetInfo method for tasks
Using for easier debugging. Replacing old getter methods in flash task with GetInfo(key) Test: fastboot_test Change-Id: If42df86c4b0278c3dc5525b1058f1947f0b34794
This commit is contained in:
parent
303fb49cc0
commit
665a460e8a
2 changed files with 41 additions and 3 deletions
|
|
@ -46,6 +46,14 @@ void FlashTask::Run() {
|
|||
do_for_partitions(pname_, slot_, flash, true);
|
||||
}
|
||||
|
||||
std::string FlashTask::ToString() {
|
||||
std::string apply_vbmeta_string = "";
|
||||
if (apply_vbmeta_) {
|
||||
apply_vbmeta_string = " --apply_vbmeta";
|
||||
}
|
||||
return "flash" + apply_vbmeta_string + " " + pname_ + " " + fname_;
|
||||
}
|
||||
|
||||
std::string FlashTask::GetPartitionAndSlot() {
|
||||
auto slot = slot_;
|
||||
if (slot.empty()) {
|
||||
|
|
@ -84,6 +92,10 @@ void RebootTask::Run() {
|
|||
}
|
||||
}
|
||||
|
||||
std::string RebootTask::ToString() {
|
||||
return "reboot " + reboot_target_;
|
||||
}
|
||||
|
||||
FlashSuperLayoutTask::FlashSuperLayoutTask(const std::string& super_name,
|
||||
std::unique_ptr<SuperFlashHelper> helper,
|
||||
SparsePtr sparse_layout, uint64_t super_size)
|
||||
|
|
@ -106,6 +118,9 @@ void FlashSuperLayoutTask::Run() {
|
|||
// Send the data to the device.
|
||||
flash_partition_files(super_name_, files);
|
||||
}
|
||||
std::string FlashSuperLayoutTask::ToString() {
|
||||
return "optimized-flash-super";
|
||||
}
|
||||
|
||||
std::unique_ptr<FlashSuperLayoutTask> FlashSuperLayoutTask::Initialize(
|
||||
const FlashingPlan* fp, std::vector<ImageEntry>& os_images) {
|
||||
|
|
@ -263,6 +278,9 @@ void UpdateSuperTask::Run() {
|
|||
}
|
||||
fp_->fb->RawCommand(command, "Updating super partition");
|
||||
}
|
||||
std::string UpdateSuperTask::ToString() {
|
||||
return "update-super";
|
||||
}
|
||||
|
||||
ResizeTask::ResizeTask(const FlashingPlan* fp, const std::string& pname, const std::string& size,
|
||||
const std::string& slot)
|
||||
|
|
@ -277,12 +295,20 @@ void ResizeTask::Run() {
|
|||
do_for_partitions(pname_, slot_, resize_partition, false);
|
||||
}
|
||||
|
||||
std::string ResizeTask::ToString() {
|
||||
return "resize " + pname_;
|
||||
}
|
||||
|
||||
DeleteTask::DeleteTask(const FlashingPlan* fp, const std::string& pname) : fp_(fp), pname_(pname){};
|
||||
|
||||
void DeleteTask::Run() {
|
||||
fp_->fb->DeletePartition(pname_);
|
||||
}
|
||||
|
||||
std::string DeleteTask::ToString() {
|
||||
return "delete " + pname_;
|
||||
}
|
||||
|
||||
WipeTask::WipeTask(const FlashingPlan* fp, const std::string& pname) : fp_(fp), pname_(pname){};
|
||||
|
||||
void WipeTask::Run() {
|
||||
|
|
@ -298,3 +324,7 @@ void WipeTask::Run() {
|
|||
}
|
||||
fb_perform_format(pname_, 1, partition_type, "", fp_->fs_options);
|
||||
}
|
||||
|
||||
std::string WipeTask::ToString() {
|
||||
return "erase " + pname_;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,6 +35,8 @@ class Task {
|
|||
public:
|
||||
Task() = default;
|
||||
virtual void Run() = 0;
|
||||
virtual std::string ToString() = 0;
|
||||
|
||||
virtual FlashTask* AsFlashTask() { return nullptr; }
|
||||
virtual RebootTask* AsRebootTask() { return nullptr; }
|
||||
virtual UpdateSuperTask* AsUpdateSuperTask() { return nullptr; }
|
||||
|
|
@ -49,11 +51,12 @@ class FlashTask : public Task {
|
|||
const bool apply_vbmeta, const FlashingPlan* fp);
|
||||
virtual FlashTask* AsFlashTask() override { return this; }
|
||||
|
||||
void Run() override;
|
||||
std::string ToString() override;
|
||||
std::string GetPartition() { return pname_; }
|
||||
std::string GetImageName() { return fname_; }
|
||||
std::string GetPartitionAndSlot();
|
||||
std::string GetSlot() { return slot_; }
|
||||
void Run() override;
|
||||
std::string GetPartitionAndSlot();
|
||||
|
||||
private:
|
||||
const std::string pname_;
|
||||
|
|
@ -69,6 +72,7 @@ class RebootTask : public Task {
|
|||
RebootTask(const FlashingPlan* fp, const std::string& reboot_target);
|
||||
virtual RebootTask* AsRebootTask() override { return this; }
|
||||
void Run() override;
|
||||
std::string ToString() override;
|
||||
|
||||
private:
|
||||
const std::string reboot_target_ = "";
|
||||
|
|
@ -85,6 +89,7 @@ class FlashSuperLayoutTask : public Task {
|
|||
const FlashingPlan* fp, std::vector<std::unique_ptr<Task>>& tasks);
|
||||
using ImageEntry = std::pair<const Image*, std::string>;
|
||||
void Run() override;
|
||||
std::string ToString() override;
|
||||
|
||||
private:
|
||||
const std::string super_name_;
|
||||
|
|
@ -99,6 +104,7 @@ class UpdateSuperTask : public Task {
|
|||
virtual UpdateSuperTask* AsUpdateSuperTask() override { return this; }
|
||||
|
||||
void Run() override;
|
||||
std::string ToString() override;
|
||||
|
||||
private:
|
||||
const FlashingPlan* fp_;
|
||||
|
|
@ -109,6 +115,7 @@ class ResizeTask : public Task {
|
|||
ResizeTask(const FlashingPlan* fp, const std::string& pname, const std::string& size,
|
||||
const std::string& slot);
|
||||
void Run() override;
|
||||
std::string ToString() override;
|
||||
|
||||
private:
|
||||
const FlashingPlan* fp_;
|
||||
|
|
@ -121,6 +128,7 @@ class DeleteTask : public Task {
|
|||
public:
|
||||
DeleteTask(const FlashingPlan* fp, const std::string& pname);
|
||||
void Run() override;
|
||||
std::string ToString() override;
|
||||
|
||||
private:
|
||||
const FlashingPlan* fp_;
|
||||
|
|
@ -131,8 +139,8 @@ class WipeTask : public Task {
|
|||
public:
|
||||
WipeTask(const FlashingPlan* fp, const std::string& pname);
|
||||
virtual WipeTask* AsWipeTask() override { return this; }
|
||||
|
||||
void Run() override;
|
||||
std::string ToString() override;
|
||||
|
||||
private:
|
||||
const FlashingPlan* fp_;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue