Don't update if any app has status="noupdate".
Only update if all apps have status="ok" and at least one app doesn't
have noupdate="true".
Bug: 62985600
Test: update_engine_unittests
Change-Id: I4171989e474408cea914e97f408db2ec83a94d8c
(cherry picked from commit d869bd816b8635ed2df5b2b74fdebe393bdcbd90)
diff --git a/omaha_request_action.cc b/omaha_request_action.cc
index 473f138..c3bbf9d 100644
--- a/omaha_request_action.cc
+++ b/omaha_request_action.cc
@@ -950,13 +950,20 @@
output_object->update_exists = false;
for (size_t i = 0; i < parser_data->apps.size(); i++) {
const string& status = parser_data->apps[i].updatecheck_status;
- // Also treat noupdate="true" in postinstall attributes as no update even if
- // updatecheck status says otherwise.
- if (status == "noupdate" ||
- parser_data->apps[i].action_postinstall_attrs["noupdate"] == "true") {
+ if (status == "noupdate") {
+ // Don't update if any app has status="noupdate".
LOG(INFO) << "No update for <app> " << i;
+ output_object->update_exists = false;
+ break;
} else if (status == "ok") {
- output_object->update_exists = true;
+ if (parser_data->apps[i].action_postinstall_attrs["noupdate"] == "true") {
+ // noupdate="true" in postinstall attributes means it's an update to
+ // self, only update if there's at least one app really have update.
+ LOG(INFO) << "Update to self for <app> " << i;
+ } else {
+ LOG(INFO) << "Update for <app> " << i;
+ output_object->update_exists = true;
+ }
} else {
LOG(ERROR) << "Unknown Omaha response status: " << status;
completer->set_code(ErrorCode::kOmahaResponseInvalid);