Snap for 6502793 from 02a2e222a9 to mainline-release

Change-Id: I9d151d8f9c727dc2f66796b4d5f3f9fcdc82d1de
This commit is contained in:
android-build-team Robot 2020-05-17 07:01:05 +00:00
commit e877b3cdd6
3 changed files with 10 additions and 14 deletions

View file

@ -311,7 +311,7 @@ static int install_app_incremental(int argc, const char** argv, bool wait, bool
const auto start = clock::now();
int first_apk = -1;
int last_apk = -1;
std::vector<std::string_view> args = {"package"sv};
incremental::Args passthrough_args = {};
for (int i = 0; i < argc; ++i) {
const auto arg = std::string_view(argv[i]);
if (android::base::EndsWithIgnoreCase(arg, ".apk"sv)) {
@ -319,12 +319,11 @@ static int install_app_incremental(int argc, const char** argv, bool wait, bool
if (first_apk == -1) {
first_apk = i;
}
} else if (arg.starts_with("install-"sv)) {
} else if (arg.starts_with("install"sv)) {
// incremental installation command on the device is the same for all its variations in
// the adb, e.g. install-multiple or install-multi-package
args.push_back("install"sv);
} else {
args.push_back(arg);
passthrough_args.push_back(arg);
}
}
@ -345,7 +344,7 @@ static int install_app_incremental(int argc, const char** argv, bool wait, bool
}
printf("Performing Incremental Install\n");
auto server_process = incremental::install(files, silent);
auto server_process = incremental::install(files, passthrough_args, silent);
if (!server_process) {
return -1;
}

View file

@ -93,12 +93,10 @@ static std::pair<unique_fd, std::string> read_and_encode_signature(Size file_siz
// Send install-incremental to the device along with properly configured file descriptors in
// streaming format. Once connection established, send all fs-verity tree bytes.
static unique_fd start_install(const Files& files, bool silent) {
static unique_fd start_install(const Files& files, const Args& passthrough_args, bool silent) {
std::vector<std::string> command_args{"package", "install-incremental"};
command_args.insert(command_args.end(), passthrough_args.begin(), passthrough_args.end());
// fd's with positions at the beginning of fs-verity
std::vector<unique_fd> signature_fds;
signature_fds.reserve(files.size());
for (int i = 0, size = files.size(); i < size; ++i) {
const auto& file = files[i];
@ -118,8 +116,6 @@ static unique_fd start_install(const Files& files, bool silent) {
auto file_desc = StringPrintf("%s:%lld:%d:%s:1", android::base::Basename(file).c_str(),
(long long)st.st_size, i, signature.c_str());
command_args.push_back(std::move(file_desc));
signature_fds.push_back(std::move(signature_fd));
}
std::string error;
@ -150,8 +146,8 @@ bool can_install(const Files& files) {
return true;
}
std::optional<Process> install(const Files& files, bool silent) {
auto connection_fd = start_install(files, silent);
std::optional<Process> install(const Files& files, const Args& passthrough_args, bool silent) {
auto connection_fd = start_install(files, passthrough_args, silent);
if (connection_fd < 0) {
if (!silent) {
fprintf(stderr, "adb: failed to initiate installation on device.\n");

View file

@ -26,9 +26,10 @@
namespace incremental {
using Files = std::vector<std::string>;
using Args = std::vector<std::string_view>;
bool can_install(const Files& files);
std::optional<Process> install(const Files& files, bool silent);
std::optional<Process> install(const Files& files, const Args& passthrough_args, bool silent);
enum class Result { Success, Failure, None };
Result wait_for_installation(int read_fd);