• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2019 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 #pragma once
18 
19 #include <input/InputDevice.h>
20 #include <input/KeyboardClassifier.h>
21 #include "NotifyArgs.h"
22 
23 #include <string>
24 #include <vector>
25 
26 namespace android {
27 
28 class EventHubInterface;
29 class InputDevice;
30 class InputListenerInterface;
31 class InputMapper;
32 class InputReaderPolicyInterface;
33 struct StylusState;
34 
35 /* Internal interface used by individual input devices to access global input device state
36  * and parameters maintained by the input reader.
37  */
38 class InputReaderContext {
39 public:
InputReaderContext()40     InputReaderContext() {}
~InputReaderContext()41     virtual ~InputReaderContext() {}
42 
43     virtual std::string dump() = 0;
44 
45     virtual void updateGlobalMetaState() = 0;
46     virtual int32_t getGlobalMetaState() = 0;
47 
48     virtual void disableVirtualKeysUntil(nsecs_t time) = 0;
49     virtual bool shouldDropVirtualKey(nsecs_t now, int32_t keyCode, int32_t scanCode) = 0;
50 
51     virtual void requestTimeoutAtTime(nsecs_t when) = 0;
52     virtual int32_t bumpGeneration() = 0;
53 
54     virtual void getExternalStylusDevices(std::vector<InputDeviceInfo>& outDevices) = 0;
55     [[nodiscard]] virtual std::list<NotifyArgs> dispatchExternalStylusState(
56             const StylusState& outState) = 0;
57 
58     virtual InputReaderPolicyInterface* getPolicy() = 0;
59     virtual EventHubInterface* getEventHub() = 0;
60 
61     virtual int32_t getNextId() const = 0;
62 
63     virtual void updateLedMetaState(int32_t metaState) = 0;
64     virtual int32_t getLedMetaState() = 0;
65 
66     virtual void setPreventingTouchpadTaps(bool prevent) = 0;
67     virtual bool isPreventingTouchpadTaps() = 0;
68 
69     virtual void setLastKeyDownTimestamp(nsecs_t when) = 0;
70     virtual nsecs_t getLastKeyDownTimestamp() = 0;
71 
72     virtual KeyboardClassifier& getKeyboardClassifier() = 0;
73 };
74 
75 } // namespace android
76