blob: 5db3ef02e30203efa5b81343069b7d5578e9cf77 [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 Deymo5e3ea272016-01-28 13:42:23 -080023#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 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 Deymof8bfcff2016-02-02 21:22:11 -080046 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 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 Deymofa78f142016-01-26 21:36:16 -080067};
68
69} // namespace chromeos_update_engine
70
71#endif // UPDATE_ENGINE_DAEMON_STATE_ANDROID_H_