vab support: merges and unmapping super devices

- check for merges before formatting data
- add advanced option for unmapping super devices

Change-Id: I38d4d3bbdfa071969016c3e000c86a4d03c71e45
This commit is contained in:
bigbiff
2021-08-09 23:04:33 +00:00
parent d1e556a9a2
commit cfa875c4d4
14 changed files with 178 additions and 19 deletions
+23 -1
View File
@@ -32,6 +32,8 @@
#include <libgen.h>
#include <zlib.h>
#include <sstream>
#include <android-base/properties.h>
#include <libsnapshot/snapshot.h>
#include "cutils/properties.h"
#include "libblkid/include/blkid.h"
@@ -1714,7 +1716,6 @@ bool TWPartition::Wipe(string New_File_System) {
recreate_media = false;
} else {
DataManager::GetValue(TW_RM_RF_VAR, check);
if (check || Use_Rm_Rf)
wiped = Wipe_RMRF();
else if (New_File_System == "ext4")
@@ -3473,3 +3474,24 @@ std::string TWPartition::Get_Display_Name() {
bool TWPartition::Is_SlotSelect() {
return SlotSelect;
}
bool TWPartition::Check_Pending_Merges() {
auto sm = android::snapshot::SnapshotManager::NewForFirstStageMount();
if (!sm) {
LOGERR("Unable to call snapshot manager\n");
return false;
}
auto callback = [&]() -> void {
double progress;
sm->GetUpdateState(&progress);
LOGINFO("waiting for merge to complete: %.2f\n", progress);
};
LOGINFO("checking for merges\n");
if (!sm->HandleImminentDataWipe(callback)) {
LOGERR("Unable to check merge status\n");
return false;
}
return true;
}