summaryrefslogtreecommitdiffstats
path: root/recovery.cpp
diff options
context:
space:
mode:
authorDoug Zongker <dougz@android.com>2012-01-10 00:16:13 +0100
committerDoug Zongker <dougz@android.com>2012-01-18 19:35:28 +0100
commite83b7cf8f1bad5b334b6352d3b850d8555530a9a (patch)
tree3a139cf549726cf66f41ef4899a21cde379a3648 /recovery.cpp
parentfix verifier test (diff)
downloadandroid_bootable_recovery-e83b7cf8f1bad5b334b6352d3b850d8555530a9a.tar
android_bootable_recovery-e83b7cf8f1bad5b334b6352d3b850d8555530a9a.tar.gz
android_bootable_recovery-e83b7cf8f1bad5b334b6352d3b850d8555530a9a.tar.bz2
android_bootable_recovery-e83b7cf8f1bad5b334b6352d3b850d8555530a9a.tar.lz
android_bootable_recovery-e83b7cf8f1bad5b334b6352d3b850d8555530a9a.tar.xz
android_bootable_recovery-e83b7cf8f1bad5b334b6352d3b850d8555530a9a.tar.zst
android_bootable_recovery-e83b7cf8f1bad5b334b6352d3b850d8555530a9a.zip
Diffstat (limited to 'recovery.cpp')
-rw-r--r--recovery.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/recovery.cpp b/recovery.cpp
index a0d96d2aa..3f95372c5 100644
--- a/recovery.cpp
+++ b/recovery.cpp
@@ -40,6 +40,10 @@
#include "ui.h"
#include "screen_ui.h"
#include "device.h"
+#include "adb_install.h"
+extern "C" {
+#include "minadbd/adb.h"
+}
static const struct option OPTIONS[] = {
{ "send_intent", required_argument, NULL, 's' },
@@ -721,6 +725,21 @@ prompt_and_wait(Device* device) {
}
}
break;
+
+ case Device::APPLY_ADB_SIDELOAD:
+ ensure_path_mounted(CACHE_ROOT);
+ status = apply_from_adb(ui, &wipe_cache, TEMPORARY_INSTALL_FILE);
+ if (status >= 0) {
+ if (status != INSTALL_SUCCESS) {
+ ui->SetBackground(RecoveryUI::ERROR);
+ ui->Print("Installation aborted.\n");
+ } else if (!ui->IsTextVisible()) {
+ return; // reboot if logs aren't visible
+ } else {
+ ui->Print("\nInstall from ADB complete.\n");
+ }
+ }
+ break;
}
}
}
@@ -737,6 +756,19 @@ main(int argc, char **argv) {
// If these fail, there's not really anywhere to complain...
freopen(TEMPORARY_LOG_FILE, "a", stdout); setbuf(stdout, NULL);
freopen(TEMPORARY_LOG_FILE, "a", stderr); setbuf(stderr, NULL);
+
+ // If this binary is started with the single argument "--adbd",
+ // instead of being the normal recovery binary, it turns into kind
+ // of a stripped-down version of adbd that only supports the
+ // 'sideload' command. Note this must be a real argument, not
+ // anything in the command file or bootloader control block; the
+ // only way recovery should be run with this argument is when it
+ // starts a copy of itself from the apply_from_adb() function.
+ if (argc == 2 && strcmp(argv[1], "--adbd") == 0) {
+ adb_main();
+ return 0;
+ }
+
printf("Starting recovery on %s", ctime(&start));
Device* device = make_device();