Allow OTA package size larger than 2GiB(2147483647 bytes) on sideload.

At present, multiple partitions such as vendor have been added,
which reduces the coupling between mobile phone manufacturers
and Android systems. However, it may increase the generated
package size substantially (e.g. from ~200MB to ~800MB).
Causes the package size to exceed the int limit (2147483647 bytes).
Change the int length parameters to long.

Bug: http://b/112003354
Test: adb sideload ota.zip (ota.zip bigger than 2147483647 bytes)
Change-Id: Ifb656431f7b961ac0e91754107578dc8b89ff14e
Signed-off-by: katao <katao@xiaomi.com>
This commit is contained in:
katao 2018-09-20 20:34:05 +08:00 committed by Tao Bao
parent 9c675b0964
commit 77d6173714

View file

@ -33,19 +33,20 @@
#include "sysdeps.h"
static void sideload_host_service(unique_fd sfd, const std::string& args) {
int file_size;
int block_size;
if (sscanf(args.c_str(), "%d:%d", &file_size, &block_size) != 2) {
printf("bad sideload-host arguments: %s\n", args.c_str());
exit(1);
}
int64_t file_size;
int block_size;
if ((sscanf(args.c_str(), "%" SCNd64 ":%d", &file_size, &block_size) != 2) || file_size <= 0 ||
block_size <= 0) {
printf("bad sideload-host arguments: %s\n", args.c_str());
exit(1);
}
printf("sideload-host file size %d block size %d\n", file_size, block_size);
printf("sideload-host file size %" PRId64 " block size %d\n", file_size, block_size);
int result = run_adb_fuse(sfd, file_size, block_size);
int result = run_adb_fuse(sfd, file_size, block_size);
printf("sideload_host finished\n");
exit(result == 0 ? 0 : 1);
printf("sideload_host finished\n");
exit(result == 0 ? 0 : 1);
}
unique_fd daemon_service_to_fd(const char* name, atransport* /* transport */) {