blob: 928a14eb77edb6f5eb4be79c2f0a3accd469656b [file] [log] [blame]
Alex Deymofa78f142016-01-26 21:36:16 -08001//
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 Deymo5e3ea272016-01-28 13:42:23 -080020#include <memory>
Alex Deymofa78f142016-01-26 21:36:16 -080021#include <set>
22
Alex Deymo14c0da82016-07-20 16:45:45 -070023#include "update_engine/certificate_checker.h"
Alex Deymo5e3ea272016-01-28 13:42:23 -080024#include "update_engine/common/boot_control_interface.h"
Alex Deymo5e3ea272016-01-28 13:42:23 -080025#include "update_engine/common/hardware_interface.h"
26#include "update_engine/common/prefs_interface.h"
Alex Deymofa78f142016-01-26 21:36:16 -080027#include "update_engine/daemon_state_interface.h"
Alex Deymof8bfcff2016-02-02 21:22:11 -080028#include "update_engine/service_delegate_android_interface.h"
Alex Deymofa78f142016-01-26 21:36:16 -080029#include "update_engine/service_observer_interface.h"
Alex Deymo5e3ea272016-01-28 13:42:23 -080030#include "update_engine/update_attempter_android.h"
Alex Deymofa78f142016-01-26 21:36:16 -080031
32namespace chromeos_update_engine {
33
34class DaemonStateAndroid : public DaemonStateInterface {
35 public:
36 DaemonStateAndroid() = default;
Alex Deymof8bfcff2016-02-02 21:22:11 -080037 ~DaemonStateAndroid() override = default;
Alex Deymofa78f142016-01-26 21:36:16 -080038
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 Deymo03a4de72016-07-20 16:08:23 -070046 const std::set<ServiceObserverInterface*>& service_observers() override {
Alex Deymof8bfcff2016-02-02 21:22:11 -080047 return service_observers_;
48 }
49
50 // Return a pointer to the service delegate.
51 ServiceDelegateAndroidInterface* service_delegate();
52
Alex Deymofa78f142016-01-26 21:36:16 -080053 protected:
54 std::set<ServiceObserverInterface*> service_observers_;
Alex Deymo5e3ea272016-01-28 13:42:23 -080055
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 Deymo765580d2016-06-22 19:23:13 -070067
68 // OpenSSLWrapper and CertificateChecker used for checking changes in SSL
69 // certificates.
70 OpenSSLWrapper openssl_wrapper_;
71 std::unique_ptr<CertificateChecker> certificate_checker_;
Alex Deymofa78f142016-01-26 21:36:16 -080072};
73
74} // namespace chromeos_update_engine
75
76#endif // UPDATE_ENGINE_DAEMON_STATE_ANDROID_H_