From acfc03463b7fca50f6b176fb1d10aa735aeb2c9d Mon Sep 17 00:00:00 2001 From: Steve Kondik Date: Thu, 3 Apr 2014 22:50:38 -0700 Subject: sr: Add performance control * Crank it up when installing Change-Id: I997d937901ff446834e6c479aaf629bee51de388 --- adb_install.cpp | 4 ++++ install.cpp | 25 ++++++++++++++++++++----- install.h | 2 ++ 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/adb_install.cpp b/adb_install.cpp index a67973d..23bfb51 100644 --- a/adb_install.cpp +++ b/adb_install.cpp @@ -178,11 +178,15 @@ void stop_sideload() { } int wait_sideload() { + set_perf_mode(true); + pthread_join(sideload_thread, NULL); ui->FlushKeys(); maybe_restart_adbd(); + set_perf_mode(false); + return sideload_data.result; } diff --git a/install.cpp b/install.cpp index 709b945..48da7f5 100644 --- a/install.cpp +++ b/install.cpp @@ -37,6 +37,8 @@ #include "verifier.h" #include "ui.h" +#include "cutils/properties.h" + extern RecoveryUI* ui; #define ASSUMED_UPDATE_BINARY_NAME "META-INF/com/google/android/update-binary" @@ -262,6 +264,8 @@ mdtp_update() static int really_install_package(const char *path, bool* wipe_cache, bool needs_mount) { + int ret = 0; + ui->SetBackground(RecoveryUI::INSTALLING_UPDATE); ui->Print("Finding update package...\n"); // Give verification half the progress bar... @@ -315,6 +319,8 @@ really_install_package(const char *path, bool* wipe_cache, bool needs_mount) } LOGI("%d key(s) loaded from %s\n", numKeys, PUBLIC_KEYS_FILE); + set_perf_mode(true); + ui->Print("Verifying update package...\n"); int err; @@ -336,7 +342,8 @@ really_install_package(const char *path, bool* wipe_cache, bool needs_mount) if (err != VERIFY_SUCCESS) { LOGE("signature verification failed\n"); sysReleaseMap(&map); - return INSTALL_CORRUPT; + ret = INSTALL_CORRUPT; + goto out; } /* Try to open the package. @@ -346,14 +353,15 @@ really_install_package(const char *path, bool* wipe_cache, bool needs_mount) if (err != 0) { LOGE("Can't open %s\n(%s)\n", path, err != -1 ? strerror(err) : "bad"); sysReleaseMap(&map); - return INSTALL_CORRUPT; + ret = INSTALL_CORRUPT; + goto out; } /* Verify and install the contents of the package. */ ui->Print("Installing update...\n"); ui->SetEnableReboot(false); - int result = try_update_binary(path, &zip, wipe_cache); + ret = try_update_binary(path, &zip, wipe_cache); ui->SetEnableReboot(true); ui->Print("\n"); @@ -361,7 +369,7 @@ really_install_package(const char *path, bool* wipe_cache, bool needs_mount) #ifdef USE_MDTP /* If MDTP update failed, return an error such that recovery will not finish. */ - if (result == INSTALL_SUCCESS) { + if (ret == INSTALL_SUCCESS) { if (!mdtp_update()) { ui->Print("Unable to verify integrity of /system for MDTP, update aborted.\n"); return INSTALL_ERROR; @@ -370,7 +378,9 @@ really_install_package(const char *path, bool* wipe_cache, bool needs_mount) } #endif /* USE_MDTP */ - return result; +out: + set_perf_mode(false); + return ret; } int @@ -400,3 +410,8 @@ install_package(const char* path, bool* wipe_cache, const char* install_file, } return result; } + +void +set_perf_mode(bool enable) { + property_set("recovery.perf.mode", enable ? "1" : "0"); +} diff --git a/install.h b/install.h index 680499d..e6ce66e 100644 --- a/install.h +++ b/install.h @@ -30,6 +30,8 @@ enum { INSTALL_SUCCESS, INSTALL_ERROR, INSTALL_CORRUPT, INSTALL_NONE }; int install_package(const char* root_path, bool* wipe_cache, const char* install_file, bool needs_mount); +void set_perf_mode(bool enable); + #ifdef __cplusplus } #endif -- cgit v1.1