| 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 |  | 
| Amin Hassani | ec7bc11 | 2020-10-29 16:47:58 -0700 | [diff] [blame] | 17 | #ifndef UPDATE_ENGINE_AOSP_DAEMON_STATE_ANDROID_H_ | 
 | 18 | #define UPDATE_ENGINE_AOSP_DAEMON_STATE_ANDROID_H_ | 
| Alex Deymo | fa78f14 | 2016-01-26 21:36:16 -0800 | [diff] [blame] | 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 |  | 
| Amin Hassani | ec7bc11 | 2020-10-29 16:47:58 -0700 | [diff] [blame] | 23 | #include "update_engine/aosp/service_delegate_android_interface.h" | 
 | 24 | #include "update_engine/aosp/update_attempter_android.h" | 
| Alex Deymo | 14c0da8 | 2016-07-20 16:45:45 -0700 | [diff] [blame] | 25 | #include "update_engine/certificate_checker.h" | 
| Alex Deymo | 5e3ea27 | 2016-01-28 13:42:23 -0800 | [diff] [blame] | 26 | #include "update_engine/common/boot_control_interface.h" | 
| Amin Hassani | ec7bc11 | 2020-10-29 16:47:58 -0700 | [diff] [blame] | 27 | #include "update_engine/common/daemon_state_interface.h" | 
| Alex Deymo | 5e3ea27 | 2016-01-28 13:42:23 -0800 | [diff] [blame] | 28 | #include "update_engine/common/hardware_interface.h" | 
 | 29 | #include "update_engine/common/prefs_interface.h" | 
| Amin Hassani | ec7bc11 | 2020-10-29 16:47:58 -0700 | [diff] [blame] | 30 | #include "update_engine/common/service_observer_interface.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 | 03a4de7 | 2016-07-20 16:08:23 -0700 | [diff] [blame] | 46 |   const std::set<ServiceObserverInterface*>& service_observers() override { | 
| Alex Deymo | f8bfcff | 2016-02-02 21:22:11 -0800 | [diff] [blame] | 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 | 765580d | 2016-06-22 19:23:13 -0700 | [diff] [blame] | 67 |  | 
 | 68 |   // OpenSSLWrapper and CertificateChecker used for checking changes in SSL | 
 | 69 |   // certificates. | 
 | 70 |   OpenSSLWrapper openssl_wrapper_; | 
 | 71 |   std::unique_ptr<CertificateChecker> certificate_checker_; | 
| Alex Deymo | fa78f14 | 2016-01-26 21:36:16 -0800 | [diff] [blame] | 72 | }; | 
 | 73 |  | 
 | 74 | }  // namespace chromeos_update_engine | 
 | 75 |  | 
| Amin Hassani | ec7bc11 | 2020-10-29 16:47:58 -0700 | [diff] [blame] | 76 | #endif  // UPDATE_ENGINE_AOSP_DAEMON_STATE_ANDROID_H_ |