Allow non datamedia devices to wipe encryption

With 5.0 L, we decrypt automatically if the default_password is
used. Non datamedia devices do not get the format data button so
they cannot wipe encryption off the device. This patch add a wipe
encryption button where the format data button would normally be
located on the Wipe page.

This patch also attempts to remove / delete the dm-crypt block
device before formatting.

Change-Id: I100d5d154d6c49254fd48e23279df973db5f23ae
This commit is contained in:
Ethan Yonker
2014-12-20 15:38:29 -06:00
committed by maxwen
parent 726a020632
commit d79d9bceb3
6 changed files with 87 additions and 13 deletions
+10
View File
@@ -1371,6 +1371,15 @@ bool TWPartition::Wipe_Encryption() {
Has_Data_Media = false;
Decrypted_Block_Device = "";
#ifdef TW_INCLUDE_CRYPTO
if (Is_Decrypted) {
if (!UnMount(true))
return false;
if (delete_crypto_blk_dev("userdata") != 0) {
LOGERR("Error deleting crypto block device, continuing anyway.\n");
}
}
#endif
Is_Decrypted = false;
Is_Encrypted = false;
Find_Actual_Block_Device();
@@ -1381,6 +1390,7 @@ bool TWPartition::Wipe_Encryption() {
if (Mount(false))
PartitionManager.Add_MTP_Storage(MTP_Storage_ID);
}
DataManager::SetValue(TW_IS_ENCRYPTED, 0);
#ifndef TW_OEM_BUILD
gui_print("You may need to reboot recovery to be able to use /data again.\n");
#endif