Alex Deymo | aea4c1c | 2015-08-19 20:24:43 -0700 | [diff] [blame] | 1 | // |
| 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 Deymo | b7ca096 | 2014-10-01 17:58:07 -0700 | [diff] [blame] | 16 | |
Amin Hassani | ec7bc11 | 2020-10-29 16:47:58 -0700 | [diff] [blame] | 17 | #ifndef UPDATE_ENGINE_AOSP_DAEMON_ANDROID_H_ |
| 18 | #define UPDATE_ENGINE_AOSP_DAEMON_ANDROID_H_ |
Alex Deymo | b7ca096 | 2014-10-01 17:58:07 -0700 | [diff] [blame] | 19 | |
| 20 | #include <memory> |
Alex Deymo | b7ca096 | 2014-10-01 17:58:07 -0700 | [diff] [blame] | 21 | |
Alex Vakulenko | e119e6a | 2016-01-06 17:13:11 -0800 | [diff] [blame] | 22 | #include <brillo/binder_watcher.h> |
Alex Deymo | b7ca096 | 2014-10-01 17:58:07 -0700 | [diff] [blame] | 23 | |
Amin Hassani | ec7bc11 | 2020-10-29 16:47:58 -0700 | [diff] [blame] | 24 | #include "update_engine/aosp/binder_service_android.h" |
| 25 | #include "update_engine/aosp/binder_service_stable_android.h" |
| 26 | #include "update_engine/common/daemon_base.h" |
| 27 | #include "update_engine/common/daemon_state_interface.h" |
Alex Deymo | 39910dc | 2015-11-09 17:04:30 -0800 | [diff] [blame] | 28 | #include "update_engine/common/subprocess.h" |
Alex Deymo | b7ca096 | 2014-10-01 17:58:07 -0700 | [diff] [blame] | 29 | |
| 30 | namespace chromeos_update_engine { |
| 31 | |
Amin Hassani | 565331e | 2019-06-24 14:11:29 -0700 | [diff] [blame] | 32 | class DaemonAndroid : public DaemonBase { |
Alex Deymo | b7ca096 | 2014-10-01 17:58:07 -0700 | [diff] [blame] | 33 | public: |
Amin Hassani | 565331e | 2019-06-24 14:11:29 -0700 | [diff] [blame] | 34 | DaemonAndroid() = default; |
Alex Deymo | b7ca096 | 2014-10-01 17:58:07 -0700 | [diff] [blame] | 35 | |
| 36 | protected: |
| 37 | int OnInit() override; |
| 38 | |
| 39 | private: |
Amin Hassani | 565331e | 2019-06-24 14:11:29 -0700 | [diff] [blame] | 40 | // The Subprocess singleton class requires a |brillo::MessageLoop| in the |
Alex Deymo | b7ca096 | 2014-10-01 17:58:07 -0700 | [diff] [blame] | 41 | // current thread, so we need to initialize it from this class instead of |
| 42 | // the main() function. |
| 43 | Subprocess subprocess_; |
| 44 | |
Alex Vakulenko | e119e6a | 2016-01-06 17:13:11 -0800 | [diff] [blame] | 45 | brillo::BinderWatcher binder_watcher_; |
Alex Deymo | fa78f14 | 2016-01-26 21:36:16 -0800 | [diff] [blame] | 46 | android::sp<BinderUpdateEngineAndroidService> binder_service_; |
Yifan Hong | 2562cf2 | 2020-07-21 19:28:44 -0700 | [diff] [blame] | 47 | android::sp<BinderUpdateEngineAndroidStableService> stable_binder_service_; |
Alex Vakulenko | e119e6a | 2016-01-06 17:13:11 -0800 | [diff] [blame] | 48 | |
Alex Deymo | fa78f14 | 2016-01-26 21:36:16 -0800 | [diff] [blame] | 49 | // The daemon state with all the required daemon classes for the configured |
| 50 | // platform. |
| 51 | std::unique_ptr<DaemonStateInterface> daemon_state_; |
Alex Deymo | 2b4268c | 2015-12-04 13:56:25 -0800 | [diff] [blame] | 52 | |
Amin Hassani | 565331e | 2019-06-24 14:11:29 -0700 | [diff] [blame] | 53 | DISALLOW_COPY_AND_ASSIGN(DaemonAndroid); |
Alex Deymo | b7ca096 | 2014-10-01 17:58:07 -0700 | [diff] [blame] | 54 | }; |
| 55 | |
| 56 | } // namespace chromeos_update_engine |
| 57 | |
Amin Hassani | ec7bc11 | 2020-10-29 16:47:58 -0700 | [diff] [blame] | 58 | #endif // UPDATE_ENGINE_AOSP_DAEMON_ANDROID_H_ |