summaryrefslogtreecommitdiff
path: root/services/input/InputReader.cpp
diff options
context:
space:
mode:
author Jeff Brown <jeffbrown@google.com> 2012-04-20 19:28:00 -0700
committer Jeff Brown <jeffbrown@google.com> 2012-04-20 20:11:12 -0700
commit5bbd4b4f5fc19302fa017ad6afee6eb2d489d91a (patch)
tree2bc118a5ef332003cc7f6791968076c48b3cf84b /services/input/InputReader.cpp
parent9e6d4b035d4f012d23264d3d2bc946b1ca02dba1 (diff)
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
Diffstat (limited to 'services/input/InputReader.cpp')
-rw-r--r--services/input/InputReader.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/services/input/InputReader.cpp b/services/input/InputReader.cpp
index 3a48b1607130..6022f107ec89 100644
--- a/services/input/InputReader.cpp
+++ b/services/input/InputReader.cpp
@@ -918,7 +918,7 @@ void InputDevice::dump(String8& dump) {
getDeviceInfo(& deviceInfo);
dump.appendFormat(INDENT "Device %d: %s\n", deviceInfo.getId(),
- deviceInfo.getName().string());
+ deviceInfo.getDisplayName().string());
dump.appendFormat(INDENT2 "Generation: %d\n", mGeneration);
dump.appendFormat(INDENT2 "IsExternal: %s\n", toString(mIsExternal));
dump.appendFormat(INDENT2 "Sources: 0x%08x\n", deviceInfo.getSources());
@@ -972,6 +972,16 @@ void InputDevice::configure(nsecs_t when, const InputReaderConfiguration* config
}
}
+ if (!changes || (changes & InputReaderConfiguration::CHANGE_DEVICE_ALIAS)) {
+ if (!(mClasses & INPUT_DEVICE_CLASS_VIRTUAL)) {
+ String8 alias = mContext->getPolicy()->getDeviceAlias(mIdentifier);
+ if (mAlias != alias) {
+ mAlias = alias;
+ bumpGeneration();
+ }
+ }
+ }
+
size_t numMappers = mMappers.size();
for (size_t i = 0; i < numMappers; i++) {
InputMapper* mapper = mMappers[i];
@@ -1039,7 +1049,7 @@ void InputDevice::timeoutExpired(nsecs_t when) {
}
void InputDevice::getDeviceInfo(InputDeviceInfo* outDeviceInfo) {
- outDeviceInfo->initialize(mId, mGeneration, mIdentifier.name, mIdentifier.descriptor);
+ outDeviceInfo->initialize(mId, mGeneration, mIdentifier, mAlias);
size_t numMappers = mMappers.size();
for (size_t i = 0; i < numMappers; i++) {