Input: Add isStylusToolType() utility function
Using this utility function will ensure we don't forget to check for
both TOOL_TYPE_STYLUS and TOOL_TYPE_ERASER when we are looking to
identify a stylus.
This will cause a behavior change in UnwantedInteractionBlocker, where
TOOL_TYPE_ERASER was not previously considered a stylus tool.
Bug: None
Test: atest inputflinger_tests
Change-Id: I3dae9b5037d7ac08a5672c6e4d6e3b62ee2bd352
diff --git a/services/inputflinger/PreferStylusOverTouchBlocker.cpp b/services/inputflinger/PreferStylusOverTouchBlocker.cpp
index beec2e1..ddd5146 100644
--- a/services/inputflinger/PreferStylusOverTouchBlocker.cpp
+++ b/services/inputflinger/PreferStylusOverTouchBlocker.cpp
@@ -25,8 +25,7 @@
for (size_t i = 0; i < args.pointerCount; i++) {
// Make sure we are canceling stylus pointers
const int32_t toolType = args.pointerProperties[i].toolType;
- if (toolType == AMOTION_EVENT_TOOL_TYPE_STYLUS ||
- toolType == AMOTION_EVENT_TOOL_TYPE_ERASER) {
+ if (isStylusToolType(toolType)) {
hasStylus = true;
}
if (toolType == AMOTION_EVENT_TOOL_TYPE_FINGER) {