Fix error code for no update.
PayloadState does not get notified if there's no update, so the error
code will not be updated, move this to UpdateAttempter.
We were using the generic kError for no update, this change added a
new error code kNoUpdate for this, now update_engine_client will show
kNoUpdate instead of kSuccess or a random last error.
Bug: 36946608
Test: update_engine_client --check_for_update --follow
Change-Id: Ie1e94841788437140e0894dc2e73c314a7564108
(cherry picked from commit 89e24c11b406fe048382bdf1c89334e10417b899)
Reviewed-on: https://chromium-review.googlesource.com/1055857
Commit-Ready: Amin Hassani <ahassani@chromium.org>
Tested-by: Amin Hassani <ahassani@chromium.org>
Reviewed-by: Nicolas Norvez <norvez@chromium.org>
Reviewed-by: Sen Jiang <senj@chromium.org>
diff --git a/payload_state.cc b/payload_state.cc
index 745ae2e..7c969b3 100644
--- a/payload_state.cc
+++ b/payload_state.cc
@@ -67,7 +67,6 @@
rollback_happened_(false),
attempt_num_bytes_downloaded_(0),
attempt_connection_type_(metrics::ConnectionType::kUnknown),
- attempt_error_code_(ErrorCode::kSuccess),
attempt_type_(AttemptType::kUpdate) {
for (int i = 0; i <= kNumDownloadSources; i++)
total_bytes_downloaded_[i] = current_bytes_downloaded_[i] = 0;
@@ -244,7 +243,6 @@
metrics::RollbackResult::kSuccess);
break;
}
- attempt_error_code_ = ErrorCode::kSuccess;
// Reset the number of responses seen since it counts from the last
// successful update, e.g. now.
@@ -258,7 +256,6 @@
ErrorCode base_error = utils::GetBaseErrorCode(error);
LOG(INFO) << "Updating payload state for error code: " << base_error
<< " (" << utils::ErrorCodeToString(base_error) << ")";
- attempt_error_code_ = base_error;
if (candidate_urls_.size() == 0) {
// This means we got this error even before we got a valid Omaha response
@@ -361,6 +358,7 @@
case ErrorCode::kUserCanceled:
case ErrorCode::kOmahaUpdateIgnoredOverCellular:
case ErrorCode::kUpdatedButNotActive:
+ case ErrorCode::kNoUpdate:
LOG(INFO) << "Not incrementing URL index or failure count for this error";
break;