Support update binary log command

Also track and log install time similar to AOSP recovery.

Change-Id: I68b41a75cf0d1fa57b693c726cccd382a16f91b1
This commit is contained in:
Ethan Yonker
2016-08-26 22:22:24 -05:00
parent 534d4e0612
commit 072c8d82dd
+8
View File
@@ -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;