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-10 19:18:17 +0100
commit9270a20a801403c9f60d6a701b39eae70d380403 (patch)
tree5bdb058af5b05a65112297a504018ee356e0ddbb /recovery.cpp
parentRename (IF_)LOGW(_IF) to (IF_)ALOGW(_IF) DO NOT MERGE (diff)
downloadandroid_bootable_recovery-9270a20a801403c9f60d6a701b39eae70d380403.tar
android_bootable_recovery-9270a20a801403c9f60d6a701b39eae70d380403.tar.gz
android_bootable_recovery-9270a20a801403c9f60d6a701b39eae70d380403.tar.bz2
android_bootable_recovery-9270a20a801403c9f60d6a701b39eae70d380403.tar.lz
android_bootable_recovery-9270a20a801403c9f60d6a701b39eae70d380403.tar.xz
android_bootable_recovery-9270a20a801403c9f60d6a701b39eae70d380403.tar.zst
android_bootable_recovery-9270a20a801403c9f60d6a701b39eae70d380403.zip
Diffstat (limited to '')
-rw-r--r--recovery.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/recovery.cpp b/recovery.cpp
index da9334aae..726442b84 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' },
@@ -725,6 +729,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;
}
}
}
@@ -741,6 +760,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();