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
This commit is contained in:
@@ -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++) {
|
||||
|
||||
Reference in New Issue
Block a user