Jeff Brown | 5912f95 | 2013-07-01 19:10:31 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2012 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 | c08b0db | 2022-09-10 00:57:15 +0000 | [diff] [blame^] | 17 | #pragma once |
Jeff Brown | 5912f95 | 2013-07-01 19:10:31 -0700 | [diff] [blame] | 18 | |
Chris Ye | f59a2f4 | 2020-10-16 12:55:26 -0700 | [diff] [blame] | 19 | #include <android/sensor.h> |
Jeff Brown | 5912f95 | 2013-07-01 19:10:31 -0700 | [diff] [blame] | 20 | #include <input/Input.h> |
| 21 | #include <input/KeyCharacterMap.h> |
Chris Ye | f59a2f4 | 2020-10-16 12:55:26 -0700 | [diff] [blame] | 22 | #include <unordered_map> |
Arthur Hung | 7c3ae9c | 2019-03-11 11:23:03 +0800 | [diff] [blame] | 23 | #include <vector> |
Jeff Brown | 5912f95 | 2013-07-01 19:10:31 -0700 | [diff] [blame] | 24 | |
Vaibhav Devmurari | dd82b8e | 2022-08-16 15:34:01 +0000 | [diff] [blame] | 25 | #include "android/hardware/input/InputDeviceCountryCode.h" |
| 26 | |
Jeff Brown | 5912f95 | 2013-07-01 19:10:31 -0700 | [diff] [blame] | 27 | namespace android { |
| 28 | |
| 29 | /* |
| 30 | * Identifies a device. |
| 31 | */ |
| 32 | struct InputDeviceIdentifier { |
| 33 | inline InputDeviceIdentifier() : |
| 34 | bus(0), vendor(0), product(0), version(0) { |
| 35 | } |
| 36 | |
| 37 | // Information provided by the kernel. |
Siarhei Vishniakou | ec8f725 | 2018-07-06 11:19:32 +0100 | [diff] [blame] | 38 | std::string name; |
| 39 | std::string location; |
| 40 | std::string uniqueId; |
Jeff Brown | 5912f95 | 2013-07-01 19:10:31 -0700 | [diff] [blame] | 41 | uint16_t bus; |
| 42 | uint16_t vendor; |
| 43 | uint16_t product; |
| 44 | uint16_t version; |
| 45 | |
| 46 | // A composite input device descriptor string that uniquely identifies the device |
| 47 | // even across reboots or reconnections. The value of this field is used by |
| 48 | // upper layers of the input system to associate settings with individual devices. |
| 49 | // It is hashed from whatever kernel provided information is available. |
| 50 | // Ideally, the way this value is computed should not change between Android releases |
| 51 | // because that would invalidate persistent settings that rely on it. |
Siarhei Vishniakou | ec8f725 | 2018-07-06 11:19:32 +0100 | [diff] [blame] | 52 | std::string descriptor; |
RoboErik | ec2a15a | 2013-12-19 11:54:29 -0800 | [diff] [blame] | 53 | |
| 54 | // A value added to uniquely identify a device in the absence of a unique id. This |
| 55 | // is intended to be a minimum way to distinguish from other active devices and may |
| 56 | // reuse values that are not associated with an input anymore. |
| 57 | uint16_t nonce; |
Siarhei Vishniakou | b45635c | 2019-02-20 19:22:09 -0600 | [diff] [blame] | 58 | |
| 59 | /** |
| 60 | * Return InputDeviceIdentifier.name that has been adjusted as follows: |
| 61 | * - all characters besides alphanumerics, dash, |
| 62 | * and underscore have been replaced with underscores. |
| 63 | * This helps in situations where a file that matches the device name is needed, |
| 64 | * while conforming to the filename limitations. |
| 65 | */ |
| 66 | std::string getCanonicalName() const; |
Jeff Brown | 5912f95 | 2013-07-01 19:10:31 -0700 | [diff] [blame] | 67 | }; |
| 68 | |
Chris Ye | f59a2f4 | 2020-10-16 12:55:26 -0700 | [diff] [blame] | 69 | /* Types of input device sensors. Keep sync with core/java/android/hardware/Sensor.java */ |
| 70 | enum class InputDeviceSensorType : int32_t { |
| 71 | ACCELEROMETER = ASENSOR_TYPE_ACCELEROMETER, |
| 72 | MAGNETIC_FIELD = ASENSOR_TYPE_MAGNETIC_FIELD, |
| 73 | ORIENTATION = 3, |
| 74 | GYROSCOPE = ASENSOR_TYPE_GYROSCOPE, |
| 75 | LIGHT = ASENSOR_TYPE_LIGHT, |
| 76 | PRESSURE = ASENSOR_TYPE_PRESSURE, |
| 77 | TEMPERATURE = 7, |
| 78 | PROXIMITY = ASENSOR_TYPE_PROXIMITY, |
| 79 | GRAVITY = ASENSOR_TYPE_GRAVITY, |
| 80 | LINEAR_ACCELERATION = ASENSOR_TYPE_LINEAR_ACCELERATION, |
| 81 | ROTATION_VECTOR = ASENSOR_TYPE_ROTATION_VECTOR, |
| 82 | RELATIVE_HUMIDITY = ASENSOR_TYPE_RELATIVE_HUMIDITY, |
| 83 | AMBIENT_TEMPERATURE = ASENSOR_TYPE_AMBIENT_TEMPERATURE, |
| 84 | MAGNETIC_FIELD_UNCALIBRATED = ASENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED, |
| 85 | GAME_ROTATION_VECTOR = ASENSOR_TYPE_GAME_ROTATION_VECTOR, |
| 86 | GYROSCOPE_UNCALIBRATED = ASENSOR_TYPE_GYROSCOPE_UNCALIBRATED, |
| 87 | SIGNIFICANT_MOTION = ASENSOR_TYPE_SIGNIFICANT_MOTION, |
Dominik Laskowski | 7578845 | 2021-02-09 18:51:25 -0800 | [diff] [blame] | 88 | |
| 89 | ftl_first = ACCELEROMETER, |
| 90 | ftl_last = SIGNIFICANT_MOTION |
Chris Ye | f59a2f4 | 2020-10-16 12:55:26 -0700 | [diff] [blame] | 91 | }; |
| 92 | |
| 93 | enum class InputDeviceSensorAccuracy : int32_t { |
| 94 | ACCURACY_NONE = 0, |
| 95 | ACCURACY_LOW = 1, |
| 96 | ACCURACY_MEDIUM = 2, |
| 97 | ACCURACY_HIGH = 3, |
| 98 | }; |
| 99 | |
| 100 | enum class InputDeviceSensorReportingMode : int32_t { |
| 101 | CONTINUOUS = 0, |
| 102 | ON_CHANGE = 1, |
| 103 | ONE_SHOT = 2, |
| 104 | SPECIAL_TRIGGER = 3, |
| 105 | }; |
| 106 | |
Chris Ye | 3fdbfef | 2021-01-06 18:45:18 -0800 | [diff] [blame] | 107 | enum class InputDeviceLightType : int32_t { |
Chris Ye | 8575833 | 2021-05-16 23:05:17 -0700 | [diff] [blame] | 108 | MONO = 0, |
Chris Ye | 3fdbfef | 2021-01-06 18:45:18 -0800 | [diff] [blame] | 109 | PLAYER_ID = 1, |
| 110 | RGB = 2, |
| 111 | MULTI_COLOR = 3, |
Dominik Laskowski | 7578845 | 2021-02-09 18:51:25 -0800 | [diff] [blame] | 112 | |
| 113 | ftl_last = MULTI_COLOR |
Chris Ye | 3fdbfef | 2021-01-06 18:45:18 -0800 | [diff] [blame] | 114 | }; |
| 115 | |
Chris Ye | f59a2f4 | 2020-10-16 12:55:26 -0700 | [diff] [blame] | 116 | struct InputDeviceSensorInfo { |
| 117 | explicit InputDeviceSensorInfo(std::string name, std::string vendor, int32_t version, |
| 118 | InputDeviceSensorType type, InputDeviceSensorAccuracy accuracy, |
| 119 | float maxRange, float resolution, float power, int32_t minDelay, |
| 120 | int32_t fifoReservedEventCount, int32_t fifoMaxEventCount, |
| 121 | std::string stringType, int32_t maxDelay, int32_t flags, |
| 122 | int32_t id) |
| 123 | : name(name), |
| 124 | vendor(vendor), |
| 125 | version(version), |
| 126 | type(type), |
| 127 | accuracy(accuracy), |
| 128 | maxRange(maxRange), |
| 129 | resolution(resolution), |
| 130 | power(power), |
| 131 | minDelay(minDelay), |
| 132 | fifoReservedEventCount(fifoReservedEventCount), |
| 133 | fifoMaxEventCount(fifoMaxEventCount), |
| 134 | stringType(stringType), |
| 135 | maxDelay(maxDelay), |
| 136 | flags(flags), |
| 137 | id(id) {} |
| 138 | // Name string of the sensor. |
| 139 | std::string name; |
| 140 | // Vendor string of this sensor. |
| 141 | std::string vendor; |
| 142 | // Version of the sensor's module. |
| 143 | int32_t version; |
| 144 | // Generic type of this sensor. |
| 145 | InputDeviceSensorType type; |
| 146 | // The current accuracy of sensor event. |
| 147 | InputDeviceSensorAccuracy accuracy; |
| 148 | // Maximum range of the sensor in the sensor's unit. |
| 149 | float maxRange; |
| 150 | // Resolution of the sensor in the sensor's unit. |
| 151 | float resolution; |
| 152 | // The power in mA used by this sensor while in use. |
| 153 | float power; |
| 154 | // The minimum delay allowed between two events in microsecond or zero if this sensor only |
| 155 | // returns a value when the data it's measuring changes. |
| 156 | int32_t minDelay; |
| 157 | // Number of events reserved for this sensor in the batch mode FIFO. |
| 158 | int32_t fifoReservedEventCount; |
| 159 | // Maximum number of events of this sensor that could be batched. |
| 160 | int32_t fifoMaxEventCount; |
| 161 | // The type of this sensor as a string. |
| 162 | std::string stringType; |
| 163 | // The delay between two sensor events corresponding to the lowest frequency that this sensor |
| 164 | // supports. |
| 165 | int32_t maxDelay; |
| 166 | // Sensor flags |
| 167 | int32_t flags; |
| 168 | // Sensor id, same as the input device ID it belongs to. |
| 169 | int32_t id; |
| 170 | }; |
| 171 | |
Chris Ye | 3fdbfef | 2021-01-06 18:45:18 -0800 | [diff] [blame] | 172 | struct InputDeviceLightInfo { |
| 173 | explicit InputDeviceLightInfo(std::string name, int32_t id, InputDeviceLightType type, |
| 174 | int32_t ordinal) |
| 175 | : name(name), id(id), type(type), ordinal(ordinal) {} |
| 176 | // Name string of the light. |
| 177 | std::string name; |
| 178 | // Light id |
| 179 | int32_t id; |
| 180 | // Type of the light. |
| 181 | InputDeviceLightType type; |
| 182 | // Ordinal of the light |
| 183 | int32_t ordinal; |
| 184 | }; |
| 185 | |
Chris Ye | e2b1e5c | 2021-03-10 22:45:12 -0800 | [diff] [blame] | 186 | struct InputDeviceBatteryInfo { |
| 187 | explicit InputDeviceBatteryInfo(std::string name, int32_t id) : name(name), id(id) {} |
| 188 | // Name string of the battery. |
| 189 | std::string name; |
| 190 | // Battery id |
| 191 | int32_t id; |
| 192 | }; |
| 193 | |
Jeff Brown | 5912f95 | 2013-07-01 19:10:31 -0700 | [diff] [blame] | 194 | /* |
| 195 | * Describes the characteristics and capabilities of an input device. |
| 196 | */ |
| 197 | class InputDeviceInfo { |
| 198 | public: |
| 199 | InputDeviceInfo(); |
| 200 | InputDeviceInfo(const InputDeviceInfo& other); |
| 201 | ~InputDeviceInfo(); |
| 202 | |
| 203 | struct MotionRange { |
| 204 | int32_t axis; |
| 205 | uint32_t source; |
| 206 | float min; |
| 207 | float max; |
| 208 | float flat; |
| 209 | float fuzz; |
| 210 | float resolution; |
| 211 | }; |
| 212 | |
Michael Wright | 0415d63 | 2013-07-17 13:23:26 -0700 | [diff] [blame] | 213 | void initialize(int32_t id, int32_t generation, int32_t controllerNumber, |
Vaibhav Devmurari | dd82b8e | 2022-08-16 15:34:01 +0000 | [diff] [blame] | 214 | const InputDeviceIdentifier& identifier, const std::string& alias, |
| 215 | bool isExternal, bool hasMic, |
| 216 | hardware::input::InputDeviceCountryCode countryCode = |
| 217 | hardware::input::InputDeviceCountryCode::INVALID); |
Jeff Brown | 5912f95 | 2013-07-01 19:10:31 -0700 | [diff] [blame] | 218 | |
| 219 | inline int32_t getId() const { return mId; } |
Michael Wright | 0415d63 | 2013-07-17 13:23:26 -0700 | [diff] [blame] | 220 | inline int32_t getControllerNumber() const { return mControllerNumber; } |
Jeff Brown | 5912f95 | 2013-07-01 19:10:31 -0700 | [diff] [blame] | 221 | inline int32_t getGeneration() const { return mGeneration; } |
| 222 | inline const InputDeviceIdentifier& getIdentifier() const { return mIdentifier; } |
Siarhei Vishniakou | ec8f725 | 2018-07-06 11:19:32 +0100 | [diff] [blame] | 223 | inline const std::string& getAlias() const { return mAlias; } |
| 224 | inline const std::string& getDisplayName() const { |
| 225 | return mAlias.empty() ? mIdentifier.name : mAlias; |
Jeff Brown | 5912f95 | 2013-07-01 19:10:31 -0700 | [diff] [blame] | 226 | } |
| 227 | inline bool isExternal() const { return mIsExternal; } |
Tim Kilbourn | 063ff53 | 2015-04-08 10:26:18 -0700 | [diff] [blame] | 228 | inline bool hasMic() const { return mHasMic; } |
Vaibhav Devmurari | dd82b8e | 2022-08-16 15:34:01 +0000 | [diff] [blame] | 229 | inline hardware::input::InputDeviceCountryCode getCountryCode() const { return mCountryCode; } |
Jeff Brown | 5912f95 | 2013-07-01 19:10:31 -0700 | [diff] [blame] | 230 | inline uint32_t getSources() const { return mSources; } |
| 231 | |
| 232 | const MotionRange* getMotionRange(int32_t axis, uint32_t source) const; |
| 233 | |
| 234 | void addSource(uint32_t source); |
| 235 | void addMotionRange(int32_t axis, uint32_t source, |
| 236 | float min, float max, float flat, float fuzz, float resolution); |
| 237 | void addMotionRange(const MotionRange& range); |
Chris Ye | f59a2f4 | 2020-10-16 12:55:26 -0700 | [diff] [blame] | 238 | void addSensorInfo(const InputDeviceSensorInfo& info); |
Chris Ye | e2b1e5c | 2021-03-10 22:45:12 -0800 | [diff] [blame] | 239 | void addBatteryInfo(const InputDeviceBatteryInfo& info); |
Chris Ye | 3fdbfef | 2021-01-06 18:45:18 -0800 | [diff] [blame] | 240 | void addLightInfo(const InputDeviceLightInfo& info); |
Jeff Brown | 5912f95 | 2013-07-01 19:10:31 -0700 | [diff] [blame] | 241 | |
Philip Junker | f843796 | 2022-01-25 21:20:19 +0100 | [diff] [blame] | 242 | void setKeyboardType(int32_t keyboardType); |
Jeff Brown | 5912f95 | 2013-07-01 19:10:31 -0700 | [diff] [blame] | 243 | inline int32_t getKeyboardType() const { return mKeyboardType; } |
| 244 | |
Chris Ye | 3a1e446 | 2020-08-12 10:13:15 -0700 | [diff] [blame] | 245 | inline void setKeyCharacterMap(const std::shared_ptr<KeyCharacterMap> value) { |
Jeff Brown | 5912f95 | 2013-07-01 19:10:31 -0700 | [diff] [blame] | 246 | mKeyCharacterMap = value; |
| 247 | } |
| 248 | |
Chris Ye | 3a1e446 | 2020-08-12 10:13:15 -0700 | [diff] [blame] | 249 | inline const std::shared_ptr<KeyCharacterMap> getKeyCharacterMap() const { |
Jeff Brown | 5912f95 | 2013-07-01 19:10:31 -0700 | [diff] [blame] | 250 | return mKeyCharacterMap; |
| 251 | } |
| 252 | |
| 253 | inline void setVibrator(bool hasVibrator) { mHasVibrator = hasVibrator; } |
| 254 | inline bool hasVibrator() const { return mHasVibrator; } |
| 255 | |
Kim Low | 03ea035 | 2020-11-06 12:45:07 -0800 | [diff] [blame] | 256 | inline void setHasBattery(bool hasBattery) { mHasBattery = hasBattery; } |
| 257 | inline bool hasBattery() const { return mHasBattery; } |
| 258 | |
Michael Wright | 931fd6d | 2013-07-10 18:05:15 -0700 | [diff] [blame] | 259 | inline void setButtonUnderPad(bool hasButton) { mHasButtonUnderPad = hasButton; } |
| 260 | inline bool hasButtonUnderPad() const { return mHasButtonUnderPad; } |
| 261 | |
Chris Ye | f59a2f4 | 2020-10-16 12:55:26 -0700 | [diff] [blame] | 262 | inline void setHasSensor(bool hasSensor) { mHasSensor = hasSensor; } |
| 263 | inline bool hasSensor() const { return mHasSensor; } |
| 264 | |
Arthur Hung | 7c3ae9c | 2019-03-11 11:23:03 +0800 | [diff] [blame] | 265 | inline const std::vector<MotionRange>& getMotionRanges() const { |
Jeff Brown | 5912f95 | 2013-07-01 19:10:31 -0700 | [diff] [blame] | 266 | return mMotionRanges; |
| 267 | } |
| 268 | |
Siarhei Vishniakou | 1983a71 | 2021-06-04 19:27:09 +0000 | [diff] [blame] | 269 | std::vector<InputDeviceSensorInfo> getSensors(); |
Chris Ye | f59a2f4 | 2020-10-16 12:55:26 -0700 | [diff] [blame] | 270 | |
Siarhei Vishniakou | 1983a71 | 2021-06-04 19:27:09 +0000 | [diff] [blame] | 271 | std::vector<InputDeviceLightInfo> getLights(); |
Chris Ye | 3fdbfef | 2021-01-06 18:45:18 -0800 | [diff] [blame] | 272 | |
Jeff Brown | 5912f95 | 2013-07-01 19:10:31 -0700 | [diff] [blame] | 273 | private: |
| 274 | int32_t mId; |
| 275 | int32_t mGeneration; |
Michael Wright | 0415d63 | 2013-07-17 13:23:26 -0700 | [diff] [blame] | 276 | int32_t mControllerNumber; |
Jeff Brown | 5912f95 | 2013-07-01 19:10:31 -0700 | [diff] [blame] | 277 | InputDeviceIdentifier mIdentifier; |
Siarhei Vishniakou | ec8f725 | 2018-07-06 11:19:32 +0100 | [diff] [blame] | 278 | std::string mAlias; |
Jeff Brown | 5912f95 | 2013-07-01 19:10:31 -0700 | [diff] [blame] | 279 | bool mIsExternal; |
Tim Kilbourn | 063ff53 | 2015-04-08 10:26:18 -0700 | [diff] [blame] | 280 | bool mHasMic; |
Vaibhav Devmurari | dd82b8e | 2022-08-16 15:34:01 +0000 | [diff] [blame] | 281 | hardware::input::InputDeviceCountryCode mCountryCode; |
Jeff Brown | 5912f95 | 2013-07-01 19:10:31 -0700 | [diff] [blame] | 282 | uint32_t mSources; |
| 283 | int32_t mKeyboardType; |
Chris Ye | 3a1e446 | 2020-08-12 10:13:15 -0700 | [diff] [blame] | 284 | std::shared_ptr<KeyCharacterMap> mKeyCharacterMap; |
Vaibhav Devmurari | dd82b8e | 2022-08-16 15:34:01 +0000 | [diff] [blame] | 285 | |
Jeff Brown | 5912f95 | 2013-07-01 19:10:31 -0700 | [diff] [blame] | 286 | bool mHasVibrator; |
Kim Low | 03ea035 | 2020-11-06 12:45:07 -0800 | [diff] [blame] | 287 | bool mHasBattery; |
Michael Wright | 931fd6d | 2013-07-10 18:05:15 -0700 | [diff] [blame] | 288 | bool mHasButtonUnderPad; |
Chris Ye | f59a2f4 | 2020-10-16 12:55:26 -0700 | [diff] [blame] | 289 | bool mHasSensor; |
Jeff Brown | 5912f95 | 2013-07-01 19:10:31 -0700 | [diff] [blame] | 290 | |
Arthur Hung | 7c3ae9c | 2019-03-11 11:23:03 +0800 | [diff] [blame] | 291 | std::vector<MotionRange> mMotionRanges; |
Chris Ye | f59a2f4 | 2020-10-16 12:55:26 -0700 | [diff] [blame] | 292 | std::unordered_map<InputDeviceSensorType, InputDeviceSensorInfo> mSensors; |
Chris Ye | 3fdbfef | 2021-01-06 18:45:18 -0800 | [diff] [blame] | 293 | /* Map from light ID to light info */ |
| 294 | std::unordered_map<int32_t, InputDeviceLightInfo> mLights; |
Chris Ye | e2b1e5c | 2021-03-10 22:45:12 -0800 | [diff] [blame] | 295 | /* Map from battery ID to battery info */ |
| 296 | std::unordered_map<int32_t, InputDeviceBatteryInfo> mBatteries; |
Jeff Brown | 5912f95 | 2013-07-01 19:10:31 -0700 | [diff] [blame] | 297 | }; |
| 298 | |
| 299 | /* Types of input device configuration files. */ |
Chris Ye | 1d927aa | 2020-07-04 18:22:41 -0700 | [diff] [blame] | 300 | enum class InputDeviceConfigurationFileType : int32_t { |
| 301 | CONFIGURATION = 0, /* .idc file */ |
| 302 | KEY_LAYOUT = 1, /* .kl file */ |
| 303 | KEY_CHARACTER_MAP = 2, /* .kcm file */ |
Jeff Brown | 5912f95 | 2013-07-01 19:10:31 -0700 | [diff] [blame] | 304 | }; |
| 305 | |
| 306 | /* |
| 307 | * Gets the path of an input device configuration file, if one is available. |
| 308 | * Considers both system provided and user installed configuration files. |
Siarhei Vishniakou | a9fd82c | 2022-05-18 09:42:52 -0700 | [diff] [blame] | 309 | * The optional suffix is appended to the end of the file name (before the |
| 310 | * extension). |
Jeff Brown | 5912f95 | 2013-07-01 19:10:31 -0700 | [diff] [blame] | 311 | * |
| 312 | * The device identifier is used to construct several default configuration file |
| 313 | * names to try based on the device name, vendor, product, and version. |
| 314 | * |
| 315 | * Returns an empty string if not found. |
| 316 | */ |
Siarhei Vishniakou | ec8f725 | 2018-07-06 11:19:32 +0100 | [diff] [blame] | 317 | extern std::string getInputDeviceConfigurationFilePathByDeviceIdentifier( |
Siarhei Vishniakou | a9fd82c | 2022-05-18 09:42:52 -0700 | [diff] [blame] | 318 | const InputDeviceIdentifier& deviceIdentifier, InputDeviceConfigurationFileType type, |
| 319 | const char* suffix = ""); |
Jeff Brown | 5912f95 | 2013-07-01 19:10:31 -0700 | [diff] [blame] | 320 | |
| 321 | /* |
| 322 | * Gets the path of an input device configuration file, if one is available. |
| 323 | * Considers both system provided and user installed configuration files. |
| 324 | * |
| 325 | * The name is case-sensitive and is used to construct the filename to resolve. |
| 326 | * All characters except 'a'-'z', 'A'-'Z', '0'-'9', '-', and '_' are replaced by underscores. |
| 327 | * |
| 328 | * Returns an empty string if not found. |
| 329 | */ |
Siarhei Vishniakou | ec8f725 | 2018-07-06 11:19:32 +0100 | [diff] [blame] | 330 | extern std::string getInputDeviceConfigurationFilePathByName( |
| 331 | const std::string& name, InputDeviceConfigurationFileType type); |
Jeff Brown | 5912f95 | 2013-07-01 19:10:31 -0700 | [diff] [blame] | 332 | |
Prabir Pradhan | cae4b3a | 2019-02-05 18:51:32 -0800 | [diff] [blame] | 333 | enum ReservedInputDeviceId : int32_t { |
| 334 | // Device id of a special "virtual" keyboard that is always present. |
| 335 | VIRTUAL_KEYBOARD_ID = -1, |
| 336 | // Device id of the "built-in" keyboard if there is one. |
| 337 | BUILT_IN_KEYBOARD_ID = 0, |
Nathaniel R. Lewis | a7b82e1 | 2020-02-12 15:40:45 -0800 | [diff] [blame] | 338 | // First device id available for dynamic devices |
| 339 | END_RESERVED_ID = 1, |
Prabir Pradhan | cae4b3a | 2019-02-05 18:51:32 -0800 | [diff] [blame] | 340 | }; |
| 341 | |
Jeff Brown | 5912f95 | 2013-07-01 19:10:31 -0700 | [diff] [blame] | 342 | } // namespace android |