Remove SystemState dependency from HttpFetcher and InstallPlan.
The SystemState class is an aggregation of all the update_engine
singletons, making it easy to handle cross-dependencies between these
singletons. Nevertheless, since we split the code into a smaller
libpayload_consumer library we need to remove the global dependencies
on the SystemState class from this library and specialize those
dependencies to the actual required class.
Bug: 25773375
TEST=FEATURES=test emerge-link update_engine; mma
Change-Id: I8800157c969db6a8d168f33ac2c6aad4f34fa236
diff --git a/payload_consumer/delta_performer.cc b/payload_consumer/delta_performer.cc
index 99db3bf..21d8e54 100644
--- a/payload_consumer/delta_performer.cc
+++ b/payload_consumer/delta_performer.cc
@@ -803,7 +803,7 @@
install_plan_->partitions.push_back(install_part);
}
- if (!install_plan_->LoadPartitionsFromSlots(system_state_)) {
+ if (!install_plan_->LoadPartitionsFromSlots(system_state_->boot_control())) {
LOG(ERROR) << "Unable to determine all the partition devices.";
*error = ErrorCode::kInstallDeviceOpenError;
return false;
diff --git a/payload_consumer/install_plan.cc b/payload_consumer/install_plan.cc
index f404c20..a2a1b7b 100644
--- a/payload_consumer/install_plan.cc
+++ b/payload_consumer/install_plan.cc
@@ -89,18 +89,18 @@
powerwash_required);
}
-bool InstallPlan::LoadPartitionsFromSlots(SystemState* system_state) {
+bool InstallPlan::LoadPartitionsFromSlots(BootControlInterface* boot_control) {
bool result = true;
for (Partition& partition : partitions) {
if (source_slot != BootControlInterface::kInvalidSlot) {
- result = system_state->boot_control()->GetPartitionDevice(
+ result = boot_control->GetPartitionDevice(
partition.name, source_slot, &partition.source_path) && result;
} else {
partition.source_path.clear();
}
if (target_slot != BootControlInterface::kInvalidSlot) {
- result = system_state->boot_control()->GetPartitionDevice(
+ result = boot_control->GetPartitionDevice(
partition.name, target_slot, &partition.target_path) && result;
} else {
partition.target_path.clear();
diff --git a/payload_consumer/install_plan.h b/payload_consumer/install_plan.h
index f412499..e69462d 100644
--- a/payload_consumer/install_plan.h
+++ b/payload_consumer/install_plan.h
@@ -25,7 +25,6 @@
#include "update_engine/common/action.h"
#include "update_engine/common/boot_control_interface.h"
-#include "update_engine/system_state.h"
// InstallPlan is a simple struct that contains relevant info for many
// parts of the update system about the install that should happen.
@@ -52,7 +51,7 @@
// Load the |source_path| and |target_path| of all |partitions| based on the
// |source_slot| and |target_slot| if available. Returns whether it succeeded
// to load all the partitions for the valid slots.
- bool LoadPartitionsFromSlots(SystemState* system_state);
+ bool LoadPartitionsFromSlots(BootControlInterface* boot_control);
bool is_resume{false};
bool is_full_update{false};