aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Kondik <shade@chemlab.org>2014-04-03 22:50:38 -0700
committerTom Marshall <tdm@cyngn.com>2015-03-10 10:23:02 -0700
commitf75d91b84ab928ad7f5a47ef5ad6c5044461e8b6 (patch)
treef819e5a5e67c08f009b77a49b03635b46b063e78
parent7fb6bb51a670b063e3d67fb7933282d4387dc81b (diff)
downloadandroid_bootable_recovery-f75d91b84ab928ad7f5a47ef5ad6c5044461e8b6.tar.gz
android_bootable_recovery-f75d91b84ab928ad7f5a47ef5ad6c5044461e8b6.tar.bz2
android_bootable_recovery-f75d91b84ab928ad7f5a47ef5ad6c5044461e8b6.zip
sr: Add performance control
* Crank it up when installing Change-Id: I997d937901ff446834e6c479aaf629bee51de388
-rw-r--r--adb_install.cpp4
-rw-r--r--install.cpp23
-rw-r--r--install.h2
3 files changed, 25 insertions, 4 deletions
diff --git a/adb_install.cpp b/adb_install.cpp
index 5584f1f3..58cb34a5 100644
--- a/adb_install.cpp
+++ b/adb_install.cpp
@@ -163,6 +163,8 @@ apply_from_adb(int* wipe_cache, const char* install_file) {
waitpid(waiter.child, &status, 0);
}
+ set_perf_mode(true);
+
set_usb_driver(false);
maybe_restart_adbd();
@@ -171,5 +173,7 @@ apply_from_adb(int* wipe_cache, const char* install_file) {
pthread_join(sideload_thread, NULL);
ui->FlushKeys();
+ set_perf_mode(false);
+
return result;
}
diff --git a/install.cpp b/install.cpp
index 8ddae4f2..688ec698 100644
--- a/install.cpp
+++ b/install.cpp
@@ -34,6 +34,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"
@@ -184,6 +186,8 @@ try_update_binary(const char *path, ZipArchive *zip, int* wipe_cache) {
static int
really_install_package(const char *path, int* 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...
@@ -237,6 +241,8 @@ really_install_package(const char *path, int* 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;
@@ -246,7 +252,8 @@ really_install_package(const char *path, int* 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.
@@ -256,20 +263,23 @@ really_install_package(const char *path, int* 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");
sysReleaseMap(&map);
- return result;
+out:
+ set_perf_mode(false);
+ return ret;
}
int
@@ -297,3 +307,8 @@ install_package(const char* path, int* 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 53c0d312..5478a115 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, int* wipe_cache,
const char* install_file, bool needs_mount);
+void set_perf_mode(bool enable);
+
#ifdef __cplusplus
}
#endif