blob: 2012fccf85fb66354e6b3f49b84247f5aecb16de [file] [log] [blame]
Jeff Brown46b9ac02010-04-22 18:58:52 -07001/*
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
17#ifndef _UI_INPUT_H
18#define _UI_INPUT_H
19
20/**
21 * Native input event structures.
22 */
23
24#include <android/input.h>
25#include <utils/Vector.h>
Jeff Brown6d0fec22010-07-23 21:28:06 -070026#include <utils/KeyedVector.h>
Jeff Brown46b9ac02010-04-22 18:58:52 -070027#include <utils/Timers.h>
Jeff Brown6d0fec22010-07-23 21:28:06 -070028#include <utils/RefBase.h>
29#include <utils/String8.h>
Jeff Brown46b9ac02010-04-22 18:58:52 -070030
31/*
32 * Additional private constants not defined in ndk/ui/input.h.
33 */
34enum {
35 /*
36 * Private control to determine when an app is tracking a key sequence.
37 */
Jeff Brownc5ed5912010-07-14 18:48:53 -070038 AKEY_EVENT_FLAG_START_TRACKING = 0x40000000
Jeff Brown46b9ac02010-04-22 18:58:52 -070039};
40
Jeff Brown89de57a2011-01-19 18:41:38 -080041enum {
42 /*
43 * Indicates that an input device has switches.
44 * This input source flag is hidden from the API because switches are only used by the system
45 * and applications have no way to interact with them.
46 */
47 AINPUT_SOURCE_SWITCH = 0x80000000,
48};
49
Jeff Brown46b9ac02010-04-22 18:58:52 -070050/*
51 * Maximum number of pointers supported per motion event.
Jeff Brown01ce2e92010-09-26 22:20:12 -070052 * Smallest number of pointers is 1.
Jeff Brown58a2da82011-01-25 16:02:22 -080053 * (We want at least 10 but some touch controllers obstensibly configured for 10 pointers
54 * will occasionally emit 11. There is not much harm making this constant bigger.)
Jeff Brown46b9ac02010-04-22 18:58:52 -070055 */
Jeff Brown58a2da82011-01-25 16:02:22 -080056#define MAX_POINTERS 16
Jeff Brown46b9ac02010-04-22 18:58:52 -070057
Dianne Hackborna95e4cb2010-06-18 18:09:33 -070058/*
Jeff Brown01ce2e92010-09-26 22:20:12 -070059 * Maximum pointer id value supported in a motion event.
60 * Smallest pointer id is 0.
61 * (This is limited by our use of BitSet32 to track pointer assignments.)
62 */
63#define MAX_POINTER_ID 31
64
65/*
Dianne Hackborna95e4cb2010-06-18 18:09:33 -070066 * Declare a concrete type for the NDK's input event forward declaration.
67 */
Dianne Hackbornd76b67c2010-07-13 17:48:30 -070068struct AInputEvent {
69 virtual ~AInputEvent() { }
70};
Dianne Hackborna95e4cb2010-06-18 18:09:33 -070071
Jeff Brown46b9ac02010-04-22 18:58:52 -070072/*
Jeff Brown6d0fec22010-07-23 21:28:06 -070073 * Declare a concrete type for the NDK's input device forward declaration.
Jeff Brown46b9ac02010-04-22 18:58:52 -070074 */
Jeff Brown6d0fec22010-07-23 21:28:06 -070075struct AInputDevice {
76 virtual ~AInputDevice() { }
Jeff Brown46b9ac02010-04-22 18:58:52 -070077};
78
Jeff Brown6d0fec22010-07-23 21:28:06 -070079
80namespace android {
81
Jeff Brown46b9ac02010-04-22 18:58:52 -070082/*
83 * Flags that flow alongside events in the input dispatch system to help with certain
84 * policy decisions such as waking from device sleep.
Jeff Brownb6997262010-10-08 22:31:17 -070085 *
86 * These flags are also defined in frameworks/base/core/java/android/view/WindowManagerPolicy.java.
Jeff Brown46b9ac02010-04-22 18:58:52 -070087 */
88enum {
Jeff Brown0eaf3932010-10-01 14:55:30 -070089 /* These flags originate in RawEvents and are generally set in the key map.
Jeff Brown497a92c2010-09-12 17:55:08 -070090 * NOTE: If you edit these flags, also edit labels in KeycodeLabels.h. */
Jeff Brown46b9ac02010-04-22 18:58:52 -070091
92 POLICY_FLAG_WAKE = 0x00000001,
93 POLICY_FLAG_WAKE_DROPPED = 0x00000002,
94 POLICY_FLAG_SHIFT = 0x00000004,
95 POLICY_FLAG_CAPS_LOCK = 0x00000008,
96 POLICY_FLAG_ALT = 0x00000010,
97 POLICY_FLAG_ALT_GR = 0x00000020,
98 POLICY_FLAG_MENU = 0x00000040,
99 POLICY_FLAG_LAUNCHER = 0x00000080,
Jeff Brown0eaf3932010-10-01 14:55:30 -0700100 POLICY_FLAG_VIRTUAL = 0x00000100,
Jeff Brown497a92c2010-09-12 17:55:08 -0700101 POLICY_FLAG_FUNCTION = 0x00000200,
Jeff Brown46b9ac02010-04-22 18:58:52 -0700102
Jeff Brown7fbdc842010-06-17 20:52:56 -0700103 POLICY_FLAG_RAW_MASK = 0x0000ffff,
104
Jeff Brown85a31762010-09-01 17:01:00 -0700105 /* These flags are set by the input dispatcher. */
106
107 // Indicates that the input event was injected.
108 POLICY_FLAG_INJECTED = 0x01000000,
109
Jeff Browne20c9e02010-10-11 14:20:19 -0700110 // Indicates that the input event is from a trusted source such as a directly attached
111 // input device or an application with system-wide event injection permission.
112 POLICY_FLAG_TRUSTED = 0x02000000,
113
Jeff Brown9c3cda02010-06-15 01:31:58 -0700114 /* These flags are set by the input reader policy as it intercepts each event. */
Jeff Brown46b9ac02010-04-22 18:58:52 -0700115
116 // Indicates that the screen was off when the event was received and the event
117 // should wake the device.
118 POLICY_FLAG_WOKE_HERE = 0x10000000,
119
120 // Indicates that the screen was dim when the event was received and the event
121 // should brighten the device.
122 POLICY_FLAG_BRIGHT_HERE = 0x20000000,
Jeff Brownb6997262010-10-08 22:31:17 -0700123
124 // Indicates that the event should be dispatched to applications.
125 // The input event should still be sent to the InputDispatcher so that it can see all
126 // input events received include those that it will not deliver.
127 POLICY_FLAG_PASS_TO_USER = 0x40000000,
Jeff Brown46b9ac02010-04-22 18:58:52 -0700128};
129
130/*
Jeff Brown9c3cda02010-06-15 01:31:58 -0700131 * Describes the basic configuration of input devices that are present.
132 */
133struct InputConfiguration {
134 enum {
135 TOUCHSCREEN_UNDEFINED = 0,
136 TOUCHSCREEN_NOTOUCH = 1,
137 TOUCHSCREEN_STYLUS = 2,
138 TOUCHSCREEN_FINGER = 3
139 };
140
141 enum {
142 KEYBOARD_UNDEFINED = 0,
143 KEYBOARD_NOKEYS = 1,
144 KEYBOARD_QWERTY = 2,
145 KEYBOARD_12KEY = 3
146 };
147
148 enum {
149 NAVIGATION_UNDEFINED = 0,
150 NAVIGATION_NONAV = 1,
151 NAVIGATION_DPAD = 2,
152 NAVIGATION_TRACKBALL = 3,
153 NAVIGATION_WHEEL = 4
154 };
155
156 int32_t touchScreen;
157 int32_t keyboard;
158 int32_t navigation;
159};
160
161/*
Jeff Brown46b9ac02010-04-22 18:58:52 -0700162 * Pointer coordinate data.
163 */
164struct PointerCoords {
165 float x;
166 float y;
167 float pressure;
168 float size;
Jeff Brownc5ed5912010-07-14 18:48:53 -0700169 float touchMajor;
170 float touchMinor;
171 float toolMajor;
172 float toolMinor;
173 float orientation;
Jeff Brown46b9ac02010-04-22 18:58:52 -0700174};
175
176/*
177 * Input events.
178 */
Dianne Hackborn2e9f93e2010-06-28 15:27:30 -0700179class InputEvent : public AInputEvent {
Jeff Brown46b9ac02010-04-22 18:58:52 -0700180public:
181 virtual ~InputEvent() { }
182
183 virtual int32_t getType() const = 0;
184
185 inline int32_t getDeviceId() const { return mDeviceId; }
186
Jeff Brownc5ed5912010-07-14 18:48:53 -0700187 inline int32_t getSource() const { return mSource; }
Dianne Hackborn3c80a4a2010-06-29 19:20:40 -0700188
Jeff Brown46b9ac02010-04-22 18:58:52 -0700189protected:
Jeff Brownc5ed5912010-07-14 18:48:53 -0700190 void initialize(int32_t deviceId, int32_t source);
Dianne Hackborn2c6081c2010-07-15 17:44:53 -0700191 void initialize(const InputEvent& from);
Jeff Brown46b9ac02010-04-22 18:58:52 -0700192
193private:
194 int32_t mDeviceId;
Jeff Brownc5ed5912010-07-14 18:48:53 -0700195 int32_t mSource;
Jeff Brown46b9ac02010-04-22 18:58:52 -0700196};
197
Jeff Brown5c225b12010-06-16 01:53:36 -0700198/*
199 * Key events.
200 */
Jeff Brown46b9ac02010-04-22 18:58:52 -0700201class KeyEvent : public InputEvent {
202public:
203 virtual ~KeyEvent() { }
204
Jeff Brownc5ed5912010-07-14 18:48:53 -0700205 virtual int32_t getType() const { return AINPUT_EVENT_TYPE_KEY; }
Jeff Brown46b9ac02010-04-22 18:58:52 -0700206
207 inline int32_t getAction() const { return mAction; }
208
209 inline int32_t getFlags() const { return mFlags; }
210
211 inline int32_t getKeyCode() const { return mKeyCode; }
212
213 inline int32_t getScanCode() const { return mScanCode; }
214
215 inline int32_t getMetaState() const { return mMetaState; }
216
217 inline int32_t getRepeatCount() const { return mRepeatCount; }
218
219 inline nsecs_t getDownTime() const { return mDownTime; }
220
221 inline nsecs_t getEventTime() const { return mEventTime; }
222
Dianne Hackborn3c80a4a2010-06-29 19:20:40 -0700223 // Return true if this event may have a default action implementation.
224 static bool hasDefaultAction(int32_t keyCode);
225 bool hasDefaultAction() const;
226
227 // Return true if this event represents a system key.
228 static bool isSystemKey(int32_t keyCode);
229 bool isSystemKey() const;
230
Jeff Brown46b9ac02010-04-22 18:58:52 -0700231 void initialize(
232 int32_t deviceId,
Jeff Brownc5ed5912010-07-14 18:48:53 -0700233 int32_t source,
Jeff Brown46b9ac02010-04-22 18:58:52 -0700234 int32_t action,
235 int32_t flags,
236 int32_t keyCode,
237 int32_t scanCode,
238 int32_t metaState,
239 int32_t repeatCount,
240 nsecs_t downTime,
241 nsecs_t eventTime);
Dianne Hackborn2c6081c2010-07-15 17:44:53 -0700242 void initialize(const KeyEvent& from);
Jeff Brown46b9ac02010-04-22 18:58:52 -0700243
244private:
245 int32_t mAction;
246 int32_t mFlags;
247 int32_t mKeyCode;
248 int32_t mScanCode;
249 int32_t mMetaState;
250 int32_t mRepeatCount;
251 nsecs_t mDownTime;
252 nsecs_t mEventTime;
253};
254
Jeff Brown5c225b12010-06-16 01:53:36 -0700255/*
256 * Motion events.
257 */
Jeff Brown46b9ac02010-04-22 18:58:52 -0700258class MotionEvent : public InputEvent {
259public:
260 virtual ~MotionEvent() { }
261
Jeff Brownc5ed5912010-07-14 18:48:53 -0700262 virtual int32_t getType() const { return AINPUT_EVENT_TYPE_MOTION; }
Jeff Brown46b9ac02010-04-22 18:58:52 -0700263
264 inline int32_t getAction() const { return mAction; }
265
Jeff Brown85a31762010-09-01 17:01:00 -0700266 inline int32_t getFlags() const { return mFlags; }
267
Jeff Brown46b9ac02010-04-22 18:58:52 -0700268 inline int32_t getEdgeFlags() const { return mEdgeFlags; }
269
270 inline int32_t getMetaState() const { return mMetaState; }
271
Jeff Brown5c225b12010-06-16 01:53:36 -0700272 inline float getXOffset() const { return mXOffset; }
273
274 inline float getYOffset() const { return mYOffset; }
275
Jeff Brown46b9ac02010-04-22 18:58:52 -0700276 inline float getXPrecision() const { return mXPrecision; }
277
278 inline float getYPrecision() const { return mYPrecision; }
279
280 inline nsecs_t getDownTime() const { return mDownTime; }
281
282 inline size_t getPointerCount() const { return mPointerIds.size(); }
283
284 inline int32_t getPointerId(size_t pointerIndex) const { return mPointerIds[pointerIndex]; }
285
286 inline nsecs_t getEventTime() const { return mSampleEventTimes[getHistorySize()]; }
287
Jeff Brown5c225b12010-06-16 01:53:36 -0700288 inline float getRawX(size_t pointerIndex) const {
Jeff Brown46b9ac02010-04-22 18:58:52 -0700289 return getCurrentPointerCoords(pointerIndex).x;
290 }
291
Jeff Brown5c225b12010-06-16 01:53:36 -0700292 inline float getRawY(size_t pointerIndex) const {
Jeff Brown46b9ac02010-04-22 18:58:52 -0700293 return getCurrentPointerCoords(pointerIndex).y;
294 }
295
Jeff Brown5c225b12010-06-16 01:53:36 -0700296 inline float getX(size_t pointerIndex) const {
297 return getRawX(pointerIndex) + mXOffset;
298 }
299
300 inline float getY(size_t pointerIndex) const {
301 return getRawY(pointerIndex) + mYOffset;
302 }
303
Jeff Brown46b9ac02010-04-22 18:58:52 -0700304 inline float getPressure(size_t pointerIndex) const {
305 return getCurrentPointerCoords(pointerIndex).pressure;
306 }
307
308 inline float getSize(size_t pointerIndex) const {
309 return getCurrentPointerCoords(pointerIndex).size;
310 }
311
Jeff Brownc5ed5912010-07-14 18:48:53 -0700312 inline float getTouchMajor(size_t pointerIndex) const {
313 return getCurrentPointerCoords(pointerIndex).touchMajor;
314 }
315
316 inline float getTouchMinor(size_t pointerIndex) const {
317 return getCurrentPointerCoords(pointerIndex).touchMinor;
318 }
319
320 inline float getToolMajor(size_t pointerIndex) const {
321 return getCurrentPointerCoords(pointerIndex).toolMajor;
322 }
323
324 inline float getToolMinor(size_t pointerIndex) const {
325 return getCurrentPointerCoords(pointerIndex).toolMinor;
326 }
327
328 inline float getOrientation(size_t pointerIndex) const {
329 return getCurrentPointerCoords(pointerIndex).orientation;
330 }
331
Jeff Brown46b9ac02010-04-22 18:58:52 -0700332 inline size_t getHistorySize() const { return mSampleEventTimes.size() - 1; }
333
334 inline nsecs_t getHistoricalEventTime(size_t historicalIndex) const {
335 return mSampleEventTimes[historicalIndex];
336 }
337
Jeff Brown5c225b12010-06-16 01:53:36 -0700338 inline float getHistoricalRawX(size_t pointerIndex, size_t historicalIndex) const {
Jeff Brown46b9ac02010-04-22 18:58:52 -0700339 return getHistoricalPointerCoords(pointerIndex, historicalIndex).x;
340 }
341
Jeff Brown5c225b12010-06-16 01:53:36 -0700342 inline float getHistoricalRawY(size_t pointerIndex, size_t historicalIndex) const {
Jeff Brown46b9ac02010-04-22 18:58:52 -0700343 return getHistoricalPointerCoords(pointerIndex, historicalIndex).y;
344 }
345
Jeff Brown5c225b12010-06-16 01:53:36 -0700346 inline float getHistoricalX(size_t pointerIndex, size_t historicalIndex) const {
347 return getHistoricalRawX(pointerIndex, historicalIndex) + mXOffset;
348 }
349
350 inline float getHistoricalY(size_t pointerIndex, size_t historicalIndex) const {
351 return getHistoricalRawY(pointerIndex, historicalIndex) + mYOffset;
352 }
353
Jeff Brown46b9ac02010-04-22 18:58:52 -0700354 inline float getHistoricalPressure(size_t pointerIndex, size_t historicalIndex) const {
355 return getHistoricalPointerCoords(pointerIndex, historicalIndex).pressure;
356 }
357
358 inline float getHistoricalSize(size_t pointerIndex, size_t historicalIndex) const {
359 return getHistoricalPointerCoords(pointerIndex, historicalIndex).size;
360 }
361
Jeff Brownc5ed5912010-07-14 18:48:53 -0700362 inline float getHistoricalTouchMajor(size_t pointerIndex, size_t historicalIndex) const {
363 return getHistoricalPointerCoords(pointerIndex, historicalIndex).touchMajor;
364 }
365
366 inline float getHistoricalTouchMinor(size_t pointerIndex, size_t historicalIndex) const {
367 return getHistoricalPointerCoords(pointerIndex, historicalIndex).touchMinor;
368 }
369
370 inline float getHistoricalToolMajor(size_t pointerIndex, size_t historicalIndex) const {
371 return getHistoricalPointerCoords(pointerIndex, historicalIndex).toolMajor;
372 }
373
374 inline float getHistoricalToolMinor(size_t pointerIndex, size_t historicalIndex) const {
375 return getHistoricalPointerCoords(pointerIndex, historicalIndex).toolMinor;
376 }
377
378 inline float getHistoricalOrientation(size_t pointerIndex, size_t historicalIndex) const {
379 return getHistoricalPointerCoords(pointerIndex, historicalIndex).orientation;
380 }
381
Jeff Brown46b9ac02010-04-22 18:58:52 -0700382 void initialize(
383 int32_t deviceId,
Jeff Brownc5ed5912010-07-14 18:48:53 -0700384 int32_t source,
Jeff Brown46b9ac02010-04-22 18:58:52 -0700385 int32_t action,
Jeff Brown85a31762010-09-01 17:01:00 -0700386 int32_t flags,
Jeff Brown46b9ac02010-04-22 18:58:52 -0700387 int32_t edgeFlags,
388 int32_t metaState,
Jeff Brown5c225b12010-06-16 01:53:36 -0700389 float xOffset,
390 float yOffset,
Jeff Brown46b9ac02010-04-22 18:58:52 -0700391 float xPrecision,
392 float yPrecision,
393 nsecs_t downTime,
394 nsecs_t eventTime,
395 size_t pointerCount,
396 const int32_t* pointerIds,
397 const PointerCoords* pointerCoords);
398
399 void addSample(
400 nsecs_t eventTime,
401 const PointerCoords* pointerCoords);
402
403 void offsetLocation(float xOffset, float yOffset);
404
Jeff Brown5c225b12010-06-16 01:53:36 -0700405 // Low-level accessors.
406 inline const int32_t* getPointerIds() const { return mPointerIds.array(); }
407 inline const nsecs_t* getSampleEventTimes() const { return mSampleEventTimes.array(); }
408 inline const PointerCoords* getSamplePointerCoords() const {
409 return mSamplePointerCoords.array();
410 }
411
Jeff Brown46b9ac02010-04-22 18:58:52 -0700412private:
413 int32_t mAction;
Jeff Brown85a31762010-09-01 17:01:00 -0700414 int32_t mFlags;
Jeff Brown46b9ac02010-04-22 18:58:52 -0700415 int32_t mEdgeFlags;
416 int32_t mMetaState;
Jeff Brown5c225b12010-06-16 01:53:36 -0700417 float mXOffset;
418 float mYOffset;
Jeff Brown46b9ac02010-04-22 18:58:52 -0700419 float mXPrecision;
420 float mYPrecision;
421 nsecs_t mDownTime;
422 Vector<int32_t> mPointerIds;
423 Vector<nsecs_t> mSampleEventTimes;
424 Vector<PointerCoords> mSamplePointerCoords;
425
426 inline const PointerCoords& getCurrentPointerCoords(size_t pointerIndex) const {
427 return mSamplePointerCoords[getHistorySize() * getPointerCount() + pointerIndex];
428 }
429
430 inline const PointerCoords& getHistoricalPointerCoords(
431 size_t pointerIndex, size_t historicalIndex) const {
432 return mSamplePointerCoords[historicalIndex * getPointerCount() + pointerIndex];
433 }
434};
435
436/*
437 * Input event factory.
438 */
439class InputEventFactoryInterface {
440protected:
441 virtual ~InputEventFactoryInterface() { }
442
443public:
444 InputEventFactoryInterface() { }
445
446 virtual KeyEvent* createKeyEvent() = 0;
447 virtual MotionEvent* createMotionEvent() = 0;
448};
449
450/*
451 * A simple input event factory implementation that uses a single preallocated instance
452 * of each type of input event that are reused for each request.
453 */
454class PreallocatedInputEventFactory : public InputEventFactoryInterface {
455public:
456 PreallocatedInputEventFactory() { }
457 virtual ~PreallocatedInputEventFactory() { }
458
459 virtual KeyEvent* createKeyEvent() { return & mKeyEvent; }
460 virtual MotionEvent* createMotionEvent() { return & mMotionEvent; }
461
462private:
463 KeyEvent mKeyEvent;
464 MotionEvent mMotionEvent;
465};
466
Jeff Brown6d0fec22010-07-23 21:28:06 -0700467/*
468 * Describes the characteristics and capabilities of an input device.
469 */
470class InputDeviceInfo {
471public:
472 InputDeviceInfo();
473 InputDeviceInfo(const InputDeviceInfo& other);
474 ~InputDeviceInfo();
475
476 struct MotionRange {
477 float min;
478 float max;
479 float flat;
480 float fuzz;
481 };
482
483 void initialize(int32_t id, const String8& name);
484
485 inline int32_t getId() const { return mId; }
486 inline const String8 getName() const { return mName; }
487 inline uint32_t getSources() const { return mSources; }
488
489 const MotionRange* getMotionRange(int32_t rangeType) const;
490
491 void addSource(uint32_t source);
492 void addMotionRange(int32_t rangeType, float min, float max, float flat, float fuzz);
493 void addMotionRange(int32_t rangeType, const MotionRange& range);
494
495 inline void setKeyboardType(int32_t keyboardType) { mKeyboardType = keyboardType; }
496 inline int32_t getKeyboardType() const { return mKeyboardType; }
497
Jeff Brown8d608662010-08-30 03:02:23 -0700498 inline const KeyedVector<int32_t, MotionRange> getMotionRanges() const {
499 return mMotionRanges;
500 }
501
Jeff Brown6d0fec22010-07-23 21:28:06 -0700502private:
503 int32_t mId;
504 String8 mName;
505 uint32_t mSources;
506 int32_t mKeyboardType;
507
508 KeyedVector<int32_t, MotionRange> mMotionRanges;
509};
510
Jeff Brown90655042010-12-02 13:50:46 -0800511/*
512 * Identifies a device.
513 */
514struct InputDeviceIdentifier {
515 inline InputDeviceIdentifier() :
516 bus(0), vendor(0), product(0), version(0) {
517 }
518
519 String8 name;
520 String8 location;
521 String8 uniqueId;
522 uint16_t bus;
523 uint16_t vendor;
524 uint16_t product;
525 uint16_t version;
526};
527
Jeff Brown47e6b1b2010-11-29 17:37:49 -0800528/* Types of input device configuration files. */
529enum InputDeviceConfigurationFileType {
530 INPUT_DEVICE_CONFIGURATION_FILE_TYPE_CONFIGURATION = 0, /* .idc file */
531 INPUT_DEVICE_CONFIGURATION_FILE_TYPE_KEY_LAYOUT = 1, /* .kl file */
532 INPUT_DEVICE_CONFIGURATION_FILE_TYPE_KEY_CHARACTER_MAP = 2, /* .kcm file */
533};
534
535/*
Jeff Brown90655042010-12-02 13:50:46 -0800536 * Gets the path of an input device configuration file, if one is available.
Jeff Brown1f245102010-11-18 20:53:46 -0800537 * Considers both system provided and user installed configuration files.
Jeff Brown47e6b1b2010-11-29 17:37:49 -0800538 *
Jeff Brown90655042010-12-02 13:50:46 -0800539 * The device identifier is used to construct several default configuration file
540 * names to try based on the device name, vendor, product, and version.
541 *
Jeff Brown47e6b1b2010-11-29 17:37:49 -0800542 * Returns an empty string if not found.
543 */
Jeff Brown90655042010-12-02 13:50:46 -0800544extern String8 getInputDeviceConfigurationFilePathByDeviceIdentifier(
545 const InputDeviceIdentifier& deviceIdentifier,
546 InputDeviceConfigurationFileType type);
547
548/*
549 * Gets the path of an input device configuration file, if one is available.
550 * Considers both system provided and user installed configuration files.
551 *
552 * The name is case-sensitive and is used to construct the filename to resolve.
553 * All characters except 'a'-'z', 'A'-'Z', '0'-'9', '-', and '_' are replaced by underscores.
554 *
555 * Returns an empty string if not found.
556 */
557extern String8 getInputDeviceConfigurationFilePathByName(
Jeff Brown47e6b1b2010-11-29 17:37:49 -0800558 const String8& name, InputDeviceConfigurationFileType type);
Jeff Brown46b9ac02010-04-22 18:58:52 -0700559
560} // namespace android
561
562#endif // _UI_INPUT_H