multiuser: Parse users only when Decrypt_DE runs successfully
Change-Id: I62b3ae3876843387a33ecf25501f7ee50f4c7f99
diff --git a/partition.cpp b/partition.cpp
index cb969a4..7ae43ba 100755
--- a/partition.cpp
+++ b/partition.cpp
@@ -741,18 +741,6 @@
int retry_count = 3;
while (!Decrypt_DE() && --retry_count)
usleep(2000);
- PartitionManager.Parse_Users(); // after load_all_de_keys() to parse_users
- std::vector<users_struct>::iterator iter;
- std::vector<users_struct>* userList = PartitionManager.Get_Users_List();
- for (iter = userList->begin(); iter != userList->end(); iter++) {
- if (atoi((*iter).userId.c_str()) != 0) {
- ExcludeAll(Mount_Point + "/system_de/" + (*iter).userId + "/spblob");
- ExcludeAll(Mount_Point + "/system/users/" + (*iter).userId + "/gatekeeper.password.key");
- ExcludeAll(Mount_Point + "/system/users/" + (*iter).userId + "/gatekeeper.pattern.key");
- ExcludeAll(Mount_Point + "/system/users/" + (*iter).userId + "/locksettings.db");
- ExcludeAll(Mount_Point + "/system/users/" + (*iter).userId + "/locksettings.db-wal");
- }
- }
if (retry_count > 0) {
property_set("ro.crypto.state", "encrypted");
Is_Encrypted = true;
@@ -764,6 +752,18 @@
LOGERR("This TWRP does not have synthetic password decrypt support\n");
pwd_type = 0; // default password
}
+ PartitionManager.Parse_Users(); // after load_all_de_keys() to parse_users
+ std::vector<users_struct>::iterator iter;
+ std::vector<users_struct>* userList = PartitionManager.Get_Users_List();
+ for (iter = userList->begin(); iter != userList->end(); iter++) {
+ if (atoi((*iter).userId.c_str()) != 0) {
+ ExcludeAll(Mount_Point + "/system_de/" + (*iter).userId + "/spblob");
+ ExcludeAll(Mount_Point + "/system/users/" + (*iter).userId + "/gatekeeper.password.key");
+ ExcludeAll(Mount_Point + "/system/users/" + (*iter).userId + "/gatekeeper.pattern.key");
+ ExcludeAll(Mount_Point + "/system/users/" + (*iter).userId + "/locksettings.db");
+ ExcludeAll(Mount_Point + "/system/users/" + (*iter).userId + "/locksettings.db-wal");
+ }
+ }
DataManager::SetValue(TW_CRYPTO_PWTYPE, pwd_type);
DataManager::SetValue("tw_crypto_pwtype_0", pwd_type);
DataManager::SetValue(TW_CRYPTO_PASSWORD, "");