Add support for multi-user decryption
* Add CLI support using the command "twrp decrypt <PASSWORD> [USER ID]" * Add GUI support using the menu Advanced --> Decrypt User Change-Id: Id2681bc2b1012a0571417f7a6e0b980b1b25c61c (cherry picked from commit 5a79f67a1b1bd1bcadeca0a4896a871646652534)
This commit is contained in:
@@ -307,8 +307,11 @@ int main(int argc, char **argv) {
|
||||
|
||||
// Offer to decrypt if the device is encrypted
|
||||
if (DataManager::GetIntValue(TW_IS_ENCRYPTED) != 0) {
|
||||
if (SkipDecryption) {
|
||||
LOGINFO("Skipping decryption\n");
|
||||
LOGINFO("Is encrypted, do decrypt page first\n");
|
||||
if (DataManager::GetIntValue(TW_IS_FBE))
|
||||
DataManager::SetValue("tw_crypto_user_id", "0");
|
||||
if (gui_startPage("decrypt", 1, 1) != 0) {
|
||||
LOGERR("Failed to start decrypt GUI page.\n");
|
||||
} else {
|
||||
LOGINFO("Is encrypted, do decrypt page first\n");
|
||||
if (gui_startPage("decrypt", 1, 1) != 0) {
|
||||
@@ -329,8 +332,7 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
|
||||
// Fixup the RTC clock on devices which require it
|
||||
if (crash_counter == 0)
|
||||
TWFunc::Fixup_Time_On_Boot();
|
||||
if (crash_counter == 0) TWFunc::Fixup_Time_On_Boot();
|
||||
|
||||
// Read the settings file
|
||||
TWFunc::Update_Log_File();
|
||||
@@ -341,7 +343,9 @@ int main(int argc, char **argv) {
|
||||
// Run any outstanding OpenRecoveryScript
|
||||
std::string cacheDir = TWFunc::get_cache_dir();
|
||||
std::string orsFile = cacheDir + "/recovery/openrecoveryscript";
|
||||
if ((DataManager::GetIntValue(TW_IS_ENCRYPTED) == 0 || SkipDecryption) && (TWFunc::Path_Exists(SCRIPT_FILE_TMP) || TWFunc::Path_Exists(orsFile))) {
|
||||
|
||||
if (TWFunc::Path_Exists(SCRIPT_FILE_TMP) ||
|
||||
(DataManager::GetIntValue(TW_IS_ENCRYPTED) == 0 && TWFunc::Path_Exists(orsFile))) {
|
||||
OpenRecoveryScript::Run_OpenRecoveryScript();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user