Prevent keyboards from being recognized as a stylus

We are getting reports of keyboards and other peripherals being
misconfigured as a stylus, because they report support for stylus
buttons.

To eliminate some of these misconfigurations, prevent anything detected
as a alphabetical keyboard from being categorized as a stylus.

Bug: 293996865
Test: None
Change-Id: I3f071d2ac6a2b70abc1130b4d5df1509452bb63b
diff --git a/services/inputflinger/reader/EventHub.cpp b/services/inputflinger/reader/EventHub.cpp
index e69c99e..f7bbc51 100644
--- a/services/inputflinger/reader/EventHub.cpp
+++ b/services/inputflinger/reader/EventHub.cpp
@@ -2473,6 +2473,7 @@
 
         // See if this device has any stylus buttons that we would want to fuse with touch data.
         if (!device->classes.any(InputDeviceClass::TOUCH | InputDeviceClass::TOUCH_MT) &&
+            !device->classes.any(InputDeviceClass::ALPHAKEY) &&
             std::any_of(STYLUS_BUTTON_KEYCODES.begin(), STYLUS_BUTTON_KEYCODES.end(),
                         [&](int32_t keycode) { return device->hasKeycodeLocked(keycode); })) {
             device->classes |= InputDeviceClass::EXTERNAL_STYLUS;