From 83bd483f3db1df4b69c1612030e1a1be05b303ad Mon Sep 17 00:00:00 2001 From: Dees_Troy Date: Sat, 4 May 2013 12:39:56 +0000 Subject: Support encrypted backup files Also includes features merged from: Update twrpTar by kokotas Revised function entryExists(). Added function to get archive's uncompressed size. Added option to exclude item(s) from the archive. Revised forks() http://review.teamw.in/#/c/590/ Change-Id: I01fa2c81643161984eff2625247af75990684bd9 --- gui/action.cpp | 37 +++++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) (limited to 'gui/action.cpp') diff --git a/gui/action.cpp b/gui/action.cpp index 64049b2c1..9bd5ce5fb 100644 --- a/gui/action.cpp +++ b/gui/action.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include #include @@ -405,6 +406,7 @@ int GUIAction::doAction(Action action, int isThreaded /* = 0 */) } } operation_end(ret_val, simulate); + return 0; } if (function == "readBackup") @@ -494,6 +496,7 @@ int GUIAction::doAction(Action action, int isThreaded /* = 0 */) PartitionManager.Mount_Current_Storage(true); } operation_end(0, simulate); + return 0; } if (function == "copylog") @@ -705,6 +708,7 @@ int GUIAction::doAction(Action action, int isThreaded /* = 0 */) operation_end(0, simulate); else operation_end(1, simulate); + return 0; } if (function == "flash") @@ -863,6 +867,7 @@ int GUIAction::doAction(Action action, int isThreaded /* = 0 */) } else PartitionManager.Update_System_Details(); operation_end(0, simulate); + return 0; } if (function == "nandroid") { @@ -893,12 +898,13 @@ int GUIAction::doAction(Action action, int isThreaded /* = 0 */) return -1; } } + DataManager::SetValue("tw_encrypt_backup", 0); if (ret == false) ret = 1; // 1 for failure else ret = 0; // 0 for success - operation_end(ret, simulate); - return 0; + operation_end(ret, simulate); + return 0; } if (function == "fixpermissions") { @@ -1226,6 +1232,7 @@ int GUIAction::doAction(Action action, int isThreaded /* = 0 */) DataManager::SetValue("tw_page_done", 1); } } + return 0; } if (function == "installsu") { @@ -1254,16 +1261,38 @@ int GUIAction::doAction(Action action, int isThreaded /* = 0 */) op_status = 1; } + operation_end(op_status, simulate); + return 0; + } + if (function == "decrypt_backup") + { + int op_status = 0; + + operation_start("Try Restore Decrypt"); + if (simulate) { + simulate_progress_bar(); + } else { + string Restore_Path, Filename, Password; + DataManager::GetValue("tw_restore", Restore_Path); + Restore_Path += "/"; + DataManager::GetValue("tw_restore_password", Password); + if (TWFunc::Try_Decrypting_Backup(Restore_Path, Password)) + op_status = 0; // success + else + op_status = 1; // fail + } + operation_end(op_status, simulate); return 0; } } else { - pthread_t t; - pthread_create(&t, NULL, thread_start, this); + pthread_t t; + pthread_create(&t, NULL, thread_start, this); return 0; } + LOGERR("Unknown action '%s'\n", function.c_str()); return -1; } -- cgit v1.2.3