summaryrefslogtreecommitdiff
path: root/src/binder/iiorap_impl.h
blob: ae1422f1b20896f48e934dd413ebd0f140929366 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/*
 * Copyright (C) 2018 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef IORAP_BINDER_IIORAP_IMPL_H
#define IORAP_BINDER_IIORAP_IMPL_H

#include "binder/iiorap_def.h"
#include "binder/package_change_observer.h"
#include "binder/package_manager_remote.h"
#include "common/macros.h"

#include "com/google/android/startop/iorap/BnIorap.h"

#include <memory>

namespace android {
template <typename Service>
class BinderService;
}

namespace iorap::manager {
  class EventManager;
};

namespace iorap {
namespace binder {

// Implementation of the IIorap service. This enables remote clients
// to connect to this process via the binder service manager.
//
// See also IIorap.aidl.
class IIorapImpl : public ::com::google::android::startop::iorap::BnIorap {
public:
  static bool Start(std::shared_ptr<iorap::manager::EventManager> event_manager);
  static constexpr const char* getServiceName() { return "iorapd"; };

  virtual ::android::status_t dump(int fd,
                                   const ::android::Vector<::android::String16>& args) override;

// Join all parameter declarations by splitting each parameter with a comma.
// Types are used fully.
#define IIORAP_IMPL_ARGS(...) \
  IORAP_PP_MAP_SEP(IORAP_BINDER_PARAM_JOIN_ALL, IORAP_PP_COMMA, __VA_ARGS__)
#define IIORAP_IMPL_BODY(name, ...) \
  ::android::binder::Status name(IIORAP_IMPL_ARGS(__VA_ARGS__)) override;

IIORAP_IFACE_DEF(/*begin*/IORAP_PP_NOP, IIORAP_IMPL_BODY, /*end*/IORAP_PP_NOP);

#undef IIORAP_IMPL_BODY
#undef IIORAP_IMPL_ARGS

  class Impl;
private:
  IIorapImpl();  // open for BinderService::publish.

  friend class ::android::BinderService<IIorapImpl>;

  std::unique_ptr<Impl> impl_;
};
}
}


#endif //IORAP_BINDER_IIORAP_IMPL_H