Snap for 8779833 from 2a8f89270f04d3a7b3f77f86e178d7c2edf48d89 to tm-qpr1-release
Change-Id: I143dc7dd9c06c2e6d22fba50fdba62e92fede1e6
diff --git a/aosp/dynamic_partition_control_android.cc b/aosp/dynamic_partition_control_android.cc
index 27d1d54..334ccdc 100644
--- a/aosp/dynamic_partition_control_android.cc
+++ b/aosp/dynamic_partition_control_android.cc
@@ -98,7 +98,8 @@
constexpr std::chrono::milliseconds kMapSnapshotTimeout{10000};
DynamicPartitionControlAndroid::~DynamicPartitionControlAndroid() {
- Cleanup();
+ UnmapAllPartitions();
+ metadata_device_.reset();
}
static FeatureFlag GetFeatureFlag(const char* enable_prop,
@@ -312,6 +313,12 @@
void DynamicPartitionControlAndroid::Cleanup() {
UnmapAllPartitions();
metadata_device_.reset();
+ if (GetVirtualAbFeatureFlag().IsEnabled()) {
+ snapshot_ = SnapshotManager::New();
+ } else {
+ snapshot_ = SnapshotManagerStub::New();
+ }
+ CHECK(snapshot_ != nullptr) << "Cannot initialize SnapshotManager.";
}
bool DynamicPartitionControlAndroid::DeviceExists(const std::string& path) {