summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2012-04-06 14:51:01 -0700
committerJeff Brown <jeffbrown@google.com>2012-04-06 14:57:19 -0700
commite38fdfae9196afd1bdc14c5ec6c12793af1e2550 (patch)
tree54523ccf3fc36a1b50410e2cb6e6d1f7230c40cf /include
parentdc0dbbd4a005f16624978b95817b33156acac526 (diff)
downloadframeworks_base-e38fdfae9196afd1bdc14c5ec6c12793af1e2550.zip
frameworks_base-e38fdfae9196afd1bdc14c5ec6c12793af1e2550.tar.gz
frameworks_base-e38fdfae9196afd1bdc14c5ec6c12793af1e2550.tar.bz2
Add a unique input device descriptor.
The purpose of the input device descriptor is to make it possible to associate persistent settings for each input device, such as the keyboard layout. The descriptor is a hash of the information we have about the device, such as its vendor id, product id, unique id, name, or location. Bug: 6110399 Change-Id: Idb80f946819b3f0dbf4e661bb0a753dbc2b60981
Diffstat (limited to 'include')
-rw-r--r--include/androidfw/Input.h46
1 files changed, 28 insertions, 18 deletions
diff --git a/include/androidfw/Input.h b/include/androidfw/Input.h
index a4ebd95..f8cbdde 100644
--- a/include/androidfw/Input.h
+++ b/include/androidfw/Input.h
@@ -811,6 +811,31 @@ private:
VelocityTracker mVelocityTracker;
};
+/*
+ * Identifies a device.
+ */
+struct InputDeviceIdentifier {
+ inline InputDeviceIdentifier() :
+ bus(0), vendor(0), product(0), version(0) {
+ }
+
+ // Information provided by the kernel.
+ String8 name;
+ String8 location;
+ String8 uniqueId;
+ uint16_t bus;
+ uint16_t vendor;
+ uint16_t product;
+ uint16_t version;
+
+ // A composite input device descriptor string that uniquely identifies the device
+ // even across reboots or reconnections. The value of this field is used by
+ // upper layers of the input system to associate settings with individual devices.
+ // It is hashed from whatever kernel provided information is available.
+ // Ideally, the way this value is computed should not change between Android releases
+ // because that would invalidate persistent settings that rely on it.
+ String8 descriptor;
+};
/*
* Describes the characteristics and capabilities of an input device.
@@ -830,10 +855,11 @@ public:
float fuzz;
};
- void initialize(int32_t id, const String8& name);
+ void initialize(int32_t id, const String8& name, const String8& descriptor);
inline int32_t getId() const { return mId; }
inline const String8 getName() const { return mName; }
+ inline const String8 getDescriptor() const { return mDescriptor; }
inline uint32_t getSources() const { return mSources; }
const MotionRange* getMotionRange(int32_t axis, uint32_t source) const;
@@ -856,6 +882,7 @@ public:
private:
int32_t mId;
String8 mName;
+ String8 mDescriptor;
uint32_t mSources;
int32_t mKeyboardType;
String8 mKeyCharacterMapFile;
@@ -863,23 +890,6 @@ private:
Vector<MotionRange> mMotionRanges;
};
-/*
- * Identifies a device.
- */
-struct InputDeviceIdentifier {
- inline InputDeviceIdentifier() :
- bus(0), vendor(0), product(0), version(0) {
- }
-
- String8 name;
- String8 location;
- String8 uniqueId;
- uint16_t bus;
- uint16_t vendor;
- uint16_t product;
- uint16_t version;
-};
-
/* Types of input device configuration files. */
enum InputDeviceConfigurationFileType {
INPUT_DEVICE_CONFIGURATION_FILE_TYPE_CONFIGURATION = 0, /* .idc file */