[REFACTOR] DynamicPartitionControl: Add GetSuperPartitionName
fs_mgr_get_super_partition_name() should be mocked because
it is an external dependency to libfs_mgr.
In tests, deliberately make GetSuperDevice() to return "fake_super"
instead of "super" to make sure it is mocked properly.
Test: run unittests
Test: manually apply OTA
Change-Id: I0f05d99bf168b6e658052b4bd67dc1e82ab36471
diff --git a/boot_control_android.cc b/boot_control_android.cc
index 44fc0fa..ce86666 100644
--- a/boot_control_android.cc
+++ b/boot_control_android.cc
@@ -24,8 +24,8 @@
#include <base/logging.h>
#include <bootloader_message/bootloader_message.h>
#include <brillo/message_loops/message_loop.h>
-#include <fs_mgr.h>
#include <fs_mgr_overlayfs.h>
+#include <libdm/dm.h>
#include "update_engine/common/utils.h"
#include "update_engine/dynamic_partition_control_android.h"
@@ -109,7 +109,7 @@
Slot slot,
const string& partition_name_suffix) const {
string source_device =
- device_dir.Append(fs_mgr_get_super_partition_name(slot)).value();
+ device_dir.Append(dynamic_control_->GetSuperPartitionName(slot)).value();
auto source_metadata =
dynamic_control_->LoadMetadataBuilder(source_device, slot);
return source_metadata->HasBlockDevice(partition_name_suffix);
@@ -122,7 +122,7 @@
Slot slot,
string* device) const {
string super_device =
- device_dir.Append(fs_mgr_get_super_partition_name(slot)).value();
+ device_dir.Append(dynamic_control_->GetSuperPartitionName(slot)).value();
auto builder = dynamic_control_->LoadMetadataBuilder(super_device, slot);
@@ -140,8 +140,8 @@
if (IsSuperBlockDevice(device_dir, current_slot, partition_name_suffix)) {
LOG(ERROR) << "The static partition " << partition_name_suffix
<< " is a block device for current metadata ("
- << fs_mgr_get_super_partition_name(current_slot) << ", slot "
- << BootControlInterface::SlotName(current_slot)
+ << dynamic_control_->GetSuperPartitionName(current_slot)
+ << ", slot " << BootControlInterface::SlotName(current_slot)
<< "). It cannot be used as a logical partition.";
return DynamicPartitionDeviceStatus::ERROR;
}