Alex Deymo | aea4c1c | 2015-08-19 20:24:43 -0700 | [diff] [blame] | 1 | // |
| 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 Deymo | c83baf6 | 2014-04-02 17:43:35 -0700 | [diff] [blame] | 16 | |
Gilad Arnold | 48415f1 | 2014-06-27 07:10:58 -0700 | [diff] [blame] | 17 | #ifndef UPDATE_ENGINE_UPDATE_MANAGER_DEVICE_POLICY_PROVIDER_H_ |
| 18 | #define UPDATE_ENGINE_UPDATE_MANAGER_DEVICE_POLICY_PROVIDER_H_ |
Alex Deymo | c83baf6 | 2014-04-02 17:43:35 -0700 | [diff] [blame] | 19 | |
| 20 | #include <set> |
| 21 | #include <string> |
| 22 | |
Alex Deymo | c83baf6 | 2014-04-02 17:43:35 -0700 | [diff] [blame] | 23 | #include <base/time/time.h> |
Miriam Polzer | a02a1f1 | 2020-08-27 08:30:14 +0200 | [diff] [blame] | 24 | #include <base/version.h> |
Alex Deymo | 63784a5 | 2014-05-28 10:46:14 -0700 | [diff] [blame] | 25 | #include <policy/libpolicy.h> |
Alex Deymo | c83baf6 | 2014-04-02 17:43:35 -0700 | [diff] [blame] | 26 | |
Alex Deymo | 63784a5 | 2014-05-28 10:46:14 -0700 | [diff] [blame] | 27 | #include "update_engine/update_manager/provider.h" |
Marton Hunyady | 000dfa2 | 2018-02-21 14:30:35 +0100 | [diff] [blame] | 28 | #include "update_engine/update_manager/rollback_prefs.h" |
Alex Deymo | 63784a5 | 2014-05-28 10:46:14 -0700 | [diff] [blame] | 29 | #include "update_engine/update_manager/shill_provider.h" |
| 30 | #include "update_engine/update_manager/variable.h" |
Adolfo Victoria | 94ffe13 | 2018-06-28 16:14:56 -0700 | [diff] [blame] | 31 | #include "update_engine/update_manager/weekly_time.h" |
Alex Deymo | c83baf6 | 2014-04-02 17:43:35 -0700 | [diff] [blame] | 32 | |
Alex Deymo | 63784a5 | 2014-05-28 10:46:14 -0700 | [diff] [blame] | 33 | namespace chromeos_update_manager { |
Alex Deymo | c83baf6 | 2014-04-02 17:43:35 -0700 | [diff] [blame] | 34 | |
| 35 | // Provides access to the current DevicePolicy. |
| 36 | class DevicePolicyProvider : public Provider { |
| 37 | public: |
Alex Deymo | 610277e | 2014-11-11 21:18:11 -0800 | [diff] [blame] | 38 | ~DevicePolicyProvider() override {} |
Alex Deymo | c83baf6 | 2014-04-02 17:43:35 -0700 | [diff] [blame] | 39 | |
| 40 | // Variable stating whether the DevicePolicy was loaded. |
| 41 | virtual Variable<bool>* var_device_policy_is_loaded() = 0; |
| 42 | |
| 43 | // Variables mapping the information received on the DevicePolicy protobuf. |
| 44 | virtual Variable<std::string>* var_release_channel() = 0; |
| 45 | |
| 46 | virtual Variable<bool>* var_release_channel_delegated() = 0; |
| 47 | |
Amin Hassani | 37b6723 | 2020-08-13 09:29:48 -0700 | [diff] [blame] | 48 | virtual Variable<std::string>* var_release_lts_tag() = 0; |
| 49 | |
Alex Deymo | c83baf6 | 2014-04-02 17:43:35 -0700 | [diff] [blame] | 50 | virtual Variable<bool>* var_update_disabled() = 0; |
| 51 | |
| 52 | virtual Variable<std::string>* var_target_version_prefix() = 0; |
| 53 | |
Marton Hunyady | 000dfa2 | 2018-02-21 14:30:35 +0100 | [diff] [blame] | 54 | // Variable returning what should happen if the target_version_prefix is |
| 55 | // earlier than the current Chrome OS version. |
| 56 | virtual Variable<RollbackToTargetVersion>* |
Amin Hassani | 4b71743 | 2019-01-14 16:24:20 -0800 | [diff] [blame] | 57 | var_rollback_to_target_version() = 0; |
Marton Hunyady | 000dfa2 | 2018-02-21 14:30:35 +0100 | [diff] [blame] | 58 | |
| 59 | // Variable returning the number of Chrome milestones rollback should be |
| 60 | // possible. Rollback protection will be postponed by this many versions. |
| 61 | virtual Variable<int>* var_rollback_allowed_milestones() = 0; |
| 62 | |
Gilad Arnold | f62a4b8 | 2014-05-01 07:41:07 -0700 | [diff] [blame] | 63 | // Returns a non-negative scatter interval used for updates. |
Alex Deymo | c83baf6 | 2014-04-02 17:43:35 -0700 | [diff] [blame] | 64 | virtual Variable<base::TimeDelta>* var_scatter_factor() = 0; |
| 65 | |
Alex Vakulenko | 072359c | 2014-07-18 11:41:07 -0700 | [diff] [blame] | 66 | // Variable returning the set of connection types allowed for updates. The |
Alex Deymo | c83baf6 | 2014-04-02 17:43:35 -0700 | [diff] [blame] | 67 | // identifiers returned are consistent with the ones returned by the |
| 68 | // ShillProvider. |
Sen Jiang | 255e22b | 2016-05-20 16:15:29 -0700 | [diff] [blame] | 69 | virtual Variable<std::set<chromeos_update_engine::ConnectionType>>* |
Amin Hassani | 4b71743 | 2019-01-14 16:24:20 -0800 | [diff] [blame] | 70 | var_allowed_connection_types_for_update() = 0; |
Alex Deymo | c83baf6 | 2014-04-02 17:43:35 -0700 | [diff] [blame] | 71 | |
Jae Hoon Kim | 9d9492f | 2019-06-17 14:52:48 -0700 | [diff] [blame] | 72 | // Variable stating whether the device has an owner. For enterprise enrolled |
| 73 | // devices, this will be false as the device owner has an empty string. |
| 74 | virtual Variable<bool>* var_has_owner() = 0; |
Alex Deymo | c83baf6 | 2014-04-02 17:43:35 -0700 | [diff] [blame] | 75 | |
| 76 | virtual Variable<bool>* var_http_downloads_enabled() = 0; |
| 77 | |
| 78 | virtual Variable<bool>* var_au_p2p_enabled() = 0; |
| 79 | |
Xiyuan Xia | 6e30bc5 | 2016-02-24 15:35:42 -0800 | [diff] [blame] | 80 | virtual Variable<bool>* var_allow_kiosk_app_control_chrome_version() = 0; |
| 81 | |
Adolfo Victoria | 0dbf1f9 | 2018-07-19 14:18:11 -0700 | [diff] [blame] | 82 | // Variable that contains the app that is to be run when launched in kiosk |
| 83 | // mode. If the device is not in kiosk-mode this should be empty. |
| 84 | virtual Variable<std::string>* var_auto_launched_kiosk_app_id() = 0; |
| 85 | |
Adolfo Victoria | 94ffe13 | 2018-06-28 16:14:56 -0700 | [diff] [blame] | 86 | // Variable that contains the time intervals during the week for which update |
| 87 | // checks are disallowed. |
| 88 | virtual Variable<WeeklyTimeIntervalVector>* |
| 89 | var_disallowed_time_intervals() = 0; |
| 90 | |
Miriam Polzer | f197cdb | 2020-08-27 08:18:29 +0200 | [diff] [blame] | 91 | // Variable that determins whether we should powerwash and rollback on channel |
| 92 | // downgrade for enrolled devices. |
| 93 | virtual Variable<ChannelDowngradeBehavior>* |
| 94 | var_channel_downgrade_behavior() = 0; |
| 95 | |
Miriam Polzer | a02a1f1 | 2020-08-27 08:30:14 +0200 | [diff] [blame] | 96 | // Variable that contains Chrome OS minimum required version. It contains a |
| 97 | // Chrome OS version number. |
| 98 | virtual Variable<base::Version>* var_device_minimum_version() = 0; |
| 99 | |
Saurabh Nijhara | 43d7adc | 2020-11-06 16:13:02 +0100 | [diff] [blame] | 100 | // Variable that contains a token which maps to a Chrome OS Quick Fix Build to |
| 101 | // which the device would be updated if not blocked by another policy. |
| 102 | virtual Variable<std::string>* var_quick_fix_build_token() = 0; |
| 103 | |
Alex Deymo | c83baf6 | 2014-04-02 17:43:35 -0700 | [diff] [blame] | 104 | protected: |
| 105 | DevicePolicyProvider() {} |
| 106 | |
| 107 | private: |
| 108 | DISALLOW_COPY_AND_ASSIGN(DevicePolicyProvider); |
| 109 | }; |
| 110 | |
Alex Deymo | 63784a5 | 2014-05-28 10:46:14 -0700 | [diff] [blame] | 111 | } // namespace chromeos_update_manager |
Alex Deymo | c83baf6 | 2014-04-02 17:43:35 -0700 | [diff] [blame] | 112 | |
Gilad Arnold | 48415f1 | 2014-06-27 07:10:58 -0700 | [diff] [blame] | 113 | #endif // UPDATE_ENGINE_UPDATE_MANAGER_DEVICE_POLICY_PROVIDER_H_ |