TouchInputMapper: Only use SOURCE_BLUETOOTH_STYLUS when fusion possible
TouchInputMapper can fuse touch pointers with pressure reported by an
external stylus using bluetooth. The pointer fusion can only happen when
the external styus can report pressure. If the external stylus does not
report pressure, there will be no stylus fusion, so do not add
SOURCE_BLUETOOTH_STYLUS to the touchscreen's InputDevice in this case.
Bug: 346797989
Test: atest inputflinger_tests
Flag: EXEMPT bugfix
Change-Id: Idd84cdb77fb3b59cbe314aeedca9d6a0da4affc3
diff --git a/services/inputflinger/reader/mapper/ExternalStylusInputMapper.cpp b/services/inputflinger/reader/mapper/ExternalStylusInputMapper.cpp
index 7cc8940..4cd37d7 100644
--- a/services/inputflinger/reader/mapper/ExternalStylusInputMapper.cpp
+++ b/services/inputflinger/reader/mapper/ExternalStylusInputMapper.cpp
@@ -33,7 +33,7 @@
void ExternalStylusInputMapper::populateDeviceInfo(InputDeviceInfo& info) {
InputMapper::populateDeviceInfo(info);
- if (mRawPressureAxis) {
+ if (mRawPressureAxis || mTouchButtonAccumulator.hasButtonTouch()) {
info.addMotionRange(AMOTION_EVENT_AXIS_PRESSURE, AINPUT_SOURCE_STYLUS, 0.0f, 1.0f, 0.0f,
0.0f, 0.0f);
}