Ultrasound: Filter out the special key event for digital pen hovering cursor
Ultrasound hovering cursor uses a special key event. This event is relevant
only for the InputReader that shows/hides the cursor accordingly.
Therefore, if the event is sent from the ultrasound device it is filtered
out in the InputReader and is not sent to applications.
Change-Id: Id3a9718be6bdb144e80bfa32c0a18a9900071167
diff --git a/services/inputflinger/InputReader.cpp b/services/inputflinger/InputReader.cpp
index 677561c..7b09b36 100644
--- a/services/inputflinger/InputReader.cpp
+++ b/services/inputflinger/InputReader.cpp
@@ -58,6 +58,9 @@
#define INDENT4 " "
#define INDENT5 " "
+// Ultrasound device name.
+#define USF_DEVICE_NAME "usf_tsc"
+
namespace android {
// --- Constants ---
@@ -2088,6 +2091,11 @@
keyCode = AKEYCODE_UNKNOWN;
flags = 0;
}
+ InputDeviceIdentifier identifier = getEventHub()->getDeviceIdentifier(rawEvent->deviceId);
+ if ((identifier.name == USF_DEVICE_NAME) && (scanCode == BTN_USF_HOVERING_CURSOR))
+ {
+ break;
+ }
processKey(rawEvent->when, rawEvent->value != 0, keyCode, scanCode, flags);
}
break;