Michael Wright | d02c5b6 | 2014-02-10 15:10:22 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2010 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 Pradhan | baa5c82 | 2019-08-30 15:27:05 -0700 | [diff] [blame] | 17 | #ifndef _UI_INPUTREADER_INPUT_READER_H |
| 18 | #define _UI_INPUTREADER_INPUT_READER_H |
Michael Wright | d02c5b6 | 2014-02-10 15:10:22 -0800 | [diff] [blame] | 19 | |
Michael Wright | 17db18e | 2020-06-26 20:51:44 +0100 | [diff] [blame] | 20 | #include <PointerControllerInterface.h> |
Chris Ye | 1c2e089 | 2020-11-30 21:41:44 -0800 | [diff] [blame] | 21 | #include <android-base/thread_annotations.h> |
Michael Wright | 17db18e | 2020-06-26 20:51:44 +0100 | [diff] [blame] | 22 | #include <utils/Condition.h> |
| 23 | #include <utils/Mutex.h> |
| 24 | |
| 25 | #include <memory> |
| 26 | #include <unordered_map> |
| 27 | #include <vector> |
| 28 | |
Michael Wright | d02c5b6 | 2014-02-10 15:10:22 -0800 | [diff] [blame] | 29 | #include "EventHub.h" |
Michael Wright | d02c5b6 | 2014-02-10 15:10:22 -0800 | [diff] [blame] | 30 | #include "InputListener.h" |
Prabir Pradhan | 29c9533 | 2018-11-14 20:14:11 -0800 | [diff] [blame] | 31 | #include "InputReaderBase.h" |
Prabir Pradhan | baa5c82 | 2019-08-30 15:27:05 -0700 | [diff] [blame] | 32 | #include "InputReaderContext.h" |
Prabir Pradhan | 5a57cff | 2019-10-31 18:40:33 -0700 | [diff] [blame] | 33 | #include "InputThread.h" |
Michael Wright | d02c5b6 | 2014-02-10 15:10:22 -0800 | [diff] [blame] | 34 | |
Michael Wright | d02c5b6 | 2014-02-10 15:10:22 -0800 | [diff] [blame] | 35 | namespace android { |
| 36 | |
| 37 | class InputDevice; |
| 38 | class InputMapper; |
Prabir Pradhan | baa5c82 | 2019-08-30 15:27:05 -0700 | [diff] [blame] | 39 | struct StylusState; |
Michael Wright | d02c5b6 | 2014-02-10 15:10:22 -0800 | [diff] [blame] | 40 | |
Michael Wright | d02c5b6 | 2014-02-10 15:10:22 -0800 | [diff] [blame] | 41 | /* The input reader reads raw event data from the event hub and processes it into input events |
| 42 | * that it sends to the input listener. Some functions of the input reader, such as early |
| 43 | * event filtering in low power states, are controlled by a separate policy object. |
| 44 | * |
Prabir Pradhan | 28efc19 | 2019-11-05 01:10:04 +0000 | [diff] [blame] | 45 | * The InputReader owns a collection of InputMappers. InputReader starts its own thread, where |
| 46 | * most of the work happens, but the InputReader can receive queries from other system |
Michael Wright | d02c5b6 | 2014-02-10 15:10:22 -0800 | [diff] [blame] | 47 | * components running on arbitrary threads. To keep things manageable, the InputReader |
| 48 | * uses a single Mutex to guard its state. The Mutex may be held while calling into the |
| 49 | * EventHub or the InputReaderPolicy but it is never held while calling into the |
Prabir Pradhan | 28efc19 | 2019-11-05 01:10:04 +0000 | [diff] [blame] | 50 | * InputListener. All calls to InputListener must happen from InputReader's thread. |
Michael Wright | d02c5b6 | 2014-02-10 15:10:22 -0800 | [diff] [blame] | 51 | */ |
| 52 | class InputReader : public InputReaderInterface { |
| 53 | public: |
Siarhei Vishniakou | 3bc7e09 | 2019-07-24 17:43:30 -0700 | [diff] [blame] | 54 | InputReader(std::shared_ptr<EventHubInterface> eventHub, |
| 55 | const sp<InputReaderPolicyInterface>& policy, |
| 56 | const sp<InputListenerInterface>& listener); |
Michael Wright | d02c5b6 | 2014-02-10 15:10:22 -0800 | [diff] [blame] | 57 | virtual ~InputReader(); |
| 58 | |
arthurhung | c903df1 | 2020-08-11 15:08:42 +0800 | [diff] [blame] | 59 | void dump(std::string& dump) override; |
| 60 | void monitor() override; |
Michael Wright | d02c5b6 | 2014-02-10 15:10:22 -0800 | [diff] [blame] | 61 | |
arthurhung | c903df1 | 2020-08-11 15:08:42 +0800 | [diff] [blame] | 62 | status_t start() override; |
| 63 | status_t stop() override; |
Michael Wright | d02c5b6 | 2014-02-10 15:10:22 -0800 | [diff] [blame] | 64 | |
Chris Ye | 98d3f53 | 2020-10-01 21:48:59 -0700 | [diff] [blame] | 65 | std::vector<InputDeviceInfo> getInputDevices() const override; |
Michael Wright | d02c5b6 | 2014-02-10 15:10:22 -0800 | [diff] [blame] | 66 | |
arthurhung | c903df1 | 2020-08-11 15:08:42 +0800 | [diff] [blame] | 67 | bool isInputDeviceEnabled(int32_t deviceId) override; |
Siarhei Vishniakou | e54cb85 | 2017-03-21 17:48:16 -0700 | [diff] [blame] | 68 | |
arthurhung | c903df1 | 2020-08-11 15:08:42 +0800 | [diff] [blame] | 69 | int32_t getScanCodeState(int32_t deviceId, uint32_t sourceMask, int32_t scanCode) override; |
| 70 | int32_t getKeyCodeState(int32_t deviceId, uint32_t sourceMask, int32_t keyCode) override; |
| 71 | int32_t getSwitchState(int32_t deviceId, uint32_t sourceMask, int32_t sw) override; |
Michael Wright | d02c5b6 | 2014-02-10 15:10:22 -0800 | [diff] [blame] | 72 | |
arthurhung | c903df1 | 2020-08-11 15:08:42 +0800 | [diff] [blame] | 73 | void toggleCapsLockState(int32_t deviceId) override; |
Andrii Kulian | 763a3a4 | 2016-03-08 10:46:16 -0800 | [diff] [blame] | 74 | |
arthurhung | c903df1 | 2020-08-11 15:08:42 +0800 | [diff] [blame] | 75 | bool hasKeys(int32_t deviceId, uint32_t sourceMask, size_t numCodes, const int32_t* keyCodes, |
| 76 | uint8_t* outFlags) override; |
Michael Wright | d02c5b6 | 2014-02-10 15:10:22 -0800 | [diff] [blame] | 77 | |
arthurhung | c903df1 | 2020-08-11 15:08:42 +0800 | [diff] [blame] | 78 | void requestRefreshConfiguration(uint32_t changes) override; |
Michael Wright | d02c5b6 | 2014-02-10 15:10:22 -0800 | [diff] [blame] | 79 | |
Chris Ye | 8714371 | 2020-11-10 05:05:58 +0000 | [diff] [blame] | 80 | void vibrate(int32_t deviceId, const VibrationSequence& sequence, ssize_t repeat, |
arthurhung | c903df1 | 2020-08-11 15:08:42 +0800 | [diff] [blame] | 81 | int32_t token) override; |
| 82 | void cancelVibrate(int32_t deviceId, int32_t token) override; |
Michael Wright | d02c5b6 | 2014-02-10 15:10:22 -0800 | [diff] [blame] | 83 | |
Chris Ye | 8714371 | 2020-11-10 05:05:58 +0000 | [diff] [blame] | 84 | bool isVibrating(int32_t deviceId) override; |
| 85 | |
| 86 | std::vector<int32_t> getVibratorIds(int32_t deviceId) override; |
| 87 | |
arthurhung | c903df1 | 2020-08-11 15:08:42 +0800 | [diff] [blame] | 88 | bool canDispatchToDisplay(int32_t deviceId, int32_t displayId) override; |
Prabir Pradhan | da7c00c | 2019-08-29 14:12:42 -0700 | [diff] [blame] | 89 | |
Chris Ye | f59a2f4 | 2020-10-16 12:55:26 -0700 | [diff] [blame] | 90 | bool enableSensor(int32_t deviceId, InputDeviceSensorType sensorType, |
| 91 | std::chrono::microseconds samplingPeriod, |
| 92 | std::chrono::microseconds maxBatchReportLatency) override; |
| 93 | |
| 94 | void disableSensor(int32_t deviceId, InputDeviceSensorType sensorType) override; |
| 95 | |
| 96 | void flushSensor(int32_t deviceId, InputDeviceSensorType sensorType) override; |
| 97 | |
Kim Low | 03ea035 | 2020-11-06 12:45:07 -0800 | [diff] [blame] | 98 | std::optional<int32_t> getBatteryCapacity(int32_t deviceId) override; |
| 99 | |
| 100 | std::optional<int32_t> getBatteryStatus(int32_t deviceId) override; |
| 101 | |
Michael Wright | d02c5b6 | 2014-02-10 15:10:22 -0800 | [diff] [blame] | 102 | protected: |
| 103 | // These members are protected so they can be instrumented by test cases. |
Chris Ye | 1c2e089 | 2020-11-30 21:41:44 -0800 | [diff] [blame] | 104 | virtual std::shared_ptr<InputDevice> createDeviceLocked(int32_t deviceId, |
| 105 | const InputDeviceIdentifier& identifier) |
| 106 | REQUIRES(mLock); |
Michael Wright | d02c5b6 | 2014-02-10 15:10:22 -0800 | [diff] [blame] | 107 | |
Prabir Pradhan | 28efc19 | 2019-11-05 01:10:04 +0000 | [diff] [blame] | 108 | // With each iteration of the loop, InputReader reads and processes one incoming message from |
| 109 | // the EventHub. |
| 110 | void loopOnce(); |
| 111 | |
Michael Wright | d02c5b6 | 2014-02-10 15:10:22 -0800 | [diff] [blame] | 112 | class ContextImpl : public InputReaderContext { |
| 113 | InputReader* mReader; |
Garfield Tan | ff1f1bb | 2020-01-28 13:24:04 -0800 | [diff] [blame] | 114 | IdGenerator mIdGenerator; |
Michael Wright | d02c5b6 | 2014-02-10 15:10:22 -0800 | [diff] [blame] | 115 | |
| 116 | public: |
Chih-Hung Hsieh | 6d2ede1 | 2016-09-01 11:28:23 -0700 | [diff] [blame] | 117 | explicit ContextImpl(InputReader* reader); |
Chris Ye | 1c2e089 | 2020-11-30 21:41:44 -0800 | [diff] [blame] | 118 | // lock is already held by the input loop |
| 119 | void updateGlobalMetaState() NO_THREAD_SAFETY_ANALYSIS override; |
| 120 | int32_t getGlobalMetaState() NO_THREAD_SAFETY_ANALYSIS override; |
| 121 | void disableVirtualKeysUntil(nsecs_t time) NO_THREAD_SAFETY_ANALYSIS override; |
| 122 | bool shouldDropVirtualKey(nsecs_t now, int32_t keyCode, |
| 123 | int32_t scanCode) NO_THREAD_SAFETY_ANALYSIS override; |
| 124 | void fadePointer() NO_THREAD_SAFETY_ANALYSIS override; |
| 125 | std::shared_ptr<PointerControllerInterface> getPointerController(int32_t deviceId) |
| 126 | NO_THREAD_SAFETY_ANALYSIS override; |
| 127 | void requestTimeoutAtTime(nsecs_t when) NO_THREAD_SAFETY_ANALYSIS override; |
| 128 | int32_t bumpGeneration() NO_THREAD_SAFETY_ANALYSIS override; |
| 129 | void getExternalStylusDevices(std::vector<InputDeviceInfo>& outDevices) |
| 130 | NO_THREAD_SAFETY_ANALYSIS override; |
| 131 | void dispatchExternalStylusState(const StylusState& outState) |
| 132 | NO_THREAD_SAFETY_ANALYSIS override; |
| 133 | InputReaderPolicyInterface* getPolicy() NO_THREAD_SAFETY_ANALYSIS override; |
Chris Ye | 1c2e089 | 2020-11-30 21:41:44 -0800 | [diff] [blame] | 134 | EventHubInterface* getEventHub() NO_THREAD_SAFETY_ANALYSIS override; |
Chris Ye | 1c2e089 | 2020-11-30 21:41:44 -0800 | [diff] [blame] | 135 | void updateLedMetaState(int32_t metaState) NO_THREAD_SAFETY_ANALYSIS override; |
| 136 | int32_t getLedMetaState() NO_THREAD_SAFETY_ANALYSIS override; |
Siarhei Vishniakou | cec3f6a | 2020-11-10 15:42:39 -0600 | [diff] [blame] | 137 | |
| 138 | // Send events to InputListener interface |
| 139 | void notifyConfigurationChanged(nsecs_t when) override; |
| 140 | void notifyKey(nsecs_t eventTime, int32_t deviceId, uint32_t source, int32_t displayId, |
| 141 | uint32_t policyFlags, int32_t action, int32_t flags, int32_t keyCode, |
| 142 | int32_t scanCode, int32_t metaState, nsecs_t downTime) override; |
| 143 | void notifyMotion(nsecs_t eventTime, int32_t deviceId, uint32_t source, int32_t displayId, |
| 144 | uint32_t policyFlags, int32_t action, int32_t actionButton, int32_t flags, |
| 145 | int32_t metaState, int32_t buttonState, |
| 146 | MotionClassification classification, int32_t edgeFlags, |
| 147 | uint32_t pointerCount, const PointerProperties* pointerProperties, |
| 148 | const PointerCoords* pointerCoords, float xPrecision, float yPrecision, |
| 149 | float xCursorPosition, float yCursorPosition, nsecs_t downTime, |
| 150 | const std::vector<TouchVideoFrame>& videoFrames) override; |
| 151 | void notifySwitch(nsecs_t eventTime, uint32_t switchValues, uint32_t switchMask) override; |
| 152 | void notifySensor(nsecs_t when, int32_t deviceId, InputDeviceSensorType sensorType, |
| 153 | InputDeviceSensorAccuracy accuracy, bool accuracyChanged, |
| 154 | nsecs_t timestamp, std::vector<float> values) override; |
Chris Ye | fb55290 | 2021-02-03 17:18:37 -0800 | [diff] [blame] | 155 | void notifyVibratorState(nsecs_t when, int32_t deviceId, bool isOn) override; |
Siarhei Vishniakou | cec3f6a | 2020-11-10 15:42:39 -0600 | [diff] [blame] | 156 | void notifyDeviceReset(nsecs_t when, int32_t deviceId) override; |
| 157 | void notifyPointerCaptureChanged(nsecs_t when, bool hasCapture) override; |
| 158 | |
Michael Wright | d02c5b6 | 2014-02-10 15:10:22 -0800 | [diff] [blame] | 159 | } mContext; |
| 160 | |
| 161 | friend class ContextImpl; |
Chris Ye | 1c2e089 | 2020-11-30 21:41:44 -0800 | [diff] [blame] | 162 | // Test cases need to override the locked functions |
| 163 | mutable std::mutex mLock; |
Michael Wright | d02c5b6 | 2014-02-10 15:10:22 -0800 | [diff] [blame] | 164 | |
| 165 | private: |
Prabir Pradhan | 5a57cff | 2019-10-31 18:40:33 -0700 | [diff] [blame] | 166 | std::unique_ptr<InputThread> mThread; |
Prabir Pradhan | 28efc19 | 2019-11-05 01:10:04 +0000 | [diff] [blame] | 167 | |
Chris Ye | 1c2e089 | 2020-11-30 21:41:44 -0800 | [diff] [blame] | 168 | std::condition_variable mReaderIsAliveCondition; |
Michael Wright | d02c5b6 | 2014-02-10 15:10:22 -0800 | [diff] [blame] | 169 | |
Siarhei Vishniakou | 3bc7e09 | 2019-07-24 17:43:30 -0700 | [diff] [blame] | 170 | // This could be unique_ptr, but due to the way InputReader tests are written, |
| 171 | // it is made shared_ptr here. In the tests, an EventHub reference is retained by the test |
| 172 | // in parallel to passing it to the InputReader. |
| 173 | std::shared_ptr<EventHubInterface> mEventHub; |
Michael Wright | d02c5b6 | 2014-02-10 15:10:22 -0800 | [diff] [blame] | 174 | sp<InputReaderPolicyInterface> mPolicy; |
| 175 | sp<QueuedInputListener> mQueuedListener; |
| 176 | |
Chris Ye | 1c2e089 | 2020-11-30 21:41:44 -0800 | [diff] [blame] | 177 | InputReaderConfiguration mConfig GUARDED_BY(mLock); |
Michael Wright | d02c5b6 | 2014-02-10 15:10:22 -0800 | [diff] [blame] | 178 | |
| 179 | // The event queue. |
| 180 | static const int EVENT_BUFFER_SIZE = 256; |
Chris Ye | 1c2e089 | 2020-11-30 21:41:44 -0800 | [diff] [blame] | 181 | RawEvent mEventBuffer[EVENT_BUFFER_SIZE] GUARDED_BY(mLock); |
Michael Wright | d02c5b6 | 2014-02-10 15:10:22 -0800 | [diff] [blame] | 182 | |
Nathaniel R. Lewis | a7b82e1 | 2020-02-12 15:40:45 -0800 | [diff] [blame] | 183 | // An input device can represent a collection of EventHub devices. This map provides a way |
| 184 | // to lookup the input device instance from the EventHub device id. |
Chris Ye | 1c2e089 | 2020-11-30 21:41:44 -0800 | [diff] [blame] | 185 | std::unordered_map<int32_t /*eventHubId*/, std::shared_ptr<InputDevice>> mDevices |
| 186 | GUARDED_BY(mLock); |
Michael Wright | d02c5b6 | 2014-02-10 15:10:22 -0800 | [diff] [blame] | 187 | |
Chris Ye | e731003 | 2020-09-22 15:36:28 -0700 | [diff] [blame] | 188 | // An input device contains one or more eventHubId, this map provides a way to lookup the |
| 189 | // EventHubIds contained in the input device from the input device instance. |
| 190 | std::unordered_map<std::shared_ptr<InputDevice>, std::vector<int32_t> /*eventHubId*/> |
Chris Ye | 1c2e089 | 2020-11-30 21:41:44 -0800 | [diff] [blame] | 191 | mDeviceToEventHubIdsMap GUARDED_BY(mLock); |
Chris Ye | e731003 | 2020-09-22 15:36:28 -0700 | [diff] [blame] | 192 | |
Michael Wright | d02c5b6 | 2014-02-10 15:10:22 -0800 | [diff] [blame] | 193 | // low-level input event decoding and device management |
Chris Ye | 1c2e089 | 2020-11-30 21:41:44 -0800 | [diff] [blame] | 194 | void processEventsLocked(const RawEvent* rawEvents, size_t count) REQUIRES(mLock); |
Michael Wright | d02c5b6 | 2014-02-10 15:10:22 -0800 | [diff] [blame] | 195 | |
Chris Ye | 1c2e089 | 2020-11-30 21:41:44 -0800 | [diff] [blame] | 196 | void addDeviceLocked(nsecs_t when, int32_t eventHubId) REQUIRES(mLock); |
| 197 | void removeDeviceLocked(nsecs_t when, int32_t eventHubId) REQUIRES(mLock); |
| 198 | void processEventsForDeviceLocked(int32_t eventHubId, const RawEvent* rawEvents, size_t count) |
| 199 | REQUIRES(mLock); |
| 200 | void timeoutExpiredLocked(nsecs_t when) REQUIRES(mLock); |
Michael Wright | d02c5b6 | 2014-02-10 15:10:22 -0800 | [diff] [blame] | 201 | |
Chris Ye | 1c2e089 | 2020-11-30 21:41:44 -0800 | [diff] [blame] | 202 | void handleConfigurationChangedLocked(nsecs_t when) REQUIRES(mLock); |
Michael Wright | d02c5b6 | 2014-02-10 15:10:22 -0800 | [diff] [blame] | 203 | |
Chris Ye | 1c2e089 | 2020-11-30 21:41:44 -0800 | [diff] [blame] | 204 | int32_t mGlobalMetaState GUARDED_BY(mLock); |
| 205 | void updateGlobalMetaStateLocked() REQUIRES(mLock); |
| 206 | int32_t getGlobalMetaStateLocked() REQUIRES(mLock); |
Michael Wright | d02c5b6 | 2014-02-10 15:10:22 -0800 | [diff] [blame] | 207 | |
Chris Ye | 1c2e089 | 2020-11-30 21:41:44 -0800 | [diff] [blame] | 208 | int32_t mLedMetaState GUARDED_BY(mLock); |
| 209 | void updateLedMetaStateLocked(int32_t metaState) REQUIRES(mLock); |
| 210 | int32_t getLedMetaStateLocked() REQUIRES(mLock); |
arthurhung | c903df1 | 2020-08-11 15:08:42 +0800 | [diff] [blame] | 211 | |
Chris Ye | 1c2e089 | 2020-11-30 21:41:44 -0800 | [diff] [blame] | 212 | void notifyExternalStylusPresenceChangedLocked() REQUIRES(mLock); |
| 213 | void getExternalStylusDevicesLocked(std::vector<InputDeviceInfo>& outDevices) REQUIRES(mLock); |
Michael Wright | 842500e | 2015-03-13 17:32:02 -0700 | [diff] [blame] | 214 | void dispatchExternalStylusState(const StylusState& state); |
| 215 | |
Prabir Pradhan | c7ef27e | 2020-02-03 19:19:15 -0800 | [diff] [blame] | 216 | // The PointerController that is shared among all the input devices that need it. |
Michael Wright | 17db18e | 2020-06-26 20:51:44 +0100 | [diff] [blame] | 217 | std::weak_ptr<PointerControllerInterface> mPointerController; |
Chris Ye | 1c2e089 | 2020-11-30 21:41:44 -0800 | [diff] [blame] | 218 | std::shared_ptr<PointerControllerInterface> getPointerControllerLocked(int32_t deviceId) |
| 219 | REQUIRES(mLock); |
| 220 | void updatePointerDisplayLocked() REQUIRES(mLock); |
| 221 | void fadePointerLocked() REQUIRES(mLock); |
Michael Wright | d02c5b6 | 2014-02-10 15:10:22 -0800 | [diff] [blame] | 222 | |
Chris Ye | 1c2e089 | 2020-11-30 21:41:44 -0800 | [diff] [blame] | 223 | int32_t mGeneration GUARDED_BY(mLock); |
| 224 | int32_t bumpGenerationLocked() REQUIRES(mLock); |
Michael Wright | d02c5b6 | 2014-02-10 15:10:22 -0800 | [diff] [blame] | 225 | |
Chris Ye | 1c2e089 | 2020-11-30 21:41:44 -0800 | [diff] [blame] | 226 | int32_t mNextInputDeviceId GUARDED_BY(mLock); |
| 227 | int32_t nextInputDeviceIdLocked() REQUIRES(mLock); |
Nathaniel R. Lewis | a7b82e1 | 2020-02-12 15:40:45 -0800 | [diff] [blame] | 228 | |
Chris Ye | 1c2e089 | 2020-11-30 21:41:44 -0800 | [diff] [blame] | 229 | std::vector<InputDeviceInfo> getInputDevicesLocked() const REQUIRES(mLock); |
Michael Wright | d02c5b6 | 2014-02-10 15:10:22 -0800 | [diff] [blame] | 230 | |
Chris Ye | 1c2e089 | 2020-11-30 21:41:44 -0800 | [diff] [blame] | 231 | nsecs_t mDisableVirtualKeysTimeout GUARDED_BY(mLock); |
| 232 | void disableVirtualKeysUntilLocked(nsecs_t time) REQUIRES(mLock); |
| 233 | bool shouldDropVirtualKeyLocked(nsecs_t now, int32_t keyCode, int32_t scanCode) REQUIRES(mLock); |
Michael Wright | d02c5b6 | 2014-02-10 15:10:22 -0800 | [diff] [blame] | 234 | |
Chris Ye | 1c2e089 | 2020-11-30 21:41:44 -0800 | [diff] [blame] | 235 | nsecs_t mNextTimeout GUARDED_BY(mLock); |
| 236 | void requestTimeoutAtTimeLocked(nsecs_t when) REQUIRES(mLock); |
Michael Wright | d02c5b6 | 2014-02-10 15:10:22 -0800 | [diff] [blame] | 237 | |
Chris Ye | 1c2e089 | 2020-11-30 21:41:44 -0800 | [diff] [blame] | 238 | uint32_t mConfigurationChangesToRefresh GUARDED_BY(mLock); |
| 239 | void refreshConfigurationLocked(uint32_t changes) REQUIRES(mLock); |
Michael Wright | d02c5b6 | 2014-02-10 15:10:22 -0800 | [diff] [blame] | 240 | |
| 241 | // state queries |
| 242 | typedef int32_t (InputDevice::*GetStateFunc)(uint32_t sourceMask, int32_t code); |
| 243 | int32_t getStateLocked(int32_t deviceId, uint32_t sourceMask, int32_t code, |
Chris Ye | 1c2e089 | 2020-11-30 21:41:44 -0800 | [diff] [blame] | 244 | GetStateFunc getStateFunc) REQUIRES(mLock); |
Michael Wright | d02c5b6 | 2014-02-10 15:10:22 -0800 | [diff] [blame] | 245 | bool markSupportedKeyCodesLocked(int32_t deviceId, uint32_t sourceMask, size_t numCodes, |
Chris Ye | 1c2e089 | 2020-11-30 21:41:44 -0800 | [diff] [blame] | 246 | const int32_t* keyCodes, uint8_t* outFlags) REQUIRES(mLock); |
Nathaniel R. Lewis | a7b82e1 | 2020-02-12 15:40:45 -0800 | [diff] [blame] | 247 | |
| 248 | // find an InputDevice from an InputDevice id |
Chris Ye | 1c2e089 | 2020-11-30 21:41:44 -0800 | [diff] [blame] | 249 | InputDevice* findInputDeviceLocked(int32_t deviceId) REQUIRES(mLock); |
Michael Wright | d02c5b6 | 2014-02-10 15:10:22 -0800 | [diff] [blame] | 250 | }; |
| 251 | |
Michael Wright | d02c5b6 | 2014-02-10 15:10:22 -0800 | [diff] [blame] | 252 | } // namespace android |
| 253 | |
Prabir Pradhan | baa5c82 | 2019-08-30 15:27:05 -0700 | [diff] [blame] | 254 | #endif // _UI_INPUTREADER_INPUT_READER_H |