Add support to fastboot_driver for sending sparse images with CRC check
The default argument will prevent anything from breaking
Test: Build on glinux
Change-Id: Ib427ab210476db1ec1c69c0a3238d0653e98b79a
diff --git a/fastboot/fastboot_driver.cpp b/fastboot/fastboot_driver.cpp
index 55ca65d..c508abe 100644
--- a/fastboot/fastboot_driver.cpp
+++ b/fastboot/fastboot_driver.cpp
@@ -220,10 +220,10 @@
return HandleResponse(response, info);
}
-RetCode FastBootDriver::Download(sparse_file* s, std::string* response,
+RetCode FastBootDriver::Download(sparse_file* s, bool use_crc, std::string* response,
std::vector<std::string>* info) {
error_ = "";
- int64_t size = sparse_file_len(s, true, false);
+ int64_t size = sparse_file_len(s, true, use_crc);
if (size <= 0 || size > MAX_DOWNLOAD_SIZE) {
error_ = "Sparse file is too large or invalid";
return BAD_ARG;
@@ -247,7 +247,7 @@
return data->self->SparseWriteCallback(data->tpbuf, cbuf, len);
};
- if (sparse_file_callback(s, true, false, cb, &cb_priv) < 0) {
+ if (sparse_file_callback(s, true, use_crc, cb, &cb_priv) < 0) {
error_ = "Error reading sparse file";
return IO_ERROR;
}