Skip to content

Commit

Permalink
Adjust the message for Roll-forward update
Browse files Browse the repository at this point in the history
When roll-forward update happens, adjust the message to
"Update installed, pending restart", as it's more appropriate than the
previous message "Failed to update, error code is 21".

b/382561808

Change-Id: I72a6e31052f3894c53ea1e3344c19b910764a205
  • Loading branch information
yuying-y committed Dec 11, 2024
1 parent 9307a5f commit db6f0c6
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions chrome/updater/updater_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include "cobalt/browser/switches.h"
#include "components/crx_file/crx_verifier.h"
#include "components/update_client/cobalt_slot_management.h"
#include "components/update_client/update_client_errors.h"
#include "components/update_client/utils.h"
#include "starboard/configuration_constants.h"
#include "starboard/extension/installation_manager.h"
Expand All @@ -46,6 +47,7 @@ namespace {

using update_client::CobaltSlotManagement;
using update_client::ComponentState;
using update_client::UpdateCheckError;

// The SHA256 hash of the "cobalt_evergreen_public" key.
constexpr uint8_t kCobaltPublicKeyHash[] = {
Expand Down Expand Up @@ -98,17 +100,24 @@ void Observer::OnEvent(Events event, const std::string& id) {
status = "Status is unknown.";
} else if (crx_update_item_.state == ComponentState::kUpToDate &&
updater_configurator_->GetPreviousUpdaterStatus().compare(
updater_status_string_map.find(UpdaterStatus::kUpdated)
->second) == 0) {
updater_status_string_map.at(UpdaterStatus::kUpdated)) == 0) {
status = std::string(
updater_status_string_map.find(UpdaterStatus::kUpdated)->second);
updater_status_string_map.at(UpdaterStatus::kUpdated));
} else {
status = std::string(
updater_status_string_map.find(status_iterator->second)->second);
}
if (crx_update_item_.state == ComponentState::kUpdateError) {
status +=
", error code is " + std::to_string(crx_update_item_.error_code);
// QUICK_ROLL_FORWARD update, adjust the message to "Update installed,
// pending restart"
if (crx_update_item_.error_code == static_cast<int>(UpdateCheckError::QUICK_ROLL_FORWARD)) {
status = std::string(
updater_status_string_map.at(UpdaterStatus::kUpdated));
} else {
status +=
", error category is " + std::to_string(static_cast<int>(crx_update_item_.error_category)) +
", error code is " + std::to_string(crx_update_item_.error_code);
}
}
if (updater_notification_ext_ != nullptr) {
updater_notification_ext_->UpdaterState(
Expand Down

0 comments on commit db6f0c6

Please sign in to comment.