blob: 30b45f766bc56c3e0b827ba2515b64d99d06a453 [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 Brown46b9ac02010-04-22 18:58:52 -070053 */
54#define MAX_POINTERS 10
55
Dianne Hackborna95e4cb2010-06-18 18:09:33 -070056/*
Jeff Brown01ce2e92010-09-26 22:20:12 -070057 * Maximum pointer id value supported in a motion event.
58 * Smallest pointer id is 0.
59 * (This is limited by our use of BitSet32 to track pointer assignments.)
60 */
61#define MAX_POINTER_ID 31
62
63/*
Dianne Hackborna95e4cb2010-06-18 18:09:33 -070064 * Declare a concrete type for the NDK's input event forward declaration.
65 */
Dianne Hackbornd76b67c2010-07-13 17:48:30 -070066struct AInputEvent {
67 virtual ~AInputEvent() { }
68};
Dianne Hackborna95e4cb2010-06-18 18:09:33 -070069
Jeff Brown46b9ac02010-04-22 18:58:52 -070070/*
Jeff Brown6d0fec22010-07-23 21:28:06 -070071 * Declare a concrete type for the NDK's input device forward declaration.
Jeff Brown46b9ac02010-04-22 18:58:52 -070072 */
Jeff Brown6d0fec22010-07-23 21:28:06 -070073struct AInputDevice {
74 virtual ~AInputDevice() { }
Jeff Brown46b9ac02010-04-22 18:58:52 -070075};
76
Jeff Brown6d0fec22010-07-23 21:28:06 -070077
78namespace android {
79
Jeff Brown46b9ac02010-04-22 18:58:52 -070080/*
81 * Flags that flow alongside events in the input dispatch system to help with certain
82 * policy decisions such as waking from device sleep.
Jeff Brownb6997262010-10-08 22:31:17 -070083 *
84 * These flags are also defined in frameworks/base/core/java/android/view/WindowManagerPolicy.java.
Jeff Brown46b9ac02010-04-22 18:58:52 -070085 */
86enum {
Jeff Brown0eaf3932010-10-01 14:55:30 -070087 /* These flags originate in RawEvents and are generally set in the key map.
Jeff Brown497a92c2010-09-12 17:55:08 -070088 * NOTE: If you edit these flags, also edit labels in KeycodeLabels.h. */
Jeff Brown46b9ac02010-04-22 18:58:52 -070089
90 POLICY_FLAG_WAKE = 0x00000001,
91 POLICY_FLAG_WAKE_DROPPED = 0x00000002,
92 POLICY_FLAG_SHIFT = 0x00000004,
93 POLICY_FLAG_CAPS_LOCK = 0x00000008,
94 POLICY_FLAG_ALT = 0x00000010,
95 POLICY_FLAG_ALT_GR = 0x00000020,
96 POLICY_FLAG_MENU = 0x00000040,
97 POLICY_FLAG_LAUNCHER = 0x00000080,
Jeff Brown0eaf3932010-10-01 14:55:30 -070098 POLICY_FLAG_VIRTUAL = 0x00000100,
Jeff Brown497a92c2010-09-12 17:55:08 -070099 POLICY_FLAG_FUNCTION = 0x00000200,
Jeff Brown46b9ac02010-04-22 18:58:52 -0700100
Jeff Brown7fbdc842010-06-17 20:52:56 -0700101 POLICY_FLAG_RAW_MASK = 0x0000ffff,
102
Jeff Brown85a31762010-09-01 17:01:00 -0700103 /* These flags are set by the input dispatcher. */
104
105 // Indicates that the input event was injected.
106 POLICY_FLAG_INJECTED = 0x01000000,
107
Jeff Browne20c9e02010-10-11 14:20:19 -0700108 // Indicates that the input event is from a trusted source such as a directly attached
109 // input device or an application with system-wide event injection permission.
110 POLICY_FLAG_TRUSTED = 0x02000000,
111
Jeff Brown9c3cda02010-06-15 01:31:58 -0700112 /* These flags are set by the input reader policy as it intercepts each event. */
Jeff Brown46b9ac02010-04-22 18:58:52 -0700113
114 // Indicates that the screen was off when the event was received and the event
115 // should wake the device.
116 POLICY_FLAG_WOKE_HERE = 0x10000000,
117
118 // Indicates that the screen was dim when the event was received and the event
119 // should brighten the device.
120 POLICY_FLAG_BRIGHT_HERE = 0x20000000,
Jeff Brownb6997262010-10-08 22:31:17 -0700121
122 // Indicates that the event should be dispatched to applications.
123 // The input event should still be sent to the InputDispatcher so that it can see all
124 // input events received include those that it will not deliver.
125 POLICY_FLAG_PASS_TO_USER = 0x40000000,
Jeff Brown46b9ac02010-04-22 18:58:52 -0700126};
127
128/*
Jeff Brown9c3cda02010-06-15 01:31:58 -0700129 * Describes the basic configuration of input devices that are present.
130 */
131struct InputConfiguration {
132 enum {
133 TOUCHSCREEN_UNDEFINED = 0,
134 TOUCHSCREEN_NOTOUCH = 1,
135 TOUCHSCREEN_STYLUS = 2,
136 TOUCHSCREEN_FINGER = 3
137 };
138
139 enum {
140 KEYBOARD_UNDEFINED = 0,
141 KEYBOARD_NOKEYS = 1,
142 KEYBOARD_QWERTY = 2,
143 KEYBOARD_12KEY = 3
144 };
145
146 enum {
147 NAVIGATION_UNDEFINED = 0,
148 NAVIGATION_NONAV = 1,
149 NAVIGATION_DPAD = 2,
150 NAVIGATION_TRACKBALL = 3,
151 NAVIGATION_WHEEL = 4
152 };
153
154 int32_t touchScreen;
155 int32_t keyboard;
156 int32_t navigation;
157};
158
159/*
Jeff Brown46b9ac02010-04-22 18:58:52 -0700160 * Pointer coordinate data.
161 */
162struct PointerCoords {
163 float x;
164 float y;
165 float pressure;
166 float size;
Jeff Brownc5ed5912010-07-14 18:48:53 -0700167 float touchMajor;
168 float touchMinor;
169 float toolMajor;
170 float toolMinor;
171 float orientation;
Jeff Brown46b9ac02010-04-22 18:58:52 -0700172};
173
174/*
175 * Input events.
176 */
Dianne Hackborn2e9f93e2010-06-28 15:27:30 -0700177class InputEvent : public AInputEvent {
Jeff Brown46b9ac02010-04-22 18:58:52 -0700178public:
179 virtual ~InputEvent() { }
180
181 virtual int32_t getType() const = 0;
182
183 inline int32_t getDeviceId() const { return mDeviceId; }
184
Jeff Brownc5ed5912010-07-14 18:48:53 -0700185 inline int32_t getSource() const { return mSource; }
Dianne Hackborn3c80a4a2010-06-29 19:20:40 -0700186
Jeff Brown46b9ac02010-04-22 18:58:52 -0700187protected:
Jeff Brownc5ed5912010-07-14 18:48:53 -0700188 void initialize(int32_t deviceId, int32_t source);
Dianne Hackborn2c6081c2010-07-15 17:44:53 -0700189 void initialize(const InputEvent& from);
Jeff Brown46b9ac02010-04-22 18:58:52 -0700190
191private:
192 int32_t mDeviceId;
Jeff Brownc5ed5912010-07-14 18:48:53 -0700193 int32_t mSource;
Jeff Brown46b9ac02010-04-22 18:58:52 -0700194};
195
Jeff Brown5c225b12010-06-16 01:53:36 -0700196/*
197 * Key events.
198 */
Jeff Brown46b9ac02010-04-22 18:58:52 -0700199class KeyEvent : public InputEvent {
200public:
201 virtual ~KeyEvent() { }
202
Jeff Brownc5ed5912010-07-14 18:48:53 -0700203 virtual int32_t getType() const { return AINPUT_EVENT_TYPE_KEY; }
Jeff Brown46b9ac02010-04-22 18:58:52 -0700204
205 inline int32_t getAction() const { return mAction; }
206
207 inline int32_t getFlags() const { return mFlags; }
208
209 inline int32_t getKeyCode() const { return mKeyCode; }
210
211 inline int32_t getScanCode() const { return mScanCode; }
212
213 inline int32_t getMetaState() const { return mMetaState; }
214
215 inline int32_t getRepeatCount() const { return mRepeatCount; }
216
217 inline nsecs_t getDownTime() const { return mDownTime; }
218
219 inline nsecs_t getEventTime() const { return mEventTime; }
220
Dianne Hackborn3c80a4a2010-06-29 19:20:40 -0700221 // Return true if this event may have a default action implementation.
222 static bool hasDefaultAction(int32_t keyCode);
223 bool hasDefaultAction() const;
224
225 // Return true if this event represents a system key.
226 static bool isSystemKey(int32_t keyCode);
227 bool isSystemKey() const;
228
Jeff Brown46b9ac02010-04-22 18:58:52 -0700229 void initialize(
230 int32_t deviceId,
Jeff Brownc5ed5912010-07-14 18:48:53 -0700231 int32_t source,
Jeff Brown46b9ac02010-04-22 18:58:52 -0700232 int32_t action,
233 int32_t flags,
234 int32_t keyCode,
235 int32_t scanCode,
236 int32_t metaState,
237 int32_t repeatCount,
238 nsecs_t downTime,
239 nsecs_t eventTime);
Dianne Hackborn2c6081c2010-07-15 17:44:53 -0700240 void initialize(const KeyEvent& from);
Jeff Brown46b9ac02010-04-22 18:58:52 -0700241
242private:
243 int32_t mAction;
244 int32_t mFlags;
245 int32_t mKeyCode;
246 int32_t mScanCode;
247 int32_t mMetaState;
248 int32_t mRepeatCount;
249 nsecs_t mDownTime;
250 nsecs_t mEventTime;
251};
252
Jeff Brown5c225b12010-06-16 01:53:36 -0700253/*
254 * Motion events.
255 */
Jeff Brown46b9ac02010-04-22 18:58:52 -0700256class MotionEvent : public InputEvent {
257public:
258 virtual ~MotionEvent() { }
259
Jeff Brownc5ed5912010-07-14 18:48:53 -0700260 virtual int32_t getType() const { return AINPUT_EVENT_TYPE_MOTION; }
Jeff Brown46b9ac02010-04-22 18:58:52 -0700261
262 inline int32_t getAction() const { return mAction; }
263
Jeff Brown85a31762010-09-01 17:01:00 -0700264 inline int32_t getFlags() const { return mFlags; }
265
Jeff Brown46b9ac02010-04-22 18:58:52 -0700266 inline int32_t getEdgeFlags() const { return mEdgeFlags; }
267
268 inline int32_t getMetaState() const { return mMetaState; }
269
Jeff Brown5c225b12010-06-16 01:53:36 -0700270 inline float getXOffset() const { return mXOffset; }
271
272 inline float getYOffset() const { return mYOffset; }
273
Jeff Brown46b9ac02010-04-22 18:58:52 -0700274 inline float getXPrecision() const { return mXPrecision; }
275
276 inline float getYPrecision() const { return mYPrecision; }
277
278 inline nsecs_t getDownTime() const { return mDownTime; }
279
280 inline size_t getPointerCount() const { return mPointerIds.size(); }
281
282 inline int32_t getPointerId(size_t pointerIndex) const { return mPointerIds[pointerIndex]; }
283
284 inline nsecs_t getEventTime() const { return mSampleEventTimes[getHistorySize()]; }
285
Jeff Brown5c225b12010-06-16 01:53:36 -0700286 inline float getRawX(size_t pointerIndex) const {
Jeff Brown46b9ac02010-04-22 18:58:52 -0700287 return getCurrentPointerCoords(pointerIndex).x;
288 }
289
Jeff Brown5c225b12010-06-16 01:53:36 -0700290 inline float getRawY(size_t pointerIndex) const {
Jeff Brown46b9ac02010-04-22 18:58:52 -0700291 return getCurrentPointerCoords(pointerIndex).y;
292 }
293
Jeff Brown5c225b12010-06-16 01:53:36 -0700294 inline float getX(size_t pointerIndex) const {
295 return getRawX(pointerIndex) + mXOffset;
296 }
297
298 inline float getY(size_t pointerIndex) const {
299 return getRawY(pointerIndex) + mYOffset;
300 }
301
Jeff Brown46b9ac02010-04-22 18:58:52 -0700302 inline float getPressure(size_t pointerIndex) const {
303 return getCurrentPointerCoords(pointerIndex).pressure;
304 }
305
306 inline float getSize(size_t pointerIndex) const {
307 return getCurrentPointerCoords(pointerIndex).size;
308 }
309
Jeff Brownc5ed5912010-07-14 18:48:53 -0700310 inline float getTouchMajor(size_t pointerIndex) const {
311 return getCurrentPointerCoords(pointerIndex).touchMajor;
312 }
313
314 inline float getTouchMinor(size_t pointerIndex) const {
315 return getCurrentPointerCoords(pointerIndex).touchMinor;
316 }
317
318 inline float getToolMajor(size_t pointerIndex) const {
319 return getCurrentPointerCoords(pointerIndex).toolMajor;
320 }
321
322 inline float getToolMinor(size_t pointerIndex) const {
323 return getCurrentPointerCoords(pointerIndex).toolMinor;
324 }
325
326 inline float getOrientation(size_t pointerIndex) const {
327 return getCurrentPointerCoords(pointerIndex).orientation;
328 }
329
Jeff Brown46b9ac02010-04-22 18:58:52 -0700330 inline size_t getHistorySize() const { return mSampleEventTimes.size() - 1; }
331
332 inline nsecs_t getHistoricalEventTime(size_t historicalIndex) const {
333 return mSampleEventTimes[historicalIndex];
334 }
335
Jeff Brown5c225b12010-06-16 01:53:36 -0700336 inline float getHistoricalRawX(size_t pointerIndex, size_t historicalIndex) const {
Jeff Brown46b9ac02010-04-22 18:58:52 -0700337 return getHistoricalPointerCoords(pointerIndex, historicalIndex).x;
338 }
339
Jeff Brown5c225b12010-06-16 01:53:36 -0700340 inline float getHistoricalRawY(size_t pointerIndex, size_t historicalIndex) const {
Jeff Brown46b9ac02010-04-22 18:58:52 -0700341 return getHistoricalPointerCoords(pointerIndex, historicalIndex).y;
342 }
343
Jeff Brown5c225b12010-06-16 01:53:36 -0700344 inline float getHistoricalX(size_t pointerIndex, size_t historicalIndex) const {
345 return getHistoricalRawX(pointerIndex, historicalIndex) + mXOffset;
346 }
347
348 inline float getHistoricalY(size_t pointerIndex, size_t historicalIndex) const {
349 return getHistoricalRawY(pointerIndex, historicalIndex) + mYOffset;
350 }
351
Jeff Brown46b9ac02010-04-22 18:58:52 -0700352 inline float getHistoricalPressure(size_t pointerIndex, size_t historicalIndex) const {
353 return getHistoricalPointerCoords(pointerIndex, historicalIndex).pressure;
354 }
355
356 inline float getHistoricalSize(size_t pointerIndex, size_t historicalIndex) const {
357 return getHistoricalPointerCoords(pointerIndex, historicalIndex).size;
358 }
359
Jeff Brownc5ed5912010-07-14 18:48:53 -0700360 inline float getHistoricalTouchMajor(size_t pointerIndex, size_t historicalIndex) const {
361 return getHistoricalPointerCoords(pointerIndex, historicalIndex).touchMajor;
362 }
363
364 inline float getHistoricalTouchMinor(size_t pointerIndex, size_t historicalIndex) const {
365 return getHistoricalPointerCoords(pointerIndex, historicalIndex).touchMinor;
366 }
367
368 inline float getHistoricalToolMajor(size_t pointerIndex, size_t historicalIndex) const {
369 return getHistoricalPointerCoords(pointerIndex, historicalIndex).toolMajor;
370 }
371
372 inline float getHistoricalToolMinor(size_t pointerIndex, size_t historicalIndex) const {
373 return getHistoricalPointerCoords(pointerIndex, historicalIndex).toolMinor;
374 }
375
376 inline float getHistoricalOrientation(size_t pointerIndex, size_t historicalIndex) const {
377 return getHistoricalPointerCoords(pointerIndex, historicalIndex).orientation;
378 }
379
Jeff Brown46b9ac02010-04-22 18:58:52 -0700380 void initialize(
381 int32_t deviceId,
Jeff Brownc5ed5912010-07-14 18:48:53 -0700382 int32_t source,
Jeff Brown46b9ac02010-04-22 18:58:52 -0700383 int32_t action,
Jeff Brown85a31762010-09-01 17:01:00 -0700384 int32_t flags,
Jeff Brown46b9ac02010-04-22 18:58:52 -0700385 int32_t edgeFlags,
386 int32_t metaState,
Jeff Brown5c225b12010-06-16 01:53:36 -0700387 float xOffset,
388 float yOffset,
Jeff Brown46b9ac02010-04-22 18:58:52 -0700389 float xPrecision,
390 float yPrecision,
391 nsecs_t downTime,
392 nsecs_t eventTime,
393 size_t pointerCount,
394 const int32_t* pointerIds,
395 const PointerCoords* pointerCoords);
396
397 void addSample(
398 nsecs_t eventTime,
399 const PointerCoords* pointerCoords);
400
401 void offsetLocation(float xOffset, float yOffset);
402
Jeff Brown5c225b12010-06-16 01:53:36 -0700403 // Low-level accessors.
404 inline const int32_t* getPointerIds() const { return mPointerIds.array(); }
405 inline const nsecs_t* getSampleEventTimes() const { return mSampleEventTimes.array(); }
406 inline const PointerCoords* getSamplePointerCoords() const {
407 return mSamplePointerCoords.array();
408 }
409
Jeff Brown46b9ac02010-04-22 18:58:52 -0700410private:
411 int32_t mAction;
Jeff Brown85a31762010-09-01 17:01:00 -0700412 int32_t mFlags;
Jeff Brown46b9ac02010-04-22 18:58:52 -0700413 int32_t mEdgeFlags;
414 int32_t mMetaState;
Jeff Brown5c225b12010-06-16 01:53:36 -0700415 float mXOffset;
416 float mYOffset;
Jeff Brown46b9ac02010-04-22 18:58:52 -0700417 float mXPrecision;
418 float mYPrecision;
419 nsecs_t mDownTime;
420 Vector<int32_t> mPointerIds;
421 Vector<nsecs_t> mSampleEventTimes;
422 Vector<PointerCoords> mSamplePointerCoords;
423
424 inline const PointerCoords& getCurrentPointerCoords(size_t pointerIndex) const {
425 return mSamplePointerCoords[getHistorySize() * getPointerCount() + pointerIndex];
426 }
427
428 inline const PointerCoords& getHistoricalPointerCoords(
429 size_t pointerIndex, size_t historicalIndex) const {
430 return mSamplePointerCoords[historicalIndex * getPointerCount() + pointerIndex];
431 }
432};
433
434/*
435 * Input event factory.
436 */
437class InputEventFactoryInterface {
438protected:
439 virtual ~InputEventFactoryInterface() { }
440
441public:
442 InputEventFactoryInterface() { }
443
444 virtual KeyEvent* createKeyEvent() = 0;
445 virtual MotionEvent* createMotionEvent() = 0;
446};
447
448/*
449 * A simple input event factory implementation that uses a single preallocated instance
450 * of each type of input event that are reused for each request.
451 */
452class PreallocatedInputEventFactory : public InputEventFactoryInterface {
453public:
454 PreallocatedInputEventFactory() { }
455 virtual ~PreallocatedInputEventFactory() { }
456
457 virtual KeyEvent* createKeyEvent() { return & mKeyEvent; }
458 virtual MotionEvent* createMotionEvent() { return & mMotionEvent; }
459
460private:
461 KeyEvent mKeyEvent;
462 MotionEvent mMotionEvent;
463};
464
Jeff Brown6d0fec22010-07-23 21:28:06 -0700465/*
466 * Describes the characteristics and capabilities of an input device.
467 */
468class InputDeviceInfo {
469public:
470 InputDeviceInfo();
471 InputDeviceInfo(const InputDeviceInfo& other);
472 ~InputDeviceInfo();
473
474 struct MotionRange {
475 float min;
476 float max;
477 float flat;
478 float fuzz;
479 };
480
481 void initialize(int32_t id, const String8& name);
482
483 inline int32_t getId() const { return mId; }
484 inline const String8 getName() const { return mName; }
485 inline uint32_t getSources() const { return mSources; }
486
487 const MotionRange* getMotionRange(int32_t rangeType) const;
488
489 void addSource(uint32_t source);
490 void addMotionRange(int32_t rangeType, float min, float max, float flat, float fuzz);
491 void addMotionRange(int32_t rangeType, const MotionRange& range);
492
493 inline void setKeyboardType(int32_t keyboardType) { mKeyboardType = keyboardType; }
494 inline int32_t getKeyboardType() const { return mKeyboardType; }
495
Jeff Brown8d608662010-08-30 03:02:23 -0700496 inline const KeyedVector<int32_t, MotionRange> getMotionRanges() const {
497 return mMotionRanges;
498 }
499
Jeff Brown6d0fec22010-07-23 21:28:06 -0700500private:
501 int32_t mId;
502 String8 mName;
503 uint32_t mSources;
504 int32_t mKeyboardType;
505
506 KeyedVector<int32_t, MotionRange> mMotionRanges;
507};
508
Jeff Brown90655042010-12-02 13:50:46 -0800509/*
510 * Identifies a device.
511 */
512struct InputDeviceIdentifier {
513 inline InputDeviceIdentifier() :
514 bus(0), vendor(0), product(0), version(0) {
515 }
516
517 String8 name;
518 String8 location;
519 String8 uniqueId;
520 uint16_t bus;
521 uint16_t vendor;
522 uint16_t product;
523 uint16_t version;
524};
525
Jeff Brown47e6b1b2010-11-29 17:37:49 -0800526/* Types of input device configuration files. */
527enum InputDeviceConfigurationFileType {
528 INPUT_DEVICE_CONFIGURATION_FILE_TYPE_CONFIGURATION = 0, /* .idc file */
529 INPUT_DEVICE_CONFIGURATION_FILE_TYPE_KEY_LAYOUT = 1, /* .kl file */
530 INPUT_DEVICE_CONFIGURATION_FILE_TYPE_KEY_CHARACTER_MAP = 2, /* .kcm file */
531};
532
533/*
Jeff Brown90655042010-12-02 13:50:46 -0800534 * Gets the path of an input device configuration file, if one is available.
Jeff Brown1f245102010-11-18 20:53:46 -0800535 * Considers both system provided and user installed configuration files.
Jeff Brown47e6b1b2010-11-29 17:37:49 -0800536 *
Jeff Brown90655042010-12-02 13:50:46 -0800537 * The device identifier is used to construct several default configuration file
538 * names to try based on the device name, vendor, product, and version.
539 *
Jeff Brown47e6b1b2010-11-29 17:37:49 -0800540 * Returns an empty string if not found.
541 */
Jeff Brown90655042010-12-02 13:50:46 -0800542extern String8 getInputDeviceConfigurationFilePathByDeviceIdentifier(
543 const InputDeviceIdentifier& deviceIdentifier,
544 InputDeviceConfigurationFileType type);
545
546/*
547 * Gets the path of an input device configuration file, if one is available.
548 * Considers both system provided and user installed configuration files.
549 *
550 * The name is case-sensitive and is used to construct the filename to resolve.
551 * All characters except 'a'-'z', 'A'-'Z', '0'-'9', '-', and '_' are replaced by underscores.
552 *
553 * Returns an empty string if not found.
554 */
555extern String8 getInputDeviceConfigurationFilePathByName(
Jeff Brown47e6b1b2010-11-29 17:37:49 -0800556 const String8& name, InputDeviceConfigurationFileType type);
Jeff Brown46b9ac02010-04-22 18:58:52 -0700557
558} // namespace android
559
560#endif // _UI_INPUT_H