summaryrefslogtreecommitdiffstats
path: root/gui/action.cpp
diff options
context:
space:
mode:
authorthat <github@that.at>2015-12-26 20:53:51 +0100
committerEthan Yonker <dees_troy@teamw.in>2015-12-29 22:39:57 +0100
commit10ae24ff94396c67e773e3ce967bce82cdb9b4f6 (patch)
tree8f8ee4bf0fcc61b3df78a5b39b3893defd189f53 /gui/action.cpp
parentdo not include stlport headers unless link to it (diff)
downloadandroid_bootable_recovery-10ae24ff94396c67e773e3ce967bce82cdb9b4f6.tar
android_bootable_recovery-10ae24ff94396c67e773e3ce967bce82cdb9b4f6.tar.gz
android_bootable_recovery-10ae24ff94396c67e773e3ce967bce82cdb9b4f6.tar.bz2
android_bootable_recovery-10ae24ff94396c67e773e3ce967bce82cdb9b4f6.tar.lz
android_bootable_recovery-10ae24ff94396c67e773e3ce967bce82cdb9b4f6.tar.xz
android_bootable_recovery-10ae24ff94396c67e773e3ce967bce82cdb9b4f6.tar.zst
android_bootable_recovery-10ae24ff94396c67e773e3ce967bce82cdb9b4f6.zip
Diffstat (limited to '')
-rw-r--r--gui/action.cpp44
1 files changed, 13 insertions, 31 deletions
diff --git a/gui/action.cpp b/gui/action.cpp
index 20944dac7..081e2d134 100644
--- a/gui/action.cpp
+++ b/gui/action.cpp
@@ -226,6 +226,7 @@ GUIAction::GUIAction(xml_node<>* node)
ADD_ACTION(resize);
ADD_ACTION(changefilesystem);
ADD_ACTION(flashimage);
+ ADD_ACTION(twcmd);
}
// First, get the action
@@ -522,7 +523,6 @@ int GUIAction::reboot(std::string arg)
int GUIAction::home(std::string arg __unused)
{
- PageManager::SelectPackage("TWRP");
gui_changePage("main");
return 0;
}
@@ -1536,41 +1536,12 @@ int GUIAction::adbsideloadcancel(std::string arg __unused)
int GUIAction::openrecoveryscript(std::string arg __unused)
{
- int op_status = 1;
-
operation_start("OpenRecoveryScript");
if (simulate) {
simulate_progress_bar();
operation_end(0);
} else {
- // Check for the SCRIPT_FILE_TMP first as these are AOSP recovery commands
- // that we converted to ORS commands during boot in recovery.cpp.
- // Run those first.
- int reboot = 0;
- if (TWFunc::Path_Exists(SCRIPT_FILE_TMP)) {
- gui_msg("running_recovery_commands=Running Recovery Commands");
- if (OpenRecoveryScript::run_script_file() == 0) {
- reboot = 1;
- op_status = 0;
- }
- }
- // Check for the ORS file in /cache and attempt to run those commands.
- if (OpenRecoveryScript::check_for_script_file()) {
- gui_msg("running_ors=Running OpenRecoveryScript");
- if (OpenRecoveryScript::run_script_file() == 0) {
- reboot = 1;
- op_status = 0;
- }
- }
- if (reboot) {
- // Disable stock recovery reflashing
- TWFunc::Disable_Stock_Recovery_Replace();
- usleep(2000000); // Sleep for 2 seconds before rebooting
- TWFunc::tw_reboot(rb_system);
- usleep(5000000); // Sleep for 5 seconds to allow reboot to occur
- } else {
- DataManager::SetValue("tw_page_done", 1);
- }
+ int op_status = OpenRecoveryScript::Run_OpenRecoveryScript_Action();
operation_end(op_status);
}
return 0;
@@ -1743,6 +1714,17 @@ int GUIAction::flashimage(std::string arg __unused)
return 0;
}
+int GUIAction::twcmd(std::string arg)
+{
+ operation_start("TWRP CLI Command");
+ if (simulate)
+ simulate_progress_bar();
+ else
+ OpenRecoveryScript::Run_CLI_Command(arg.c_str());
+ operation_end(0);
+ return 0;
+}
+
int GUIAction::getKeyByName(std::string key)
{
if (key == "home") return KEY_HOME;