summaryrefslogtreecommitdiffstats
path: root/uncrypt/uncrypt.cpp
diff options
context:
space:
mode:
authorYabin Cui <yabinc@google.com>2016-06-09 23:09:39 +0200
committerTao Bao <tbao@google.com>2016-10-19 20:19:15 +0200
commitfd99a318fe630b49ba35f9a19a1866e8b1a42b7e (patch)
tree53388e66db91793598030067dea27790a7f2c0de /uncrypt/uncrypt.cpp
parentMerge "Add a unit test for applypatch_check" (diff)
downloadandroid_bootable_recovery-fd99a318fe630b49ba35f9a19a1866e8b1a42b7e.tar
android_bootable_recovery-fd99a318fe630b49ba35f9a19a1866e8b1a42b7e.tar.gz
android_bootable_recovery-fd99a318fe630b49ba35f9a19a1866e8b1a42b7e.tar.bz2
android_bootable_recovery-fd99a318fe630b49ba35f9a19a1866e8b1a42b7e.tar.lz
android_bootable_recovery-fd99a318fe630b49ba35f9a19a1866e8b1a42b7e.tar.xz
android_bootable_recovery-fd99a318fe630b49ba35f9a19a1866e8b1a42b7e.tar.zst
android_bootable_recovery-fd99a318fe630b49ba35f9a19a1866e8b1a42b7e.zip
Diffstat (limited to '')
-rw-r--r--uncrypt/uncrypt.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/uncrypt/uncrypt.cpp b/uncrypt/uncrypt.cpp
index 8b4d8ef8c..a5d692bbb 100644
--- a/uncrypt/uncrypt.cpp
+++ b/uncrypt/uncrypt.cpp
@@ -528,14 +528,31 @@ static bool setup_bcb(const int socket) {
return false;
}
LOG(INFO) << " received command: [" << content << "] (" << content.size() << ")";
+ std::vector<std::string> options = android::base::Split(content, "\n");
+ std::string wipe_package;
+ for (auto& option : options) {
+ if (android::base::StartsWith(option, "--wipe_package=")) {
+ std::string path = option.substr(strlen("--wipe_package="));
+ if (!android::base::ReadFileToString(path, &wipe_package)) {
+ PLOG(ERROR) << "failed to read " << path;
+ return false;
+ }
+ option = android::base::StringPrintf("--wipe_package_size=%zu", wipe_package.size());
+ }
+ }
// c8. setup the bcb command
std::string err;
- if (!write_bootloader_message({content}, &err)) {
+ if (!write_bootloader_message(options, &err)) {
LOG(ERROR) << "failed to set bootloader message: " << err;
write_status_to_socket(-1, socket);
return false;
}
+ if (!wipe_package.empty() && !write_wipe_package(wipe_package, &err)) {
+ PLOG(ERROR) << "failed to set wipe package: " << err;
+ write_status_to_socket(-1, socket);
+ return false;
+ }
// c10. send "100" status
write_status_to_socket(100, socket);
return true;