Add the ability to revert a crypto mapping when unmounting a volume
Add the force_and_revert option to the unmount command which will force
the unmount, and revert a crypto mapping. This is used during factory
reset so that when the internal sdcard volume is formatted, it formats
the raw device, not the encrypted mapping.
Change-Id: I36b6ff9bb54863b121de635472a303bf4a2334a9
diff --git a/VolumeManager.cpp b/VolumeManager.cpp
index 0f04a06..0eb72a1 100644
--- a/VolumeManager.cpp
+++ b/VolumeManager.cpp
@@ -1045,7 +1045,7 @@
VolumeManager *vm = VolumeManager::Instance();
vm->disableVolumeManager();
vm->unshareVolume(label, "ums");
- return vm->unmountVolume(label, true);
+ return vm->unmountVolume(label, true, false);
}
extern "C" int vold_getNumDirectVolumes(void) {
@@ -1087,7 +1087,7 @@
return 0;
}
-int VolumeManager::unmountVolume(const char *label, bool force) {
+int VolumeManager::unmountVolume(const char *label, bool force, bool revert) {
Volume *v = lookupVolume(label);
if (!v) {
@@ -1109,7 +1109,7 @@
cleanupAsec(v, force);
- return v->unmountVol(force);
+ return v->unmountVol(force, revert);
}
/*