summaryrefslogtreecommitdiffstats
path: root/gui
diff options
context:
space:
mode:
authorDees_Troy <dees_troy@teamw.in>2012-09-17 22:00:01 +0200
committerDees_Troy <dees_troy@teamw.in>2012-09-17 22:06:12 +0200
commit43d8b0077072ff4ef5ffa07be5dcbf7a73fe499f (patch)
tree58d02c17fb5487c361244a69a8a9850337638f2d /gui
parentMove to shared libmincrypt (diff)
downloadandroid_bootable_recovery-43d8b0077072ff4ef5ffa07be5dcbf7a73fe499f.tar
android_bootable_recovery-43d8b0077072ff4ef5ffa07be5dcbf7a73fe499f.tar.gz
android_bootable_recovery-43d8b0077072ff4ef5ffa07be5dcbf7a73fe499f.tar.bz2
android_bootable_recovery-43d8b0077072ff4ef5ffa07be5dcbf7a73fe499f.tar.lz
android_bootable_recovery-43d8b0077072ff4ef5ffa07be5dcbf7a73fe499f.tar.xz
android_bootable_recovery-43d8b0077072ff4ef5ffa07be5dcbf7a73fe499f.tar.zst
android_bootable_recovery-43d8b0077072ff4ef5ffa07be5dcbf7a73fe499f.zip
Diffstat (limited to 'gui')
-rw-r--r--gui/action.cpp43
-rwxr-xr-xgui/devices/800x1280/res/ui.xml15
2 files changed, 53 insertions, 5 deletions
diff --git a/gui/action.cpp b/gui/action.cpp
index b050febd0..3d6c9ebaa 100644
--- a/gui/action.cpp
+++ b/gui/action.cpp
@@ -21,6 +21,9 @@
#include "../partitions.hpp"
#include "../twrp-functions.hpp"
+#include "../ui.h"
+#include "../adb_install.h"
+
extern "C" {
#include "../common.h"
#include "../roots.h"
@@ -31,6 +34,8 @@ extern "C" {
#include "../variables.h"
#include "../twinstall.h"
+#include "../minadbd/adb.h"
+
int TWinstall_zip(const char* path, int* wipe_cache);
void wipe_dalvik_cache(void);
int check_backup_name(int show_error);
@@ -55,6 +60,8 @@ int gui_start();
#include "rapidxml.hpp"
#include "objects.hpp"
+extern RecoveryUI* ui;
+
void curtainClose(void);
GUIAction::GUIAction(xml_node<>* node)
@@ -733,6 +740,7 @@ int GUIAction::doAction(Action action, int isThreaded /* = 0 */)
if (function == "nandroid")
{
operation_start("Nandroid");
+ int ret = 0;
if (simulate) {
DataManager::SetValue("tw_partition", "Simulation");
@@ -741,21 +749,27 @@ int GUIAction::doAction(Action action, int isThreaded /* = 0 */)
if (arg == "backup") {
string Backup_Name;
DataManager::GetValue(TW_BACKUP_NAME, Backup_Name);
- if (Backup_Name == "(Current Date)" || Backup_Name == "0" || Backup_Name == "(" || check_backup_name(1))
- PartitionManager.Run_Backup(Backup_Name);
- else
+ if (Backup_Name == "(Current Date)" || Backup_Name == "0" || Backup_Name == "(" || check_backup_name(1) == 0)
+ ret = PartitionManager.Run_Backup();
+ else {
+ operation_end(1, simulate);
return -1;
+ }
DataManager::SetValue(TW_BACKUP_NAME, "(Current Date)");
} else if (arg == "restore") {
string Restore_Name;
DataManager::GetValue("tw_restore", Restore_Name);
- PartitionManager.Run_Restore(Restore_Name);
+ ret = PartitionManager.Run_Restore(Restore_Name);
} else {
operation_end(1, simulate);
return -1;
}
}
- operation_end(0, simulate);
+ if (ret == false)
+ ret = 1; // 1 for failure
+ else
+ ret = 0; // 0 for success
+ operation_end(ret, simulate);
return 0;
}
if (function == "fixpermissions")
@@ -1048,6 +1062,25 @@ LOGE("TODO: Implement ORS support\n");
operation_end(op_status, simulate);
return 0;
}
+ if (function == "adbsideload")
+ {
+ int ret = 0;
+
+ operation_start("Sideload");
+ if (simulate) {
+ simulate_progress_bar();
+ } else {
+ int wipe_cache = 0;
+ ui_print("Starting ADB sideload feature...\n");
+ __system("touch /tmp/update.zip");
+ ret = apply_from_adb(ui, &wipe_cache, "/tmp/last_install");
+ LOGI("Result was: %i\n", ret);
+ if (ret != 0)
+ ret = 1;
+ }
+ operation_end(ret, simulate);
+ return 0;
+ }
}
else
{
diff --git a/gui/devices/800x1280/res/ui.xml b/gui/devices/800x1280/res/ui.xml
index 94468d8c0..decfcad55 100755
--- a/gui/devices/800x1280/res/ui.xml
+++ b/gui/devices/800x1280/res/ui.xml
@@ -2541,6 +2541,21 @@
</object>
<object type="button">
+ <placement x="%col1_x%" y="%row4_y%" />
+ <font resource="font" color="%button_text_color%" />
+ <text>ADB Sideload</text>
+ <image resource="main_button" />
+ <actions>
+ <action function="set">tw_action=adbsideload</action>
+ <action function="set">tw_action_text1=ADB Sideload</action>
+ <action function="set">tw_action_text2=Usage: adb sideload filename.zip</action>
+ <action function="set">tw_complete_text1=ADB Sideload Complete</action>
+ <action function="set">tw_slider_text=Swipe to Wipe</action>
+ <action function="page">action_page</action>
+ </actions>
+ </object>
+
+ <object type="button">
<condition var1="tw_show_dumlock" var2="1" />
<placement x="%col2_x%" y="%row4_y%" />
<font resource="font" color="%button_text_color%" />