Add an option to one click flash current booted TWRP ramdisk
Change-Id: I12303696698a5feaa43401bcac9e30d5b3b99a0c
diff --git a/twrpinstall/twinstall.cpp b/twrpinstall/twinstall.cpp
index 139e983..7f9e8c0 100755
--- a/twrpinstall/twinstall.cpp
+++ b/twrpinstall/twinstall.cpp
@@ -55,6 +55,7 @@
#include "gui/pages.hpp"
#include "twinstall.h"
#include "installcommand.h"
+#include "../twrpRepacker.hpp"
extern "C" {
#include "gui/gui.h"
}
@@ -242,7 +243,7 @@
}
int TWinstall_zip(const char* path, int* wipe_cache, bool check_for_digest) {
- int ret_val, zip_verify = 1, unmount_system = 1;
+ int ret_val, zip_verify = 1, unmount_system = 1, reflashtwrp = 0;
gui_msg(Msg("installing_zip=Installing zip file '{1}'")(path));
if (strlen(path) < 9 || strncmp(path, "/sideload", 9) != 0) {
@@ -350,6 +351,11 @@
gui_warn("mount_vab_partitions=Devices on super may not mount until rebooting recovery.");
}
gui_warn("flash_ab_reboot=To flash additional zips, please reboot recovery to switch to the updated slot.");
+ DataManager::GetValue(TW_AUTO_REFLASHTWRP_VAR, reflashtwrp);
+ if (reflashtwrp) {
+ twrpRepacker repacker;
+ repacker.Flash_Current_Twrp();
+ }
} else {
std::string binary_name("ui.xml");
ZipEntry binary_entry;