blob: 4ae9ae9dd08ea0763f203860769f11776d648a5e [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
Dominik Laskowski2f01d772022-03-23 16:01:29 -070019#include <ftl/flags.h>
Nathaniel R. Lewisa7b82e12020-02-12 15:40:45 -080020#include <input/DisplayViewport.h>
21#include <input/InputDevice.h>
Siarhei Vishniakou32f36ae2020-09-02 20:17:10 -070022#include <input/PropertyMap.h>
Nathaniel R. Lewisa7b82e12020-02-12 15:40:45 -080023
Dominik Laskowski2f01d772022-03-23 16:01:29 -070024#include <cstdint>
Nathaniel R. Lewisa7b82e12020-02-12 15:40:45 -080025#include <optional>
26#include <unordered_map>
27#include <vector>
28
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070029#include "EventHub.h"
30#include "InputReaderBase.h"
31#include "InputReaderContext.h"
32
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070033namespace android {
34
Chris Ye1dd2e5c2021-04-04 23:12:41 -070035class PeripheralController;
36class PeripheralControllerInterface;
Nathaniel R. Lewis26ec2222020-01-10 16:30:54 -080037class InputDeviceContext;
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070038class InputMapper;
39
40/* Represents the state of a single input device. */
41class InputDevice {
42public:
43 InputDevice(InputReaderContext* context, int32_t id, int32_t generation,
Nathaniel R. Lewisa7b82e12020-02-12 15:40:45 -080044 const InputDeviceIdentifier& identifier);
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070045 ~InputDevice();
46
47 inline InputReaderContext* getContext() { return mContext; }
48 inline int32_t getId() const { return mId; }
49 inline int32_t getControllerNumber() const { return mControllerNumber; }
50 inline int32_t getGeneration() const { return mGeneration; }
51 inline const std::string getName() const { return mIdentifier.name; }
52 inline const std::string getDescriptor() { return mIdentifier.descriptor; }
Dominik Laskowski2f01d772022-03-23 16:01:29 -070053 inline ftl::Flags<InputDeviceClass> getClasses() const { return mClasses; }
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070054 inline uint32_t getSources() const { return mSources; }
Nathaniel R. Lewisa7b82e12020-02-12 15:40:45 -080055 inline bool hasEventHubDevices() const { return !mDevices.empty(); }
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070056
57 inline bool isExternal() { return mIsExternal; }
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070058 inline std::optional<uint8_t> getAssociatedDisplayPort() const {
59 return mAssociatedDisplayPort;
60 }
Christine Franks2a2293c2022-01-18 11:51:16 -080061 inline std::optional<std::string> getAssociatedDisplayUniqueId() const {
62 return mAssociatedDisplayUniqueId;
63 }
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070064 inline std::optional<DisplayViewport> getAssociatedViewport() const {
65 return mAssociatedViewport;
66 }
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070067 inline bool hasMic() const { return mHasMic; }
68
Nathaniel R. Lewisa7b82e12020-02-12 15:40:45 -080069 inline bool isIgnored() { return !getMapperCount(); }
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070070
71 bool isEnabled();
72 void setEnabled(bool enabled, nsecs_t when);
73
Chris Yee7310032020-09-22 15:36:28 -070074 void dump(std::string& dump, const std::string& eventHubDevStr);
Nathaniel R. Lewisa7b82e12020-02-12 15:40:45 -080075 void addEventHubDevice(int32_t eventHubId, bool populateMappers = true);
76 void removeEventHubDevice(int32_t eventHubId);
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070077 void configure(nsecs_t when, const InputReaderConfiguration* config, uint32_t changes);
78 void reset(nsecs_t when);
79 void process(const RawEvent* rawEvents, size_t count);
80 void timeoutExpired(nsecs_t when);
81 void updateExternalStylusState(const StylusState& state);
82
Siarhei Vishniakou1983a712021-06-04 19:27:09 +000083 InputDeviceInfo getDeviceInfo();
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070084 int32_t getKeyCodeState(uint32_t sourceMask, int32_t keyCode);
85 int32_t getScanCodeState(uint32_t sourceMask, int32_t scanCode);
86 int32_t getSwitchState(uint32_t sourceMask, int32_t switchCode);
Philip Junker4af3b3d2021-12-14 10:36:55 +010087 int32_t getKeyCodeForKeyLocation(int32_t locationKeyCode) const;
Siarhei Vishniakou74007942022-06-13 13:57:47 -070088 bool markSupportedKeyCodes(uint32_t sourceMask, const std::vector<int32_t>& keyCodes,
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070089 uint8_t* outFlags);
Chris Ye87143712020-11-10 05:05:58 +000090 void vibrate(const VibrationSequence& sequence, ssize_t repeat, int32_t token);
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070091 void cancelVibrate(int32_t token);
Chris Ye87143712020-11-10 05:05:58 +000092 bool isVibrating();
93 std::vector<int32_t> getVibratorIds();
Siarhei Vishniakou58ba3d12021-02-11 01:31:07 +000094 void cancelTouch(nsecs_t when, nsecs_t readTime);
Chris Yef59a2f42020-10-16 12:55:26 -070095 bool enableSensor(InputDeviceSensorType sensorType, std::chrono::microseconds samplingPeriod,
96 std::chrono::microseconds maxBatchReportLatency);
97 void disableSensor(InputDeviceSensorType sensorType);
98 void flushSensor(InputDeviceSensorType sensorType);
Prabir Pradhanbaa5c822019-08-30 15:27:05 -070099
Andy Chenf9f1a022022-08-29 20:07:10 -0400100 std::optional<int32_t> getBatteryEventHubId() const;
Kim Low03ea0352020-11-06 12:45:07 -0800101
Chris Ye3fdbfef2021-01-06 18:45:18 -0800102 bool setLightColor(int32_t lightId, int32_t color);
103 bool setLightPlayerId(int32_t lightId, int32_t playerId);
104 std::optional<int32_t> getLightColor(int32_t lightId);
105 std::optional<int32_t> getLightPlayerId(int32_t lightId);
106
Prabir Pradhanbaa5c822019-08-30 15:27:05 -0700107 int32_t getMetaState();
108 void updateMetaState(int32_t keyCode);
109
Prabir Pradhanbaa5c822019-08-30 15:27:05 -0700110 void bumpGeneration();
111
112 void notifyReset(nsecs_t when);
113
114 inline const PropertyMap& getConfiguration() { return mConfiguration; }
115 inline EventHubInterface* getEventHub() { return mContext->getEventHub(); }
116
Prabir Pradhanbaa5c822019-08-30 15:27:05 -0700117 std::optional<int32_t> getAssociatedDisplayId();
118
arthurhungc903df12020-08-11 15:08:42 +0800119 void updateLedState(bool reset);
120
Nathaniel R. Lewisa7b82e12020-02-12 15:40:45 -0800121 size_t getMapperCount();
122
Nathaniel R. Lewisf4916ef2020-01-14 11:57:18 -0800123 // construct and add a mapper to the input device
124 template <class T, typename... Args>
Nathaniel R. Lewisa7b82e12020-02-12 15:40:45 -0800125 T& addMapper(int32_t eventHubId, Args... args) {
126 // ensure a device entry exists for this eventHubId
127 addEventHubDevice(eventHubId, false);
128
129 // create mapper
130 auto& devicePair = mDevices[eventHubId];
131 auto& deviceContext = devicePair.first;
132 auto& mappers = devicePair.second;
133 T* mapper = new T(*deviceContext, args...);
134 mappers.emplace_back(mapper);
Nathaniel R. Lewisf4916ef2020-01-14 11:57:18 -0800135 return *mapper;
136 }
137
Chris Yee2b1e5c2021-03-10 22:45:12 -0800138 // construct and add a controller to the input device
139 template <class T>
140 T& addController(int32_t eventHubId) {
141 // ensure a device entry exists for this eventHubId
142 addEventHubDevice(eventHubId, false);
143
144 // create controller
145 auto& devicePair = mDevices[eventHubId];
146 auto& deviceContext = devicePair.first;
147
148 mController = std::make_unique<T>(*deviceContext);
149 return *(reinterpret_cast<T*>(mController.get()));
150 }
151
Prabir Pradhanbaa5c822019-08-30 15:27:05 -0700152private:
153 InputReaderContext* mContext;
154 int32_t mId;
155 int32_t mGeneration;
156 int32_t mControllerNumber;
Vaibhav Devmuraridd82b8e2022-08-16 15:34:01 +0000157 hardware::input::InputDeviceCountryCode mCountryCode;
Prabir Pradhanbaa5c822019-08-30 15:27:05 -0700158 InputDeviceIdentifier mIdentifier;
159 std::string mAlias;
Dominik Laskowski2f01d772022-03-23 16:01:29 -0700160 ftl::Flags<InputDeviceClass> mClasses;
Prabir Pradhanbaa5c822019-08-30 15:27:05 -0700161
Nathaniel R. Lewisa7b82e12020-02-12 15:40:45 -0800162 // map from eventHubId to device context and mappers
163 using MapperVector = std::vector<std::unique_ptr<InputMapper>>;
164 using DevicePair = std::pair<std::unique_ptr<InputDeviceContext>, MapperVector>;
Chris Yee2b1e5c2021-03-10 22:45:12 -0800165 // Map from EventHub ID to pair of device context and vector of mapper.
Nathaniel R. Lewisa7b82e12020-02-12 15:40:45 -0800166 std::unordered_map<int32_t, DevicePair> mDevices;
Chris Yee2b1e5c2021-03-10 22:45:12 -0800167 // Misc devices controller for lights, battery, etc.
Chris Ye1dd2e5c2021-04-04 23:12:41 -0700168 std::unique_ptr<PeripheralControllerInterface> mController;
Prabir Pradhanbaa5c822019-08-30 15:27:05 -0700169
170 uint32_t mSources;
171 bool mIsExternal;
172 std::optional<uint8_t> mAssociatedDisplayPort;
Christine Franks1ba71cc2021-04-07 14:37:42 -0700173 std::optional<std::string> mAssociatedDisplayUniqueId;
Prabir Pradhanbaa5c822019-08-30 15:27:05 -0700174 std::optional<DisplayViewport> mAssociatedViewport;
175 bool mHasMic;
176 bool mDropUntilNextSync;
177
178 typedef int32_t (InputMapper::*GetStateFunc)(uint32_t sourceMask, int32_t code);
179 int32_t getState(uint32_t sourceMask, int32_t code, GetStateFunc getStateFunc);
180
181 PropertyMap mConfiguration;
Nathaniel R. Lewisf4916ef2020-01-14 11:57:18 -0800182
Nathaniel R. Lewisa7b82e12020-02-12 15:40:45 -0800183 // helpers to interate over the devices collection
184 // run a function against every mapper on every subdevice
Nathaniel R. Lewisf4916ef2020-01-14 11:57:18 -0800185 inline void for_each_mapper(std::function<void(InputMapper&)> f) {
Nathaniel R. Lewisa7b82e12020-02-12 15:40:45 -0800186 for (auto& deviceEntry : mDevices) {
187 auto& devicePair = deviceEntry.second;
188 auto& mappers = devicePair.second;
189 for (auto& mapperPtr : mappers) {
190 f(*mapperPtr);
191 }
192 }
193 }
194
195 // run a function against every mapper on a specific subdevice
196 inline void for_each_mapper_in_subdevice(int32_t eventHubDevice,
197 std::function<void(InputMapper&)> f) {
198 auto deviceIt = mDevices.find(eventHubDevice);
199 if (deviceIt != mDevices.end()) {
200 auto& devicePair = deviceIt->second;
201 auto& mappers = devicePair.second;
202 for (auto& mapperPtr : mappers) {
203 f(*mapperPtr);
204 }
205 }
206 }
207
208 // run a function against every subdevice
209 inline void for_each_subdevice(std::function<void(InputDeviceContext&)> f) {
210 for (auto& deviceEntry : mDevices) {
211 auto& devicePair = deviceEntry.second;
212 auto& contextPtr = devicePair.first;
213 f(*contextPtr);
Nathaniel R. Lewisf4916ef2020-01-14 11:57:18 -0800214 }
215 }
216
217 // return the first value returned by a function over every mapper.
218 // if all mappers return nullopt, return nullopt.
219 template <typename T>
Philip Junker4af3b3d2021-12-14 10:36:55 +0100220 inline std::optional<T> first_in_mappers(
221 std::function<std::optional<T>(InputMapper&)> f) const {
Nathaniel R. Lewisa7b82e12020-02-12 15:40:45 -0800222 for (auto& deviceEntry : mDevices) {
223 auto& devicePair = deviceEntry.second;
224 auto& mappers = devicePair.second;
225 for (auto& mapperPtr : mappers) {
226 std::optional<T> ret = f(*mapperPtr);
227 if (ret) {
228 return ret;
229 }
Nathaniel R. Lewisf4916ef2020-01-14 11:57:18 -0800230 }
231 }
232 return std::nullopt;
233 }
Prabir Pradhanbaa5c822019-08-30 15:27:05 -0700234};
235
Nathaniel R. Lewis26ec2222020-01-10 16:30:54 -0800236/* Provides access to EventHub methods, but limits access to the current InputDevice.
237 * Essentially an implementation of EventHubInterface, but for a specific device id.
238 * Helps hide implementation details of InputDevice and EventHub. Used by mappers to
239 * check the status of the associated hardware device
240 */
241class InputDeviceContext {
242public:
Nathaniel R. Lewisa7b82e12020-02-12 15:40:45 -0800243 InputDeviceContext(InputDevice& device, int32_t eventHubId);
Nathaniel R. Lewis26ec2222020-01-10 16:30:54 -0800244 ~InputDeviceContext();
245
246 inline InputReaderContext* getContext() { return mContext; }
Nathaniel R. Lewisa7b82e12020-02-12 15:40:45 -0800247 inline int32_t getId() { return mDeviceId; }
248 inline int32_t getEventHubId() { return mId; }
Nathaniel R. Lewis26ec2222020-01-10 16:30:54 -0800249
Dominik Laskowski2f01d772022-03-23 16:01:29 -0700250 inline ftl::Flags<InputDeviceClass> getDeviceClasses() const {
Chris Ye1b0c7342020-07-28 21:57:03 -0700251 return mEventHub->getDeviceClasses(mId);
252 }
Nathaniel R. Lewis26ec2222020-01-10 16:30:54 -0800253 inline InputDeviceIdentifier getDeviceIdentifier() const {
254 return mEventHub->getDeviceIdentifier(mId);
255 }
256 inline int32_t getDeviceControllerNumber() const {
257 return mEventHub->getDeviceControllerNumber(mId);
258 }
259 inline void getConfiguration(PropertyMap* outConfiguration) const {
260 return mEventHub->getConfiguration(mId, outConfiguration);
261 }
262 inline status_t getAbsoluteAxisInfo(int32_t code, RawAbsoluteAxisInfo* axisInfo) const {
263 return mEventHub->getAbsoluteAxisInfo(mId, code, axisInfo);
264 }
265 inline bool hasRelativeAxis(int32_t code) const {
266 return mEventHub->hasRelativeAxis(mId, code);
267 }
Chris Yef59a2f42020-10-16 12:55:26 -0700268 inline bool hasInputProperty(int32_t property) const {
Nathaniel R. Lewis26ec2222020-01-10 16:30:54 -0800269 return mEventHub->hasInputProperty(mId, property);
270 }
Chris Yef59a2f42020-10-16 12:55:26 -0700271
272 inline bool hasMscEvent(int mscEvent) const { return mEventHub->hasMscEvent(mId, mscEvent); }
273
Nathaniel R. Lewis26ec2222020-01-10 16:30:54 -0800274 inline status_t mapKey(int32_t scanCode, int32_t usageCode, int32_t metaState,
275 int32_t* outKeycode, int32_t* outMetaState, uint32_t* outFlags) const {
276 return mEventHub->mapKey(mId, scanCode, usageCode, metaState, outKeycode, outMetaState,
277 outFlags);
278 }
279 inline status_t mapAxis(int32_t scanCode, AxisInfo* outAxisInfo) const {
280 return mEventHub->mapAxis(mId, scanCode, outAxisInfo);
281 }
Chris Yef59a2f42020-10-16 12:55:26 -0700282 inline base::Result<std::pair<InputDeviceSensorType, int32_t>> mapSensor(int32_t absCode) {
283 return mEventHub->mapSensor(mId, absCode);
284 }
285
Chris Ye3fdbfef2021-01-06 18:45:18 -0800286 inline const std::vector<int32_t> getRawLightIds() { return mEventHub->getRawLightIds(mId); }
287
288 inline std::optional<RawLightInfo> getRawLightInfo(int32_t lightId) {
289 return mEventHub->getRawLightInfo(mId, lightId);
290 }
291
292 inline std::optional<int32_t> getLightBrightness(int32_t lightId) {
293 return mEventHub->getLightBrightness(mId, lightId);
294 }
295
296 inline void setLightBrightness(int32_t lightId, int32_t brightness) {
297 return mEventHub->setLightBrightness(mId, lightId, brightness);
298 }
299
300 inline std::optional<std::unordered_map<LightColor, int32_t>> getLightIntensities(
301 int32_t lightId) {
302 return mEventHub->getLightIntensities(mId, lightId);
303 }
304
305 inline void setLightIntensities(int32_t lightId,
306 std::unordered_map<LightColor, int32_t> intensities) {
307 return mEventHub->setLightIntensities(mId, lightId, intensities);
308 }
309
Nathaniel R. Lewis26ec2222020-01-10 16:30:54 -0800310 inline std::vector<TouchVideoFrame> getVideoFrames() { return mEventHub->getVideoFrames(mId); }
Vaibhav Devmuraridd82b8e2022-08-16 15:34:01 +0000311 inline hardware::input::InputDeviceCountryCode getCountryCode() const {
312 return mEventHub->getCountryCode(mId);
313 }
Nathaniel R. Lewis26ec2222020-01-10 16:30:54 -0800314 inline int32_t getScanCodeState(int32_t scanCode) const {
315 return mEventHub->getScanCodeState(mId, scanCode);
316 }
317 inline int32_t getKeyCodeState(int32_t keyCode) const {
318 return mEventHub->getKeyCodeState(mId, keyCode);
319 }
Philip Junker4af3b3d2021-12-14 10:36:55 +0100320 inline int32_t getKeyCodeForKeyLocation(int32_t locationKeyCode) const {
321 return mEventHub->getKeyCodeForKeyLocation(mId, locationKeyCode);
322 }
Nathaniel R. Lewis26ec2222020-01-10 16:30:54 -0800323 inline int32_t getSwitchState(int32_t sw) const { return mEventHub->getSwitchState(mId, sw); }
324 inline status_t getAbsoluteAxisValue(int32_t code, int32_t* outValue) const {
325 return mEventHub->getAbsoluteAxisValue(mId, code, outValue);
326 }
Siarhei Vishniakou74007942022-06-13 13:57:47 -0700327 inline bool markSupportedKeyCodes(const std::vector<int32_t>& keyCodes,
Nathaniel R. Lewis26ec2222020-01-10 16:30:54 -0800328 uint8_t* outFlags) const {
Siarhei Vishniakou74007942022-06-13 13:57:47 -0700329 return mEventHub->markSupportedKeyCodes(mId, keyCodes, outFlags);
Nathaniel R. Lewis26ec2222020-01-10 16:30:54 -0800330 }
331 inline bool hasScanCode(int32_t scanCode) const {
332 return mEventHub->hasScanCode(mId, scanCode);
333 }
Arthur Hungcb40a002021-08-03 14:31:01 +0000334 inline bool hasKeyCode(int32_t keyCode) const { return mEventHub->hasKeyCode(mId, keyCode); }
Nathaniel R. Lewis26ec2222020-01-10 16:30:54 -0800335 inline bool hasLed(int32_t led) const { return mEventHub->hasLed(mId, led); }
336 inline void setLedState(int32_t led, bool on) { return mEventHub->setLedState(mId, led, on); }
337 inline void getVirtualKeyDefinitions(std::vector<VirtualKeyDefinition>& outVirtualKeys) const {
338 return mEventHub->getVirtualKeyDefinitions(mId, outVirtualKeys);
339 }
Chris Ye3a1e4462020-08-12 10:13:15 -0700340 inline const std::shared_ptr<KeyCharacterMap> getKeyCharacterMap() const {
Nathaniel R. Lewis26ec2222020-01-10 16:30:54 -0800341 return mEventHub->getKeyCharacterMap(mId);
342 }
Chris Ye3a1e4462020-08-12 10:13:15 -0700343 inline bool setKeyboardLayoutOverlay(std::shared_ptr<KeyCharacterMap> map) {
Nathaniel R. Lewis26ec2222020-01-10 16:30:54 -0800344 return mEventHub->setKeyboardLayoutOverlay(mId, map);
345 }
Nathaniel R. Lewiscacd69a2019-08-12 22:07:00 +0000346 inline void vibrate(const VibrationElement& element) {
347 return mEventHub->vibrate(mId, element);
348 }
Nathaniel R. Lewis26ec2222020-01-10 16:30:54 -0800349 inline void cancelVibrate() { return mEventHub->cancelVibrate(mId); }
350
Chris Ye87143712020-11-10 05:05:58 +0000351 inline std::vector<int32_t> getVibratorIds() { return mEventHub->getVibratorIds(mId); }
352
Chris Yee2b1e5c2021-03-10 22:45:12 -0800353 inline const std::vector<int32_t> getRawBatteryIds() {
354 return mEventHub->getRawBatteryIds(mId);
Kim Low03ea0352020-11-06 12:45:07 -0800355 }
356
Chris Yee2b1e5c2021-03-10 22:45:12 -0800357 inline std::optional<RawBatteryInfo> getRawBatteryInfo(int32_t batteryId) {
358 return mEventHub->getRawBatteryInfo(mId, batteryId);
359 }
360
361 inline std::optional<int32_t> getBatteryCapacity(int32_t batteryId) {
362 return mEventHub->getBatteryCapacity(mId, batteryId);
363 }
364
365 inline std::optional<int32_t> getBatteryStatus(int32_t batteryId) {
366 return mEventHub->getBatteryStatus(mId, batteryId);
367 }
Kim Low03ea0352020-11-06 12:45:07 -0800368
Nathaniel R. Lewis26ec2222020-01-10 16:30:54 -0800369 inline bool hasAbsoluteAxis(int32_t code) const {
370 RawAbsoluteAxisInfo info;
371 mEventHub->getAbsoluteAxisInfo(mId, code, &info);
372 return info.valid;
373 }
374 inline bool isKeyPressed(int32_t code) const {
375 return mEventHub->getScanCodeState(mId, code) == AKEY_STATE_DOWN;
376 }
377 inline int32_t getAbsoluteAxisValue(int32_t code) const {
378 int32_t value;
379 mEventHub->getAbsoluteAxisValue(mId, code, &value);
380 return value;
381 }
382 inline bool isDeviceEnabled() { return mEventHub->isDeviceEnabled(mId); }
383 inline status_t enableDevice() { return mEventHub->enableDevice(mId); }
384 inline status_t disableDevice() { return mEventHub->disableDevice(mId); }
385
386 inline const std::string getName() { return mDevice.getName(); }
387 inline const std::string getDescriptor() { return mDevice.getDescriptor(); }
388 inline bool isExternal() { return mDevice.isExternal(); }
389 inline std::optional<uint8_t> getAssociatedDisplayPort() const {
390 return mDevice.getAssociatedDisplayPort();
391 }
Christine Franks2a2293c2022-01-18 11:51:16 -0800392 inline std::optional<std::string> getAssociatedDisplayUniqueId() const {
393 return mDevice.getAssociatedDisplayUniqueId();
394 }
Nathaniel R. Lewis26ec2222020-01-10 16:30:54 -0800395 inline std::optional<DisplayViewport> getAssociatedViewport() const {
396 return mDevice.getAssociatedViewport();
397 }
Siarhei Vishniakou58ba3d12021-02-11 01:31:07 +0000398 inline void cancelTouch(nsecs_t when, nsecs_t readTime) { mDevice.cancelTouch(when, readTime); }
Nathaniel R. Lewis26ec2222020-01-10 16:30:54 -0800399 inline void bumpGeneration() { mDevice.bumpGeneration(); }
400 inline const PropertyMap& getConfiguration() { return mDevice.getConfiguration(); }
401
402private:
403 InputDevice& mDevice;
404 InputReaderContext* mContext;
405 EventHubInterface* mEventHub;
406 int32_t mId;
Nathaniel R. Lewisa7b82e12020-02-12 15:40:45 -0800407 int32_t mDeviceId;
Nathaniel R. Lewis26ec2222020-01-10 16:30:54 -0800408};
409
Prabir Pradhanbaa5c822019-08-30 15:27:05 -0700410} // namespace android