@@ -36,37 +36,6 @@ namespace android {
3636
3737namespace {
3838
39- bool isFromMouse (const NotifyMotionArgs& args) {
40- return isFromSource (args.source , AINPUT_SOURCE_MOUSE) &&
41- args.pointerProperties [0 ].toolType == ToolType::MOUSE;
42- }
43-
44- bool isFromTouchpad (const NotifyMotionArgs& args) {
45- return isFromSource (args.source , AINPUT_SOURCE_MOUSE) &&
46- args.pointerProperties [0 ].toolType == ToolType::FINGER;
47- }
48-
49- bool isFromDrawingTablet (const NotifyMotionArgs& args) {
50- return isFromSource (args.source , AINPUT_SOURCE_MOUSE | AINPUT_SOURCE_STYLUS) &&
51- isStylusToolType (args.pointerProperties [0 ].toolType );
52- }
53-
54- bool isHoverAction (int32_t action) {
55- return action == AMOTION_EVENT_ACTION_HOVER_ENTER ||
56- action == AMOTION_EVENT_ACTION_HOVER_MOVE || action == AMOTION_EVENT_ACTION_HOVER_EXIT;
57- }
58-
59- bool isStylusHoverEvent (const NotifyMotionArgs& args) {
60- return isStylusEvent (args.source , args.pointerProperties ) && isHoverAction (args.action );
61- }
62-
63- bool isMouseOrTouchpad (uint32_t sources) {
64- // Check if this is a mouse or touchpad, but not a drawing tablet.
65- return isFromSource (sources, AINPUT_SOURCE_MOUSE_RELATIVE) ||
66- (isFromSource (sources, AINPUT_SOURCE_MOUSE) &&
67- !isFromSource (sources, AINPUT_SOURCE_STYLUS));
68- }
69-
7039inline void notifyPointerDisplayChange (std::optional<std::tuple<ui::LogicalDisplayId, vec2>> change,
7140 PointerChoreographerPolicyInterface& policy) {
7241 if (!change) {
@@ -239,15 +208,16 @@ NotifyMotionArgs PointerChoreographer::processMotion(const NotifyMotionArgs& arg
239208 PointerDisplayChange pointerDisplayChange;
240209 { // acquire lock
241210 std::scoped_lock _l (getLock ());
242- if (isFromMouse (args)) {
211+ if (isFromMouse (args. source , args. pointerProperties [ 0 ]. toolType )) {
243212 newArgs = processMouseEventLocked (args);
244213 pointerDisplayChange = calculatePointerDisplayChangeToNotify ();
245- } else if (isFromTouchpad (args)) {
214+ } else if (isFromTouchpad (args. source , args. pointerProperties [ 0 ]. toolType )) {
246215 newArgs = processTouchpadEventLocked (args);
247216 pointerDisplayChange = calculatePointerDisplayChangeToNotify ();
248- } else if (isFromDrawingTablet (args)) {
217+ } else if (isFromDrawingTablet (args. source , args. pointerProperties [ 0 ]. toolType )) {
249218 processDrawingTabletEventLocked (args);
250- } else if (mStylusPointerIconEnabled && isStylusHoverEvent (args)) {
219+ } else if (mStylusPointerIconEnabled &&
220+ isStylusHoverEvent (args.source , args.pointerProperties , args.action )) {
251221 processStylusHoverEventLocked (args);
252222 } else if (isFromSource (args.source , AINPUT_SOURCE_TOUCHSCREEN)) {
253223 processTouchscreenAndStylusEventLocked (args);
0 commit comments