blob: d56a22e8dd96dd55339fac19dc0d86aa9014d0ab [file] [log] [blame]
Alex Deymoaea4c1c2015-08-19 20:24:43 -07001//
2// Copyright (C) 2014 The Android Open Source Project
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15//
Alex Deymoc705cc82014-02-19 11:15:00 -080016
Alex Deymo63784a52014-05-28 10:46:14 -070017#include "update_engine/update_manager/chromeos_policy.h"
Alex Deymo0d11c602014-04-23 20:12:20 -070018
Gilad Arnolde1218812014-05-07 12:21:36 -070019#include <algorithm>
Gilad Arnold0adbc942014-05-12 10:35:43 -070020#include <set>
Alex Deymoc705cc82014-02-19 11:15:00 -080021#include <string>
Amin Hassani186ff6a2018-02-27 11:06:03 -080022#include <vector>
Alex Deymoc705cc82014-02-19 11:15:00 -080023
Gilad Arnoldf62a4b82014-05-01 07:41:07 -070024#include <base/logging.h>
Gilad Arnoldb3b05442014-05-30 14:25:05 -070025#include <base/strings/string_util.h>
Gilad Arnoldf62a4b82014-05-01 07:41:07 -070026#include <base/time/time.h>
27
Alex Deymo39910dc2015-11-09 17:04:30 -080028#include "update_engine/common/error_code.h"
Alex Deymoe88e9fe2016-02-03 16:38:00 -080029#include "update_engine/common/error_code_utils.h"
Alex Deymo39910dc2015-11-09 17:04:30 -080030#include "update_engine/common/utils.h"
Alex Deymo63784a52014-05-28 10:46:14 -070031#include "update_engine/update_manager/device_policy_provider.h"
Amin Hassani186ff6a2018-02-27 11:06:03 -080032#include "update_engine/update_manager/enough_slots_ab_updates_policy_impl.h"
33#include "update_engine/update_manager/enterprise_device_policy_impl.h"
34#include "update_engine/update_manager/interactive_update_policy_impl.h"
35#include "update_engine/update_manager/official_build_check_policy_impl.h"
36#include "update_engine/update_manager/out_of_box_experience_policy_impl.h"
Alex Deymo63784a52014-05-28 10:46:14 -070037#include "update_engine/update_manager/policy_utils.h"
38#include "update_engine/update_manager/shill_provider.h"
Gilad Arnoldf62a4b82014-05-01 07:41:07 -070039
Alex Deymo0d11c602014-04-23 20:12:20 -070040using base::Time;
41using base::TimeDelta;
Sen Jiang255e22b2016-05-20 16:15:29 -070042using chromeos_update_engine::ConnectionTethering;
43using chromeos_update_engine::ConnectionType;
Gilad Arnoldb3b05442014-05-30 14:25:05 -070044using chromeos_update_engine::ErrorCode;
Aaron Wood23bd3392017-10-06 14:48:25 -070045using chromeos_update_engine::InstallPlan;
Gilad Arnolddc4bb262014-07-23 10:45:19 -070046using std::get;
Gilad Arnoldf62a4b82014-05-01 07:41:07 -070047using std::min;
Gilad Arnold0adbc942014-05-12 10:35:43 -070048using std::set;
Alex Deymoc705cc82014-02-19 11:15:00 -080049using std::string;
Amin Hassani186ff6a2018-02-27 11:06:03 -080050using std::vector;
Alex Deymoc705cc82014-02-19 11:15:00 -080051
Gilad Arnoldb3b05442014-05-30 14:25:05 -070052namespace {
53
Gilad Arnolddc4bb262014-07-23 10:45:19 -070054// Examines |err_code| and decides whether the URL index needs to be advanced,
55// the error count for the URL incremented, or none of the above. In the first
56// case, returns true; in the second case, increments |*url_num_error_p| and
57// returns false; otherwise just returns false.
Gilad Arnoldb3b05442014-05-30 14:25:05 -070058//
59// TODO(garnold) Adapted from PayloadState::UpdateFailed() (to be retired).
Gilad Arnolddc4bb262014-07-23 10:45:19 -070060bool HandleErrorCode(ErrorCode err_code, int* url_num_error_p) {
Gilad Arnoldb3b05442014-05-30 14:25:05 -070061 err_code = chromeos_update_engine::utils::GetBaseErrorCode(err_code);
62 switch (err_code) {
63 // Errors which are good indicators of a problem with a particular URL or
64 // the protocol used in the URL or entities in the communication channel
65 // (e.g. proxies). We should try the next available URL in the next update
66 // check to quickly recover from these errors.
67 case ErrorCode::kPayloadHashMismatchError:
68 case ErrorCode::kPayloadSizeMismatchError:
69 case ErrorCode::kDownloadPayloadVerificationError:
70 case ErrorCode::kDownloadPayloadPubKeyVerificationError:
71 case ErrorCode::kSignedDeltaPayloadExpectedError:
72 case ErrorCode::kDownloadInvalidMetadataMagicString:
73 case ErrorCode::kDownloadSignatureMissingInManifest:
74 case ErrorCode::kDownloadManifestParseError:
75 case ErrorCode::kDownloadMetadataSignatureError:
76 case ErrorCode::kDownloadMetadataSignatureVerificationError:
77 case ErrorCode::kDownloadMetadataSignatureMismatch:
78 case ErrorCode::kDownloadOperationHashVerificationError:
79 case ErrorCode::kDownloadOperationExecutionError:
80 case ErrorCode::kDownloadOperationHashMismatch:
81 case ErrorCode::kDownloadInvalidMetadataSize:
82 case ErrorCode::kDownloadInvalidMetadataSignature:
83 case ErrorCode::kDownloadOperationHashMissingError:
84 case ErrorCode::kDownloadMetadataSignatureMissingError:
85 case ErrorCode::kPayloadMismatchedType:
86 case ErrorCode::kUnsupportedMajorPayloadVersion:
87 case ErrorCode::kUnsupportedMinorPayloadVersion:
88 LOG(INFO) << "Advancing download URL due to error "
Alex Deymoe88e9fe2016-02-03 16:38:00 -080089 << chromeos_update_engine::utils::ErrorCodeToString(err_code)
Gilad Arnoldb3b05442014-05-30 14:25:05 -070090 << " (" << static_cast<int>(err_code) << ")";
Gilad Arnoldb3b05442014-05-30 14:25:05 -070091 return true;
92
93 // Errors which seem to be just transient network/communication related
94 // failures and do not indicate any inherent problem with the URL itself.
95 // So, we should keep the current URL but just increment the
96 // failure count to give it more chances. This way, while we maximize our
97 // chances of downloading from the URLs that appear earlier in the response
98 // (because download from a local server URL that appears earlier in a
99 // response is preferable than downloading from the next URL which could be
Alex Vakulenko072359c2014-07-18 11:41:07 -0700100 // an Internet URL and thus could be more expensive).
Gilad Arnoldb3b05442014-05-30 14:25:05 -0700101 case ErrorCode::kError:
102 case ErrorCode::kDownloadTransferError:
103 case ErrorCode::kDownloadWriteError:
104 case ErrorCode::kDownloadStateInitializationError:
Gilad Arnold684219d2014-07-07 14:54:57 -0700105 case ErrorCode::kOmahaErrorInHTTPResponse: // Aggregate for HTTP errors.
Gilad Arnoldb3b05442014-05-30 14:25:05 -0700106 LOG(INFO) << "Incrementing URL failure count due to error "
Alex Deymoe88e9fe2016-02-03 16:38:00 -0800107 << chromeos_update_engine::utils::ErrorCodeToString(err_code)
Gilad Arnoldb3b05442014-05-30 14:25:05 -0700108 << " (" << static_cast<int>(err_code) << ")";
Gilad Arnolddc4bb262014-07-23 10:45:19 -0700109 *url_num_error_p += 1;
Gilad Arnoldb3b05442014-05-30 14:25:05 -0700110 return false;
111
112 // Errors which are not specific to a URL and hence shouldn't result in
113 // the URL being penalized. This can happen in two cases:
114 // 1. We haven't started downloading anything: These errors don't cost us
115 // anything in terms of actual payload bytes, so we should just do the
116 // regular retries at the next update check.
117 // 2. We have successfully downloaded the payload: In this case, the
118 // payload attempt number would have been incremented and would take care
Alex Vakulenko072359c2014-07-18 11:41:07 -0700119 // of the back-off at the next update check.
Gilad Arnoldb3b05442014-05-30 14:25:05 -0700120 // In either case, there's no need to update URL index or failure count.
121 case ErrorCode::kOmahaRequestError:
122 case ErrorCode::kOmahaResponseHandlerError:
123 case ErrorCode::kPostinstallRunnerError:
124 case ErrorCode::kFilesystemCopierError:
125 case ErrorCode::kInstallDeviceOpenError:
126 case ErrorCode::kKernelDeviceOpenError:
127 case ErrorCode::kDownloadNewPartitionInfoError:
128 case ErrorCode::kNewRootfsVerificationError:
129 case ErrorCode::kNewKernelVerificationError:
130 case ErrorCode::kPostinstallBootedFromFirmwareB:
131 case ErrorCode::kPostinstallFirmwareRONotUpdatable:
132 case ErrorCode::kOmahaRequestEmptyResponseError:
133 case ErrorCode::kOmahaRequestXMLParseError:
134 case ErrorCode::kOmahaResponseInvalid:
135 case ErrorCode::kOmahaUpdateIgnoredPerPolicy:
136 case ErrorCode::kOmahaUpdateDeferredPerPolicy:
Kevin Cernekee2494e282016-03-29 18:03:53 -0700137 case ErrorCode::kNonCriticalUpdateInOOBE:
Gilad Arnoldb3b05442014-05-30 14:25:05 -0700138 case ErrorCode::kOmahaUpdateDeferredForBackoff:
139 case ErrorCode::kPostinstallPowerwashError:
140 case ErrorCode::kUpdateCanceledByChannelChange:
David Zeuthenf3e28012014-08-26 18:23:52 -0400141 case ErrorCode::kOmahaRequestXMLHasEntityDecl:
Allie Woodeb9e6d82015-04-17 13:55:30 -0700142 case ErrorCode::kFilesystemVerifierError:
Alex Deymo1f19dcc2016-02-03 09:22:17 -0800143 case ErrorCode::kUserCanceled:
Weidong Guo421ff332017-04-17 10:08:38 -0700144 case ErrorCode::kOmahaUpdateIgnoredOverCellular:
Sen Jiang02c49422017-10-31 15:14:11 -0700145 case ErrorCode::kUpdatedButNotActive:
Sen Jiang3978ddd2018-03-22 18:05:44 -0700146 case ErrorCode::kNoUpdate:
Marton Hunyady199152d2018-05-07 19:08:48 +0200147 case ErrorCode::kRollbackNotPossible:
Gilad Arnoldb3b05442014-05-30 14:25:05 -0700148 LOG(INFO) << "Not changing URL index or failure count due to error "
Alex Deymoe88e9fe2016-02-03 16:38:00 -0800149 << chromeos_update_engine::utils::ErrorCodeToString(err_code)
Gilad Arnoldb3b05442014-05-30 14:25:05 -0700150 << " (" << static_cast<int>(err_code) << ")";
151 return false;
152
153 case ErrorCode::kSuccess: // success code
154 case ErrorCode::kUmaReportedMax: // not an error code
155 case ErrorCode::kOmahaRequestHTTPResponseBase: // aggregated already
Alex Deymo1f19dcc2016-02-03 09:22:17 -0800156 case ErrorCode::kDevModeFlag: // not an error code
Gilad Arnoldb3b05442014-05-30 14:25:05 -0700157 case ErrorCode::kResumedFlag: // not an error code
158 case ErrorCode::kTestImageFlag: // not an error code
159 case ErrorCode::kTestOmahaUrlFlag: // not an error code
160 case ErrorCode::kSpecialFlags: // not an error code
161 // These shouldn't happen. Enumerating these explicitly here so that we
162 // can let the compiler warn about new error codes that are added to
163 // action_processor.h but not added here.
164 LOG(WARNING) << "Unexpected error "
Alex Deymoe88e9fe2016-02-03 16:38:00 -0800165 << chromeos_update_engine::utils::ErrorCodeToString(err_code)
Gilad Arnoldb3b05442014-05-30 14:25:05 -0700166 << " (" << static_cast<int>(err_code) << ")";
167 // Note: Not adding a default here so as to let the compiler warn us of
168 // any new enums that were added in the .h but not listed in this switch.
169 }
170 return false;
171}
172
Gilad Arnolddc4bb262014-07-23 10:45:19 -0700173// Checks whether |url| can be used under given download restrictions.
174bool IsUrlUsable(const string& url, bool http_allowed) {
Alex Vakulenko0103c362016-01-20 07:56:15 -0800175 return http_allowed ||
176 !base::StartsWith(url, "http://",
177 base::CompareCase::INSENSITIVE_ASCII);
Gilad Arnoldb3b05442014-05-30 14:25:05 -0700178}
179
180} // namespace
181
Alex Deymo63784a52014-05-28 10:46:14 -0700182namespace chromeos_update_manager {
Alex Deymoc705cc82014-02-19 11:15:00 -0800183
Amin Hassani186ff6a2018-02-27 11:06:03 -0800184const NextUpdateCheckPolicyConstants
185 ChromeOSPolicy::kNextUpdateCheckPolicyConstants = {
186 .timeout_initial_interval = 7 * 60,
187 .timeout_periodic_interval = 45 * 60,
188 .timeout_max_backoff_interval = 4 * 60 * 60,
189 .timeout_regular_fuzz = 10 * 60,
190 .attempt_backoff_max_interval_in_days = 16,
191 .attempt_backoff_fuzz_in_hours = 12,
192};
Alex Deymo14e7dde2015-10-20 14:46:33 -0700193
Gilad Arnold349ac832014-10-06 14:20:28 -0700194const int ChromeOSPolicy::kMaxP2PAttempts = 10;
195const int ChromeOSPolicy::kMaxP2PAttemptsPeriodInSeconds = 5 * 24 * 60 * 60;
Gilad Arnolda2e8eaa2014-09-24 13:12:33 -0700196
Alex Deymo0d11c602014-04-23 20:12:20 -0700197EvalStatus ChromeOSPolicy::UpdateCheckAllowed(
198 EvaluationContext* ec, State* state, string* error,
199 UpdateCheckParams* result) const {
Gilad Arnold42f253b2014-06-25 12:39:17 -0700200 // Set the default return values.
201 result->updates_enabled = true;
202 result->target_channel.clear();
Gilad Arnoldd4b30322014-07-21 15:35:27 -0700203 result->target_version_prefix.clear();
Marton Hunyadyba51c3f2018-04-25 15:18:10 +0200204 result->rollback_allowed = false;
Marton Hunyady0e0e3542018-02-21 18:51:39 +0100205 result->rollback_allowed_milestones = -1;
Gilad Arnold44dc3bf2014-07-18 23:39:38 -0700206 result->is_interactive = false;
Gilad Arnold42f253b2014-06-25 12:39:17 -0700207
Amin Hassani186ff6a2018-02-27 11:06:03 -0800208 EnoughSlotsAbUpdatesPolicyImpl enough_slots_ab_updates_policy;
209 EnterpriseDevicePolicyImpl enterprise_device_policy;
210 OnlyUpdateOfficialBuildsPolicyImpl only_update_official_builds_policy;
211 InteractiveUpdatePolicyImpl interactive_update_policy;
212 OobePolicyImpl oobe_policy;
213 NextUpdateCheckTimePolicyImpl next_update_check_time_policy(
214 kNextUpdateCheckPolicyConstants);
Gilad Arnolda1eabcd2014-07-09 15:42:40 -0700215
Amin Hassani186ff6a2018-02-27 11:06:03 -0800216 vector<Policy const*> policies_to_consult = {
217 // Do not perform any updates if there are not enough slots to do A/B
218 // updates.
219 &enough_slots_ab_updates_policy,
220
221 // Check to see if Enterprise-managed (has DevicePolicy) and/or
222 // Kiosk-mode. If so, then defer to those settings.
223 &enterprise_device_policy,
224
225 // Check to see if an interactive update was requested.
226 &interactive_update_policy,
227
228 // Unofficial builds should not perform periodic update checks.
229 &only_update_official_builds_policy,
230
231 // If OOBE is enabled, wait until it is completed.
232 &oobe_policy,
233
234 // Ensure that periodic update checks are timed properly.
235 &next_update_check_time_policy,
236 };
237
238 // Now that the list of policy implementations, and the order to consult them,
239 // has been setup, consult the policies. If none of the policies make a
240 // definitive decisions about whether or not to check for updates, then allow
241 // the update check to happen.
242 EvalStatus status = ConsultPolicies(policies_to_consult,
243 &Policy::UpdateCheckAllowed,
244 ec,
245 state,
246 error,
247 result);
248 if (EvalStatus::kContinue != status) {
249 return status;
250 } else {
251 // It is time to check for an update.
252 LOG(INFO) << "Allowing update check.";
Gilad Arnoldbfc44f72014-07-09 14:41:39 -0700253 return EvalStatus::kSucceeded;
254 }
Alex Deymoc705cc82014-02-19 11:15:00 -0800255}
256
Aaron Wood23bd3392017-10-06 14:48:25 -0700257EvalStatus ChromeOSPolicy::UpdateCanBeApplied(EvaluationContext* ec,
258 State* state,
259 std::string* error,
260 ErrorCode* result,
261 InstallPlan* install_plan) const {
262 *result = ErrorCode::kSuccess;
263 return EvalStatus::kSucceeded;
264}
265
Gilad Arnoldf62a4b82014-05-01 07:41:07 -0700266EvalStatus ChromeOSPolicy::UpdateCanStart(
267 EvaluationContext* ec,
268 State* state,
269 string* error,
Gilad Arnold42f253b2014-06-25 12:39:17 -0700270 UpdateDownloadParams* result,
Gilad Arnoldd78caf92014-09-24 09:28:14 -0700271 const UpdateState update_state) const {
Gilad Arnolddc4bb262014-07-23 10:45:19 -0700272 // Set the default return values. Note that we set persisted values (backoff,
273 // scattering) to the same values presented in the update state. The reason is
274 // that preemptive returns, such as the case where an update check is due,
275 // should not clear off the said values; rather, it is the deliberate
276 // inference of new values that should cause them to be reset.
Gilad Arnold14a9e702014-10-08 08:09:09 -0700277 result->update_can_start = false;
Gilad Arnoldf62a4b82014-05-01 07:41:07 -0700278 result->cannot_start_reason = UpdateCannotStartReason::kUndefined;
Gilad Arnoldb3b05442014-05-30 14:25:05 -0700279 result->download_url_idx = -1;
Gilad Arnold14a9e702014-10-08 08:09:09 -0700280 result->download_url_allowed = true;
281 result->download_url_num_errors = 0;
Gilad Arnoldb2f99192014-10-07 13:01:52 -0700282 result->p2p_downloading_allowed = false;
283 result->p2p_sharing_allowed = false;
Gilad Arnolddc4bb262014-07-23 10:45:19 -0700284 result->do_increment_failures = false;
285 result->backoff_expiry = update_state.backoff_expiry;
286 result->scatter_wait_period = update_state.scatter_wait_period;
287 result->scatter_check_threshold = update_state.scatter_check_threshold;
Gilad Arnoldf62a4b82014-05-01 07:41:07 -0700288
289 // Make sure that we're not due for an update check.
290 UpdateCheckParams check_result;
291 EvalStatus check_status = UpdateCheckAllowed(ec, state, error, &check_result);
292 if (check_status == EvalStatus::kFailed)
293 return EvalStatus::kFailed;
Gilad Arnold14a9e702014-10-08 08:09:09 -0700294 bool is_check_due = (check_status == EvalStatus::kSucceeded &&
295 check_result.updates_enabled == true);
Gilad Arnoldf62a4b82014-05-01 07:41:07 -0700296
Gilad Arnolddc4bb262014-07-23 10:45:19 -0700297 // Check whether backoff applies, and if not then which URL can be used for
298 // downloading. These require scanning the download error log, and so they are
299 // done together.
300 UpdateBackoffAndDownloadUrlResult backoff_url_result;
301 EvalStatus backoff_url_status = UpdateBackoffAndDownloadUrl(
302 ec, state, error, &backoff_url_result, update_state);
Gilad Arnold14a9e702014-10-08 08:09:09 -0700303 if (backoff_url_status == EvalStatus::kFailed)
304 return EvalStatus::kFailed;
305 result->download_url_idx = backoff_url_result.url_idx;
306 result->download_url_num_errors = backoff_url_result.url_num_errors;
307 result->do_increment_failures = backoff_url_result.do_increment_failures;
308 result->backoff_expiry = backoff_url_result.backoff_expiry;
309 bool is_backoff_active =
310 (backoff_url_status == EvalStatus::kAskMeAgainLater) ||
311 !backoff_url_result.backoff_expiry.is_null();
Gilad Arnolddc4bb262014-07-23 10:45:19 -0700312
Gilad Arnoldf62a4b82014-05-01 07:41:07 -0700313 DevicePolicyProvider* const dp_provider = state->device_policy_provider();
Gilad Arnold14a9e702014-10-08 08:09:09 -0700314 bool is_scattering_active = false;
315 EvalStatus scattering_status = EvalStatus::kSucceeded;
Gilad Arnoldf62a4b82014-05-01 07:41:07 -0700316
317 const bool* device_policy_is_loaded_p = ec->GetValue(
318 dp_provider->var_device_policy_is_loaded());
319 if (device_policy_is_loaded_p && *device_policy_is_loaded_p) {
Gilad Arnold76a11f62014-05-20 09:02:12 -0700320 // Check whether scattering applies to this update attempt. We should not be
321 // scattering if this is an interactive update check, or if OOBE is enabled
322 // but not completed.
323 //
324 // Note: current code further suppresses scattering if a "deadline"
Gilad Arnoldf62a4b82014-05-01 07:41:07 -0700325 // attribute is found in the Omaha response. However, it appears that the
Gilad Arnold76a11f62014-05-20 09:02:12 -0700326 // presence of this attribute is merely indicative of an OOBE update, during
327 // which we suppress scattering anyway.
Gilad Arnold14a9e702014-10-08 08:09:09 -0700328 bool is_scattering_applicable = false;
Gilad Arnolddc4bb262014-07-23 10:45:19 -0700329 result->scatter_wait_period = kZeroInterval;
330 result->scatter_check_threshold = 0;
331 if (!update_state.is_interactive) {
Gilad Arnold76a11f62014-05-20 09:02:12 -0700332 const bool* is_oobe_enabled_p = ec->GetValue(
333 state->config_provider()->var_is_oobe_enabled());
334 if (is_oobe_enabled_p && !(*is_oobe_enabled_p)) {
Gilad Arnold14a9e702014-10-08 08:09:09 -0700335 is_scattering_applicable = true;
Gilad Arnold76a11f62014-05-20 09:02:12 -0700336 } else {
337 const bool* is_oobe_complete_p = ec->GetValue(
Gilad Arnoldb3b05442014-05-30 14:25:05 -0700338 state->system_provider()->var_is_oobe_complete());
Gilad Arnold14a9e702014-10-08 08:09:09 -0700339 is_scattering_applicable = (is_oobe_complete_p && *is_oobe_complete_p);
Gilad Arnold76a11f62014-05-20 09:02:12 -0700340 }
341 }
342
343 // Compute scattering values.
Gilad Arnold14a9e702014-10-08 08:09:09 -0700344 if (is_scattering_applicable) {
Gilad Arnoldf62a4b82014-05-01 07:41:07 -0700345 UpdateScatteringResult scatter_result;
Gilad Arnold14a9e702014-10-08 08:09:09 -0700346 scattering_status = UpdateScattering(ec, state, error, &scatter_result,
347 update_state);
348 if (scattering_status == EvalStatus::kFailed) {
349 return EvalStatus::kFailed;
350 } else {
351 result->scatter_wait_period = scatter_result.wait_period;
352 result->scatter_check_threshold = scatter_result.check_threshold;
353 if (scattering_status == EvalStatus::kAskMeAgainLater ||
354 scatter_result.is_scattering)
355 is_scattering_active = true;
Gilad Arnoldf62a4b82014-05-01 07:41:07 -0700356 }
357 }
Gilad Arnold78ecbfc2014-10-22 14:38:25 -0700358 }
Gilad Arnoldf62a4b82014-05-01 07:41:07 -0700359
Gilad Arnold78ecbfc2014-10-22 14:38:25 -0700360 // Find out whether P2P is globally enabled.
361 bool p2p_enabled;
362 EvalStatus p2p_enabled_status = P2PEnabled(ec, state, error, &p2p_enabled);
363 if (p2p_enabled_status != EvalStatus::kSucceeded)
364 return EvalStatus::kFailed;
365
366 // Is P2P is enabled, consider allowing it for downloading and/or sharing.
367 if (p2p_enabled) {
368 // Sharing via P2P is allowed if not disabled by Omaha.
369 if (update_state.p2p_sharing_disabled) {
370 LOG(INFO) << "Blocked P2P sharing because it is disabled by Omaha.";
Gilad Arnoldb2f99192014-10-07 13:01:52 -0700371 } else {
Gilad Arnold78ecbfc2014-10-22 14:38:25 -0700372 result->p2p_sharing_allowed = true;
Gilad Arnoldef8d0872014-10-03 14:14:06 -0700373 }
Gilad Arnoldf62a4b82014-05-01 07:41:07 -0700374
Gilad Arnold78ecbfc2014-10-22 14:38:25 -0700375 // Downloading via P2P is allowed if not disabled by Omaha, an update is not
376 // interactive, and other limits haven't been reached.
377 if (update_state.p2p_downloading_disabled) {
378 LOG(INFO) << "Blocked P2P downloading because it is disabled by Omaha.";
379 } else if (update_state.is_interactive) {
380 LOG(INFO) << "Blocked P2P downloading because update is interactive.";
Gilad Arnoldb2f99192014-10-07 13:01:52 -0700381 } else if (update_state.p2p_num_attempts >= kMaxP2PAttempts) {
Gilad Arnold78ecbfc2014-10-22 14:38:25 -0700382 LOG(INFO) << "Blocked P2P downloading as it was attempted too many "
383 "times.";
Gilad Arnoldb2f99192014-10-07 13:01:52 -0700384 } else if (!update_state.p2p_first_attempted.is_null() &&
385 ec->IsWallclockTimeGreaterThan(
386 update_state.p2p_first_attempted +
387 TimeDelta::FromSeconds(kMaxP2PAttemptsPeriodInSeconds))) {
Gilad Arnold78ecbfc2014-10-22 14:38:25 -0700388 LOG(INFO) << "Blocked P2P downloading as its usage timespan exceeds "
389 "limit.";
Gilad Arnoldb2f99192014-10-07 13:01:52 -0700390 } else {
Gilad Arnold14a9e702014-10-08 08:09:09 -0700391 // P2P download is allowed; if backoff or scattering are active, be sure
392 // to suppress them, yet prevent any download URL from being used.
Gilad Arnoldb2f99192014-10-07 13:01:52 -0700393 result->p2p_downloading_allowed = true;
Gilad Arnold14a9e702014-10-08 08:09:09 -0700394 if (is_backoff_active || is_scattering_active) {
395 is_backoff_active = is_scattering_active = false;
396 result->download_url_allowed = false;
397 }
Gilad Arnoldb2f99192014-10-07 13:01:52 -0700398 }
Gilad Arnoldf62a4b82014-05-01 07:41:07 -0700399 }
400
Gilad Arnold14a9e702014-10-08 08:09:09 -0700401 // Check for various deterrents.
402 if (is_check_due) {
403 result->cannot_start_reason = UpdateCannotStartReason::kCheckDue;
404 return EvalStatus::kSucceeded;
405 }
406 if (is_backoff_active) {
407 result->cannot_start_reason = UpdateCannotStartReason::kBackoff;
408 return backoff_url_status;
409 }
410 if (is_scattering_active) {
411 result->cannot_start_reason = UpdateCannotStartReason::kScattering;
412 return scattering_status;
413 }
Gilad Arnoldb2f99192014-10-07 13:01:52 -0700414 if (result->download_url_idx < 0 && !result->p2p_downloading_allowed) {
Gilad Arnolddc4bb262014-07-23 10:45:19 -0700415 result->cannot_start_reason = UpdateCannotStartReason::kCannotDownload;
Gilad Arnold14a9e702014-10-08 08:09:09 -0700416 return EvalStatus::kSucceeded;
Gilad Arnoldb3b05442014-05-30 14:25:05 -0700417 }
418
Gilad Arnold14a9e702014-10-08 08:09:09 -0700419 // Update is good to go.
420 result->update_can_start = true;
Gilad Arnoldaf2f6ae2014-04-28 14:14:52 -0700421 return EvalStatus::kSucceeded;
422}
423
Gilad Arnolda8262e22014-06-02 13:54:27 -0700424// TODO(garnold) Logic in this method is based on
425// ConnectionManager::IsUpdateAllowedOver(); be sure to deprecate the latter.
426//
427// TODO(garnold) The current logic generally treats the list of allowed
428// connections coming from the device policy as a whitelist, meaning that it
429// can only be used for enabling connections, but not disable them. Further,
430// certain connection types (like Bluetooth) cannot be enabled even by policy.
431// In effect, the only thing that device policy can change is to enable
432// updates over a cellular network (disabled by default). We may want to
433// revisit this semantics, allowing greater flexibility in defining specific
434// permissions over all types of networks.
Gilad Arnold684219d2014-07-07 14:54:57 -0700435EvalStatus ChromeOSPolicy::UpdateDownloadAllowed(
Gilad Arnolda8262e22014-06-02 13:54:27 -0700436 EvaluationContext* ec,
437 State* state,
438 string* error,
439 bool* result) const {
440 // Get the current connection type.
441 ShillProvider* const shill_provider = state->shill_provider();
442 const ConnectionType* conn_type_p = ec->GetValue(
443 shill_provider->var_conn_type());
444 POLICY_CHECK_VALUE_AND_FAIL(conn_type_p, error);
445 ConnectionType conn_type = *conn_type_p;
446
447 // If we're tethering, treat it as a cellular connection.
448 if (conn_type != ConnectionType::kCellular) {
449 const ConnectionTethering* conn_tethering_p = ec->GetValue(
450 shill_provider->var_conn_tethering());
451 POLICY_CHECK_VALUE_AND_FAIL(conn_tethering_p, error);
452 if (*conn_tethering_p == ConnectionTethering::kConfirmed)
453 conn_type = ConnectionType::kCellular;
454 }
455
456 // By default, we allow updates for all connection types, with exceptions as
457 // noted below. This also determines whether a device policy can override the
458 // default.
459 *result = true;
460 bool device_policy_can_override = false;
461 switch (conn_type) {
462 case ConnectionType::kBluetooth:
463 *result = false;
464 break;
465
466 case ConnectionType::kCellular:
467 *result = false;
468 device_policy_can_override = true;
469 break;
470
471 case ConnectionType::kUnknown:
472 if (error)
473 *error = "Unknown connection type";
474 return EvalStatus::kFailed;
475
476 default:
477 break; // Nothing to do.
478 }
479
480 // If update is allowed, we're done.
481 if (*result)
482 return EvalStatus::kSucceeded;
483
484 // Check whether the device policy specifically allows this connection.
Gilad Arnolda8262e22014-06-02 13:54:27 -0700485 if (device_policy_can_override) {
486 DevicePolicyProvider* const dp_provider = state->device_policy_provider();
487 const bool* device_policy_is_loaded_p = ec->GetValue(
488 dp_provider->var_device_policy_is_loaded());
489 if (device_policy_is_loaded_p && *device_policy_is_loaded_p) {
490 const set<ConnectionType>* allowed_conn_types_p = ec->GetValue(
491 dp_provider->var_allowed_connection_types_for_update());
492 if (allowed_conn_types_p) {
493 if (allowed_conn_types_p->count(conn_type)) {
494 *result = true;
495 return EvalStatus::kSucceeded;
496 }
Gilad Arnold28d6be62014-06-30 14:04:04 -0700497 } else if (conn_type == ConnectionType::kCellular) {
498 // Local user settings can allow updates over cellular iff a policy was
499 // loaded but no allowed connections were specified in it.
500 const bool* update_over_cellular_allowed_p = ec->GetValue(
501 state->updater_provider()->var_cellular_enabled());
502 if (update_over_cellular_allowed_p && *update_over_cellular_allowed_p)
503 *result = true;
Gilad Arnolda8262e22014-06-02 13:54:27 -0700504 }
505 }
506 }
507
Gilad Arnold28d6be62014-06-30 14:04:04 -0700508 return (*result ? EvalStatus::kSucceeded : EvalStatus::kAskMeAgainLater);
Gilad Arnolda8262e22014-06-02 13:54:27 -0700509}
510
Gilad Arnold78ecbfc2014-10-22 14:38:25 -0700511EvalStatus ChromeOSPolicy::P2PEnabled(EvaluationContext* ec,
512 State* state,
Alex Deymo39910dc2015-11-09 17:04:30 -0800513 string* error,
Gilad Arnold78ecbfc2014-10-22 14:38:25 -0700514 bool* result) const {
515 bool enabled = false;
516
517 // Determine whether use of P2P is allowed by policy. Even if P2P is not
518 // explicitly allowed, we allow it if the device is enterprise enrolled (that
519 // is, missing or empty owner string).
520 DevicePolicyProvider* const dp_provider = state->device_policy_provider();
521 const bool* device_policy_is_loaded_p = ec->GetValue(
522 dp_provider->var_device_policy_is_loaded());
523 if (device_policy_is_loaded_p && *device_policy_is_loaded_p) {
524 const bool* policy_au_p2p_enabled_p = ec->GetValue(
525 dp_provider->var_au_p2p_enabled());
526 if (policy_au_p2p_enabled_p) {
527 enabled = *policy_au_p2p_enabled_p;
528 } else {
529 const string* policy_owner_p = ec->GetValue(dp_provider->var_owner());
530 if (!policy_owner_p || policy_owner_p->empty())
531 enabled = true;
532 }
533 }
534
535 // Enable P2P, if so mandated by the updater configuration. This is additive
536 // to whether or not P2P is enabled by device policy.
537 if (!enabled) {
538 const bool* updater_p2p_enabled_p = ec->GetValue(
539 state->updater_provider()->var_p2p_enabled());
540 enabled = updater_p2p_enabled_p && *updater_p2p_enabled_p;
541 }
542
543 *result = enabled;
544 return EvalStatus::kSucceeded;
545}
546
547EvalStatus ChromeOSPolicy::P2PEnabledChanged(EvaluationContext* ec,
548 State* state,
Alex Deymo39910dc2015-11-09 17:04:30 -0800549 string* error,
Gilad Arnold78ecbfc2014-10-22 14:38:25 -0700550 bool* result,
551 bool prev_result) const {
552 EvalStatus status = P2PEnabled(ec, state, error, result);
553 if (status == EvalStatus::kSucceeded && *result == prev_result)
554 return EvalStatus::kAskMeAgainLater;
555 return status;
556}
557
Gilad Arnolddc4bb262014-07-23 10:45:19 -0700558EvalStatus ChromeOSPolicy::UpdateBackoffAndDownloadUrl(
Alex Deymof329b932014-10-30 01:37:48 -0700559 EvaluationContext* ec, State* state, string* error,
Gilad Arnolddc4bb262014-07-23 10:45:19 -0700560 UpdateBackoffAndDownloadUrlResult* result,
561 const UpdateState& update_state) const {
562 // Sanity checks.
563 DCHECK_GE(update_state.download_errors_max, 0);
564
565 // Set default result values.
566 result->do_increment_failures = false;
567 result->backoff_expiry = update_state.backoff_expiry;
568 result->url_idx = -1;
569 result->url_num_errors = 0;
570
571 const bool* is_official_build_p = ec->GetValue(
572 state->system_provider()->var_is_official_build());
573 bool is_official_build = (is_official_build_p ? *is_official_build_p : true);
574
575 // Check whether backoff is enabled.
576 bool may_backoff = false;
577 if (update_state.is_backoff_disabled) {
578 LOG(INFO) << "Backoff disabled by Omaha.";
579 } else if (update_state.is_interactive) {
580 LOG(INFO) << "No backoff for interactive updates.";
581 } else if (update_state.is_delta_payload) {
582 LOG(INFO) << "No backoff for delta payloads.";
583 } else if (!is_official_build) {
584 LOG(INFO) << "No backoff for unofficial builds.";
585 } else {
586 may_backoff = true;
Gilad Arnoldb3b05442014-05-30 14:25:05 -0700587 }
588
Gilad Arnolddc4bb262014-07-23 10:45:19 -0700589 // If previous backoff still in effect, block.
590 if (may_backoff && !update_state.backoff_expiry.is_null() &&
591 !ec->IsWallclockTimeGreaterThan(update_state.backoff_expiry)) {
592 LOG(INFO) << "Previous backoff has not expired, waiting.";
593 return EvalStatus::kAskMeAgainLater;
594 }
Gilad Arnoldb3b05442014-05-30 14:25:05 -0700595
596 // Determine whether HTTP downloads are forbidden by policy. This only
597 // applies to official system builds; otherwise, HTTP is always enabled.
598 bool http_allowed = true;
Gilad Arnolddc4bb262014-07-23 10:45:19 -0700599 if (is_official_build) {
Gilad Arnoldb3b05442014-05-30 14:25:05 -0700600 DevicePolicyProvider* const dp_provider = state->device_policy_provider();
601 const bool* device_policy_is_loaded_p = ec->GetValue(
602 dp_provider->var_device_policy_is_loaded());
603 if (device_policy_is_loaded_p && *device_policy_is_loaded_p) {
604 const bool* policy_http_downloads_enabled_p = ec->GetValue(
605 dp_provider->var_http_downloads_enabled());
606 http_allowed = (!policy_http_downloads_enabled_p ||
607 *policy_http_downloads_enabled_p);
608 }
609 }
610
Gilad Arnolddc4bb262014-07-23 10:45:19 -0700611 int url_idx = update_state.last_download_url_idx;
612 if (url_idx < 0)
613 url_idx = -1;
614 bool do_advance_url = false;
615 bool is_failure_occurred = false;
616 Time err_time;
617
618 // Scan the relevant part of the download error log, tracking which URLs are
619 // being used, and accounting the number of errors for each URL. Note that
620 // this process may not traverse all errors provided, as it may decide to bail
621 // out midway depending on the particular errors exhibited, the number of
622 // failures allowed, etc. When this ends, |url_idx| will point to the last URL
623 // used (-1 if starting fresh), |do_advance_url| will determine whether the
624 // URL needs to be advanced, and |err_time| the point in time when the last
625 // reported error occurred. Additionally, if the error log indicates that an
626 // update attempt has failed (abnormal), then |is_failure_occurred| will be
627 // set to true.
628 const int num_urls = update_state.download_urls.size();
629 int prev_url_idx = -1;
630 int url_num_errors = update_state.last_download_url_num_errors;
631 Time prev_err_time;
632 bool is_first = true;
633 for (const auto& err_tuple : update_state.download_errors) {
634 // Do some sanity checks.
635 int used_url_idx = get<0>(err_tuple);
636 if (is_first && url_idx >= 0 && used_url_idx != url_idx) {
637 LOG(WARNING) << "First URL in error log (" << used_url_idx
638 << ") not as expected (" << url_idx << ")";
Gilad Arnoldb3b05442014-05-30 14:25:05 -0700639 }
Gilad Arnolddc4bb262014-07-23 10:45:19 -0700640 is_first = false;
641 url_idx = used_url_idx;
642 if (url_idx < 0 || url_idx >= num_urls) {
643 LOG(ERROR) << "Download error log contains an invalid URL index ("
644 << url_idx << ")";
645 return EvalStatus::kFailed;
646 }
647 err_time = get<2>(err_tuple);
648 if (!(prev_err_time.is_null() || err_time >= prev_err_time)) {
649 // TODO(garnold) Monotonicity cannot really be assumed when dealing with
650 // wallclock-based timestamps. However, we're making a simplifying
651 // assumption so as to keep the policy implementation straightforward, for
652 // now. In general, we should convert all timestamp handling in the
653 // UpdateManager to use monotonic time (instead of wallclock), including
654 // the computation of various expiration times (backoff, scattering, etc).
655 // The client will do whatever conversions necessary when
656 // persisting/retrieving these values across reboots. See chromium:408794.
657 LOG(ERROR) << "Download error timestamps not monotonically increasing.";
658 return EvalStatus::kFailed;
659 }
660 prev_err_time = err_time;
Gilad Arnoldb3b05442014-05-30 14:25:05 -0700661
Gilad Arnolddc4bb262014-07-23 10:45:19 -0700662 // Ignore errors that happened before the last known failed attempt.
663 if (!update_state.failures_last_updated.is_null() &&
664 err_time <= update_state.failures_last_updated)
665 continue;
666
667 if (prev_url_idx >= 0) {
668 if (url_idx < prev_url_idx) {
669 LOG(ERROR) << "The URLs in the download error log have wrapped around ("
670 << prev_url_idx << "->" << url_idx
671 << "). This should not have happened and means that there's "
672 "a bug. To be conservative, we record a failed attempt "
673 "(invalidating the rest of the error log) and resume "
674 "download from the first usable URL.";
675 url_idx = -1;
676 is_failure_occurred = true;
677 break;
678 }
679
680 if (url_idx > prev_url_idx) {
681 url_num_errors = 0;
682 do_advance_url = false;
683 }
684 }
685
686 if (HandleErrorCode(get<1>(err_tuple), &url_num_errors) ||
687 url_num_errors > update_state.download_errors_max)
688 do_advance_url = true;
689
690 prev_url_idx = url_idx;
Gilad Arnoldb3b05442014-05-30 14:25:05 -0700691 }
692
Gilad Arnolddc4bb262014-07-23 10:45:19 -0700693 // If required, advance to the next usable URL. If the URLs wraparound, we
694 // mark an update attempt failure. Also be sure to set the download error
695 // count to zero.
696 if (url_idx < 0 || do_advance_url) {
697 url_num_errors = 0;
698 int start_url_idx = -1;
699 do {
700 if (++url_idx == num_urls) {
701 url_idx = 0;
702 // We only mark failure if an actual advancing of a URL was required.
703 if (do_advance_url)
704 is_failure_occurred = true;
705 }
706
707 if (start_url_idx < 0)
708 start_url_idx = url_idx;
709 else if (url_idx == start_url_idx)
710 url_idx = -1; // No usable URL.
711 } while (url_idx >= 0 &&
712 !IsUrlUsable(update_state.download_urls[url_idx], http_allowed));
713 }
714
715 // If we have a download URL but a failure was observed, compute a new backoff
716 // expiry (if allowed). The backoff period is generally 2 ^ (num_failures - 1)
717 // days, bounded by the size of int and kAttemptBackoffMaxIntervalInDays, and
718 // fuzzed by kAttemptBackoffFuzzInHours hours. Backoff expiry is computed from
719 // the latest recorded time of error.
720 Time backoff_expiry;
721 if (url_idx >= 0 && is_failure_occurred && may_backoff) {
722 CHECK(!err_time.is_null())
723 << "We must have an error timestamp if a failure occurred!";
724 const uint64_t* seed = ec->GetValue(state->random_provider()->var_seed());
725 POLICY_CHECK_VALUE_AND_FAIL(seed, error);
726 PRNG prng(*seed);
Alex Deymof329b932014-10-30 01:37:48 -0700727 int exp = min(update_state.num_failures,
Gilad Arnolddc4bb262014-07-23 10:45:19 -0700728 static_cast<int>(sizeof(int)) * 8 - 2);
Amin Hassani186ff6a2018-02-27 11:06:03 -0800729 TimeDelta backoff_interval = TimeDelta::FromDays(min(
730 1 << exp,
731 kNextUpdateCheckPolicyConstants.attempt_backoff_max_interval_in_days));
732 TimeDelta backoff_fuzz = TimeDelta::FromHours(
733 kNextUpdateCheckPolicyConstants.attempt_backoff_fuzz_in_hours);
734 TimeDelta wait_period = NextUpdateCheckTimePolicyImpl::FuzzedInterval(
735 &prng, backoff_interval.InSeconds(), backoff_fuzz.InSeconds());
Gilad Arnolddc4bb262014-07-23 10:45:19 -0700736 backoff_expiry = err_time + wait_period;
737
738 // If the newly computed backoff already expired, nullify it.
739 if (ec->IsWallclockTimeGreaterThan(backoff_expiry))
740 backoff_expiry = Time();
741 }
742
743 result->do_increment_failures = is_failure_occurred;
744 result->backoff_expiry = backoff_expiry;
Gilad Arnoldb3b05442014-05-30 14:25:05 -0700745 result->url_idx = url_idx;
Gilad Arnolddc4bb262014-07-23 10:45:19 -0700746 result->url_num_errors = url_num_errors;
Gilad Arnoldb3b05442014-05-30 14:25:05 -0700747 return EvalStatus::kSucceeded;
748}
749
Gilad Arnoldf62a4b82014-05-01 07:41:07 -0700750EvalStatus ChromeOSPolicy::UpdateScattering(
751 EvaluationContext* ec,
752 State* state,
753 string* error,
754 UpdateScatteringResult* result,
755 const UpdateState& update_state) const {
756 // Preconditions. These stem from the postconditions and usage contract.
757 DCHECK(update_state.scatter_wait_period >= kZeroInterval);
758 DCHECK_GE(update_state.scatter_check_threshold, 0);
759
760 // Set default result values.
761 result->is_scattering = false;
762 result->wait_period = kZeroInterval;
763 result->check_threshold = 0;
764
765 DevicePolicyProvider* const dp_provider = state->device_policy_provider();
766
767 // Ensure that a device policy is loaded.
768 const bool* device_policy_is_loaded_p = ec->GetValue(
769 dp_provider->var_device_policy_is_loaded());
770 if (!(device_policy_is_loaded_p && *device_policy_is_loaded_p))
771 return EvalStatus::kSucceeded;
772
773 // Is scattering enabled by policy?
774 const TimeDelta* scatter_factor_p = ec->GetValue(
775 dp_provider->var_scatter_factor());
776 if (!scatter_factor_p || *scatter_factor_p == kZeroInterval)
777 return EvalStatus::kSucceeded;
778
779 // Obtain a pseudo-random number generator.
780 const uint64_t* seed = ec->GetValue(state->random_provider()->var_seed());
781 POLICY_CHECK_VALUE_AND_FAIL(seed, error);
782 PRNG prng(*seed);
783
784 // Step 1: Maintain the scattering wait period.
785 //
786 // If no wait period was previously determined, or it no longer fits in the
787 // scatter factor, then generate a new one. Otherwise, keep the one we have.
Gilad Arnoldf62a4b82014-05-01 07:41:07 -0700788 TimeDelta wait_period = update_state.scatter_wait_period;
789 if (wait_period == kZeroInterval || wait_period > *scatter_factor_p) {
790 wait_period = TimeDelta::FromSeconds(
791 prng.RandMinMax(1, scatter_factor_p->InSeconds()));
792 }
793
Gilad Arnolddc4bb262014-07-23 10:45:19 -0700794 // If we surpassed the wait period or the max scatter period associated with
Gilad Arnoldf62a4b82014-05-01 07:41:07 -0700795 // the update, then no wait is needed.
796 Time wait_expires = (update_state.first_seen +
797 min(wait_period, update_state.scatter_wait_period_max));
Gilad Arnolda65fced2014-07-23 09:01:31 -0700798 if (ec->IsWallclockTimeGreaterThan(wait_expires))
Gilad Arnoldf62a4b82014-05-01 07:41:07 -0700799 wait_period = kZeroInterval;
800
801 // Step 2: Maintain the update check threshold count.
802 //
803 // If an update check threshold is not specified then generate a new
804 // one.
805 int check_threshold = update_state.scatter_check_threshold;
806 if (check_threshold == 0) {
807 check_threshold = prng.RandMinMax(
808 update_state.scatter_check_threshold_min,
809 update_state.scatter_check_threshold_max);
810 }
811
812 // If the update check threshold is not within allowed range then nullify it.
813 // TODO(garnold) This is compliant with current logic found in
814 // OmahaRequestAction::IsUpdateCheckCountBasedWaitingSatisfied(). We may want
815 // to change it so that it behaves similarly to the wait period case, namely
816 // if the current value exceeds the maximum, we set a new one within range.
817 if (check_threshold > update_state.scatter_check_threshold_max)
818 check_threshold = 0;
819
820 // If the update check threshold is non-zero and satisfied, then nullify it.
821 if (check_threshold > 0 && update_state.num_checks >= check_threshold)
822 check_threshold = 0;
823
824 bool is_scattering = (wait_period != kZeroInterval || check_threshold);
825 EvalStatus ret = EvalStatus::kSucceeded;
826 if (is_scattering && wait_period == update_state.scatter_wait_period &&
827 check_threshold == update_state.scatter_check_threshold)
828 ret = EvalStatus::kAskMeAgainLater;
829 result->is_scattering = is_scattering;
830 result->wait_period = wait_period;
831 result->check_threshold = check_threshold;
832 return ret;
833}
834
Alex Deymo63784a52014-05-28 10:46:14 -0700835} // namespace chromeos_update_manager