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 // 16 17 #ifndef UPDATE_ENGINE_UPDATE_MANAGER_DEVICE_POLICY_PROVIDER_H_ 18 #define UPDATE_ENGINE_UPDATE_MANAGER_DEVICE_POLICY_PROVIDER_H_ 19 20 #include <set> 21 #include <string> 22 23 #include <base/time/time.h> 24 #include <policy/libpolicy.h> 25 26 #include "update_engine/update_manager/provider.h" 27 #include "update_engine/update_manager/rollback_prefs.h" 28 #include "update_engine/update_manager/shill_provider.h" 29 #include "update_engine/update_manager/variable.h" 30 #include "update_engine/update_manager/weekly_time.h" 31 32 namespace chromeos_update_manager { 33 34 // Provides access to the current DevicePolicy. 35 class DevicePolicyProvider : public Provider { 36 public: ~DevicePolicyProvider()37 ~DevicePolicyProvider() override {} 38 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 51 // Variable returning what should happen if the target_version_prefix is 52 // earlier than the current Chrome OS version. 53 virtual Variable<RollbackToTargetVersion>* 54 var_rollback_to_target_version() = 0; 55 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 60 // Returns a non-negative scatter interval used for updates. 61 virtual Variable<base::TimeDelta>* var_scatter_factor() = 0; 62 63 // Variable returning the set of connection types allowed for updates. The 64 // identifiers returned are consistent with the ones returned by the 65 // ShillProvider. 66 virtual Variable<std::set<chromeos_update_engine::ConnectionType>>* 67 var_allowed_connection_types_for_update() = 0; 68 69 // Variable stating whether the device has an owner. For enterprise enrolled 70 // devices, this will be false as the device owner has an empty string. 71 virtual Variable<bool>* var_has_owner() = 0; 72 73 virtual Variable<bool>* var_http_downloads_enabled() = 0; 74 75 virtual Variable<bool>* var_au_p2p_enabled() = 0; 76 77 virtual Variable<bool>* var_allow_kiosk_app_control_chrome_version() = 0; 78 79 // 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 83 // 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 88 protected: DevicePolicyProvider()89 DevicePolicyProvider() {} 90 91 private: 92 DISALLOW_COPY_AND_ASSIGN(DevicePolicyProvider); 93 }; 94 95 } // namespace chromeos_update_manager 96 97 #endif // UPDATE_ENGINE_UPDATE_MANAGER_DEVICE_POLICY_PROVIDER_H_ 98