blob: 291a147838544b30434d3cc33bb4b4c35bdba3cd [file] [log] [blame]
Alex Deymoc705cc82014-02-19 11:15:00 -08001// Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
Alex Deymo63784a52014-05-28 10:46:14 -07005#include "update_engine/update_manager/chromeos_policy.h"
Alex Deymo0d11c602014-04-23 20:12:20 -07006
Gilad Arnolde1218812014-05-07 12:21:36 -07007#include <algorithm>
Gilad Arnold0adbc942014-05-12 10:35:43 -07008#include <set>
Alex Deymoc705cc82014-02-19 11:15:00 -08009#include <string>
10
Gilad Arnoldf62a4b82014-05-01 07:41:07 -070011#include <base/logging.h>
Gilad Arnoldb3b05442014-05-30 14:25:05 -070012#include <base/strings/string_util.h>
Gilad Arnoldf62a4b82014-05-01 07:41:07 -070013#include <base/time/time.h>
14
Gilad Arnoldb3b05442014-05-30 14:25:05 -070015#include "update_engine/error_code.h"
Alex Deymo63784a52014-05-28 10:46:14 -070016#include "update_engine/update_manager/device_policy_provider.h"
17#include "update_engine/update_manager/policy_utils.h"
18#include "update_engine/update_manager/shill_provider.h"
Gilad Arnoldb3b05442014-05-30 14:25:05 -070019#include "update_engine/utils.h"
Gilad Arnoldf62a4b82014-05-01 07:41:07 -070020
Alex Deymo0d11c602014-04-23 20:12:20 -070021using base::Time;
22using base::TimeDelta;
Gilad Arnoldb3b05442014-05-30 14:25:05 -070023using chromeos_update_engine::ErrorCode;
Gilad Arnolddc4bb262014-07-23 10:45:19 -070024using std::get;
Gilad Arnoldb3b05442014-05-30 14:25:05 -070025using std::max;
Gilad Arnoldf62a4b82014-05-01 07:41:07 -070026using std::min;
Gilad Arnold0adbc942014-05-12 10:35:43 -070027using std::set;
Alex Deymoc705cc82014-02-19 11:15:00 -080028using std::string;
29
Gilad Arnoldb3b05442014-05-30 14:25:05 -070030namespace {
31
Gilad Arnolddc4bb262014-07-23 10:45:19 -070032// Examines |err_code| and decides whether the URL index needs to be advanced,
33// the error count for the URL incremented, or none of the above. In the first
34// case, returns true; in the second case, increments |*url_num_error_p| and
35// returns false; otherwise just returns false.
Gilad Arnoldb3b05442014-05-30 14:25:05 -070036//
37// TODO(garnold) Adapted from PayloadState::UpdateFailed() (to be retired).
Gilad Arnolddc4bb262014-07-23 10:45:19 -070038bool HandleErrorCode(ErrorCode err_code, int* url_num_error_p) {
Gilad Arnoldb3b05442014-05-30 14:25:05 -070039 err_code = chromeos_update_engine::utils::GetBaseErrorCode(err_code);
40 switch (err_code) {
41 // Errors which are good indicators of a problem with a particular URL or
42 // the protocol used in the URL or entities in the communication channel
43 // (e.g. proxies). We should try the next available URL in the next update
44 // check to quickly recover from these errors.
45 case ErrorCode::kPayloadHashMismatchError:
46 case ErrorCode::kPayloadSizeMismatchError:
47 case ErrorCode::kDownloadPayloadVerificationError:
48 case ErrorCode::kDownloadPayloadPubKeyVerificationError:
49 case ErrorCode::kSignedDeltaPayloadExpectedError:
50 case ErrorCode::kDownloadInvalidMetadataMagicString:
51 case ErrorCode::kDownloadSignatureMissingInManifest:
52 case ErrorCode::kDownloadManifestParseError:
53 case ErrorCode::kDownloadMetadataSignatureError:
54 case ErrorCode::kDownloadMetadataSignatureVerificationError:
55 case ErrorCode::kDownloadMetadataSignatureMismatch:
56 case ErrorCode::kDownloadOperationHashVerificationError:
57 case ErrorCode::kDownloadOperationExecutionError:
58 case ErrorCode::kDownloadOperationHashMismatch:
59 case ErrorCode::kDownloadInvalidMetadataSize:
60 case ErrorCode::kDownloadInvalidMetadataSignature:
61 case ErrorCode::kDownloadOperationHashMissingError:
62 case ErrorCode::kDownloadMetadataSignatureMissingError:
63 case ErrorCode::kPayloadMismatchedType:
64 case ErrorCode::kUnsupportedMajorPayloadVersion:
65 case ErrorCode::kUnsupportedMinorPayloadVersion:
66 LOG(INFO) << "Advancing download URL due to error "
67 << chromeos_update_engine::utils::CodeToString(err_code)
68 << " (" << static_cast<int>(err_code) << ")";
Gilad Arnoldb3b05442014-05-30 14:25:05 -070069 return true;
70
71 // Errors which seem to be just transient network/communication related
72 // failures and do not indicate any inherent problem with the URL itself.
73 // So, we should keep the current URL but just increment the
74 // failure count to give it more chances. This way, while we maximize our
75 // chances of downloading from the URLs that appear earlier in the response
76 // (because download from a local server URL that appears earlier in a
77 // response is preferable than downloading from the next URL which could be
Alex Vakulenko072359c2014-07-18 11:41:07 -070078 // an Internet URL and thus could be more expensive).
Gilad Arnoldb3b05442014-05-30 14:25:05 -070079 case ErrorCode::kError:
80 case ErrorCode::kDownloadTransferError:
81 case ErrorCode::kDownloadWriteError:
82 case ErrorCode::kDownloadStateInitializationError:
Gilad Arnold684219d2014-07-07 14:54:57 -070083 case ErrorCode::kOmahaErrorInHTTPResponse: // Aggregate for HTTP errors.
Gilad Arnoldb3b05442014-05-30 14:25:05 -070084 LOG(INFO) << "Incrementing URL failure count due to error "
85 << chromeos_update_engine::utils::CodeToString(err_code)
86 << " (" << static_cast<int>(err_code) << ")";
Gilad Arnolddc4bb262014-07-23 10:45:19 -070087 *url_num_error_p += 1;
Gilad Arnoldb3b05442014-05-30 14:25:05 -070088 return false;
89
90 // Errors which are not specific to a URL and hence shouldn't result in
91 // the URL being penalized. This can happen in two cases:
92 // 1. We haven't started downloading anything: These errors don't cost us
93 // anything in terms of actual payload bytes, so we should just do the
94 // regular retries at the next update check.
95 // 2. We have successfully downloaded the payload: In this case, the
96 // payload attempt number would have been incremented and would take care
Alex Vakulenko072359c2014-07-18 11:41:07 -070097 // of the back-off at the next update check.
Gilad Arnoldb3b05442014-05-30 14:25:05 -070098 // In either case, there's no need to update URL index or failure count.
99 case ErrorCode::kOmahaRequestError:
100 case ErrorCode::kOmahaResponseHandlerError:
101 case ErrorCode::kPostinstallRunnerError:
102 case ErrorCode::kFilesystemCopierError:
103 case ErrorCode::kInstallDeviceOpenError:
104 case ErrorCode::kKernelDeviceOpenError:
105 case ErrorCode::kDownloadNewPartitionInfoError:
106 case ErrorCode::kNewRootfsVerificationError:
107 case ErrorCode::kNewKernelVerificationError:
108 case ErrorCode::kPostinstallBootedFromFirmwareB:
109 case ErrorCode::kPostinstallFirmwareRONotUpdatable:
110 case ErrorCode::kOmahaRequestEmptyResponseError:
111 case ErrorCode::kOmahaRequestXMLParseError:
112 case ErrorCode::kOmahaResponseInvalid:
113 case ErrorCode::kOmahaUpdateIgnoredPerPolicy:
114 case ErrorCode::kOmahaUpdateDeferredPerPolicy:
115 case ErrorCode::kOmahaUpdateDeferredForBackoff:
116 case ErrorCode::kPostinstallPowerwashError:
117 case ErrorCode::kUpdateCanceledByChannelChange:
David Zeuthenf3e28012014-08-26 18:23:52 -0400118 case ErrorCode::kOmahaRequestXMLHasEntityDecl:
Gilad Arnoldb3b05442014-05-30 14:25:05 -0700119 LOG(INFO) << "Not changing URL index or failure count due to error "
120 << chromeos_update_engine::utils::CodeToString(err_code)
121 << " (" << static_cast<int>(err_code) << ")";
122 return false;
123
124 case ErrorCode::kSuccess: // success code
125 case ErrorCode::kUmaReportedMax: // not an error code
126 case ErrorCode::kOmahaRequestHTTPResponseBase: // aggregated already
127 case ErrorCode::kDevModeFlag: // not an error code
128 case ErrorCode::kResumedFlag: // not an error code
129 case ErrorCode::kTestImageFlag: // not an error code
130 case ErrorCode::kTestOmahaUrlFlag: // not an error code
131 case ErrorCode::kSpecialFlags: // not an error code
132 // These shouldn't happen. Enumerating these explicitly here so that we
133 // can let the compiler warn about new error codes that are added to
134 // action_processor.h but not added here.
135 LOG(WARNING) << "Unexpected error "
136 << chromeos_update_engine::utils::CodeToString(err_code)
137 << " (" << static_cast<int>(err_code) << ")";
138 // Note: Not adding a default here so as to let the compiler warn us of
139 // any new enums that were added in the .h but not listed in this switch.
140 }
141 return false;
142}
143
Gilad Arnolddc4bb262014-07-23 10:45:19 -0700144// Checks whether |url| can be used under given download restrictions.
145bool IsUrlUsable(const string& url, bool http_allowed) {
146 return http_allowed || !StartsWithASCII(url, "http://", false);
Gilad Arnoldb3b05442014-05-30 14:25:05 -0700147}
148
149} // namespace
150
Alex Deymo63784a52014-05-28 10:46:14 -0700151namespace chromeos_update_manager {
Alex Deymoc705cc82014-02-19 11:15:00 -0800152
Gilad Arnolda2e8eaa2014-09-24 13:12:33 -0700153const int ChromeOSPolicy::kTimeoutInitialInterval = 7 * 60;
154const int ChromeOSPolicy::kTimeoutPeriodicInterval = 45 * 60;
155const int ChromeOSPolicy::kTimeoutMaxBackoffInterval = 4 * 60 * 60;
156const int ChromeOSPolicy::kTimeoutRegularFuzz = 10 * 60;
Gilad Arnolddc4bb262014-07-23 10:45:19 -0700157const int ChromeOSPolicy::kAttemptBackoffMaxIntervalInDays = 16;
158const int ChromeOSPolicy::kAttemptBackoffFuzzInHours = 12;
Gilad Arnolda2e8eaa2014-09-24 13:12:33 -0700159
Alex Deymo0d11c602014-04-23 20:12:20 -0700160EvalStatus ChromeOSPolicy::UpdateCheckAllowed(
161 EvaluationContext* ec, State* state, string* error,
162 UpdateCheckParams* result) const {
Gilad Arnold42f253b2014-06-25 12:39:17 -0700163 // Set the default return values.
164 result->updates_enabled = true;
165 result->target_channel.clear();
Gilad Arnoldd4b30322014-07-21 15:35:27 -0700166 result->target_version_prefix.clear();
Gilad Arnold44dc3bf2014-07-18 23:39:38 -0700167 result->is_interactive = false;
Gilad Arnold42f253b2014-06-25 12:39:17 -0700168
Gilad Arnolda1eabcd2014-07-09 15:42:40 -0700169 DevicePolicyProvider* const dp_provider = state->device_policy_provider();
Gilad Arnold44dc3bf2014-07-18 23:39:38 -0700170 UpdaterProvider* const updater_provider = state->updater_provider();
Gilad Arnolda1eabcd2014-07-09 15:42:40 -0700171 SystemProvider* const system_provider = state->system_provider();
172
Gilad Arnold44dc3bf2014-07-18 23:39:38 -0700173 // Do not perform any updates if booted from removable device. This decision
174 // is final.
Gilad Arnoldbfc44f72014-07-09 14:41:39 -0700175 const bool* is_boot_device_removable_p = ec->GetValue(
Gilad Arnolda1eabcd2014-07-09 15:42:40 -0700176 system_provider->var_is_boot_device_removable());
Gilad Arnoldbfc44f72014-07-09 14:41:39 -0700177 if (is_boot_device_removable_p && *is_boot_device_removable_p) {
Gilad Arnoldec7f9162014-07-15 13:24:46 -0700178 LOG(INFO) << "Booted from removable device, disabling update checks.";
Gilad Arnoldbfc44f72014-07-09 14:41:39 -0700179 result->updates_enabled = false;
180 return EvalStatus::kSucceeded;
181 }
182
Gilad Arnold42f253b2014-06-25 12:39:17 -0700183 const bool* device_policy_is_loaded_p = ec->GetValue(
184 dp_provider->var_device_policy_is_loaded());
185 if (device_policy_is_loaded_p && *device_policy_is_loaded_p) {
186 // Check whether updates are disabled by policy.
187 const bool* update_disabled_p = ec->GetValue(
188 dp_provider->var_update_disabled());
Gilad Arnoldec7f9162014-07-15 13:24:46 -0700189 if (update_disabled_p && *update_disabled_p) {
190 LOG(INFO) << "Updates disabled by policy, blocking update checks.";
Gilad Arnold42f253b2014-06-25 12:39:17 -0700191 return EvalStatus::kAskMeAgainLater;
Gilad Arnoldec7f9162014-07-15 13:24:46 -0700192 }
Gilad Arnold42f253b2014-06-25 12:39:17 -0700193
Gilad Arnoldd4b30322014-07-21 15:35:27 -0700194 // Determine whether a target version prefix is dictated by policy.
195 const string* target_version_prefix_p = ec->GetValue(
196 dp_provider->var_target_version_prefix());
197 if (target_version_prefix_p)
198 result->target_version_prefix = *target_version_prefix_p;
199
Gilad Arnold42f253b2014-06-25 12:39:17 -0700200 // Determine whether a target channel is dictated by policy.
201 const bool* release_channel_delegated_p = ec->GetValue(
202 dp_provider->var_release_channel_delegated());
203 if (release_channel_delegated_p && !(*release_channel_delegated_p)) {
204 const string* release_channel_p = ec->GetValue(
205 dp_provider->var_release_channel());
206 if (release_channel_p)
207 result->target_channel = *release_channel_p;
208 }
209 }
210
Gilad Arnold44dc3bf2014-07-18 23:39:38 -0700211 // First, check to see if an interactive update was requested.
Gilad Arnoldec7f9162014-07-15 13:24:46 -0700212 const UpdateRequestStatus* forced_update_requested_p = ec->GetValue(
213 updater_provider->var_forced_update_requested());
214 if (forced_update_requested_p &&
215 *forced_update_requested_p != UpdateRequestStatus::kNone) {
216 result->is_interactive =
217 (*forced_update_requested_p == UpdateRequestStatus::kInteractive);
218 LOG(INFO) << "Forced update signaled ("
219 << (result->is_interactive ? "interactive" : "periodic")
220 << "), allowing update check.";
Gilad Arnold44dc3bf2014-07-18 23:39:38 -0700221 return EvalStatus::kSucceeded;
222 }
223
224 // The logic thereafter applies to periodic updates. Bear in mind that we
225 // should not return a final "no" if any of these criteria are not satisfied,
226 // because the system may still update due to an interactive update request.
227
228 // Unofficial builds should not perform periodic update checks.
229 const bool* is_official_build_p = ec->GetValue(
230 system_provider->var_is_official_build());
231 if (is_official_build_p && !(*is_official_build_p)) {
Gilad Arnoldec7f9162014-07-15 13:24:46 -0700232 LOG(INFO) << "Unofficial build, blocking periodic update checks.";
Gilad Arnold44dc3bf2014-07-18 23:39:38 -0700233 return EvalStatus::kAskMeAgainLater;
234 }
235
236 // If OOBE is enabled, wait until it is completed.
237 const bool* is_oobe_enabled_p = ec->GetValue(
238 state->config_provider()->var_is_oobe_enabled());
239 if (is_oobe_enabled_p && *is_oobe_enabled_p) {
240 const bool* is_oobe_complete_p = ec->GetValue(
241 system_provider->var_is_oobe_complete());
Gilad Arnoldec7f9162014-07-15 13:24:46 -0700242 if (is_oobe_complete_p && !(*is_oobe_complete_p)) {
243 LOG(INFO) << "OOBE not completed, blocking update checks.";
Gilad Arnold44dc3bf2014-07-18 23:39:38 -0700244 return EvalStatus::kAskMeAgainLater;
Gilad Arnoldec7f9162014-07-15 13:24:46 -0700245 }
Gilad Arnold44dc3bf2014-07-18 23:39:38 -0700246 }
247
248 // Ensure that periodic update checks are timed properly.
Alex Deymo0d11c602014-04-23 20:12:20 -0700249 Time next_update_check;
250 if (NextUpdateCheckTime(ec, state, error, &next_update_check) !=
251 EvalStatus::kSucceeded) {
252 return EvalStatus::kFailed;
253 }
Gilad Arnoldec7f9162014-07-15 13:24:46 -0700254 if (!ec->IsWallclockTimeGreaterThan(next_update_check)) {
255 LOG(INFO) << "Periodic check interval not satisfied, blocking until "
256 << chromeos_update_engine::utils::ToString(next_update_check);
Alex Deymo0d11c602014-04-23 20:12:20 -0700257 return EvalStatus::kAskMeAgainLater;
Gilad Arnoldec7f9162014-07-15 13:24:46 -0700258 }
Alex Deymo0d11c602014-04-23 20:12:20 -0700259
260 // It is time to check for an update.
Gilad Arnoldec7f9162014-07-15 13:24:46 -0700261 LOG(INFO) << "Allowing update check.";
Alex Deymoe636c3c2014-03-11 19:02:08 -0700262 return EvalStatus::kSucceeded;
Alex Deymoc705cc82014-02-19 11:15:00 -0800263}
264
Gilad Arnoldf62a4b82014-05-01 07:41:07 -0700265EvalStatus ChromeOSPolicy::UpdateCanStart(
266 EvaluationContext* ec,
267 State* state,
268 string* error,
Gilad Arnold42f253b2014-06-25 12:39:17 -0700269 UpdateDownloadParams* result,
Gilad Arnoldd78caf92014-09-24 09:28:14 -0700270 const UpdateState update_state) const {
Gilad Arnolddc4bb262014-07-23 10:45:19 -0700271 // Set the default return values. Note that we set persisted values (backoff,
272 // scattering) to the same values presented in the update state. The reason is
273 // that preemptive returns, such as the case where an update check is due,
274 // should not clear off the said values; rather, it is the deliberate
275 // inference of new values that should cause them to be reset.
Gilad Arnoldf62a4b82014-05-01 07:41:07 -0700276 result->update_can_start = true;
Gilad Arnoldf62a4b82014-05-01 07:41:07 -0700277 result->cannot_start_reason = UpdateCannotStartReason::kUndefined;
Gilad Arnoldb3b05442014-05-30 14:25:05 -0700278 result->download_url_idx = -1;
Gilad Arnolddc4bb262014-07-23 10:45:19 -0700279 result->p2p_allowed = false;
280 result->do_increment_failures = false;
281 result->backoff_expiry = update_state.backoff_expiry;
282 result->scatter_wait_period = update_state.scatter_wait_period;
283 result->scatter_check_threshold = update_state.scatter_check_threshold;
Gilad Arnoldf62a4b82014-05-01 07:41:07 -0700284
285 // Make sure that we're not due for an update check.
286 UpdateCheckParams check_result;
287 EvalStatus check_status = UpdateCheckAllowed(ec, state, error, &check_result);
288 if (check_status == EvalStatus::kFailed)
289 return EvalStatus::kFailed;
290 if (check_status == EvalStatus::kSucceeded &&
291 check_result.updates_enabled == true) {
292 result->update_can_start = false;
293 result->cannot_start_reason = UpdateCannotStartReason::kCheckDue;
294 return EvalStatus::kSucceeded;
295 }
296
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);
303 if (backoff_url_status != EvalStatus::kFailed) {
304 result->download_url_idx = backoff_url_result.url_idx;
305 result->download_url_num_errors = backoff_url_result.url_num_errors;
306 result->do_increment_failures = backoff_url_result.do_increment_failures;
307 result->backoff_expiry = backoff_url_result.backoff_expiry;
308 }
309 if (backoff_url_status != EvalStatus::kSucceeded ||
310 !backoff_url_result.backoff_expiry.is_null()) {
311 if (backoff_url_status != EvalStatus::kFailed) {
312 result->update_can_start = false;
313 result->cannot_start_reason = UpdateCannotStartReason::kBackoff;
314 }
315 return backoff_url_status;
316 }
317
Gilad Arnoldf62a4b82014-05-01 07:41:07 -0700318 DevicePolicyProvider* const dp_provider = state->device_policy_provider();
319
320 const bool* device_policy_is_loaded_p = ec->GetValue(
321 dp_provider->var_device_policy_is_loaded());
322 if (device_policy_is_loaded_p && *device_policy_is_loaded_p) {
Gilad Arnold76a11f62014-05-20 09:02:12 -0700323 // Check whether scattering applies to this update attempt. We should not be
324 // scattering if this is an interactive update check, or if OOBE is enabled
325 // but not completed.
326 //
327 // Note: current code further suppresses scattering if a "deadline"
Gilad Arnoldf62a4b82014-05-01 07:41:07 -0700328 // attribute is found in the Omaha response. However, it appears that the
Gilad Arnold76a11f62014-05-20 09:02:12 -0700329 // presence of this attribute is merely indicative of an OOBE update, during
330 // which we suppress scattering anyway.
331 bool scattering_applies = false;
Gilad Arnolddc4bb262014-07-23 10:45:19 -0700332 result->scatter_wait_period = kZeroInterval;
333 result->scatter_check_threshold = 0;
334 if (!update_state.is_interactive) {
Gilad Arnold76a11f62014-05-20 09:02:12 -0700335 const bool* is_oobe_enabled_p = ec->GetValue(
336 state->config_provider()->var_is_oobe_enabled());
337 if (is_oobe_enabled_p && !(*is_oobe_enabled_p)) {
338 scattering_applies = true;
339 } else {
340 const bool* is_oobe_complete_p = ec->GetValue(
Gilad Arnoldb3b05442014-05-30 14:25:05 -0700341 state->system_provider()->var_is_oobe_complete());
Gilad Arnold76a11f62014-05-20 09:02:12 -0700342 scattering_applies = (is_oobe_complete_p && *is_oobe_complete_p);
343 }
344 }
345
346 // Compute scattering values.
347 if (scattering_applies) {
Gilad Arnoldf62a4b82014-05-01 07:41:07 -0700348 UpdateScatteringResult scatter_result;
349 EvalStatus scattering_status = UpdateScattering(
350 ec, state, error, &scatter_result, update_state);
351 if (scattering_status != EvalStatus::kSucceeded ||
352 scatter_result.is_scattering) {
353 if (scattering_status != EvalStatus::kFailed) {
354 result->update_can_start = false;
355 result->cannot_start_reason = UpdateCannotStartReason::kScattering;
356 result->scatter_wait_period = scatter_result.wait_period;
357 result->scatter_check_threshold = scatter_result.check_threshold;
358 }
359 return scattering_status;
360 }
361 }
362
Gilad Arnoldef8d0872014-10-03 14:14:06 -0700363 // Determine whether use of P2P is allowed by policy. Even if P2P is not
364 // explicitly allowed, we allow it if the device is enterprise enrolled
365 // (that is, missing or empty owner string).
Gilad Arnoldf62a4b82014-05-01 07:41:07 -0700366 const bool* policy_au_p2p_enabled_p = ec->GetValue(
367 dp_provider->var_au_p2p_enabled());
Gilad Arnoldef8d0872014-10-03 14:14:06 -0700368 if (policy_au_p2p_enabled_p) {
369 result->p2p_allowed = *policy_au_p2p_enabled_p;
370 } else {
371 const string* policy_owner_p = ec->GetValue(dp_provider->var_owner());
372 if (!policy_owner_p || policy_owner_p->empty())
373 result->p2p_allowed = true;
374 }
Gilad Arnoldf62a4b82014-05-01 07:41:07 -0700375 }
376
Gilad Arnoldef8d0872014-10-03 14:14:06 -0700377 // Enable P2P, if so mandated by the updater configuration. This is additive
378 // to whether or not P2P is allowed per device policy (see above).
Gilad Arnoldf62a4b82014-05-01 07:41:07 -0700379 if (!result->p2p_allowed) {
380 const bool* updater_p2p_enabled_p = ec->GetValue(
381 state->updater_provider()->var_p2p_enabled());
382 result->p2p_allowed = updater_p2p_enabled_p && *updater_p2p_enabled_p;
383 }
384
Gilad Arnolddc4bb262014-07-23 10:45:19 -0700385 // Store the download URL and failure increment flag. Note that no URL will
386 // only terminate evaluation if no other means of download (such as P2P) are
387 // enabled.
388 if (result->download_url_idx < 0 && !result->p2p_allowed) {
389 result->update_can_start = false;
390 result->cannot_start_reason = UpdateCannotStartReason::kCannotDownload;
Gilad Arnoldb3b05442014-05-30 14:25:05 -0700391 }
392
Gilad Arnoldaf2f6ae2014-04-28 14:14:52 -0700393 return EvalStatus::kSucceeded;
394}
395
Gilad Arnolda8262e22014-06-02 13:54:27 -0700396// TODO(garnold) Logic in this method is based on
397// ConnectionManager::IsUpdateAllowedOver(); be sure to deprecate the latter.
398//
399// TODO(garnold) The current logic generally treats the list of allowed
400// connections coming from the device policy as a whitelist, meaning that it
401// can only be used for enabling connections, but not disable them. Further,
402// certain connection types (like Bluetooth) cannot be enabled even by policy.
403// In effect, the only thing that device policy can change is to enable
404// updates over a cellular network (disabled by default). We may want to
405// revisit this semantics, allowing greater flexibility in defining specific
406// permissions over all types of networks.
Gilad Arnold684219d2014-07-07 14:54:57 -0700407EvalStatus ChromeOSPolicy::UpdateDownloadAllowed(
Gilad Arnolda8262e22014-06-02 13:54:27 -0700408 EvaluationContext* ec,
409 State* state,
410 string* error,
411 bool* result) const {
412 // Get the current connection type.
413 ShillProvider* const shill_provider = state->shill_provider();
414 const ConnectionType* conn_type_p = ec->GetValue(
415 shill_provider->var_conn_type());
416 POLICY_CHECK_VALUE_AND_FAIL(conn_type_p, error);
417 ConnectionType conn_type = *conn_type_p;
418
419 // If we're tethering, treat it as a cellular connection.
420 if (conn_type != ConnectionType::kCellular) {
421 const ConnectionTethering* conn_tethering_p = ec->GetValue(
422 shill_provider->var_conn_tethering());
423 POLICY_CHECK_VALUE_AND_FAIL(conn_tethering_p, error);
424 if (*conn_tethering_p == ConnectionTethering::kConfirmed)
425 conn_type = ConnectionType::kCellular;
426 }
427
428 // By default, we allow updates for all connection types, with exceptions as
429 // noted below. This also determines whether a device policy can override the
430 // default.
431 *result = true;
432 bool device_policy_can_override = false;
433 switch (conn_type) {
434 case ConnectionType::kBluetooth:
435 *result = false;
436 break;
437
438 case ConnectionType::kCellular:
439 *result = false;
440 device_policy_can_override = true;
441 break;
442
443 case ConnectionType::kUnknown:
444 if (error)
445 *error = "Unknown connection type";
446 return EvalStatus::kFailed;
447
448 default:
449 break; // Nothing to do.
450 }
451
452 // If update is allowed, we're done.
453 if (*result)
454 return EvalStatus::kSucceeded;
455
456 // Check whether the device policy specifically allows this connection.
Gilad Arnolda8262e22014-06-02 13:54:27 -0700457 if (device_policy_can_override) {
458 DevicePolicyProvider* const dp_provider = state->device_policy_provider();
459 const bool* device_policy_is_loaded_p = ec->GetValue(
460 dp_provider->var_device_policy_is_loaded());
461 if (device_policy_is_loaded_p && *device_policy_is_loaded_p) {
462 const set<ConnectionType>* allowed_conn_types_p = ec->GetValue(
463 dp_provider->var_allowed_connection_types_for_update());
464 if (allowed_conn_types_p) {
465 if (allowed_conn_types_p->count(conn_type)) {
466 *result = true;
467 return EvalStatus::kSucceeded;
468 }
Gilad Arnold28d6be62014-06-30 14:04:04 -0700469 } else if (conn_type == ConnectionType::kCellular) {
470 // Local user settings can allow updates over cellular iff a policy was
471 // loaded but no allowed connections were specified in it.
472 const bool* update_over_cellular_allowed_p = ec->GetValue(
473 state->updater_provider()->var_cellular_enabled());
474 if (update_over_cellular_allowed_p && *update_over_cellular_allowed_p)
475 *result = true;
Gilad Arnolda8262e22014-06-02 13:54:27 -0700476 }
477 }
478 }
479
Gilad Arnold28d6be62014-06-30 14:04:04 -0700480 return (*result ? EvalStatus::kSucceeded : EvalStatus::kAskMeAgainLater);
Gilad Arnolda8262e22014-06-02 13:54:27 -0700481}
482
Alex Deymo0d11c602014-04-23 20:12:20 -0700483EvalStatus ChromeOSPolicy::NextUpdateCheckTime(EvaluationContext* ec,
484 State* state, string* error,
485 Time* next_update_check) const {
Gilad Arnolda0258a52014-07-10 16:21:19 -0700486 UpdaterProvider* const updater_provider = state->updater_provider();
487
Alex Deymo0d11c602014-04-23 20:12:20 -0700488 // Don't check for updates too often. We limit the update checks to once every
489 // some interval. The interval is kTimeoutInitialInterval the first time and
490 // kTimeoutPeriodicInterval for the subsequent update checks. If the update
491 // check fails, we increase the interval between the update checks
492 // exponentially until kTimeoutMaxBackoffInterval. Finally, to avoid having
493 // many chromebooks running update checks at the exact same time, we add some
494 // fuzz to the interval.
495 const Time* updater_started_time =
Gilad Arnolda0258a52014-07-10 16:21:19 -0700496 ec->GetValue(updater_provider->var_updater_started_time());
Alex Deymo0d11c602014-04-23 20:12:20 -0700497 POLICY_CHECK_VALUE_AND_FAIL(updater_started_time, error);
498
499 const base::Time* last_checked_time =
Gilad Arnolda0258a52014-07-10 16:21:19 -0700500 ec->GetValue(updater_provider->var_last_checked_time());
Alex Deymo0d11c602014-04-23 20:12:20 -0700501
502 const uint64_t* seed = ec->GetValue(state->random_provider()->var_seed());
503 POLICY_CHECK_VALUE_AND_FAIL(seed, error);
504
505 PRNG prng(*seed);
506
Gilad Arnold38b14022014-07-09 12:45:56 -0700507 // If this is the first attempt, compute and return an initial value.
Alex Deymo0d11c602014-04-23 20:12:20 -0700508 if (!last_checked_time || *last_checked_time < *updater_started_time) {
Alex Deymo0d11c602014-04-23 20:12:20 -0700509 *next_update_check = *updater_started_time + FuzzedInterval(
510 &prng, kTimeoutInitialInterval, kTimeoutRegularFuzz);
511 return EvalStatus::kSucceeded;
512 }
Gilad Arnold38b14022014-07-09 12:45:56 -0700513
Gilad Arnolda0258a52014-07-10 16:21:19 -0700514 // Check whether the server is enforcing a poll interval; if not, this value
515 // will be zero.
516 const unsigned int* server_dictated_poll_interval = ec->GetValue(
517 updater_provider->var_server_dictated_poll_interval());
518 POLICY_CHECK_VALUE_AND_FAIL(server_dictated_poll_interval, error);
Alex Deymo0d11c602014-04-23 20:12:20 -0700519
Gilad Arnolda0258a52014-07-10 16:21:19 -0700520 int interval = *server_dictated_poll_interval;
521 int fuzz = 0;
522
Alex Vakulenko072359c2014-07-18 11:41:07 -0700523 // If no poll interval was dictated by server compute a back-off period,
Gilad Arnolda0258a52014-07-10 16:21:19 -0700524 // starting from a predetermined base periodic interval and increasing
525 // exponentially by the number of consecutive failed attempts.
526 if (interval == 0) {
527 const unsigned int* consecutive_failed_update_checks = ec->GetValue(
528 updater_provider->var_consecutive_failed_update_checks());
529 POLICY_CHECK_VALUE_AND_FAIL(consecutive_failed_update_checks, error);
530
531 interval = kTimeoutPeriodicInterval;
532 unsigned int num_failures = *consecutive_failed_update_checks;
533 while (interval < kTimeoutMaxBackoffInterval && num_failures) {
534 interval *= 2;
535 num_failures--;
Alex Deymo0d11c602014-04-23 20:12:20 -0700536 }
537 }
538
Alex Vakulenko072359c2014-07-18 11:41:07 -0700539 // We cannot back off longer than the predetermined maximum interval.
Gilad Arnolda0258a52014-07-10 16:21:19 -0700540 if (interval > kTimeoutMaxBackoffInterval)
541 interval = kTimeoutMaxBackoffInterval;
542
Alex Vakulenko072359c2014-07-18 11:41:07 -0700543 // We cannot back off shorter than the predetermined periodic interval. Also,
Gilad Arnolda0258a52014-07-10 16:21:19 -0700544 // in this case set the fuzz to a predetermined regular value.
545 if (interval <= kTimeoutPeriodicInterval) {
546 interval = kTimeoutPeriodicInterval;
547 fuzz = kTimeoutRegularFuzz;
548 }
549
550 // If not otherwise determined, defer to a fuzz of +/-(interval / 2).
Gilad Arnold38b14022014-07-09 12:45:56 -0700551 if (fuzz == 0)
552 fuzz = interval;
553
Alex Deymo0d11c602014-04-23 20:12:20 -0700554 *next_update_check = *last_checked_time + FuzzedInterval(
Gilad Arnold38b14022014-07-09 12:45:56 -0700555 &prng, interval, fuzz);
Alex Deymo0d11c602014-04-23 20:12:20 -0700556 return EvalStatus::kSucceeded;
557}
558
559TimeDelta ChromeOSPolicy::FuzzedInterval(PRNG* prng, int interval, int fuzz) {
Gilad Arnolde1218812014-05-07 12:21:36 -0700560 DCHECK_GE(interval, 0);
561 DCHECK_GE(fuzz, 0);
Alex Deymo0d11c602014-04-23 20:12:20 -0700562 int half_fuzz = fuzz / 2;
Alex Deymo0d11c602014-04-23 20:12:20 -0700563 // This guarantees the output interval is non negative.
Gilad Arnoldb3b05442014-05-30 14:25:05 -0700564 int interval_min = max(interval - half_fuzz, 0);
Gilad Arnolde1218812014-05-07 12:21:36 -0700565 int interval_max = interval + half_fuzz;
566 return TimeDelta::FromSeconds(prng->RandMinMax(interval_min, interval_max));
Alex Deymo0d11c602014-04-23 20:12:20 -0700567}
568
Gilad Arnolddc4bb262014-07-23 10:45:19 -0700569EvalStatus ChromeOSPolicy::UpdateBackoffAndDownloadUrl(
Gilad Arnoldb3b05442014-05-30 14:25:05 -0700570 EvaluationContext* ec, State* state, std::string* error,
Gilad Arnolddc4bb262014-07-23 10:45:19 -0700571 UpdateBackoffAndDownloadUrlResult* result,
572 const UpdateState& update_state) const {
573 // Sanity checks.
574 DCHECK_GE(update_state.download_errors_max, 0);
575
576 // Set default result values.
577 result->do_increment_failures = false;
578 result->backoff_expiry = update_state.backoff_expiry;
579 result->url_idx = -1;
580 result->url_num_errors = 0;
581
582 const bool* is_official_build_p = ec->GetValue(
583 state->system_provider()->var_is_official_build());
584 bool is_official_build = (is_official_build_p ? *is_official_build_p : true);
585
586 // Check whether backoff is enabled.
587 bool may_backoff = false;
588 if (update_state.is_backoff_disabled) {
589 LOG(INFO) << "Backoff disabled by Omaha.";
590 } else if (update_state.is_interactive) {
591 LOG(INFO) << "No backoff for interactive updates.";
592 } else if (update_state.is_delta_payload) {
593 LOG(INFO) << "No backoff for delta payloads.";
594 } else if (!is_official_build) {
595 LOG(INFO) << "No backoff for unofficial builds.";
596 } else {
597 may_backoff = true;
Gilad Arnoldb3b05442014-05-30 14:25:05 -0700598 }
599
Gilad Arnolddc4bb262014-07-23 10:45:19 -0700600 // If previous backoff still in effect, block.
601 if (may_backoff && !update_state.backoff_expiry.is_null() &&
602 !ec->IsWallclockTimeGreaterThan(update_state.backoff_expiry)) {
603 LOG(INFO) << "Previous backoff has not expired, waiting.";
604 return EvalStatus::kAskMeAgainLater;
605 }
Gilad Arnoldb3b05442014-05-30 14:25:05 -0700606
607 // Determine whether HTTP downloads are forbidden by policy. This only
608 // applies to official system builds; otherwise, HTTP is always enabled.
609 bool http_allowed = true;
Gilad Arnolddc4bb262014-07-23 10:45:19 -0700610 if (is_official_build) {
Gilad Arnoldb3b05442014-05-30 14:25:05 -0700611 DevicePolicyProvider* const dp_provider = state->device_policy_provider();
612 const bool* device_policy_is_loaded_p = ec->GetValue(
613 dp_provider->var_device_policy_is_loaded());
614 if (device_policy_is_loaded_p && *device_policy_is_loaded_p) {
615 const bool* policy_http_downloads_enabled_p = ec->GetValue(
616 dp_provider->var_http_downloads_enabled());
617 http_allowed = (!policy_http_downloads_enabled_p ||
618 *policy_http_downloads_enabled_p);
619 }
620 }
621
Gilad Arnolddc4bb262014-07-23 10:45:19 -0700622 int url_idx = update_state.last_download_url_idx;
623 if (url_idx < 0)
624 url_idx = -1;
625 bool do_advance_url = false;
626 bool is_failure_occurred = false;
627 Time err_time;
628
629 // Scan the relevant part of the download error log, tracking which URLs are
630 // being used, and accounting the number of errors for each URL. Note that
631 // this process may not traverse all errors provided, as it may decide to bail
632 // out midway depending on the particular errors exhibited, the number of
633 // failures allowed, etc. When this ends, |url_idx| will point to the last URL
634 // used (-1 if starting fresh), |do_advance_url| will determine whether the
635 // URL needs to be advanced, and |err_time| the point in time when the last
636 // reported error occurred. Additionally, if the error log indicates that an
637 // update attempt has failed (abnormal), then |is_failure_occurred| will be
638 // set to true.
639 const int num_urls = update_state.download_urls.size();
640 int prev_url_idx = -1;
641 int url_num_errors = update_state.last_download_url_num_errors;
642 Time prev_err_time;
643 bool is_first = true;
644 for (const auto& err_tuple : update_state.download_errors) {
645 // Do some sanity checks.
646 int used_url_idx = get<0>(err_tuple);
647 if (is_first && url_idx >= 0 && used_url_idx != url_idx) {
648 LOG(WARNING) << "First URL in error log (" << used_url_idx
649 << ") not as expected (" << url_idx << ")";
Gilad Arnoldb3b05442014-05-30 14:25:05 -0700650 }
Gilad Arnolddc4bb262014-07-23 10:45:19 -0700651 is_first = false;
652 url_idx = used_url_idx;
653 if (url_idx < 0 || url_idx >= num_urls) {
654 LOG(ERROR) << "Download error log contains an invalid URL index ("
655 << url_idx << ")";
656 return EvalStatus::kFailed;
657 }
658 err_time = get<2>(err_tuple);
659 if (!(prev_err_time.is_null() || err_time >= prev_err_time)) {
660 // TODO(garnold) Monotonicity cannot really be assumed when dealing with
661 // wallclock-based timestamps. However, we're making a simplifying
662 // assumption so as to keep the policy implementation straightforward, for
663 // now. In general, we should convert all timestamp handling in the
664 // UpdateManager to use monotonic time (instead of wallclock), including
665 // the computation of various expiration times (backoff, scattering, etc).
666 // The client will do whatever conversions necessary when
667 // persisting/retrieving these values across reboots. See chromium:408794.
668 LOG(ERROR) << "Download error timestamps not monotonically increasing.";
669 return EvalStatus::kFailed;
670 }
671 prev_err_time = err_time;
Gilad Arnoldb3b05442014-05-30 14:25:05 -0700672
Gilad Arnolddc4bb262014-07-23 10:45:19 -0700673 // Ignore errors that happened before the last known failed attempt.
674 if (!update_state.failures_last_updated.is_null() &&
675 err_time <= update_state.failures_last_updated)
676 continue;
677
678 if (prev_url_idx >= 0) {
679 if (url_idx < prev_url_idx) {
680 LOG(ERROR) << "The URLs in the download error log have wrapped around ("
681 << prev_url_idx << "->" << url_idx
682 << "). This should not have happened and means that there's "
683 "a bug. To be conservative, we record a failed attempt "
684 "(invalidating the rest of the error log) and resume "
685 "download from the first usable URL.";
686 url_idx = -1;
687 is_failure_occurred = true;
688 break;
689 }
690
691 if (url_idx > prev_url_idx) {
692 url_num_errors = 0;
693 do_advance_url = false;
694 }
695 }
696
697 if (HandleErrorCode(get<1>(err_tuple), &url_num_errors) ||
698 url_num_errors > update_state.download_errors_max)
699 do_advance_url = true;
700
701 prev_url_idx = url_idx;
Gilad Arnoldb3b05442014-05-30 14:25:05 -0700702 }
703
Gilad Arnolddc4bb262014-07-23 10:45:19 -0700704 // If required, advance to the next usable URL. If the URLs wraparound, we
705 // mark an update attempt failure. Also be sure to set the download error
706 // count to zero.
707 if (url_idx < 0 || do_advance_url) {
708 url_num_errors = 0;
709 int start_url_idx = -1;
710 do {
711 if (++url_idx == num_urls) {
712 url_idx = 0;
713 // We only mark failure if an actual advancing of a URL was required.
714 if (do_advance_url)
715 is_failure_occurred = true;
716 }
717
718 if (start_url_idx < 0)
719 start_url_idx = url_idx;
720 else if (url_idx == start_url_idx)
721 url_idx = -1; // No usable URL.
722 } while (url_idx >= 0 &&
723 !IsUrlUsable(update_state.download_urls[url_idx], http_allowed));
724 }
725
726 // If we have a download URL but a failure was observed, compute a new backoff
727 // expiry (if allowed). The backoff period is generally 2 ^ (num_failures - 1)
728 // days, bounded by the size of int and kAttemptBackoffMaxIntervalInDays, and
729 // fuzzed by kAttemptBackoffFuzzInHours hours. Backoff expiry is computed from
730 // the latest recorded time of error.
731 Time backoff_expiry;
732 if (url_idx >= 0 && is_failure_occurred && may_backoff) {
733 CHECK(!err_time.is_null())
734 << "We must have an error timestamp if a failure occurred!";
735 const uint64_t* seed = ec->GetValue(state->random_provider()->var_seed());
736 POLICY_CHECK_VALUE_AND_FAIL(seed, error);
737 PRNG prng(*seed);
738 int exp = std::min(update_state.num_failures,
739 static_cast<int>(sizeof(int)) * 8 - 2);
740 TimeDelta backoff_interval = TimeDelta::FromDays(
741 std::min(1 << exp, kAttemptBackoffMaxIntervalInDays));
742 TimeDelta backoff_fuzz = TimeDelta::FromHours(kAttemptBackoffFuzzInHours);
743 TimeDelta wait_period = FuzzedInterval(&prng, backoff_interval.InSeconds(),
744 backoff_fuzz.InSeconds());
745 backoff_expiry = err_time + wait_period;
746
747 // If the newly computed backoff already expired, nullify it.
748 if (ec->IsWallclockTimeGreaterThan(backoff_expiry))
749 backoff_expiry = Time();
750 }
751
752 result->do_increment_failures = is_failure_occurred;
753 result->backoff_expiry = backoff_expiry;
Gilad Arnoldb3b05442014-05-30 14:25:05 -0700754 result->url_idx = url_idx;
Gilad Arnolddc4bb262014-07-23 10:45:19 -0700755 result->url_num_errors = url_num_errors;
Gilad Arnoldb3b05442014-05-30 14:25:05 -0700756 return EvalStatus::kSucceeded;
757}
758
Gilad Arnoldf62a4b82014-05-01 07:41:07 -0700759EvalStatus ChromeOSPolicy::UpdateScattering(
760 EvaluationContext* ec,
761 State* state,
762 string* error,
763 UpdateScatteringResult* result,
764 const UpdateState& update_state) const {
765 // Preconditions. These stem from the postconditions and usage contract.
766 DCHECK(update_state.scatter_wait_period >= kZeroInterval);
767 DCHECK_GE(update_state.scatter_check_threshold, 0);
768
769 // Set default result values.
770 result->is_scattering = false;
771 result->wait_period = kZeroInterval;
772 result->check_threshold = 0;
773
774 DevicePolicyProvider* const dp_provider = state->device_policy_provider();
775
776 // Ensure that a device policy is loaded.
777 const bool* device_policy_is_loaded_p = ec->GetValue(
778 dp_provider->var_device_policy_is_loaded());
779 if (!(device_policy_is_loaded_p && *device_policy_is_loaded_p))
780 return EvalStatus::kSucceeded;
781
782 // Is scattering enabled by policy?
783 const TimeDelta* scatter_factor_p = ec->GetValue(
784 dp_provider->var_scatter_factor());
785 if (!scatter_factor_p || *scatter_factor_p == kZeroInterval)
786 return EvalStatus::kSucceeded;
787
788 // Obtain a pseudo-random number generator.
789 const uint64_t* seed = ec->GetValue(state->random_provider()->var_seed());
790 POLICY_CHECK_VALUE_AND_FAIL(seed, error);
791 PRNG prng(*seed);
792
793 // Step 1: Maintain the scattering wait period.
794 //
795 // If no wait period was previously determined, or it no longer fits in the
796 // scatter factor, then generate a new one. Otherwise, keep the one we have.
Gilad Arnoldf62a4b82014-05-01 07:41:07 -0700797 TimeDelta wait_period = update_state.scatter_wait_period;
798 if (wait_period == kZeroInterval || wait_period > *scatter_factor_p) {
799 wait_period = TimeDelta::FromSeconds(
800 prng.RandMinMax(1, scatter_factor_p->InSeconds()));
801 }
802
Gilad Arnolddc4bb262014-07-23 10:45:19 -0700803 // If we surpassed the wait period or the max scatter period associated with
Gilad Arnoldf62a4b82014-05-01 07:41:07 -0700804 // the update, then no wait is needed.
805 Time wait_expires = (update_state.first_seen +
806 min(wait_period, update_state.scatter_wait_period_max));
Gilad Arnolda65fced2014-07-23 09:01:31 -0700807 if (ec->IsWallclockTimeGreaterThan(wait_expires))
Gilad Arnoldf62a4b82014-05-01 07:41:07 -0700808 wait_period = kZeroInterval;
809
810 // Step 2: Maintain the update check threshold count.
811 //
812 // If an update check threshold is not specified then generate a new
813 // one.
814 int check_threshold = update_state.scatter_check_threshold;
815 if (check_threshold == 0) {
816 check_threshold = prng.RandMinMax(
817 update_state.scatter_check_threshold_min,
818 update_state.scatter_check_threshold_max);
819 }
820
821 // If the update check threshold is not within allowed range then nullify it.
822 // TODO(garnold) This is compliant with current logic found in
823 // OmahaRequestAction::IsUpdateCheckCountBasedWaitingSatisfied(). We may want
824 // to change it so that it behaves similarly to the wait period case, namely
825 // if the current value exceeds the maximum, we set a new one within range.
826 if (check_threshold > update_state.scatter_check_threshold_max)
827 check_threshold = 0;
828
829 // If the update check threshold is non-zero and satisfied, then nullify it.
830 if (check_threshold > 0 && update_state.num_checks >= check_threshold)
831 check_threshold = 0;
832
833 bool is_scattering = (wait_period != kZeroInterval || check_threshold);
834 EvalStatus ret = EvalStatus::kSucceeded;
835 if (is_scattering && wait_period == update_state.scatter_wait_period &&
836 check_threshold == update_state.scatter_check_threshold)
837 ret = EvalStatus::kAskMeAgainLater;
838 result->is_scattering = is_scattering;
839 result->wait_period = wait_period;
840 result->check_threshold = check_threshold;
841 return ret;
842}
843
Alex Deymo63784a52014-05-28 10:46:14 -0700844} // namespace chromeos_update_manager