| Alex Deymo | fa78f14 | 2016-01-26 21:36:16 -0800 | [diff] [blame] | 1 | // | 
|  | 2 | // Copyright (C) 2016 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_DAEMON_STATE_ANDROID_H_ | 
|  | 18 | #define UPDATE_ENGINE_DAEMON_STATE_ANDROID_H_ | 
|  | 19 |  | 
| Alex Deymo | 5e3ea27 | 2016-01-28 13:42:23 -0800 | [diff] [blame] | 20 | #include <memory> | 
| Alex Deymo | fa78f14 | 2016-01-26 21:36:16 -0800 | [diff] [blame] | 21 | #include <set> | 
|  | 22 |  | 
| Alex Deymo | 5e3ea27 | 2016-01-28 13:42:23 -0800 | [diff] [blame] | 23 | #include "update_engine/common/boot_control_interface.h" | 
|  | 24 | #include "update_engine/common/certificate_checker.h" | 
|  | 25 | #include "update_engine/common/hardware_interface.h" | 
|  | 26 | #include "update_engine/common/prefs_interface.h" | 
| Alex Deymo | fa78f14 | 2016-01-26 21:36:16 -0800 | [diff] [blame] | 27 | #include "update_engine/daemon_state_interface.h" | 
| Alex Deymo | f8bfcff | 2016-02-02 21:22:11 -0800 | [diff] [blame] | 28 | #include "update_engine/service_delegate_android_interface.h" | 
| Alex Deymo | fa78f14 | 2016-01-26 21:36:16 -0800 | [diff] [blame] | 29 | #include "update_engine/service_observer_interface.h" | 
| Alex Deymo | 5e3ea27 | 2016-01-28 13:42:23 -0800 | [diff] [blame] | 30 | #include "update_engine/update_attempter_android.h" | 
| Alex Deymo | fa78f14 | 2016-01-26 21:36:16 -0800 | [diff] [blame] | 31 |  | 
|  | 32 | namespace chromeos_update_engine { | 
|  | 33 |  | 
|  | 34 | class DaemonStateAndroid : public DaemonStateInterface { | 
|  | 35 | public: | 
|  | 36 | DaemonStateAndroid() = default; | 
| Alex Deymo | f8bfcff | 2016-02-02 21:22:11 -0800 | [diff] [blame] | 37 | ~DaemonStateAndroid() override = default; | 
| Alex Deymo | fa78f14 | 2016-01-26 21:36:16 -0800 | [diff] [blame] | 38 |  | 
|  | 39 | bool Initialize(); | 
|  | 40 |  | 
|  | 41 | // DaemonStateInterface overrides. | 
|  | 42 | bool StartUpdater() override; | 
|  | 43 | void AddObserver(ServiceObserverInterface* observer) override; | 
|  | 44 | void RemoveObserver(ServiceObserverInterface* observer) override; | 
|  | 45 |  | 
| Alex Deymo | f8bfcff | 2016-02-02 21:22:11 -0800 | [diff] [blame] | 46 | const std::set<ServiceObserverInterface*>& service_observers() { | 
|  | 47 | return service_observers_; | 
|  | 48 | } | 
|  | 49 |  | 
|  | 50 | // Return a pointer to the service delegate. | 
|  | 51 | ServiceDelegateAndroidInterface* service_delegate(); | 
|  | 52 |  | 
| Alex Deymo | fa78f14 | 2016-01-26 21:36:16 -0800 | [diff] [blame] | 53 | protected: | 
|  | 54 | std::set<ServiceObserverInterface*> service_observers_; | 
| Alex Deymo | 5e3ea27 | 2016-01-28 13:42:23 -0800 | [diff] [blame] | 55 |  | 
|  | 56 | // Interface for the boot control functions. | 
|  | 57 | std::unique_ptr<BootControlInterface> boot_control_; | 
|  | 58 |  | 
|  | 59 | // Interface for the hardware functions. | 
|  | 60 | std::unique_ptr<HardwareInterface> hardware_; | 
|  | 61 |  | 
|  | 62 | // Interface for persisted store. | 
|  | 63 | std::unique_ptr<PrefsInterface> prefs_; | 
|  | 64 |  | 
|  | 65 | // The main class handling the updates. | 
|  | 66 | std::unique_ptr<UpdateAttempterAndroid> update_attempter_; | 
| Alex Deymo | fa78f14 | 2016-01-26 21:36:16 -0800 | [diff] [blame] | 67 | }; | 
|  | 68 |  | 
|  | 69 | }  // namespace chromeos_update_engine | 
|  | 70 |  | 
|  | 71 | #endif  // UPDATE_ENGINE_DAEMON_STATE_ANDROID_H_ |