From 06f3a285cd8f61a94df27fc1b062160aa73ec909 Mon Sep 17 00:00:00 2001 From: Pierre-Hugues Husson Date: Thu, 22 Oct 2020 23:22:46 +0200 Subject: [PATCH 09/10] Matching an input with a display uses uniqueId Not all devices have a `location`, notably bluetooth devices. However, we might still want to associate them with a screen, so match them with uniqueId indeed. This is useful to have bluetooth keyboard in desktop mode for instance. Change-Id: Ifcbc8329d54386f58e013270d9888316c0f516b6 --- services/inputflinger/reader/InputDevice.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/services/inputflinger/reader/InputDevice.cpp b/services/inputflinger/reader/InputDevice.cpp index 4b19e5e35..8f2d3a685 100644 --- a/services/inputflinger/reader/InputDevice.cpp +++ b/services/inputflinger/reader/InputDevice.cpp @@ -275,7 +275,10 @@ void InputDevice::configure(nsecs_t when, const InputReaderConfiguration* config mAssociatedDisplayPort = std::nullopt; mAssociatedViewport = std::nullopt; // Find the display port that corresponds to the current input port. - const std::string& inputPort = mIdentifier.location; + std::string inputPort = mIdentifier.location; + if (inputPort.empty()) { + inputPort = mIdentifier.uniqueId; + } if (!inputPort.empty()) { const std::unordered_map& ports = config->portAssociations; const auto& displayPort = ports.find(inputPort); -- 2.17.1