From 5bbd4b4f5fc19302fa017ad6afee6eb2d489d91a Mon Sep 17 00:00:00 2001 From: Jeff Brown Date: Fri, 20 Apr 2012 19:28:00 -0700 Subject: Get alias for Bluetooth devices. Bluetooth devices can be renamed by the user. Make the input system aware of the user-specified name and transparently pass it down to applications. This enables the keyboard layout picker Settings UI to use device names that are consistent with what the user set in the Bluetooth UI. Bug: 6363157 Change-Id: I8eea26ce2c69c2a3f09c8de02e9e847610e0419c --- include/androidfw/InputDevice.h | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'include/androidfw/InputDevice.h') diff --git a/include/androidfw/InputDevice.h b/include/androidfw/InputDevice.h index 38203afac149..d6ecbf0712a7 100644 --- a/include/androidfw/InputDevice.h +++ b/include/androidfw/InputDevice.h @@ -66,13 +66,16 @@ public: float fuzz; }; - void initialize(int32_t id, int32_t generation, - const String8& name, const String8& descriptor); + void initialize(int32_t id, int32_t generation, const InputDeviceIdentifier& identifier, + const String8& alias); inline int32_t getId() const { return mId; } inline int32_t getGeneration() const { return mGeneration; } - inline const String8 getName() const { return mName; } - inline const String8 getDescriptor() const { return mDescriptor; } + inline const InputDeviceIdentifier& getIdentifier() const { return mIdentifier; } + inline const String8& getAlias() const { return mAlias; } + inline const String8& getDisplayName() const { + return mAlias.isEmpty() ? mIdentifier.name : mAlias; + } inline uint32_t getSources() const { return mSources; } const MotionRange* getMotionRange(int32_t axis, uint32_t source) const; @@ -103,8 +106,8 @@ public: private: int32_t mId; int32_t mGeneration; - String8 mName; - String8 mDescriptor; + InputDeviceIdentifier mIdentifier; + String8 mAlias; uint32_t mSources; int32_t mKeyboardType; sp mKeyCharacterMap; -- cgit v1.2.3-59-g8ed1b