blob: baead373fa2aa1a935effaded7ac74941dc47a3c [file] [log] [blame]
Alex Deymoaea4c1c2015-08-19 20:24:43 -07001//
2// Copyright (C) 2015 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//
Alex Deymob7ca0962014-10-01 17:58:07 -070016
Amin Hassani565331e2019-06-24 14:11:29 -070017#ifndef UPDATE_ENGINE_DAEMON_ANDROID_H_
18#define UPDATE_ENGINE_DAEMON_ANDROID_H_
Alex Deymob7ca0962014-10-01 17:58:07 -070019
20#include <memory>
Alex Deymob7ca0962014-10-01 17:58:07 -070021
Alex Vakulenkoe119e6a2016-01-06 17:13:11 -080022#include <brillo/binder_watcher.h>
Alex Deymob7ca0962014-10-01 17:58:07 -070023
Alex Deymoe97b39c2016-01-20 13:22:17 -080024#include "update_engine/binder_service_android.h"
Alex Deymo39910dc2015-11-09 17:04:30 -080025#include "update_engine/common/subprocess.h"
Amin Hassani565331e2019-06-24 14:11:29 -070026#include "update_engine/daemon_base.h"
Alex Deymofa78f142016-01-26 21:36:16 -080027#include "update_engine/daemon_state_interface.h"
Alex Deymob7ca0962014-10-01 17:58:07 -070028
29namespace chromeos_update_engine {
30
Amin Hassani565331e2019-06-24 14:11:29 -070031class DaemonAndroid : public DaemonBase {
Alex Deymob7ca0962014-10-01 17:58:07 -070032 public:
Amin Hassani565331e2019-06-24 14:11:29 -070033 DaemonAndroid() = default;
Alex Deymob7ca0962014-10-01 17:58:07 -070034
35 protected:
36 int OnInit() override;
37
38 private:
Amin Hassani565331e2019-06-24 14:11:29 -070039 // The Subprocess singleton class requires a |brillo::MessageLoop| in the
Alex Deymob7ca0962014-10-01 17:58:07 -070040 // current thread, so we need to initialize it from this class instead of
41 // the main() function.
42 Subprocess subprocess_;
43
Alex Vakulenkoe119e6a2016-01-06 17:13:11 -080044 brillo::BinderWatcher binder_watcher_;
Alex Deymofa78f142016-01-26 21:36:16 -080045 android::sp<BinderUpdateEngineAndroidService> binder_service_;
Alex Vakulenkoe119e6a2016-01-06 17:13:11 -080046
Alex Deymofa78f142016-01-26 21:36:16 -080047 // The daemon state with all the required daemon classes for the configured
48 // platform.
49 std::unique_ptr<DaemonStateInterface> daemon_state_;
Alex Deymo2b4268c2015-12-04 13:56:25 -080050
Amin Hassani565331e2019-06-24 14:11:29 -070051 DISALLOW_COPY_AND_ASSIGN(DaemonAndroid);
Alex Deymob7ca0962014-10-01 17:58:07 -070052};
53
54} // namespace chromeos_update_engine
55
Amin Hassani565331e2019-06-24 14:11:29 -070056#endif // UPDATE_ENGINE_DAEMON_ANDROID_H_