Ensure stylus buttons generate events consistently
Add tests to verify that a touchscreen stylus and fused/unfused external
styluses generate button events consistently.
Make changes in TouchInputMapper to enforce consistentcy for external
stylus buttons. In particular, we allow the external stylus's button
state to be applied to the touches even when there is no fusion in
progress.
Bug: 246394583
Test: atest inputflinger_tests
Change-Id: I645481db18e1bec8b61d8309aa4f02afcf1a5383
diff --git a/services/inputflinger/reader/mapper/TouchInputMapper.h b/services/inputflinger/reader/mapper/TouchInputMapper.h
index 34cecf9..efbe885 100644
--- a/services/inputflinger/reader/mapper/TouchInputMapper.h
+++ b/services/inputflinger/reader/mapper/TouchInputMapper.h
@@ -365,6 +365,8 @@
int64_t mExternalStylusId;
nsecs_t mExternalStylusFusionTimeout;
bool mExternalStylusDataPending;
+ // A subset of the buttons in mCurrentRawState that came from an external stylus.
+ int32_t mExternalStylusButtonsApplied;
// True if we sent a HOVER_ENTER event.
bool mSentHoverEnter;