blob: 7e1926201eff1a53c06e9fe78858e31afdaed7f3 [file] [log] [blame]
Alex Deymoaea4c1c2015-08-19 20:24:43 -07001//
2// Copyright (C) 2012 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//
Darin Petkova4a8a8c2010-07-15 22:21:12 -070016
Gilad Arnoldcf175a02014-07-10 16:48:47 -070017#ifndef UPDATE_ENGINE_OMAHA_REQUEST_PARAMS_H_
18#define UPDATE_ENGINE_OMAHA_REQUEST_PARAMS_H_
Darin Petkova4a8a8c2010-07-15 22:21:12 -070019
Ben Chan9abb7632014-08-07 00:10:53 -070020#include <stdint.h>
21
Andrewe045aef2020-01-08 16:29:22 -080022#include <map>
Darin Petkova4a8a8c2010-07-15 22:21:12 -070023#include <string>
Xiaochu Liu88d90382018-08-29 16:09:11 -070024#include <vector>
Darin Petkova4a8a8c2010-07-15 22:21:12 -070025
Ben Chan05735a12014-09-03 07:48:22 -070026#include <base/macros.h>
Alex Vakulenko75039d72014-03-25 12:36:28 -070027#include <base/time/time.h>
Darin Petkov49d91322010-10-25 16:34:58 -070028#include <gtest/gtest_prod.h> // for FRIEND_TEST
Darin Petkova4a8a8c2010-07-15 22:21:12 -070029
Andrewe045aef2020-01-08 16:29:22 -080030#include "update_engine/common/constants.h"
Alex Deymo39910dc2015-11-09 17:04:30 -080031#include "update_engine/common/platform_constants.h"
Alex Deymo85616652015-10-15 18:48:31 -070032#include "update_engine/image_properties.h"
Amin Hassanie8153632020-10-27 15:11:28 -070033#include "update_engine/update_manager/policy.h"
Alex Deymoac41a822015-09-15 20:52:53 -070034
Darin Petkova4a8a8c2010-07-15 22:21:12 -070035// This gathers local system information and prepares info used by the
36// Omaha request action.
37
38namespace chromeos_update_engine {
39
Jay Srinivasanae4697c2013-03-18 17:08:08 -070040class SystemState;
Jay Srinivasan0a708742012-03-20 11:26:12 -070041
Jay Srinivasanae4697c2013-03-18 17:08:08 -070042// This class encapsulates the data Omaha gets for the request, along with
43// essential state needed for the processing of the request/response. The
44// strings in this struct should not be XML escaped.
45//
Alex Vakulenkod2779df2014-06-16 13:19:00 -070046// TODO(jaysri): chromium-os:39752 tracks the need to rename this class to
Jay Srinivasanae4697c2013-03-18 17:08:08 -070047// reflect its lifetime more appropriately.
48class OmahaRequestParams {
49 public:
Alex Vakulenkod2779df2014-06-16 13:19:00 -070050 explicit OmahaRequestParams(SystemState* system_state)
Jay Srinivasanae4697c2013-03-18 17:08:08 -070051 : system_state_(system_state),
Alex Deymoac41a822015-09-15 20:52:53 -070052 os_platform_(constants::kOmahaPlatformName),
Jay Srinivasanae4697c2013-03-18 17:08:08 -070053 os_version_(kOsVersion),
Jay Srinivasanae4697c2013-03-18 17:08:08 -070054 delta_okay_(true),
55 interactive_(false),
Marton Hunyadyba51c3f2018-04-25 15:18:10 +020056 rollback_allowed_(false),
Zentaro Kavanagh28def4f2019-01-15 17:15:01 -080057 rollback_data_save_requested_(false),
Jay Srinivasanae4697c2013-03-18 17:08:08 -070058 wall_clock_based_wait_enabled_(false),
59 update_check_count_wait_enabled_(false),
60 min_update_checks_needed_(kDefaultMinUpdateChecks),
Xiaochu Liu88d90382018-08-29 16:09:11 -070061 max_update_checks_allowed_(kDefaultMaxUpdateChecks),
62 is_install_(false) {}
Jay Srinivasan0a708742012-03-20 11:26:12 -070063
Alex Deymo3be05c82015-10-23 11:29:11 -070064 virtual ~OmahaRequestParams();
Alex Deymoe8948702014-11-11 21:44:45 -080065
Andrewe045aef2020-01-08 16:29:22 -080066 enum ActiveCountingType {
67 kDayBased = 0,
68 kDateBased,
69 };
70
71 struct AppParams {
72 ActiveCountingType active_counting_type;
73 // |name| is only used for DLCs to store the DLC ID.
74 std::string name;
75 int64_t ping_active;
76 int64_t ping_date_last_active;
77 int64_t ping_date_last_rollcall;
78 bool send_ping;
Jae Hoon Kim7fdfbf12020-04-10 18:15:50 -070079 // |updated| is only used for DLCs to decide sending DBus message to
80 // dlcservice on an install/update completion.
81 bool updated = true;
Andrewe045aef2020-01-08 16:29:22 -080082 };
83
Jay Srinivasanae4697c2013-03-18 17:08:08 -070084 // Setters and getters for the various properties.
85 inline std::string os_platform() const { return os_platform_; }
86 inline std::string os_version() const { return os_version_; }
87 inline std::string os_sp() const { return os_sp_; }
Alex Deymo85616652015-10-15 18:48:31 -070088 inline std::string os_board() const { return image_props_.board; }
Alex Deymoebf6e122017-03-10 16:12:01 -080089 inline std::string os_build_fingerprint() const {
90 return image_props_.build_fingerprint;
91 }
Sen Jiang1d5d95f2017-05-19 11:33:10 -070092 inline std::string os_build_type() const { return image_props_.build_type; }
Alex Deymo85616652015-10-15 18:48:31 -070093 inline std::string board_app_id() const { return image_props_.product_id; }
94 inline std::string canary_app_id() const {
95 return image_props_.canary_product_id;
96 }
Sen Jiang94a4dec2017-03-28 18:23:35 -070097 inline std::string system_app_id() const { return image_props_.system_id; }
Aaron Wood7dcdedf2017-09-06 17:17:41 -070098 inline void set_system_app_id(const std::string& system_app_id) {
99 image_props_.system_id = system_app_id;
100 }
Sen Jiang297e5832016-03-17 14:45:51 -0700101 inline void set_app_id(const std::string& app_id) {
102 image_props_.product_id = app_id;
103 image_props_.canary_product_id = app_id;
104 }
Jay Srinivasanae4697c2013-03-18 17:08:08 -0700105 inline std::string app_lang() const { return app_lang_; }
106 inline std::string hwid() const { return hwid_; }
Chris Sosac1972482013-04-30 22:31:10 -0700107 inline std::string fw_version() const { return fw_version_; }
108 inline std::string ec_version() const { return ec_version_; }
Matt Ziegelbaumaa8e1a42019-05-09 21:41:58 -0400109 inline std::string device_requisition() const { return device_requisition_; }
Darin Petkova4a8a8c2010-07-15 22:21:12 -0700110
Jay Srinivasanae4697c2013-03-18 17:08:08 -0700111 inline void set_app_version(const std::string& version) {
Alex Deymo85616652015-10-15 18:48:31 -0700112 image_props_.version = version;
Jay Srinivasanae4697c2013-03-18 17:08:08 -0700113 }
Alex Deymo85616652015-10-15 18:48:31 -0700114 inline std::string app_version() const { return image_props_.version; }
Sen Jiang94a4dec2017-03-28 18:23:35 -0700115 inline std::string system_version() const {
116 return image_props_.system_version;
117 }
Sen Jiang684c9cd2017-10-17 16:26:45 -0700118 inline std::string product_components() const {
119 return image_props_.product_components;
120 }
Sen Jiang8cd42342018-01-31 12:06:59 -0800121 inline void set_product_components(const std::string& product_components) {
122 image_props_.product_components = product_components;
123 }
Darin Petkova4a8a8c2010-07-15 22:21:12 -0700124
Alex Deymo85616652015-10-15 18:48:31 -0700125 inline std::string current_channel() const {
126 return image_props_.current_channel;
127 }
128 inline std::string target_channel() const {
129 return mutable_image_props_.target_channel;
130 }
Jay Srinivasan1c0fe792013-03-28 16:45:25 -0700131 inline std::string download_channel() const { return download_channel_; }
Darin Petkov49d91322010-10-25 16:34:58 -0700132
Jay Srinivasanae4697c2013-03-18 17:08:08 -0700133 // Can client accept a delta ?
134 inline void set_delta_okay(bool ok) { delta_okay_ = ok; }
135 inline bool delta_okay() const { return delta_okay_; }
Jay Srinivasan0a708742012-03-20 11:26:12 -0700136
Jay Srinivasanae4697c2013-03-18 17:08:08 -0700137 // True if this is a user-initiated update check.
Chris Sosa968d0572013-08-23 14:46:02 -0700138 inline void set_interactive(bool interactive) { interactive_ = interactive; }
Jay Srinivasanae4697c2013-03-18 17:08:08 -0700139 inline bool interactive() const { return interactive_; }
Jay Srinivasan480ddfa2012-06-01 19:15:26 -0700140
Jay Srinivasanae4697c2013-03-18 17:08:08 -0700141 inline void set_update_url(const std::string& url) { update_url_ = url; }
142 inline std::string update_url() const { return update_url_; }
143
Jay Srinivasanae4697c2013-03-18 17:08:08 -0700144 inline void set_target_version_prefix(const std::string& prefix) {
145 target_version_prefix_ = prefix;
146 }
147
148 inline std::string target_version_prefix() const {
149 return target_version_prefix_;
150 }
151
Amin Hassani37b67232020-08-13 09:29:48 -0700152 inline std::string lts_tag() const { return lts_tag_; }
153
154 inline void set_lts_tag(const std::string& hint) { lts_tag_ = hint; }
155
Marton Hunyadyba51c3f2018-04-25 15:18:10 +0200156 inline void set_rollback_allowed(bool rollback_allowed) {
157 rollback_allowed_ = rollback_allowed;
158 }
159
160 inline bool rollback_allowed() const { return rollback_allowed_; }
161
Zentaro Kavanagh28def4f2019-01-15 17:15:01 -0800162 inline void set_rollback_data_save_requested(
163 bool rollback_data_save_requested) {
164 rollback_data_save_requested_ = rollback_data_save_requested;
165 }
166
167 inline bool rollback_data_save_requested() const {
168 return rollback_data_save_requested_;
169 }
170
Zentaro Kavanagh0ef9a2f2018-07-02 12:05:07 -0700171 inline void set_rollback_allowed_milestones(int rollback_allowed_milestones) {
172 rollback_allowed_milestones_ = rollback_allowed_milestones;
173 }
174
175 inline int rollback_allowed_milestones() const {
176 return rollback_allowed_milestones_;
177 }
178
Jay Srinivasanae4697c2013-03-18 17:08:08 -0700179 inline void set_wall_clock_based_wait_enabled(bool enabled) {
180 wall_clock_based_wait_enabled_ = enabled;
181 }
182 inline bool wall_clock_based_wait_enabled() const {
183 return wall_clock_based_wait_enabled_;
184 }
185
186 inline void set_waiting_period(base::TimeDelta period) {
187 waiting_period_ = period;
188 }
189 base::TimeDelta waiting_period() const { return waiting_period_; }
190
191 inline void set_update_check_count_wait_enabled(bool enabled) {
192 update_check_count_wait_enabled_ = enabled;
193 }
194
195 inline bool update_check_count_wait_enabled() const {
196 return update_check_count_wait_enabled_;
197 }
198
Ben Chan9abb7632014-08-07 00:10:53 -0700199 inline void set_min_update_checks_needed(int64_t min) {
Jay Srinivasanae4697c2013-03-18 17:08:08 -0700200 min_update_checks_needed_ = min;
201 }
Ben Chan9abb7632014-08-07 00:10:53 -0700202 inline int64_t min_update_checks_needed() const {
Jay Srinivasanae4697c2013-03-18 17:08:08 -0700203 return min_update_checks_needed_;
204 }
205
Ben Chan9abb7632014-08-07 00:10:53 -0700206 inline void set_max_update_checks_allowed(int64_t max) {
Jay Srinivasanae4697c2013-03-18 17:08:08 -0700207 max_update_checks_allowed_ = max;
208 }
Ben Chan9abb7632014-08-07 00:10:53 -0700209 inline int64_t max_update_checks_allowed() const {
Jay Srinivasanae4697c2013-03-18 17:08:08 -0700210 return max_update_checks_allowed_;
211 }
Andrewe045aef2020-01-08 16:29:22 -0800212 inline void set_dlc_apps_params(
213 const std::map<std::string, AppParams>& dlc_apps_params) {
214 dlc_apps_params_ = dlc_apps_params;
Xiaochu Liu88d90382018-08-29 16:09:11 -0700215 }
Andrewe045aef2020-01-08 16:29:22 -0800216 inline const std::map<std::string, AppParams>& dlc_apps_params() const {
217 return dlc_apps_params_;
Xiaochu Liuf53a5d32018-11-26 13:48:59 -0800218 }
Xiaochu Liu88d90382018-08-29 16:09:11 -0700219 inline void set_is_install(bool is_install) { is_install_ = is_install; }
220 inline bool is_install() const { return is_install_; }
Jay Srinivasanae4697c2013-03-18 17:08:08 -0700221
Askar Aitzhan570ca872019-04-24 11:16:12 +0200222 inline void set_autoupdate_token(const std::string& token) {
223 autoupdate_token_ = token;
224 }
225 inline const std::string& autoupdate_token() const {
226 return autoupdate_token_;
227 }
228
Andrewe045aef2020-01-08 16:29:22 -0800229 // Returns the App ID corresponding to the current value of the
Jay Srinivasandb0acdf2013-04-02 14:47:45 -0700230 // download channel.
Alex Deymo560ae1d2014-10-28 02:17:54 -0700231 virtual std::string GetAppId() const;
Jay Srinivasandb0acdf2013-04-02 14:47:45 -0700232
Jae Hoon Kim5e9cd712020-02-12 15:28:28 -0800233 // Returns the DLC app ID.
234 virtual std::string GetDlcAppId(const std::string& dlc_id) const;
235
236 // Returns true if the App ID is a DLC App ID that is currently part of the
237 // request parameters.
238 virtual bool IsDlcAppId(const std::string& app_id) const;
Andrewe045aef2020-01-08 16:29:22 -0800239
Jae Hoon Kim7fdfbf12020-04-10 18:15:50 -0700240 // If the App ID is a DLC App ID will set to no update.
241 void SetDlcNoUpdate(const std::string& app_id);
242
Darin Petkova4a8a8c2010-07-15 22:21:12 -0700243 // Suggested defaults
David Pursell02c18642014-11-06 11:26:11 -0800244 static const char kOsVersion[];
Ben Chan9abb7632014-08-07 00:10:53 -0700245 static const int64_t kDefaultMinUpdateChecks = 0;
246 static const int64_t kDefaultMaxUpdateChecks = 8;
Darin Petkova4a8a8c2010-07-15 22:21:12 -0700247
Darin Petkov5a7f5652010-07-22 21:40:09 -0700248 // Initializes all the data in the object. Non-empty
249 // |in_app_version| or |in_update_url| prevents automatic detection
250 // of the parameter. Returns true on success, false otherwise.
251 bool Init(const std::string& in_app_version,
Patrick Dubroy7fbbe8a2011-08-01 17:28:22 +0200252 const std::string& in_update_url,
Amin Hassanie8153632020-10-27 15:11:28 -0700253 const chromeos_update_manager::UpdateCheckParams& params);
Darin Petkova4a8a8c2010-07-15 22:21:12 -0700254
Jay Srinivasanae4697c2013-03-18 17:08:08 -0700255 // Permanently changes the release channel to |channel|. Performs a
256 // powerwash, if required and allowed.
257 // Returns true on success, false otherwise. Note: This call will fail if
258 // there's a channel change pending already. This is to serialize all the
259 // channel changes done by the user in order to avoid having to solve
260 // numerous edge cases around ensuring the powerwash happens as intended in
261 // all such cases.
Alex Deymo560ae1d2014-10-28 02:17:54 -0700262 virtual bool SetTargetChannel(const std::string& channel,
Alex Deymod942f9d2015-11-06 16:11:50 -0800263 bool is_powerwash_allowed,
264 std::string* error_message);
Darin Petkov49d91322010-10-25 16:34:58 -0700265
Jay Srinivasan1c0fe792013-03-28 16:45:25 -0700266 // Updates the download channel for this particular attempt from the current
267 // value of target channel. This method takes a "snapshot" of the current
268 // value of target channel and uses it for all subsequent Omaha requests for
269 // this attempt (i.e. initial request as well as download progress/error
270 // event requests). The snapshot will be updated only when either this method
271 // or Init is called again.
Alex Deymo560ae1d2014-10-28 02:17:54 -0700272 virtual void UpdateDownloadChannel();
Jay Srinivasan1c0fe792013-03-28 16:45:25 -0700273
Miriam Polzerad671982020-04-23 16:25:58 +0200274 // Returns whether we should powerwash for this update. Note that this is
275 // just an indication, the final decision to powerwash or not is made in the
276 // response handler.
277 bool ShouldPowerwash() const;
Satoru Takabayashi583667b2010-10-27 13:09:57 +0900278
David Pursell02c18642014-11-06 11:26:11 -0800279 // Check if the provided update URL is official, meaning either the default
280 // autoupdate server or the autoupdate autotest server.
281 virtual bool IsUpdateUrlOfficial() const;
282
Darin Petkova4a8a8c2010-07-15 22:21:12 -0700283 // For unit-tests.
Jay Srinivasanae4697c2013-03-18 17:08:08 -0700284 void set_root(const std::string& root);
Chris Sosa28e479c2013-07-12 11:39:53 -0700285 void set_current_channel(const std::string& channel) {
Alex Deymo85616652015-10-15 18:48:31 -0700286 image_props_.current_channel = channel;
Chris Sosa28e479c2013-07-12 11:39:53 -0700287 }
Gilad Arnold76b2b482014-04-01 13:32:43 -0700288 void set_target_channel(const std::string& channel) {
Alex Deymo85616652015-10-15 18:48:31 -0700289 mutable_image_props_.target_channel = channel;
Gilad Arnold76b2b482014-04-01 13:32:43 -0700290 }
Marton Hunyady2abda312018-04-24 18:21:49 +0200291 void set_os_sp(const std::string& os_sp) { os_sp_ = os_sp; }
292 void set_os_board(const std::string& os_board) {
293 image_props_.board = os_board;
294 }
295 void set_app_lang(const std::string& app_lang) { app_lang_ = app_lang; }
296 void set_hwid(const std::string& hwid) { hwid_ = hwid; }
297 void set_fw_version(const std::string& fw_version) {
298 fw_version_ = fw_version;
299 }
300 void set_ec_version(const std::string& ec_version) {
301 ec_version_ = ec_version;
302 }
303 void set_is_powerwash_allowed(bool powerwash_allowed) {
304 mutable_image_props_.is_powerwash_allowed = powerwash_allowed;
305 }
Miriam Polzeraff72002020-08-27 08:20:39 +0200306 bool is_powerwash_allowed() {
307 return mutable_image_props_.is_powerwash_allowed;
308 }
309
Matt Ziegelbaumaa8e1a42019-05-09 21:41:58 -0400310 void set_device_requisition(const std::string& requisition) {
311 device_requisition_ = requisition;
312 }
Darin Petkova4a8a8c2010-07-15 22:21:12 -0700313
314 private:
Jay Srinivasanae4697c2013-03-18 17:08:08 -0700315 FRIEND_TEST(OmahaRequestParamsTest, ChannelIndexTest);
Chris Sosac1972482013-04-30 22:31:10 -0700316 FRIEND_TEST(OmahaRequestParamsTest, CollectECFWVersionsTest);
Sen Jiang7f785f52018-01-24 13:31:56 -0800317 FRIEND_TEST(OmahaRequestParamsTest, IsValidChannelTest);
Sen Jiang8500d3a2018-02-08 12:04:05 -0800318 FRIEND_TEST(OmahaRequestParamsTest, SetIsPowerwashAllowedTest);
Sen Jiang7f785f52018-01-24 13:31:56 -0800319 FRIEND_TEST(OmahaRequestParamsTest, SetTargetChannelInvalidTest);
Sen Jiang8500d3a2018-02-08 12:04:05 -0800320 FRIEND_TEST(OmahaRequestParamsTest, SetTargetChannelTest);
321 FRIEND_TEST(OmahaRequestParamsTest, ShouldPowerwashTest);
Sen Jiang7f785f52018-01-24 13:31:56 -0800322 FRIEND_TEST(OmahaRequestParamsTest, ToMoreStableChannelFlagTest);
Darin Petkov49d91322010-10-25 16:34:58 -0700323
Sen Jiangce3f7cf2018-01-25 14:07:45 -0800324 // Returns true if |channel| is a valid channel, otherwise write error to
325 // |error_message| if passed and return false.
326 bool IsValidChannel(const std::string& channel,
327 std::string* error_message) const;
328 bool IsValidChannel(const std::string& channel) const {
329 return IsValidChannel(channel, nullptr);
330 }
Jay Srinivasanae4697c2013-03-18 17:08:08 -0700331
332 // Returns the index of the given channel.
333 int GetChannelIndex(const std::string& channel) const;
334
Sen Jiang8500d3a2018-02-08 12:04:05 -0800335 // True if we're trying to update to a more stable channel.
336 // i.e. index(target_channel) > index(current_channel).
337 bool ToMoreStableChannel() const;
338
Chris Sosac1972482013-04-30 22:31:10 -0700339 // Returns True if we should store the fw/ec versions based on our hwid_.
Andrewcc6ab9f2020-06-25 07:41:40 -0700340 // Compares hwid to a set of prefixes in the allowlist.
Chris Sosac1972482013-04-30 22:31:10 -0700341 bool CollectECFWVersions() const;
342
Darin Petkova4a8a8c2010-07-15 22:21:12 -0700343 // Gets the machine type (e.g. "i686").
344 std::string GetMachineType() const;
345
Jay Srinivasanae4697c2013-03-18 17:08:08 -0700346 // Global system context.
347 SystemState* system_state_;
348
Alex Deymo85616652015-10-15 18:48:31 -0700349 // The system image properties.
350 ImageProperties image_props_;
351 MutableImageProperties mutable_image_props_;
352
Jay Srinivasanae4697c2013-03-18 17:08:08 -0700353 // Basic properties of the OS and Application that go into the Omaha request.
354 std::string os_platform_;
355 std::string os_version_;
356 std::string os_sp_;
Jay Srinivasanae4697c2013-03-18 17:08:08 -0700357 std::string app_lang_;
358
Alex Deymo85616652015-10-15 18:48:31 -0700359 // There are three channel values we deal with:
360 // * The channel we got the image we are running from or "current channel"
361 // stored in |image_props_.current_channel|.
362 //
363 // * The release channel we are tracking, where we should get updates from,
364 // stored in |mutable_image_props_.target_channel|. This channel is
365 // normally the same as the current_channel, except when the user changes
366 // the channel. In that case it'll have the release channel the user
367 // switched to, regardless of whether we downloaded an update from that
368 // channel or not, or if we are in the middle of a download from a
369 // previously selected channel (as opposed to download channel
370 // which gets updated only at the start of next download).
371 //
372 // * The channel from which we're downloading the payload. This should
373 // normally be the same as target channel. But if the user made another
374 // channel change after we started the download, then they'd be different,
375 // in which case, we'd detect elsewhere that the target channel has been
376 // changed and cancel the current download attempt.
Jay Srinivasan1c0fe792013-03-28 16:45:25 -0700377 std::string download_channel_;
378
Amin Hassani37b67232020-08-13 09:29:48 -0700379 // The value defining the parameters of the LTS (Long Term Support).
380 std::string lts_tag_;
381
Amin Hassani7cc8bb02019-01-14 16:29:47 -0800382 std::string hwid_; // Hardware Qualification ID of the client
Chris Sosac1972482013-04-30 22:31:10 -0700383 std::string fw_version_; // Chrome OS Firmware Version.
384 std::string ec_version_; // Chrome OS EC Version.
Matt Ziegelbaumaa8e1a42019-05-09 21:41:58 -0400385 // TODO(b:133324571) tracks removal of this field once it is no longer
386 // needed in AU requests. Remove by October 1st 2019.
387 std::string device_requisition_; // Chrome OS Requisition type.
Vyshu852f57d2020-10-09 17:35:14 +0000388 bool delta_okay_; // If this client can accept a delta
389 bool interactive_; // Whether this is a user-initiated update check
Jay Srinivasanae4697c2013-03-18 17:08:08 -0700390
391 // The URL to send the Omaha request to.
392 std::string update_url_;
393
Jay Srinivasanae4697c2013-03-18 17:08:08 -0700394 // Prefix of the target OS version that the enterprise wants this device
395 // to be pinned to. It's empty otherwise.
396 std::string target_version_prefix_;
397
Marton Hunyadyba51c3f2018-04-25 15:18:10 +0200398 // Whether the client is accepting rollback images too.
399 bool rollback_allowed_;
400
Zentaro Kavanagh28def4f2019-01-15 17:15:01 -0800401 // Whether rollbacks should preserve some system state during powerwash.
402 bool rollback_data_save_requested_;
403
Zentaro Kavanagh0ef9a2f2018-07-02 12:05:07 -0700404 // How many milestones the client can rollback to.
405 int rollback_allowed_milestones_;
406
Adolfo Victoria497044c2018-07-18 07:51:42 -0700407 // True if scattering or staging are enabled, in which case waiting_period_
408 // specifies the amount of absolute time that we've to wait for before sending
409 // a request to Omaha.
Jay Srinivasanae4697c2013-03-18 17:08:08 -0700410 bool wall_clock_based_wait_enabled_;
411 base::TimeDelta waiting_period_;
412
Adolfo Victoria497044c2018-07-18 07:51:42 -0700413 // True if scattering or staging are enabled to denote the number of update
414 // checks we've to skip before we can send a request to Omaha. The min and max
Jay Srinivasanae4697c2013-03-18 17:08:08 -0700415 // values establish the bounds for a random number to be chosen within that
416 // range to enable such a wait.
417 bool update_check_count_wait_enabled_;
Ben Chan9abb7632014-08-07 00:10:53 -0700418 int64_t min_update_checks_needed_;
419 int64_t max_update_checks_allowed_;
Jay Srinivasanae4697c2013-03-18 17:08:08 -0700420
Darin Petkova4a8a8c2010-07-15 22:21:12 -0700421 // When reading files, prepend root_ to the paths. Useful for testing.
422 std::string root_;
423
Jae Hoon Kim5e9cd712020-02-12 15:28:28 -0800424 // A list of DLC modules to install. A mapping from DLC App ID to |AppParams|.
Andrewe045aef2020-01-08 16:29:22 -0800425 std::map<std::string, AppParams> dlc_apps_params_;
Xiaochu Liu88d90382018-08-29 16:09:11 -0700426
427 // This variable defines whether the payload is being installed in the current
Xiaochu Liuf53a5d32018-11-26 13:48:59 -0800428 // partition. At the moment, this is used for installing DLC modules on the
429 // current active partition instead of the inactive partition.
Xiaochu Liu88d90382018-08-29 16:09:11 -0700430 bool is_install_;
431
Askar Aitzhan570ca872019-04-24 11:16:12 +0200432 // Token used when making an update request for a specific build.
433 // For example: Token for a Quick Fix Build:
Felipe Andrade2f8594e2019-09-12 20:11:47 +0200434 // https://cloud.google.com/docs/chrome-enterprise/policies/?policy=DeviceQuickFixBuildToken
Askar Aitzhan570ca872019-04-24 11:16:12 +0200435 std::string autoupdate_token_;
436
Marton Hunyady2abda312018-04-24 18:21:49 +0200437 DISALLOW_COPY_AND_ASSIGN(OmahaRequestParams);
Darin Petkova4a8a8c2010-07-15 22:21:12 -0700438};
439
440} // namespace chromeos_update_engine
441
Gilad Arnoldcf175a02014-07-10 16:48:47 -0700442#endif // UPDATE_ENGINE_OMAHA_REQUEST_PARAMS_H_