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  */
16 
17 #ifndef ANDROID_INPUT_HOST_H
18 #define ANDROID_INPUT_HOST_H
19 
20 #include <vector>
21 
22 #include <hardware/input.h>
23 #include <utils/RefBase.h>
24 #include <utils/String8.h>
25 #include <utils/StrongPointer.h>
26 
27 #include "InputDriver.h"
28 
29 namespace android {
30 
31 class InputDriverInterface;
32 
33 class InputHostInterface : public virtual RefBase {
34 protected:
35     InputHostInterface() = default;
36     virtual ~InputHostInterface() = default;
37 
38 public:
39 
40     virtual void registerInputDriver(InputDriverInterface* driver) = 0;
41 
42     virtual void dump(String8& result) = 0;
43 };
44 
45 class InputHost : public InputHostInterface {
46 public:
47     InputHost() = default;
48 
49     virtual void registerInputDriver(InputDriverInterface* driver) override;
50 
51     virtual void dump(String8& result) override;
52 
53 private:
54     std::vector<sp<InputDriverInterface>> mDrivers;
55 };
56 
57 } // namespace android
58 #endif // ANDRIOD_INPUT_HOST_H
59