• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2020 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 CPP_WATCHDOG_SERVER_SRC_SERVICEMANAGER_H_
18 #define CPP_WATCHDOG_SERVER_SRC_SERVICEMANAGER_H_
19 
20 #include "IoOveruseMonitor.h"
21 #include "WatchdogBinderMediator.h"
22 #include "WatchdogPerfService.h"
23 #include "WatchdogProcessService.h"
24 #include "WatchdogServiceHelper.h"
25 
26 #include <android-base/result.h>
27 #include <utils/Looper.h>
28 #include <utils/StrongPointer.h>
29 
30 namespace android {
31 namespace automotive {
32 namespace watchdog {
33 
34 class ServiceManager {
35 public:
36     static android::base::Result<void> startServices(const android::sp<Looper>& looper);
37     static android::base::Result<void> startBinderMediator();
38     static void terminateServices();
39 
40 private:
41     static android::base::Result<void> startProcessAnrMonitor(const android::sp<Looper>& looper);
42     static android::base::Result<void> startPerfService();
43 
44     static android::sp<WatchdogProcessService> sWatchdogProcessService;
45     static android::sp<WatchdogPerfServiceInterface> sWatchdogPerfService;
46     static android::sp<WatchdogBinderMediator> sWatchdogBinderMediator;
47     static android::sp<IWatchdogServiceHelper> sWatchdogServiceHelper;
48 };
49 
50 }  // namespace watchdog
51 }  // namespace automotive
52 }  // namespace android
53 
54 #endif  // CPP_WATCHDOG_SERVER_SRC_SERVICEMANAGER_H_
55