blob: 873282ef4ca4af77ecf6fc0580f5c9cae4e225dd [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 Deymoc83baf62014-04-02 17:43:35 -070016
Gilad Arnold48415f12014-06-27 07:10:58 -070017#ifndef UPDATE_ENGINE_UPDATE_MANAGER_DEVICE_POLICY_PROVIDER_H_
18#define UPDATE_ENGINE_UPDATE_MANAGER_DEVICE_POLICY_PROVIDER_H_
Alex Deymoc83baf62014-04-02 17:43:35 -070019
20#include <set>
21#include <string>
22
Alex Deymoc83baf62014-04-02 17:43:35 -070023#include <base/time/time.h>
Alex Deymo63784a52014-05-28 10:46:14 -070024#include <policy/libpolicy.h>
Alex Deymoc83baf62014-04-02 17:43:35 -070025
Alex Deymo63784a52014-05-28 10:46:14 -070026#include "update_engine/update_manager/provider.h"
Marton Hunyady000dfa22018-02-21 14:30:35 +010027#include "update_engine/update_manager/rollback_prefs.h"
Alex Deymo63784a52014-05-28 10:46:14 -070028#include "update_engine/update_manager/shill_provider.h"
29#include "update_engine/update_manager/variable.h"
Adolfo Victoria94ffe132018-06-28 16:14:56 -070030#include "update_engine/update_manager/weekly_time.h"
Alex Deymoc83baf62014-04-02 17:43:35 -070031
Alex Deymo63784a52014-05-28 10:46:14 -070032namespace chromeos_update_manager {
Alex Deymoc83baf62014-04-02 17:43:35 -070033
34// Provides access to the current DevicePolicy.
35class DevicePolicyProvider : public Provider {
36 public:
Alex Deymo610277e2014-11-11 21:18:11 -080037 ~DevicePolicyProvider() override {}
Alex Deymoc83baf62014-04-02 17:43:35 -070038
39 // Variable stating whether the DevicePolicy was loaded.
40 virtual Variable<bool>* var_device_policy_is_loaded() = 0;
41
42 // Variables mapping the information received on the DevicePolicy protobuf.
43 virtual Variable<std::string>* var_release_channel() = 0;
44
45 virtual Variable<bool>* var_release_channel_delegated() = 0;
46
47 virtual Variable<bool>* var_update_disabled() = 0;
48
49 virtual Variable<std::string>* var_target_version_prefix() = 0;
50
Marton Hunyady000dfa22018-02-21 14:30:35 +010051 // Variable returning what should happen if the target_version_prefix is
52 // earlier than the current Chrome OS version.
53 virtual Variable<RollbackToTargetVersion>*
Amin Hassani4b717432019-01-14 16:24:20 -080054 var_rollback_to_target_version() = 0;
Marton Hunyady000dfa22018-02-21 14:30:35 +010055
56 // Variable returning the number of Chrome milestones rollback should be
57 // possible. Rollback protection will be postponed by this many versions.
58 virtual Variable<int>* var_rollback_allowed_milestones() = 0;
59
Gilad Arnoldf62a4b82014-05-01 07:41:07 -070060 // Returns a non-negative scatter interval used for updates.
Alex Deymoc83baf62014-04-02 17:43:35 -070061 virtual Variable<base::TimeDelta>* var_scatter_factor() = 0;
62
Alex Vakulenko072359c2014-07-18 11:41:07 -070063 // Variable returning the set of connection types allowed for updates. The
Alex Deymoc83baf62014-04-02 17:43:35 -070064 // identifiers returned are consistent with the ones returned by the
65 // ShillProvider.
Sen Jiang255e22b2016-05-20 16:15:29 -070066 virtual Variable<std::set<chromeos_update_engine::ConnectionType>>*
Amin Hassani4b717432019-01-14 16:24:20 -080067 var_allowed_connection_types_for_update() = 0;
Alex Deymoc83baf62014-04-02 17:43:35 -070068
69 // Variable stating the name of the device owner. For enterprise enrolled
70 // devices, this will be an empty string.
Gilad Arnoldef8d0872014-10-03 14:14:06 -070071 virtual Variable<std::string>* var_owner() = 0;
Alex Deymoc83baf62014-04-02 17:43:35 -070072
73 virtual Variable<bool>* var_http_downloads_enabled() = 0;
74
75 virtual Variable<bool>* var_au_p2p_enabled() = 0;
76
Xiyuan Xia6e30bc52016-02-24 15:35:42 -080077 virtual Variable<bool>* var_allow_kiosk_app_control_chrome_version() = 0;
78
Adolfo Victoria0dbf1f92018-07-19 14:18:11 -070079 // Variable that contains the app that is to be run when launched in kiosk
80 // mode. If the device is not in kiosk-mode this should be empty.
81 virtual Variable<std::string>* var_auto_launched_kiosk_app_id() = 0;
82
Adolfo Victoria94ffe132018-06-28 16:14:56 -070083 // Variable that contains the time intervals during the week for which update
84 // checks are disallowed.
85 virtual Variable<WeeklyTimeIntervalVector>*
86 var_disallowed_time_intervals() = 0;
87
Alex Deymoc83baf62014-04-02 17:43:35 -070088 protected:
89 DevicePolicyProvider() {}
90
91 private:
92 DISALLOW_COPY_AND_ASSIGN(DevicePolicyProvider);
93};
94
Alex Deymo63784a52014-05-28 10:46:14 -070095} // namespace chromeos_update_manager
Alex Deymoc83baf62014-04-02 17:43:35 -070096
Gilad Arnold48415f12014-06-27 07:10:58 -070097#endif // UPDATE_ENGINE_UPDATE_MANAGER_DEVICE_POLICY_PROVIDER_H_