diff options
| author | 2024-03-06 09:29:59 -0800 | |
|---|---|---|
| committer | 2024-03-06 09:29:59 -0800 | |
| commit | df7e621822a86f6b4492e10c006ea5f742ab6596 (patch) | |
| tree | 2b87ffd13d2c8cf895306dbf48509b533250968d /libs/input/Input.cpp | |
| parent | 1a0675170270fe07d5bd5f1e4a30887758046acc (diff) | |
| parent | 760f097b61fb34b23bf08af1d5ffd83cc34cba9b (diff) | |
Merge Android 14 QPR2 to AOSP main
Bug: 319669529
Merged-In: I07e275dfff55380efa7aa2908937b087a151d9ae
Change-Id: I9d633802975e235bebd391a6dbe51cf0b7fc6df6
Diffstat (limited to 'libs/input/Input.cpp')
| -rw-r--r-- | libs/input/Input.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/libs/input/Input.cpp b/libs/input/Input.cpp index 00925ba555..bd5b67b1d0 100644 --- a/libs/input/Input.cpp +++ b/libs/input/Input.cpp @@ -217,6 +217,19 @@ bool isStylusToolType(ToolType toolType) { return toolType == ToolType::STYLUS || toolType == ToolType::ERASER; } +bool isStylusEvent(uint32_t source, const std::vector<PointerProperties>& properties) { + if (!isFromSource(source, AINPUT_SOURCE_STYLUS)) { + return false; + } + // Need at least one stylus pointer for this event to be considered a stylus event + for (const PointerProperties& pointerProperties : properties) { + if (isStylusToolType(pointerProperties.toolType)) { + return true; + } + } + return false; +} + VerifiedKeyEvent verifiedKeyEventFromKeyEvent(const KeyEvent& event) { return {{VerifiedInputEvent::Type::KEY, event.getDeviceId(), event.getEventTime(), event.getSource(), event.getDisplayId()}, @@ -497,19 +510,6 @@ void PointerCoords::transform(const ui::Transform& transform) { } } -// --- PointerProperties --- - -bool PointerProperties::operator==(const PointerProperties& other) const { - return id == other.id - && toolType == other.toolType; -} - -void PointerProperties::copyFrom(const PointerProperties& other) { - id = other.id; - toolType = other.toolType; -} - - // --- MotionEvent --- void MotionEvent::initialize(int32_t id, int32_t deviceId, uint32_t source, int32_t displayId, |