diff options
Diffstat (limited to '')
-rw-r--r-- | gui/Android.mk | 1 | ||||
-rw-r--r-- | gui/action.cpp | 19 | ||||
-rw-r--r-- | gui/devices/common/res/languages/en.xml | 4 | ||||
-rw-r--r-- | gui/gui.cpp | 10 | ||||
-rw-r--r-- | gui/theme/common/landscape.xml | 3 | ||||
-rw-r--r-- | gui/theme/common/languages/en.xml | 4 | ||||
-rw-r--r-- | gui/theme/common/portrait.xml | 12 | ||||
-rw-r--r-- | gui/theme/common/watch.xml | 18 |
8 files changed, 54 insertions, 17 deletions
diff --git a/gui/Android.mk b/gui/Android.mk index 045824df6..98d562944 100644 --- a/gui/Android.mk +++ b/gui/Android.mk @@ -110,6 +110,7 @@ ifeq ($(TW_CUSTOM_THEME),) TW_THEME := landscape_hdpi endif endif + ifeq ($(TWRP_NEW_THEME),true) TWRP_THEME_LOC := $(commands_recovery_local_path)/gui/theme/$(TW_THEME) TWRP_RES := $(commands_recovery_local_path)/gui/theme/common/fonts diff --git a/gui/action.cpp b/gui/action.cpp index aac2c313f..d98a81420 100644 --- a/gui/action.cpp +++ b/gui/action.cpp @@ -1180,9 +1180,8 @@ int GUIAction::nandroid(std::string arg) DataManager::GetValue(TW_BACKUP_NAME, Backup_Name); string auto_gen = gui_lookup("auto_generate", "(Auto Generate)"); if (Backup_Name == auto_gen || Backup_Name == gui_lookup("curr_date", "(Current Date)") || Backup_Name == "0" || Backup_Name == "(" || PartitionManager.Check_Backup_Name(true) == 0) { - ret = PartitionManager.Run_Backup(); - } - else { + ret = PartitionManager.Run_Backup(false); + } else { operation_end(1); return -1; } @@ -1728,12 +1727,16 @@ int GUIAction::flashimage(std::string arg __unused) { int op_status = 0; + PartitionSettings part_settings; operation_start("Flash Image"); - string path, filename, full_filename; - DataManager::GetValue("tw_zip_location", path); - DataManager::GetValue("tw_file", filename); - full_filename = path + "/" + filename; - if (PartitionManager.Flash_Image(full_filename)) + DataManager::GetValue("tw_zip_location", part_settings.Restore_Name); + DataManager::GetValue("tw_file", part_settings.Backup_FileName); + unsigned long long total_bytes = TWFunc::Get_File_Size(part_settings.Restore_Name + "/" + part_settings.Backup_FileName); + ProgressTracking progress(total_bytes); + part_settings.progress = &progress; + part_settings.adbbackup = false; + part_settings.PM_Method = PM_RESTORE; + if (PartitionManager.Flash_Image(&part_settings)) op_status = 0; // success else op_status = 1; // fail diff --git a/gui/devices/common/res/languages/en.xml b/gui/devices/common/res/languages/en.xml index 8ce476254..e47ee7050 100644 --- a/gui/devices/common/res/languages/en.xml +++ b/gui/devices/common/res/languages/en.xml @@ -227,5 +227,9 @@ <string name="change_fs_err">Error changing file system.</string> <string name="theme_ver_err">Custom theme version does not match TWRP version. Using stock theme.</string> <string name="install_reboot">Rebooting in 5 seconds</string> + <string name="adbbackup_error">Error with ADB Backup. Quitting..."</string> + <string name="adbbackup_control_error">Cannot write to adb control channel</string> + <string name="twrp_adbbu_option">--twrp option is required to enable twrp adb backup</string> + <string name="partition_not_found">path: {1} not found in partititon list</string> </resources> </language> diff --git a/gui/gui.cpp b/gui/gui.cpp index 4cf80a482..df41939fb 100644 --- a/gui/gui.cpp +++ b/gui/gui.cpp @@ -460,6 +460,14 @@ static void ors_command_read() gui_set_FILE(orsout); PageManager::GetResources()->DumpStrings(); ors_command_done(); + //check to see if we should show backup page for parsing adbbackup partitions + } else if (strlen(command) == 23 && strncmp(command, "adbbackup", 9) == 0) { + gui_set_FILE(orsout); + DataManager::SetValue("tw_action", "twcmd"); + DataManager::SetValue("tw_action_param", command); + DataManager::SetValue("tw_enable_adb_backup", 1); + gui_changePage("backup"); + ors_command_done(); } else { // mirror output messages gui_set_FILE(orsout); @@ -480,8 +488,6 @@ static void ors_command_read() // put all things that need to be done after the command is finished into ors_command_done, not here } } - } else { - LOGINFO("ORS command line read returned an error: %i, %i, %s\n", read_ret, errno, strerror(errno)); } } diff --git a/gui/theme/common/landscape.xml b/gui/theme/common/landscape.xml index 525a2c1da..a7a59d897 100644 --- a/gui/theme/common/landscape.xml +++ b/gui/theme/common/landscape.xml @@ -1557,6 +1557,7 @@ <conditions> <condition var1="tw_include_encrypted_backup" var2="1"/> <condition var1="tw_encrypt_backup" var2="0"/> + <condition var1="tw_enable_adb_backup" op="!=" var2="1"/> </conditions> <placement x="%col1_x_right%" y="%row3_y%"/> <text>{@enc_disabled=disabled - set a password to enable}</text> @@ -1566,6 +1567,7 @@ <conditions> <condition var1="tw_include_encrypted_backup" var2="1"/> <condition var1="tw_encrypt_backup" var2="1"/> + <condition var1="tw_enable_adb_backup" op="!=" var2="1"/> </conditions> <placement x="%col1_x_right%" y="%row3_y%"/> <text>{@enc_enabled=enabled}</text> @@ -1608,6 +1610,7 @@ </checkbox> <button style="main_button_half_width"> + <condition var1="tw_enable_adb_backup" op="!=" var2="1"/> <placement x="%col1_x_left%" y="%row15a_y%"/> <text>{@select_storage_btn=Select Storage}</text> <actions> diff --git a/gui/theme/common/languages/en.xml b/gui/theme/common/languages/en.xml index 4c26d304f..2b80b25cf 100644 --- a/gui/theme/common/languages/en.xml +++ b/gui/theme/common/languages/en.xml @@ -668,5 +668,9 @@ <string name="theme_ver_err">Custom theme version does not match TWRP version. Using stock theme.</string> <string name="up_a_level">(Up A Level)</string> <string name="install_reboot">Rebooting in 5 seconds</string> + <string name="adbbackup_error">Error with ADB Backup. Quitting..."</string> + <string name="adbbackup_control_error">Cannot write to adb control channel</string> + <string name="twrp_adbbu_option">--twrp option is required to enable twrp adb backup</string> + <string name="partition_not_found">path: {1} not found in partititon list</string> </resources> </language> diff --git a/gui/theme/common/portrait.xml b/gui/theme/common/portrait.xml index 03e3982a2..6b7453845 100644 --- a/gui/theme/common/portrait.xml +++ b/gui/theme/common/portrait.xml @@ -1485,6 +1485,7 @@ <conditions> <condition var1="tw_include_encrypted_backup" var2="1"/> <condition var1="tw_encrypt_backup" var2="0"/> + <condition var1="tw_enable_adb_backup" op="!=" var2="1"/> </conditions> <placement x="%tab3_col3_x%" y="%row1_y%" w="%tab3_width%" h="%tab_height%"/> <text>{@encryption_tab=ENCRYPTION}</text> @@ -1499,6 +1500,7 @@ <conditions> <condition var1="tw_include_encrypted_backup" var2="1"/> <condition var1="tw_encrypt_backup" var2="1"/> + <condition var1="tw_enable_adb_backup" op="!=" var2="1"/> </conditions> <placement x="%tab3_col3_x%" y="%row1_y%" w="%tab3_width%" h="%tab_height%"/> <text>{@encryption_tab=ENCRYPTION}</text> @@ -1524,6 +1526,7 @@ </fill> <button> + <condition var1="tw_enable_adb_backup" op="!=" var2="1"/> <placement x="indent" y="%row3a_y%" w="%content_width%" h="%navbar_height%"/> <fill color="%transparent%"/> <actions> @@ -1540,6 +1543,7 @@ </partitionlist> <button style="main_button_half_height"> + <condition var1="tw_enable_adb_backup" op="!=" var2="1"/> <placement x="%indent%" y="%row18a_y%"/> <text>{@select_storage_btn=Select Storage}</text> <actions> @@ -1596,6 +1600,7 @@ <conditions> <condition var1="tw_include_encrypted_backup" var2="1"/> <condition var1="tw_encrypt_backup" var2="0"/> + <condition var1="tw_enable_adb_backup" op="!=" var2="1"/> </conditions> <placement x="%tab3_col3_x%" y="%row1_y%" w="%tab3_width%" h="%tab_height%"/> <text>{@encryption_tab=ENCRYPTION}</text> @@ -1610,6 +1615,7 @@ <conditions> <condition var1="tw_include_encrypted_backup" var2="1"/> <condition var1="tw_encrypt_backup" var2="1"/> + <condition var1="tw_enable_adb_backup" op="!=" var2="1"/> </conditions> <placement x="%tab3_col3_x%" y="%row1_y%" w="%tab3_width%" h="%tab_height%"/> <text>{@encryption_tab=ENCRYPTION}</text> @@ -1683,6 +1689,7 @@ <conditions> <condition var1="tw_include_encrypted_backup" var2="1"/> <condition var1="tw_encrypt_backup" var2="0"/> + <condition var1="tw_enable_adb_backup" op="!=" var2="1"/> </conditions> <placement x="%tab3_col3_x%" y="%row1_y%" w="%tab3_width%" h="%tab_height%"/> <text>{@encryption_tab=ENCRYPTION}</text> @@ -1697,6 +1704,7 @@ <conditions> <condition var1="tw_include_encrypted_backup" var2="1"/> <condition var1="tw_encrypt_backup" var2="1"/> + <condition var1="tw_enable_adb_backup" op="!=" var2="1"/> </conditions> <placement x="%tab3_col3_x%" y="%row1_y%" w="%tab3_width%" h="%tab_height%"/> <text>{@encryption_tab=ENCRYPTION}</text> @@ -1793,6 +1801,7 @@ <conditions> <condition var1="tw_include_encrypted_backup" var2="1"/> <condition var1="tw_encrypt_backup" var2="0"/> + <condition var1="tw_enable_adb_backup" op="!=" var2="1"/> </conditions> <placement x="%tab3_col3_x%" y="%row1_y%" w="%tab3_width%" h="%tab_height%"/> <text>{@encryption_tab=ENCRYPTION}</text> @@ -1807,6 +1816,7 @@ <conditions> <condition var1="tw_include_encrypted_backup" var2="1"/> <condition var1="tw_encrypt_backup" var2="1"/> + <condition var1="tw_enable_adb_backup" op="!=" var2="1"/> </conditions> <placement x="%tab3_col3_x%" y="%row1_y%" w="%tab3_width%" h="%tab_height%"/> <text>{@encryption_tab=ENCRYPTION}</text> @@ -1899,6 +1909,7 @@ <conditions> <condition var1="tw_include_encrypted_backup" var2="1"/> <condition var1="tw_encrypt_backup" var2="0"/> + <condition var1="tw_enable_adb_backup" op="!=" var2="1"/> </conditions> <placement x="%tab3_col3_x%" y="%row1_y%" w="%tab3_width%" h="%tab_height%"/> <text>{@encryption_tab=ENCRYPTION}</text> @@ -1913,6 +1924,7 @@ <conditions> <condition var1="tw_include_encrypted_backup" var2="1"/> <condition var1="tw_encrypt_backup" var2="1"/> + <condition var1="tw_enable_adb_backup" op="!=" var2="1"/> </conditions> <placement x="%tab3_col3_x%" y="%row1_y%" w="%tab3_width%" h="%tab_height%"/> <text>{@encryption_tab=ENCRYPTION}</text> diff --git a/gui/theme/common/watch.xml b/gui/theme/common/watch.xml index 4516ce262..38a2a238f 100644 --- a/gui/theme/common/watch.xml +++ b/gui/theme/common/watch.xml @@ -213,7 +213,7 @@ <text>{@backup_btn=Backup}</text> <actions> <action function="set">tw_back=main</action> - <action function="page">backup_selectstorage</action> + <action function="page">backup</action> </actions> </button> @@ -1786,7 +1786,7 @@ </action> </page> - <page name="backup_selectstorage"> + <page name="backup"> <template name="page"/> <template name="statusbar"/> @@ -1807,7 +1807,7 @@ <image resource="q_btn_refresh"/> <actions> <action function="refreshsizes"/> - <action function="page">backup_selectstorage</action> + <action function="page">backup</action> </actions> </button> @@ -1824,7 +1824,7 @@ <highlight color="%highlight_color%"/> <image resource="q_btn_arrow_right"/> <actions> - <action function="set">tw_back=backup_selectstorage</action> + <action function="set">tw_back=backup</action> <action function="page">backup_selectpartitions</action> </actions> </button> @@ -1869,7 +1869,7 @@ <placement x="%col1_x_left%" y="%row11_y%"/> <highlight color="%highlight_color%"/> <image resource="q_btn_arrow_left"/> - <action function="page">backup_selectstorage</action> + <action function="page">backup</action> </button> <button> @@ -1946,6 +1946,7 @@ <conditions> <condition var1="tw_include_encrypted_backup" var2="1"/> <condition var1="tw_encrypt_backup" var2="0"/> + <condition var1="tw_enable_adb_backup" op="!=" var2="1"/> </conditions> <placement x="%btn4_col2_x%" y="%row11_y%"/> <highlight color="%highlight_color%"/> @@ -1961,6 +1962,7 @@ <conditions> <condition var1="tw_include_encrypted_backup" var2="1"/> <condition var1="tw_encrypt_backup" var2="1"/> + <condition var1="tw_enable_adb_backup" op="!=" var2="1"/> </conditions> <placement x="%btn4_col2_x%" y="%row11_y%"/> <highlight color="%highlight_color%"/> @@ -2071,7 +2073,7 @@ <placement x="%center_x%" y="%row2_header_y%" w="%screen_half_width%" h="48"/> <actions> <action function="set">tw_back=backup_confirm</action> - <action function="page">backup_selectstorage</action> + <action function="page">backup</action> </actions> </button> @@ -2084,6 +2086,7 @@ <conditions> <condition var1="tw_include_encrypted_backup" var2="1"/> <condition var1="tw_encrypt_backup" var2="0"/> + <condition var1="tw_enable_adb_backup" op="!=" var2="1"/> </conditions> <placement x="%col1_x_right%" y="%row4a_y%"/> <text>{@disabled=Disabled}</text> @@ -2093,6 +2096,7 @@ <conditions> <condition var1="tw_include_encrypted_backup" var2="1"/> <condition var1="tw_encrypt_backup" var2="1"/> + <condition var1="tw_enable_adb_backup" op="!=" var2="1"/> </conditions> <placement x="%col1_x_right%" y="%row4a_y%"/> <text>{@enabled=Enabled}</text> @@ -2146,7 +2150,7 @@ <action> <touch key="back"/> - <action function="page">backup_selectstorage</action> + <action function="page">backup</action> </action> </page> |