daemon_state_android.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. #ifndef UPDATE_ENGINE_DAEMON_STATE_ANDROID_H_
  17. #define UPDATE_ENGINE_DAEMON_STATE_ANDROID_H_
  18. #include <memory>
  19. #include <set>
  20. #include "update_engine/certificate_checker.h"
  21. #include "update_engine/common/boot_control_interface.h"
  22. #include "update_engine/common/hardware_interface.h"
  23. #include "update_engine/common/prefs_interface.h"
  24. #include "update_engine/daemon_state_interface.h"
  25. #include "update_engine/service_delegate_android_interface.h"
  26. #include "update_engine/service_observer_interface.h"
  27. #include "update_engine/update_attempter_android.h"
  28. namespace chromeos_update_engine {
  29. class DaemonStateAndroid : public DaemonStateInterface {
  30. public:
  31. DaemonStateAndroid() = default;
  32. ~DaemonStateAndroid() override = default;
  33. bool Initialize();
  34. // DaemonStateInterface overrides.
  35. bool StartUpdater() override;
  36. void AddObserver(ServiceObserverInterface* observer) override;
  37. void RemoveObserver(ServiceObserverInterface* observer) override;
  38. const std::set<ServiceObserverInterface*>& service_observers() override {
  39. return service_observers_;
  40. }
  41. // Return a pointer to the service delegate.
  42. ServiceDelegateAndroidInterface* service_delegate();
  43. protected:
  44. std::set<ServiceObserverInterface*> service_observers_;
  45. // Interface for the boot control functions.
  46. std::unique_ptr<BootControlInterface> boot_control_;
  47. // Interface for the hardware functions.
  48. std::unique_ptr<HardwareInterface> hardware_;
  49. // Interface for persisted store.
  50. std::unique_ptr<PrefsInterface> prefs_;
  51. // The main class handling the updates.
  52. std::unique_ptr<UpdateAttempterAndroid> update_attempter_;
  53. // OpenSSLWrapper and CertificateChecker used for checking changes in SSL
  54. // certificates.
  55. OpenSSLWrapper openssl_wrapper_;
  56. std::unique_ptr<CertificateChecker> certificate_checker_;
  57. };
  58. } // namespace chromeos_update_engine
  59. #endif // UPDATE_ENGINE_DAEMON_STATE_ANDROID_H_