summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--partitionmanager.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/partitionmanager.cpp b/partitionmanager.cpp
index ad17fe4a6..945a96cc2 100644
--- a/partitionmanager.cpp
+++ b/partitionmanager.cpp
@@ -1436,12 +1436,10 @@ void TWPartitionManager::Update_System_Details(void) {
int TWPartitionManager::Decrypt_Device(string Password) {
#ifdef TW_INCLUDE_CRYPTO
int ret_val, password_len;
- char crypto_blkdev[255], cPassword[255];
+ char crypto_state[PROPERTY_VALUE_MAX], crypto_blkdev[PROPERTY_VALUE_MAX], cPassword[255];
size_t result;
std::vector<TWPartition*>::iterator iter;
- property_set("ro.crypto.state", "encrypted");
-
// Mount any partitions that need to be mounted for decrypt
for (iter = Partitions.begin(); iter != Partitions.end(); iter++) {
if ((*iter)->Mount_To_Decrypt) {
@@ -1449,6 +1447,13 @@ int TWPartitionManager::Decrypt_Device(string Password) {
}
}
+ property_get("ro.crypto.state", crypto_state, "error");
+ if (strcmp(crypto_state, "error") == 0) {
+ property_set("ro.crypto.state", "encrypted");
+ // Sleep for a bit so that services can start if needed
+ sleep(1);
+ }
+
strcpy(cPassword, Password.c_str());
int pwret = cryptfs_check_passwd(cPassword);