Add ErrorCode::kDeviceCorrupted.
This error code indicates the device is corrupted in a way
that it can no longer receive any future updates. Specifically, if a
device encounters a merge error, there is no way we can recover that
device.
Test: pass
Bug: 138808328
Change-Id: Idbd9d1bc5bc02bbba157f17f31b2c5ace839243c
diff --git a/common/error_code.h b/common/error_code.h
index 1edbba3..e473a05 100644
--- a/common/error_code.h
+++ b/common/error_code.h
@@ -84,6 +84,7 @@
kUnresolvedHostError = 58,
kUnresolvedHostRecovered = 59,
kNotEnoughSpace = 60,
+ kDeviceCorrupted = 61,
// VERY IMPORTANT! When adding new error codes:
//
diff --git a/common/error_code_utils.cc b/common/error_code_utils.cc
index 645adc5..3fbf0fe 100644
--- a/common/error_code_utils.cc
+++ b/common/error_code_utils.cc
@@ -169,6 +169,8 @@
return "ErrorCode::kUnresolvedHostRecovered";
case ErrorCode::kNotEnoughSpace:
return "ErrorCode::kNotEnoughSpace";
+ case ErrorCode::kDeviceCorrupted:
+ return "ErrorCode::kDeviceCorrupted";
// Don't add a default case to let the compiler warn about newly added
// error codes which should be added here.
}
diff --git a/metrics_utils.cc b/metrics_utils.cc
index 1f70874..9abc3ef 100644
--- a/metrics_utils.cc
+++ b/metrics_utils.cc
@@ -73,6 +73,7 @@
case ErrorCode::kFilesystemVerifierError:
case ErrorCode::kVerityCalculationError:
case ErrorCode::kNotEnoughSpace:
+ case ErrorCode::kDeviceCorrupted:
return metrics::AttemptResult::kOperationExecutionError;
case ErrorCode::kDownloadMetadataSignatureMismatch:
@@ -238,6 +239,7 @@
case ErrorCode::kFirstActiveOmahaPingSentPersistenceError:
case ErrorCode::kVerityCalculationError:
case ErrorCode::kNotEnoughSpace:
+ case ErrorCode::kDeviceCorrupted:
break;
// Special flags. These can't happen (we mask them out above) but
diff --git a/payload_state.cc b/payload_state.cc
index 23ff3e2..3ba6391 100644
--- a/payload_state.cc
+++ b/payload_state.cc
@@ -369,6 +369,7 @@
case ErrorCode::kUnresolvedHostError:
case ErrorCode::kUnresolvedHostRecovered:
case ErrorCode::kNotEnoughSpace:
+ case ErrorCode::kDeviceCorrupted:
LOG(INFO) << "Not incrementing URL index or failure count for this error";
break;
diff --git a/update_manager/chromeos_policy.cc b/update_manager/chromeos_policy.cc
index 22e5094..1fa8636 100644
--- a/update_manager/chromeos_policy.cc
+++ b/update_manager/chromeos_policy.cc
@@ -153,6 +153,7 @@
case ErrorCode::kUnresolvedHostError:
case ErrorCode::kUnresolvedHostRecovered:
case ErrorCode::kNotEnoughSpace:
+ case ErrorCode::kDeviceCorrupted:
LOG(INFO) << "Not changing URL index or failure count due to error "
<< chromeos_update_engine::utils::ErrorCodeToString(err_code)
<< " (" << static_cast<int>(err_code) << ")";