blob: 907a49faa2b7c6fc9c862ef7f07eb0702d440a87 [file] [log] [blame]
Prabir Pradhanbaa5c822019-08-30 15:27:05 -07001/*
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
Prabir Pradhan48108662022-09-09 21:22:04 +000017#pragma once
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070018
19#include <input/InputDevice.h>
Siarhei Vishniakou2935db72022-09-22 13:35:22 -070020#include "NotifyArgs.h"
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070021
22#include <vector>
23
24namespace android {
25
26class EventHubInterface;
27class InputDevice;
28class InputListenerInterface;
29class InputMapper;
30class InputReaderPolicyInterface;
31struct StylusState;
32
33/* Internal interface used by individual input devices to access global input device state
34 * and parameters maintained by the input reader.
35 */
36class InputReaderContext {
37public:
38 InputReaderContext() {}
39 virtual ~InputReaderContext() {}
40
41 virtual void updateGlobalMetaState() = 0;
42 virtual int32_t getGlobalMetaState() = 0;
43
44 virtual void disableVirtualKeysUntil(nsecs_t time) = 0;
Nathaniel R. Lewis26ec2222020-01-10 16:30:54 -080045 virtual bool shouldDropVirtualKey(nsecs_t now, int32_t keyCode, int32_t scanCode) = 0;
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070046
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070047 virtual void requestTimeoutAtTime(nsecs_t when) = 0;
48 virtual int32_t bumpGeneration() = 0;
49
50 virtual void getExternalStylusDevices(std::vector<InputDeviceInfo>& outDevices) = 0;
Siarhei Vishniakou2935db72022-09-22 13:35:22 -070051 [[nodiscard]] virtual std::list<NotifyArgs> dispatchExternalStylusState(
52 const StylusState& outState) = 0;
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070053
54 virtual InputReaderPolicyInterface* getPolicy() = 0;
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070055 virtual EventHubInterface* getEventHub() = 0;
56
Siarhei Vishniakouf2f073b2021-02-09 21:59:56 +000057 virtual int32_t getNextId() = 0;
58
arthurhungc903df12020-08-11 15:08:42 +080059 virtual void updateLedMetaState(int32_t metaState) = 0;
60 virtual int32_t getLedMetaState() = 0;
Arpit Singha5ea7c12023-07-05 15:39:25 +000061
62 virtual void setPreventingTouchpadTaps(bool prevent) = 0;
63 virtual bool isPreventingTouchpadTaps() = 0;
Arpit Singh82e413e2023-10-10 19:30:58 +000064
65 virtual void setLastKeyDownTimestamp(nsecs_t when) = 0;
66 virtual nsecs_t getLastKeyDownTimestamp() = 0;
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070067};
68
69} // namespace android