Add missing report of error code under recovery

Add report of kMapFileFailure, kForkUpdateBinaryFailure and
kUpdateBinaryCommandFailure.

Test: unit test pass; kMapFileFailure reports correctly.
Change-Id: I858c81b6c750b5e300b1b12760b1f0fa8e23b47d
This commit is contained in:
Tianjie Xu 2017-08-23 00:18:07 -07:00
parent b4bc57ed39
commit 3fec8c6419
2 changed files with 6 additions and 0 deletions

View file

@ -25,6 +25,9 @@ enum ErrorCode {
kBootreasonInBlacklist, kBootreasonInBlacklist,
kPackageCompatibilityFailure, kPackageCompatibilityFailure,
kScriptExecutionFailure, kScriptExecutionFailure,
kMapFileFailure,
kForkUpdateBinaryFailure,
kUpdateBinaryCommandFailure,
}; };
enum CauseCode { enum CauseCode {

View file

@ -321,6 +321,7 @@ static int try_update_binary(const std::string& package, ZipArchiveHandle zip, b
if (ret) { if (ret) {
close(pipefd[0]); close(pipefd[0]);
close(pipefd[1]); close(pipefd[1]);
log_buffer->push_back(android::base::StringPrintf("error: %d", kUpdateBinaryCommandFailure));
return ret; return ret;
} }
@ -385,6 +386,7 @@ static int try_update_binary(const std::string& package, ZipArchiveHandle zip, b
close(pipefd[0]); close(pipefd[0]);
close(pipefd[1]); close(pipefd[1]);
PLOG(ERROR) << "Failed to fork update binary"; PLOG(ERROR) << "Failed to fork update binary";
log_buffer->push_back(android::base::StringPrintf("error: %d", kForkUpdateBinaryFailure));
return INSTALL_ERROR; return INSTALL_ERROR;
} }
@ -573,6 +575,7 @@ static int really_install_package(const std::string& path, bool* wipe_cache, boo
MemMapping map; MemMapping map;
if (!map.MapFile(path)) { if (!map.MapFile(path)) {
LOG(ERROR) << "failed to map file"; LOG(ERROR) << "failed to map file";
log_buffer->push_back(android::base::StringPrintf("error: %d", kMapFileFailure));
return INSTALL_CORRUPT; return INSTALL_CORRUPT;
} }