Stylus fusion: Use SOURCE_BLUETOOTH_STYLUS dynamically for events
Previously, whenever an external stylus was connected, the source for
all touch devices (touchscreens, styluses, drawing tablets, etc.) would
change to include SOURCE_BLUETOOTH_STYLUS. This meant that all events
produced by these devices would also include SOURCE_BLUETOOTH_STYLUS,
even if the event was unaltered by stylus fusion.
In this CL, we introduce a way to dynamically add
SOURCE_BLUETOOTH_STYLUS to event streams that are a product of stylus
fusion.
The problem we are trying to solve is to be able to differentiate a
normal event stream from a stylus vs. an event stream from a stylus or
touchscreen that has additional information fused from a bluetooth
device. Previously, both such streams would have
SOURCE_BLUETOOTH_STYLUS, whereas now, only the latter case would use
that source.
Bug: 300473125
Test: atest inputflinger_test
Change-Id: I3526d42df68bc899c8e9a0e5ad69c95864f4c325
diff --git a/services/inputflinger/reader/mapper/TouchInputMapper.h b/services/inputflinger/reader/mapper/TouchInputMapper.h
index c5dfb00..bd9371d 100644
--- a/services/inputflinger/reader/mapper/TouchInputMapper.h
+++ b/services/inputflinger/reader/mapper/TouchInputMapper.h
@@ -357,6 +357,8 @@
bool mExternalStylusDataPending;
// A subset of the buttons in mCurrentRawState that came from an external stylus.
int32_t mExternalStylusButtonsApplied{0};
+ // True if the current cooked pointer data was modified due to the state of an external stylus.
+ bool mCurrentStreamModifiedByExternalStylus{false};
// True if we sent a HOVER_ENTER event.
bool mSentHoverEnter{false};