Always powerwash on channel change if arbitrary channel allowed.
Merged is_powerwash_allowed() and to_more_stable_channel() into
ShouldPowerwash().
Bug: 73082835
Test: update_engine_unittests
Change-Id: I6b7af0d1dac28d5fa9cddf4391bbd9cdf2acb57b
diff --git a/omaha_request_action.cc b/omaha_request_action.cc
index a8b8a94..d58612c 100644
--- a/omaha_request_action.cc
+++ b/omaha_request_action.cc
@@ -239,9 +239,7 @@
// If we are downgrading to a more stable channel and we are allowed to do
// powerwash, then pass 0.0.0.0 as the version. This is needed to get the
// highest-versioned payload on the destination channel.
- bool is_potential_downgrade =
- params->to_more_stable_channel() && params->is_powerwash_allowed();
- if (is_potential_downgrade) {
+ if (params->ShouldPowerwash()) {
LOG(INFO) << "Passing OS version as 0.0.0.0 as we are set to powerwash "
<< "on downgrading to the version in the more stable channel";
app_versions = "version=\"0.0.0.0\" from_version=\"" +
@@ -291,7 +289,7 @@
}
string product_components_args;
- if (!is_potential_downgrade && !app_data.product_components.empty()) {
+ if (!params->ShouldPowerwash() && !app_data.product_components.empty()) {
brillo::KeyValueStore store;
if (store.LoadFromString(app_data.product_components)) {
for (const string& key : store.GetKeys()) {