From 1bc976a74ed26a5dcdbf9baef53e280f04eb272f Mon Sep 17 00:00:00 2001 From: Tianjie Date: Wed, 22 Jul 2020 17:25:11 -0700 Subject: Fix some wording to comply with respectful-code https: //source.android.com/setup/contribute/respectful-code Test: Unit tests pass Change-Id: If447b2cf923f6bc7a3a3fb5f69b9fbc06a200ebb --- otautil/include/otautil/error_code.h | 2 +- recovery.cpp | 12 ++++++------ tests/unit/host/imgdiff_test.cpp | 1 - updater/commands.cpp | 3 +-- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/otautil/include/otautil/error_code.h b/otautil/include/otautil/error_code.h index 2b73c1353..7b52ce599 100644 --- a/otautil/include/otautil/error_code.h +++ b/otautil/include/otautil/error_code.h @@ -22,7 +22,7 @@ enum ErrorCode : int { kLowBattery = 20, kZipVerificationFailure, kZipOpenFailure, - kBootreasonInBlacklist, + kBootreasonInBlocklist, kPackageCompatibilityFailure, kScriptExecutionFailure, kMapFileFailure, diff --git a/recovery.cpp b/recovery.cpp index f41ac6acf..d26424ab1 100644 --- a/recovery.cpp +++ b/recovery.cpp @@ -559,15 +559,15 @@ static void set_retry_bootloader_message(int retry_count, const std::vector kBootreasonBlacklist{ + static const std::vector 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::vectorPrint("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 diff --git a/tests/unit/host/imgdiff_test.cpp b/tests/unit/host/imgdiff_test.cpp index e76ccbdfb..978ac7c2b 100644 --- a/tests/unit/host/imgdiff_test.cpp +++ b/tests/unit/host/imgdiff_test.cpp @@ -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(); diff --git a/updater/commands.cpp b/updater/commands.cpp index aed63369c..1a7c272b5 100644 --- a/updater/commands.cpp +++ b/updater/commands.cpp @@ -128,7 +128,6 @@ bool Command::ParseTargetInfoAndSourceInfo(const std::vector& 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); -- cgit v1.2.3