Unmap all partitions after postinstall finishes
If we don't unmap partitions, snapuserd will keep running in the
background and do nothing. Unmap partitions so that memory associated
with daemon can be freed.
Test: th, apply an OTA, verify that _b partitions in /dev/block/mapper
are gone
Change-Id: I4a75f4abe3e69f9ad2a67a78472b61cfbd77b0eb
Change-Id: Icacf1699a32bf045c2b832f7c1f021d90805d676
diff --git a/aosp/dynamic_partition_control_android.cc b/aosp/dynamic_partition_control_android.cc
index 4220445..e1f86d8 100644
--- a/aosp/dynamic_partition_control_android.cc
+++ b/aosp/dynamic_partition_control_android.cc
@@ -283,6 +283,7 @@
}
bool DynamicPartitionControlAndroid::UnmapAllPartitions() {
+ snapshot_->UnmapAllSnapshots();
if (mapped_devices_.empty()) {
return false;
}
diff --git a/payload_consumer/postinstall_runner_action.cc b/payload_consumer/postinstall_runner_action.cc
index e3e305b..283a6ba 100644
--- a/payload_consumer/postinstall_runner_action.cc
+++ b/payload_consumer/postinstall_runner_action.cc
@@ -400,6 +400,10 @@
if (HasOutputPipe()) {
SetOutputObject(install_plan_);
}
+ auto dynamic_control = boot_control_->GetDynamicPartitionControl();
+ CHECK(dynamic_control);
+ dynamic_control->UnmapAllPartitions();
+ LOG(INFO) << "Unmapped all partitions.";
}
void PostinstallRunnerAction::SuspendAction() {