Dynamically add STYLUS source for multi-touch devices - part 2
This is a follow-up to I70cc15f8f354e3fc876024d194a6f320fabd6d2c.
The previous change added SOURCE_STYLUS to events dynamically if they
came from a stylus tool type. In this change, we instead dynamically add
SOURCE_STYLUS to the InputDevice whenever it produces an MT_TOOL_PEN
event. This means all the events generated by that device will have
SOURCE_STYLUS added to it from that point onwards.
Bug: 246991366
Test: atest inputflinger_tests
Change-Id: I61963563eb4cdd41957247db100fcb87cc1b278b
diff --git a/services/inputflinger/reader/mapper/MultiTouchInputMapper.h b/services/inputflinger/reader/mapper/MultiTouchInputMapper.h
index ddf9e80..5f8bccf 100644
--- a/services/inputflinger/reader/mapper/MultiTouchInputMapper.h
+++ b/services/inputflinger/reader/mapper/MultiTouchInputMapper.h
@@ -50,6 +50,8 @@
// Specifies the pointer id bits that are in use, and their associated tracking id.
BitSet32 mPointerIdBits;
int32_t mPointerTrackingIdMap[MAX_POINTER_ID + 1];
+
+ bool mStylusMtToolSeen{false};
};
} // namespace android