summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
Diffstat (limited to 'libs')
-rw-r--r--libs/ui/EventHub.cpp13
-rw-r--r--libs/ui/InputReader.cpp8
-rw-r--r--libs/ui/tests/InputReader_test.cpp4
3 files changed, 18 insertions, 7 deletions
diff --git a/libs/ui/EventHub.cpp b/libs/ui/EventHub.cpp
index 5f920a7..01facbb 100644
--- a/libs/ui/EventHub.cpp
+++ b/libs/ui/EventHub.cpp
@@ -92,9 +92,9 @@ static inline const char* toString(bool value) {
return value ? "true" : "false";
}
-EventHub::device_t::device_t(int32_t _id, const char* _path, const char* name)
+EventHub::device_t::device_t(int32_t _id, const char* _path, const char* name, bool _bluetooth)
: id(_id), path(_path), name(name), classes(0)
- , keyBitmask(NULL), layoutMap(new KeyLayoutMap()), fd(-1), next(NULL) {
+ , keyBitmask(NULL), layoutMap(new KeyLayoutMap()), fd(-1), bluetooth(_bluetooth), next(NULL) {
}
EventHub::device_t::~device_t() {
@@ -137,6 +137,13 @@ String8 EventHub::getDeviceName(int32_t deviceId) const
return device->name;
}
+bool EventHub::getDeviceBluetooth(int32_t deviceId) const
+{
+ AutoMutex _l(mLock);
+ device_t* device = getDeviceLocked(deviceId);
+ return device->bluetooth;
+}
+
uint32_t EventHub::getDeviceClasses(int32_t deviceId) const
{
AutoMutex _l(mLock);
@@ -669,7 +676,7 @@ int EventHub::openDevice(const char *deviceName) {
version >> 16, (version >> 8) & 0xff, version & 0xff);
#endif
- device_t* device = new device_t(devid|mDevicesById[devid].seq, deviceName, name);
+ device_t* device = new device_t(devid|mDevicesById[devid].seq, deviceName, name, BUS_BLUETOOTH == id.bustype);
if (device == NULL) {
LOGE("out of memory");
return -1;
diff --git a/libs/ui/InputReader.cpp b/libs/ui/InputReader.cpp
index b6879dd..23fb533 100644
--- a/libs/ui/InputReader.cpp
+++ b/libs/ui/InputReader.cpp
@@ -332,7 +332,7 @@ InputDevice* InputReader::createDevice(int32_t deviceId, const String8& name, ui
if (keyboardSources != 0) {
device->addMapper(new KeyboardInputMapper(device,
- associatedDisplayId, keyboardSources, keyboardType));
+ associatedDisplayId, keyboardSources, keyboardType, mEventHub->getDeviceBluetooth(deviceId)));
}
// Trackball-like devices.
@@ -870,9 +870,9 @@ int32_t SwitchInputMapper::getSwitchState(uint32_t sourceMask, int32_t switchCod
// --- KeyboardInputMapper ---
KeyboardInputMapper::KeyboardInputMapper(InputDevice* device, int32_t associatedDisplayId,
- uint32_t sources, int32_t keyboardType) :
+ uint32_t sources, int32_t keyboardType, bool bluetooth) :
InputMapper(device), mAssociatedDisplayId(associatedDisplayId), mSources(sources),
- mKeyboardType(keyboardType) {
+ mKeyboardType(keyboardType), mBluetooth(bluetooth) {
initializeLocked();
}
@@ -962,7 +962,7 @@ void KeyboardInputMapper::processKey(nsecs_t when, bool down, int32_t keyCode,
if (down) {
// Rotate key codes according to orientation if needed.
// Note: getDisplayInfo is non-reentrant so we can continue holding the lock.
- if (mAssociatedDisplayId >= 0) {
+ if (!mBluetooth && mAssociatedDisplayId >= 0) {
int32_t orientation;
if (! getPolicy()->getDisplayInfo(mAssociatedDisplayId, NULL, NULL, & orientation)) {
return;
diff --git a/libs/ui/tests/InputReader_test.cpp b/libs/ui/tests/InputReader_test.cpp
index 09d1680..aec7ba9 100644
--- a/libs/ui/tests/InputReader_test.cpp
+++ b/libs/ui/tests/InputReader_test.cpp
@@ -486,6 +486,10 @@ private:
return device ? device->name : String8("unknown");
}
+ virtual bool getDeviceBluetooth(int32_t deviceId) const {
+ return false;
+ }
+
virtual status_t getAbsoluteAxisInfo(int32_t deviceId, int axis,
RawAbsoluteAxisInfo* outAxisInfo) const {
Device* device = getDevice(deviceId);