• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2018 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 IORAP_BINDER_IIORAP_IMPL_H
18 #define IORAP_BINDER_IIORAP_IMPL_H
19 
20 #include "binder/iiorap_def.h"
21 #include "binder/package_change_observer.h"
22 #include "binder/package_manager_remote.h"
23 #include "common/macros.h"
24 
25 #include "com/google/android/startop/iorap/BnIorap.h"
26 
27 #include <memory>
28 
29 namespace android {
30 template <typename Service>
31 class BinderService;
32 }
33 
34 namespace iorap::manager {
35   class EventManager;
36 };
37 
38 namespace iorap {
39 namespace binder {
40 
41 // Implementation of the IIorap service. This enables remote clients
42 // to connect to this process via the binder service manager.
43 //
44 // See also IIorap.aidl.
45 class IIorapImpl : public ::com::google::android::startop::iorap::BnIorap {
46 public:
47   static bool Start(std::shared_ptr<iorap::manager::EventManager> event_manager);
getServiceName()48   static constexpr const char* getServiceName() { return "iorapd"; };
49 
50   virtual ::android::status_t dump(int fd,
51                                    const ::android::Vector<::android::String16>& args) override;
52 
53 // Join all parameter declarations by splitting each parameter with a comma.
54 // Types are used fully.
55 #define IIORAP_IMPL_ARGS(...) \
56   IORAP_PP_MAP_SEP(IORAP_BINDER_PARAM_JOIN_ALL, IORAP_PP_COMMA, __VA_ARGS__)
57 #define IIORAP_IMPL_BODY(name, ...) \
58   ::android::binder::Status name(IIORAP_IMPL_ARGS(__VA_ARGS__)) override;
59 
60 IIORAP_IFACE_DEF(/*begin*/IORAP_PP_NOP, IIORAP_IMPL_BODY, /*end*/IORAP_PP_NOP);
61 
62 #undef IIORAP_IMPL_BODY
63 #undef IIORAP_IMPL_ARGS
64 
65   class Impl;
66 private:
67   IIorapImpl();  // open for BinderService::publish.
68 
69   friend class ::android::BinderService<IIorapImpl>;
70 
71   std::unique_ptr<Impl> impl_;
72 };
73 }
74 }
75 
76 
77 #endif //IORAP_BINDER_IIORAP_IMPL_H
78