From 072c8d82dd5718e02bd44479e14e25fb52f13261 Mon Sep 17 00:00:00 2001 From: Ethan Yonker Date: Fri, 26 Aug 2016 22:22:24 -0500 Subject: Support update binary log command Also track and log install time similar to AOSP recovery. Change-Id: I68b41a75cf0d1fa57b693c726cccd382a16f91b1 --- twinstall.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'twinstall.cpp') diff --git a/twinstall.cpp b/twinstall.cpp index 83cd383bc..485eb6065 100644 --- a/twinstall.cpp +++ b/twinstall.cpp @@ -255,6 +255,8 @@ static int Run_Update_Binary(const char *path, ZipArchive *Zip, int* wipe_cache) *wipe_cache = 1; } else if (strcmp(command, "clear_display") == 0) { // Do nothing, not supported by TWRP + } else if (strcmp(command, "log") == 0) { + printf("%s\n", strtok(NULL, "\n")); } else { LOGERR("unknown command [%s]\n", command); } @@ -330,12 +332,18 @@ extern "C" int TWinstall_zip(const char* path, int* wipe_cache) { sysReleaseMap(&map); return INSTALL_CORRUPT; } + time_t start, stop; + time(&start); ret_val = Run_Update_Binary(path, &Zip, wipe_cache); + time(&stop); + int total_time = (int) difftime(stop, start); if (ret_val == INSTALL_CORRUPT) { // If no updater binary is found, check for ui.xml ret_val = Install_Theme(path, &Zip); if (ret_val == INSTALL_CORRUPT) gui_msg(Msg(msg::kError, "no_updater_binary=Could not find '{1}' in the zip file.")(ASSUMED_UPDATE_BINARY_NAME)); + } else { + LOGINFO("Install took %i second(s).\n", total_time); } sysReleaseMap(&map); return ret_val; -- cgit v1.2.3