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
diff --git a/update_attempter.h b/update_attempter.h
index 76e93a2..41b7f8e 100644
--- a/update_attempter.h
+++ b/update_attempter.h
@@ -177,6 +177,8 @@
// Broadcasts the current status to all observers.
void BroadcastStatus();
+ ErrorCode GetAttemptErrorCode() const { return attempt_error_code_; }
+
// Returns the special flags to be added to ErrorCode values based on the
// parameters used in the current update attempt.
uint32_t GetErrorCodeFlags();
@@ -437,6 +439,9 @@
// HTTP server response code from the last HTTP request action.
int http_response_code_ = 0;
+ // The attempt error code when the update attempt finished.
+ ErrorCode attempt_error_code_ = ErrorCode::kSuccess;
+
// CPU limiter during the update.
CPULimiter cpu_limiter_;