OLD | NEW |
1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "update_engine/omaha_request_action.h" | 5 #include "update_engine/omaha_request_action.h" |
6 | 6 |
7 #include <inttypes.h> | 7 #include <inttypes.h> |
8 | 8 |
9 #include <sstream> | 9 #include <sstream> |
10 | 10 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 body += StringPrintf( | 112 body += StringPrintf( |
113 " <o:event eventtype=\"%d\" eventresult=\"%d\" " | 113 " <o:event eventtype=\"%d\" eventresult=\"%d\" " |
114 "previousversion=\"%s\"></o:event>\n", | 114 "previousversion=\"%s\"></o:event>\n", |
115 OmahaEvent::kTypeUpdateComplete, | 115 OmahaEvent::kTypeUpdateComplete, |
116 OmahaEvent::kResultSuccessReboot, | 116 OmahaEvent::kResultSuccessReboot, |
117 prev_version.c_str()); | 117 prev_version.c_str()); |
118 LOG_IF(WARNING, !prefs->SetString(kPrefsPreviousVersion, "")) | 118 LOG_IF(WARNING, !prefs->SetString(kPrefsPreviousVersion, "")) |
119 << "Unable to reset the previous version."; | 119 << "Unable to reset the previous version."; |
120 } | 120 } |
121 } else { | 121 } else { |
122 // The error code is an optional attribute so append it only if | 122 // The error code is an optional attribute so append it only if the result |
123 // the result is not success. | 123 // is not success. |
124 string error_code; | 124 string error_code; |
125 if (event->result != OmahaEvent::kResultSuccess) { | 125 if (event->result != OmahaEvent::kResultSuccess) { |
126 error_code = StringPrintf(" errorcode=\"%d\"", event->error_code); | 126 int code = event->error_code; |
| 127 if (!utils::IsNormalBootMode()) { |
| 128 code |= kActionCodeBootModeFlag; |
| 129 } |
| 130 error_code = StringPrintf(" errorcode=\"%d\"", code); |
127 } | 131 } |
128 body = StringPrintf( | 132 body = StringPrintf( |
129 " <o:event eventtype=\"%d\" eventresult=\"%d\"%s></o:event>\n", | 133 " <o:event eventtype=\"%d\" eventresult=\"%d\"%s></o:event>\n", |
130 event->type, event->result, error_code.c_str()); | 134 event->type, event->result, error_code.c_str()); |
131 } | 135 } |
132 return "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" | 136 return "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" |
133 "<o:gupdate xmlns:o=\"http://www.google.com/update2/request\" " | 137 "<o:gupdate xmlns:o=\"http://www.google.com/update2/request\" " |
134 "version=\"" + XmlEncode(kGupdateVersion) + "\" " | 138 "version=\"" + XmlEncode(kGupdateVersion) + "\" " |
135 "updaterversion=\"" + XmlEncode(kGupdateVersion) + "\" " | 139 "updaterversion=\"" + XmlEncode(kGupdateVersion) + "\" " |
136 "protocol=\"2.0\" ismachine=\"1\">\n" | 140 "protocol=\"2.0\" ismachine=\"1\">\n" |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 output_object.needs_admin = | 448 output_object.needs_admin = |
445 XmlGetProperty(updatecheck_node, "needsadmin") == "true"; | 449 XmlGetProperty(updatecheck_node, "needsadmin") == "true"; |
446 output_object.prompt = XmlGetProperty(updatecheck_node, "Prompt") == "true"; | 450 output_object.prompt = XmlGetProperty(updatecheck_node, "Prompt") == "true"; |
447 output_object.is_delta = | 451 output_object.is_delta = |
448 XmlGetProperty(updatecheck_node, "IsDelta") == "true"; | 452 XmlGetProperty(updatecheck_node, "IsDelta") == "true"; |
449 output_object.deadline = XmlGetProperty(updatecheck_node, "deadline"); | 453 output_object.deadline = XmlGetProperty(updatecheck_node, "deadline"); |
450 SetOutputObject(output_object); | 454 SetOutputObject(output_object); |
451 } | 455 } |
452 | 456 |
453 }; // namespace chromeos_update_engine | 457 }; // namespace chromeos_update_engine |
OLD | NEW |