Fix some wording to comply with respectful-code

https: //source.android.com/setup/contribute/respectful-code
Test: Unit tests pass
Change-Id: If447b2cf923f6bc7a3a3fb5f69b9fbc06a200ebb
This commit is contained in:
Tianjie 2020-07-22 17:25:11 -07:00
parent dca4844328
commit 1bc976a74e
4 changed files with 8 additions and 10 deletions

View file

@ -22,7 +22,7 @@ enum ErrorCode : int {
kLowBattery = 20,
kZipVerificationFailure,
kZipOpenFailure,
kBootreasonInBlacklist,
kBootreasonInBlocklist,
kPackageCompatibilityFailure,
kScriptExecutionFailure,
kMapFileFailure,

View file

@ -559,15 +559,15 @@ static void set_retry_bootloader_message(int retry_count, const std::vector<std:
}
}
static bool bootreason_in_blacklist() {
static bool bootreason_in_blocklist() {
std::string bootreason = android::base::GetProperty("ro.boot.bootreason", "");
if (!bootreason.empty()) {
// More bootreasons can be found in "system/core/bootstat/bootstat.cpp".
static const std::vector<std::string> kBootreasonBlacklist{
static const std::vector<std::string> kBootreasonBlocklist{
"kernel_panic",
"Panic",
};
for (const auto& str : kBootreasonBlacklist) {
for (const auto& str : kBootreasonBlocklist) {
if (android::base::EqualsIgnoreCase(str, bootreason)) return true;
}
}
@ -734,10 +734,10 @@ Device::BuiltinAction start_recovery(Device* device, const std::vector<std::stri
// Log the error code to last_install when installation skips due to low battery.
log_failure_code(kLowBattery, update_package);
status = INSTALL_SKIPPED;
} else if (retry_count == 0 && bootreason_in_blacklist()) {
} else if (retry_count == 0 && bootreason_in_blocklist()) {
// Skip update-on-reboot when bootreason is kernel_panic or similar
ui->Print("bootreason is in the blacklist; skip OTA installation\n");
log_failure_code(kBootreasonInBlacklist, update_package);
ui->Print("bootreason is in the blocklist; skip OTA installation\n");
log_failure_code(kBootreasonInBlocklist, update_package);
status = INSTALL_SKIPPED;
} else {
// It's a fresh update. Initialize the retry_count in the BCB to 1; therefore we can later

View file

@ -35,7 +35,6 @@
using android::base::get_unaligned;
// Sanity check for the given imgdiff patch header.
static void verify_patch_header(const std::string& patch, size_t* num_normal, size_t* num_raw,
size_t* num_deflate) {
const size_t size = patch.size();

View file

@ -128,7 +128,6 @@ bool Command::ParseTargetInfoAndSourceInfo(const std::vector<std::string>& token
// No stashes, only source ranges.
SourceInfo result(src_hash, src_ranges, {}, {});
// Sanity check the block count.
if (result.blocks() != src_blocks) {
*err =
android::base::StringPrintf("mismatching block count: %zu (%s) vs %zu", result.blocks(),
@ -262,7 +261,7 @@ Command Command::Parse(const std::string& line, size_t index, std::string* err)
return {};
}
} else if (op == Type::ABORT) {
// No-op, other than sanity checking the input args.
// Abort takes no arguments, so there's nothing else to check.
if (pos != tokens.size()) {
*err = android::base::StringPrintf("invalid number of args: %zu (expected 0)",
tokens.size() - pos);