Loading include/input/Input.h +2 −0 Original line number Diff line number Diff line Loading @@ -209,6 +209,8 @@ std::string inputEventSourceToString(int32_t source); bool isFromSource(uint32_t source, uint32_t test); bool isStylusToolType(uint32_t toolType); /* * Flags that flow alongside events in the input dispatch system to help with certain * policy decisions such as waking from device sleep. Loading libs/input/Input.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -238,6 +238,10 @@ bool isFromSource(uint32_t source, uint32_t test) { return (source & test) == test; } bool isStylusToolType(uint32_t toolType) { return toolType == AMOTION_EVENT_TOOL_TYPE_STYLUS || toolType == AMOTION_EVENT_TOOL_TYPE_ERASER; } VerifiedKeyEvent verifiedKeyEventFromKeyEvent(const KeyEvent& event) { return {{VerifiedInputEvent::Type::KEY, event.getDeviceId(), event.getEventTime(), event.getSource(), event.getDisplayId()}, Loading services/inputflinger/PreferStylusOverTouchBlocker.cpp +1 −2 Original line number Diff line number Diff line Loading @@ -25,8 +25,7 @@ static std::pair<bool, bool> checkToolType(const NotifyMotionArgs& args) { for (size_t i = 0; i < args.pointerCount; i++) { // Make sure we are canceling stylus pointers const int32_t toolType = args.pointerProperties[i].toolType; if (toolType == AMOTION_EVENT_TOOL_TYPE_STYLUS || toolType == AMOTION_EVENT_TOOL_TYPE_ERASER) { if (isStylusToolType(toolType)) { hasStylus = true; } if (toolType == AMOTION_EVENT_TOOL_TYPE_FINGER) { Loading services/inputflinger/UnwantedInteractionBlocker.cpp +11 −8 Original line number Diff line number Diff line Loading @@ -99,15 +99,18 @@ static bool isPalmRejectionEnabled() { } static int getLinuxToolCode(int toolType) { if (toolType == AMOTION_EVENT_TOOL_TYPE_STYLUS) { switch (toolType) { case AMOTION_EVENT_TOOL_TYPE_STYLUS: return BTN_TOOL_PEN; } if (toolType == AMOTION_EVENT_TOOL_TYPE_FINGER) { case AMOTION_EVENT_TOOL_TYPE_ERASER: return BTN_TOOL_RUBBER; case AMOTION_EVENT_TOOL_TYPE_FINGER: return BTN_TOOL_FINGER; } default: ALOGW("Got tool type %" PRId32 ", converting to BTN_TOOL_FINGER", toolType); return BTN_TOOL_FINGER; } } static int32_t getActionUpForPointerId(const NotifyMotionArgs& args, int32_t pointerId) { for (size_t i = 0; i < args.pointerCount; i++) { Loading Loading @@ -195,7 +198,7 @@ NotifyMotionArgs removePointerIds(const NotifyMotionArgs& args, static std::optional<NotifyMotionArgs> removeStylusPointerIds(const NotifyMotionArgs& args) { std::set<int32_t> stylusPointerIds; for (uint32_t i = 0; i < args.pointerCount; i++) { if (args.pointerProperties[i].toolType == AMOTION_EVENT_TOOL_TYPE_STYLUS) { if (isStylusToolType(args.pointerProperties[i].toolType)) { stylusPointerIds.insert(args.pointerProperties[i].id); } } Loading services/inputflinger/dispatcher/InputDispatcher.cpp +1 −2 Original line number Diff line number Diff line Loading @@ -481,8 +481,7 @@ bool windowAcceptsTouchAt(const WindowInfo& windowInfo, int32_t displayId, int32 bool isPointerFromStylus(const MotionEntry& entry, int32_t pointerIndex) { return isFromSource(entry.source, AINPUT_SOURCE_STYLUS) && (entry.pointerProperties[pointerIndex].toolType == AMOTION_EVENT_TOOL_TYPE_STYLUS || entry.pointerProperties[pointerIndex].toolType == AMOTION_EVENT_TOOL_TYPE_ERASER); isStylusToolType(entry.pointerProperties[pointerIndex].toolType); } // Determines if the given window can be targeted as InputTarget::Flags::FOREGROUND. Loading Loading
include/input/Input.h +2 −0 Original line number Diff line number Diff line Loading @@ -209,6 +209,8 @@ std::string inputEventSourceToString(int32_t source); bool isFromSource(uint32_t source, uint32_t test); bool isStylusToolType(uint32_t toolType); /* * Flags that flow alongside events in the input dispatch system to help with certain * policy decisions such as waking from device sleep. Loading
libs/input/Input.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -238,6 +238,10 @@ bool isFromSource(uint32_t source, uint32_t test) { return (source & test) == test; } bool isStylusToolType(uint32_t toolType) { return toolType == AMOTION_EVENT_TOOL_TYPE_STYLUS || toolType == AMOTION_EVENT_TOOL_TYPE_ERASER; } VerifiedKeyEvent verifiedKeyEventFromKeyEvent(const KeyEvent& event) { return {{VerifiedInputEvent::Type::KEY, event.getDeviceId(), event.getEventTime(), event.getSource(), event.getDisplayId()}, Loading
services/inputflinger/PreferStylusOverTouchBlocker.cpp +1 −2 Original line number Diff line number Diff line Loading @@ -25,8 +25,7 @@ static std::pair<bool, bool> checkToolType(const NotifyMotionArgs& args) { for (size_t i = 0; i < args.pointerCount; i++) { // Make sure we are canceling stylus pointers const int32_t toolType = args.pointerProperties[i].toolType; if (toolType == AMOTION_EVENT_TOOL_TYPE_STYLUS || toolType == AMOTION_EVENT_TOOL_TYPE_ERASER) { if (isStylusToolType(toolType)) { hasStylus = true; } if (toolType == AMOTION_EVENT_TOOL_TYPE_FINGER) { Loading
services/inputflinger/UnwantedInteractionBlocker.cpp +11 −8 Original line number Diff line number Diff line Loading @@ -99,15 +99,18 @@ static bool isPalmRejectionEnabled() { } static int getLinuxToolCode(int toolType) { if (toolType == AMOTION_EVENT_TOOL_TYPE_STYLUS) { switch (toolType) { case AMOTION_EVENT_TOOL_TYPE_STYLUS: return BTN_TOOL_PEN; } if (toolType == AMOTION_EVENT_TOOL_TYPE_FINGER) { case AMOTION_EVENT_TOOL_TYPE_ERASER: return BTN_TOOL_RUBBER; case AMOTION_EVENT_TOOL_TYPE_FINGER: return BTN_TOOL_FINGER; } default: ALOGW("Got tool type %" PRId32 ", converting to BTN_TOOL_FINGER", toolType); return BTN_TOOL_FINGER; } } static int32_t getActionUpForPointerId(const NotifyMotionArgs& args, int32_t pointerId) { for (size_t i = 0; i < args.pointerCount; i++) { Loading Loading @@ -195,7 +198,7 @@ NotifyMotionArgs removePointerIds(const NotifyMotionArgs& args, static std::optional<NotifyMotionArgs> removeStylusPointerIds(const NotifyMotionArgs& args) { std::set<int32_t> stylusPointerIds; for (uint32_t i = 0; i < args.pointerCount; i++) { if (args.pointerProperties[i].toolType == AMOTION_EVENT_TOOL_TYPE_STYLUS) { if (isStylusToolType(args.pointerProperties[i].toolType)) { stylusPointerIds.insert(args.pointerProperties[i].id); } } Loading
services/inputflinger/dispatcher/InputDispatcher.cpp +1 −2 Original line number Diff line number Diff line Loading @@ -481,8 +481,7 @@ bool windowAcceptsTouchAt(const WindowInfo& windowInfo, int32_t displayId, int32 bool isPointerFromStylus(const MotionEntry& entry, int32_t pointerIndex) { return isFromSource(entry.source, AINPUT_SOURCE_STYLUS) && (entry.pointerProperties[pointerIndex].toolType == AMOTION_EVENT_TOOL_TYPE_STYLUS || entry.pointerProperties[pointerIndex].toolType == AMOTION_EVENT_TOOL_TYPE_ERASER); isStylusToolType(entry.pointerProperties[pointerIndex].toolType); } // Determines if the given window can be targeted as InputTarget::Flags::FOREGROUND. Loading